From a0117f8c0d614a2d15111db312eebfe9378c868e Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Tue, 7 Sep 2021 11:03:24 -0400 Subject: Add WLAN card support This is loosely based on the contents of the tar file provided with the WLAN cards (AGL_Refhw_sample_software_KK_20210225.tar.gz) with updates for BSP v4.7.0 and other fixes. Changes: - Kernel patches and configuration update to enable the TI WL1837 module. As opposed to the original changes from Panasonic or the Kingfisher support, the HCI LL driver is used instead of the older ti-st + btwilink combination, since the the latter are deprecated and are removed in kernel 5.5. - As part of the above the sound configuration in the devicetree has been reworked to support the WL1837 BT audio. This includes dropping the HDMI1 audio configuration from the original Salvator-X devicetree, as it conflicts with the SSI used for the ak4613 in the reference hardware. - Recipes added for wlconf (from meta-ti) and ti-bt-firmware (loosely derived from the meta-rcar-gen3-adas version). The TI-TFL license used by ti-bt-firmware has been added in a top-level "licenses" directory and that added to LICENSE_PATH in layer.conf to satisfy the license packaging QA checking. Bug-AGL: SPEC-4071 Signed-off-by: Scott Murray Change-Id: Ib17fc01331efe0f49a90f7a8b223ec88b33b44f7 --- meta-agl-refhw-gen3/conf/layer.conf | 2 + meta-agl-refhw-gen3/licenses/TI-TFL | 62 ++++++ .../ti-bt-firmware/ti-bt-firmware_git.bb | 26 +++ .../recipes-connectivity/wlconf/wlconf_8.7.3.bb | 39 ++++ .../files/0001-Add-support-for-TI-WL1837.patch | 233 +++++++++++++++++++++ .../linux/files/0002-revert-e233201a.patch | 47 +++++ .../recipes-kernel/linux/files/refhw-rcar.cfg | 28 ++- .../recipes-kernel/linux/linux-renesas_%.bbappend | 2 + 8 files changed, 428 insertions(+), 11 deletions(-) create mode 100644 meta-agl-refhw-gen3/licenses/TI-TFL create mode 100644 meta-agl-refhw-gen3/recipes-bsp/ti-bt-firmware/ti-bt-firmware_git.bb create mode 100644 meta-agl-refhw-gen3/recipes-connectivity/wlconf/wlconf_8.7.3.bb create mode 100644 meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-Add-support-for-TI-WL1837.patch create mode 100644 meta-agl-refhw-gen3/recipes-kernel/linux/files/0002-revert-e233201a.patch (limited to 'meta-agl-refhw-gen3') diff --git a/meta-agl-refhw-gen3/conf/layer.conf b/meta-agl-refhw-gen3/conf/layer.conf index d3f6a7c..5bf71f5 100644 --- a/meta-agl-refhw-gen3/conf/layer.conf +++ b/meta-agl-refhw-gen3/conf/layer.conf @@ -16,3 +16,5 @@ BBFILE_PRIORITY_agl-refhw-gen3 = "11" LAYERDEPENDS_agl-refhw-gen3 = "core rcar-gen3" LAYERSERIES_COMPAT_agl-refhw-gen3 = "dunfell" + +LICENSE_PATH += "${LAYERDIR}/licenses" diff --git a/meta-agl-refhw-gen3/licenses/TI-TFL b/meta-agl-refhw-gen3/licenses/TI-TFL new file mode 100644 index 0000000..264692b --- /dev/null +++ b/meta-agl-refhw-gen3/licenses/TI-TFL @@ -0,0 +1,62 @@ +TEXAS INSTRUMENTS TEXT FILE LICENSE + +Copyright (c) [earliest year] - [latest year] Texas Instruments Incorporated + +All rights reserved not granted herein. + +Limited License. + +Texas Instruments Incorporated grants a world-wide, royalty-free, +non-exclusive license under copyrights and patents it now or hereafter owns +or controls to make, have made, use, import, offer to sell and sell +("Utilize") this software subject to the terms herein. With respect to the +foregoing patent license, such license is granted solely to the extent that +any such patent is necessary to Utilize the software alone. The patent +license shall not apply to any combinations which include this software, +other than combinations with devices manufactured by or for TI ("TI +Devices"). No hardware patent is licensed hereunder. + +Redistributions must preserve existing copyright notices and reproduce this +license (including the above copyright notice and the disclaimer and (if +applicable) source code license limitations below) in the documentation +and/or other materials provided with the distribution + +Redistribution and use in binary form, without modification, are permitted +provided that the following conditions are met: + +* No reverse engineering, decompilation, or disassembly of this software is +permitted with respect to any software provided in binary form. + +* any redistribution and use are licensed by TI for use only with TI +Devices. + +* Nothing shall obligate TI to provide you with source code for the software +licensed and provided to you in object code. + +If software source code is provided to you, modification and redistribution +of the source code are permitted provided that the following conditions are +met: + +* any redistribution and use of the source code, including any resulting +derivative works, are licensed by TI for use only with TI Devices. + +* any redistribution and use of any object code compiled from the source +code and any resulting derivative works, are licensed by TI for use only +with TI Devices. + +Neither the name of Texas Instruments Incorporated nor the names of its +suppliers may be used to endorse or promote products derived from this +software without specific prior written permission. + +DISCLAIMER. + +THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "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 TI AND TI'S LICENSORS 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. diff --git a/meta-agl-refhw-gen3/recipes-bsp/ti-bt-firmware/ti-bt-firmware_git.bb b/meta-agl-refhw-gen3/recipes-bsp/ti-bt-firmware/ti-bt-firmware_git.bb new file mode 100644 index 0000000..22d9145 --- /dev/null +++ b/meta-agl-refhw-gen3/recipes-bsp/ti-bt-firmware/ti-bt-firmware_git.bb @@ -0,0 +1,26 @@ +SUMMARY = "Bluetooth firmare files for WL18xx combo modules" +LICENSE = "TI-TFL" +LIC_FILES_CHKSUM = "file://LICENSE;md5=f39eac9f4573be5b012e8313831e72a9" + +# Use the commit ID for PV since several different firmware versions +# are mixed together. +PV = "git${SRCPV}" + +SRC_URI = "git://git.ti.com/ti-bt/service-packs.git;branch=master" +SRCREV = "6c9104f0fb7ca1bfb663c61e9ea599b3eafbee67" + +S = "${WORKDIR}/git" + +inherit allarch + +CLEANBROKEN = "1" + +do_compile[noexec] = "1" +do_configure[noexec] = "1" + +do_install() { + install -d ${D}${nonarch_base_libdir}/firmware/ti-connectivity/ + oe_runmake "DEST_DIR=${D}" "BASE_LIB_DIR=${nonarch_base_libdir}" install +} + +FILES_${PN} = "${nonarch_base_libdir}/firmware/ti-connectivity/*" diff --git a/meta-agl-refhw-gen3/recipes-connectivity/wlconf/wlconf_8.7.3.bb b/meta-agl-refhw-gen3/recipes-connectivity/wlconf/wlconf_8.7.3.bb new file mode 100644 index 0000000..42a3248 --- /dev/null +++ b/meta-agl-refhw-gen3/recipes-connectivity/wlconf/wlconf_8.7.3.bb @@ -0,0 +1,39 @@ +DESCRIPTION = "Configuration utility for TI wireless drivers" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://README;beginline=1;endline=21;md5=adc05a1903d3f107f85c90328e3a9438" + +# Tag: R8.7_SP3 (8.7.3) +SRCREV = "5048b59a444ac59ba7171d6e122d5a84581aebf2" +SRC_URI = "git://git.ti.com/wilink8-wlan/18xx-ti-utils.git" + +S = "${WORKDIR}/git/wlconf" + +EXTRA_OEMAKE = "CC="${CC}"" + +do_install() { + install -d ${D}${sbindir} + install -d ${D}${sbindir}/wlconf/ + install -d ${D}${sbindir}/wlconf/official_inis + install -d ${D}/lib/firmware/ti-connectivity + + install -m 0755 wlconf ${D}${sbindir}/wlconf/ + install -m 0755 dictionary.txt ${D}${sbindir}/wlconf/ + install -m 0755 struct.bin ${D}${sbindir}/wlconf/ + install -m 0755 default.conf ${D}${sbindir}/wlconf/ + install -m 0755 wl18xx-conf-default.bin ${D}${sbindir}/wlconf/ + install -m 0755 wl18xx-conf-default.bin ${D}/lib/firmware/ti-connectivity/wl18xx-conf.bin + install -m 0755 README ${D}${sbindir}/wlconf/ + install -m 0755 example.conf ${D}${sbindir}/wlconf/ + install -m 0755 example.ini ${D}${sbindir}/wlconf/ + install -m 0755 configure-device.sh ${D}${sbindir}/wlconf/ + install -m 0755 ${S}/official_inis/* \ + ${D}${sbindir}/wlconf/official_inis/ +} + +FILES_${PN} += " \ + ${sbindir}/wlconf \ + ${sbindir}/wlconf/official_inis \ + /lib/firmware/ti-connectivity/wl18xx-conf.bin \ +" + +FILES_${PN}-dbg += "${sbindir}/wlconf/.debug" \ No newline at end of file diff --git a/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-Add-support-for-TI-WL1837.patch b/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-Add-support-for-TI-WL1837.patch new file mode 100644 index 0000000..cfd1276 --- /dev/null +++ b/meta-agl-refhw-gen3/recipes-kernel/linux/files/0001-Add-support-for-TI-WL1837.patch @@ -0,0 +1,233 @@ +Add support for TI WL1837 + +This patch adds description of TI WL1837 and links interfaces +to communicate with the IC. + +Signed-off-by: ito.yoshiki001 + +Reworked: +- WL1837 specific devicetree configuration moved to the board + specific r8a7795-agl-refhw.dts from agl-refhw-common.dtsi. +- Switched to HCI_LL driver for BT support to match other upstream + users and prepare for btwilink driver going away (dropped in 5.5 + upstream). +- WLAN_PWR_EN enabling moved to GPIO initialization to work around + BT initialization problems. +- Update sound configuration to enable WL1837 BT audio, and disable + the HDMI1 audio left over from the original Salvator-X devicetree. + The latter is clean up, as HDMI1 as defined uses a SSI that + conflicts with the ak4613 configuration. + +Signed-off-by: Scott Murray +--- + arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi | 37 +++++++--- + arch/arm64/boot/dts/renesas/r8a7795-agl-refhw.dts | 84 ++++++++++++++++++----- + 2 files changed, 94 insertions(+), 27 deletions(-) + +diff --git a/arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi b/arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi +index 796ac4c078e0..6f34b54c6ce1 100644 +--- a/arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi ++++ b/arch/arm64/boot/dts/renesas/agl-refhw-common.dtsi +@@ -183,6 +183,18 @@ + 1800000 0>; + }; + ++ wlan_en: regulator-wlan_en { ++ compatible = "regulator-fixed"; ++ ++ regulator-name = "wlan-en-regulator"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ ++ gpio = <&gpio7 2 GPIO_ACTIVE_HIGH>; ++ startup-delay-us = <70000>; ++ enable-active-high; ++ }; ++ + hdmi0-out { + compatible = "hdmi-connector"; + label = "HDMI0 OUT"; +@@ -672,7 +684,8 @@ + }; + + sound_pins: sound { +- groups = "ssi349_ctrl", "ssi3_data", "ssi4_data"; ++ groups = "ssi349_ctrl", "ssi3_data", "ssi4_data", ++ "ssi78_ctrl", "ssi7_data", "ssi8_data"; + function = "ssi"; + }; + +@@ -827,24 +840,28 @@ + }; + + &sdhi3 { ++ /* Default WLAN card configuration */ + pinctrl-0 = <&sdhi3_pins>; +- pinctrl-1 = <&sdhi3_pins_uhs>; +- pinctrl-names = "default", "state_uhs"; ++ pinctrl-names = "default"; + +- vmmc-supply = <&vcc_sdhi3>; +- vqmmc-supply = <&vccq_sdhi3>; +- cd-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; +- wp-gpios = <&gpio4 16 GPIO_ACTIVE_HIGH>; ++ vmmc-supply = <&wlan_en>; + bus-width = <4>; +- sd-uhs-sdr50; +- sd-uhs-sdr104; +- status = "okay"; ++ no-1-8-v; ++ non-removable; ++ cap-power-off-card; ++ keep-power-in-suspend; ++ ++ /* leave disabled by default */ + }; + + &ssi4 { + shared-pin; + }; + ++&ssi8 { ++ shared-pin; ++}; ++ + &usb_extal_clk { + clock-frequency = <50000000>; + }; +diff --git a/arch/arm64/boot/dts/renesas/r8a7795-agl-refhw.dts b/arch/arm64/boot/dts/renesas/r8a7795-agl-refhw.dts +index 83638a6228c0..97cc6e08ee8f 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7795-agl-refhw.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7795-agl-refhw.dts +@@ -119,6 +119,23 @@ + }; + }; + ++ sound_wl18xx { ++ compatible = "audio-graph-card"; ++ label = "wl18xx"; ++ ++ dais = <&rsnd_port2>; ++ }; ++ ++ wl18xx_pcm { ++ compatible = "ti,wl18xx-pcm"; ++ status = "okay"; ++ ++ port { ++ wl18xx_endpoint: endpoint { ++ remote-endpoint = <&rsnd_for_wl18xx>; ++ }; ++ }; ++ }; + }; + + &adsp { +@@ -155,8 +172,14 @@ + + &sound_card { + dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1 /* HDMI0 */ +- &rsnd_port2>; /* HDMI1 */ ++ &rsnd_port1>; /* HDMI0 */ ++}; ++ ++&hscif0 { ++ bluetooth { ++ compatible = "ti,wl1837-st"; ++ enable-gpios = <&gpio7 3 GPIO_ACTIVE_HIGH>; ++ }; + }; + + &hdmi0 { +@@ -192,12 +215,6 @@ + remote-endpoint = <&hdmi1_con>; + }; + }; +- port@2 { +- reg = <2>; +- dw_hdmi1_snd_in: endpoint { +- remote-endpoint = <&rsnd_endpoint2>; +- }; +- }; + }; + }; + +@@ -215,8 +232,11 @@ + }; + + &rcar_sound { ++ /* Multi DAI */ ++ #sound-dai-cells = <1>; ++ + ports { +- /* rsnd_port0 is on salvator-common */ ++ /* rsnd_port0 is in agl-refhw-common */ + rsnd_port1: port@1 { + reg = <1>; + rsnd_endpoint1: endpoint { +@@ -231,14 +251,15 @@ + }; + rsnd_port2: port@2 { + reg = <2>; +- rsnd_endpoint2: endpoint { +- remote-endpoint = <&dw_hdmi1_snd_in>; ++ rsnd_for_wl18xx: endpoint { ++ remote-endpoint = <&wl18xx_endpoint>; + +- dai-format = "i2s"; +- bitclock-master = <&rsnd_endpoint2>; +- frame-master = <&rsnd_endpoint2>; ++ simple-audio-card,format = "i2s"; ++ bitclock-master = <&wl18xx_endpoint>; ++ frame-master = <&wl18xx_endpoint>; + +- playback = <&ssi3>; ++ playback = <&ssi7>; ++ capture = <&ssi8>; + }; + }; + }; +@@ -373,11 +394,40 @@ + }; + + &sdhi3 { +- /delete-property/ wp-gpios; +- non-removable; ++ status = "okay"; ++ ++ max-frequency = <50000000>; ++ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ wlcore: wlcore@2 { ++ compatible = "ti,wl1837"; ++ reg = <2>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <25 IRQ_TYPE_EDGE_FALLING>; ++ }; + }; + + &gpio6 { ++ /* ++ * Enable WLAN_PWR_EN right from boot to get reliable BT ++ * initialization, as doing it at SDHI initialization ++ * does not seem to do so, no matter how much BT_EN is ++ * delayed. ++ * ++ * This is perhaps not ideal per the requirements described ++ * in the "Level Shifting WL18xx/WL18xxMOD/WL18xxQ I/Os" ++ * document (SWRA448A)[1], but the BT UART seems unusable ++ * otherwise. ++ * ++ * [1] https://www.ti.com/lit/an/swra448a/swra448a.pdf ++ */ ++ wlan-pwr-en { ++ gpio-hog; ++ gpios = <9 GPIO_ACTIVE_HIGH>; ++ output-high; ++ }; ++ + /* Enable the CAN 1 & 2 transceivers */ + can-1-transceiver-stb { + gpio-hog; diff --git a/meta-agl-refhw-gen3/recipes-kernel/linux/files/0002-revert-e233201a.patch b/meta-agl-refhw-gen3/recipes-kernel/linux/files/0002-revert-e233201a.patch new file mode 100644 index 0000000..76039be --- /dev/null +++ b/meta-agl-refhw-gen3/recipes-kernel/linux/files/0002-revert-e233201a.patch @@ -0,0 +1,47 @@ +Revert "wl18xx: do not invert IRQ on WLxxxx side" + +This reverts commit 2bcfc394307ae164cbbdff74b902af61dc0181b4. +The hard-coded assumption that the IRQ inversion logic is not +needed breaks non-Kingfisher users, specifically the WLAN card +for the AGL reference hardware board. + +Signed-off-by: Scott Murray + +--- + drivers/net/wireless/ti/wl18xx/main.c | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c +index 764987101116..0b3cf8477c6c 100644 +--- a/drivers/net/wireless/ti/wl18xx/main.c ++++ b/drivers/net/wireless/ti/wl18xx/main.c +@@ -865,9 +865,7 @@ static int wl18xx_pre_upload(struct wl1271 *wl) + { + u32 tmp; + int ret; +-#if 0 + u16 irq_invert; +-#endif + + BUILD_BUG_ON(sizeof(struct wl18xx_mac_and_phy_params) > + WL18XX_PHY_INIT_MEM_SIZE); +@@ -920,11 +918,6 @@ static int wl18xx_pre_upload(struct wl1271 *wl) + if (ret < 0) + goto out; + +-#if 0 +- /* We have level translator with inversion on IRQ line so we +- * set IRQ_TYPE_EDGE_FALLING in DTS, but we do not need to +- * invert IRQ logic on WLxxxx side! +- */ + ret = irq_get_trigger_type(wl->irq); + if ((ret == IRQ_TYPE_LEVEL_LOW) || (ret == IRQ_TYPE_EDGE_FALLING)) { + wl1271_info("using inverted interrupt logic: %d", ret); +@@ -944,7 +937,6 @@ static int wl18xx_pre_upload(struct wl1271 *wl) + + ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); + } +-#endif + + out: + return ret; diff --git a/meta-agl-refhw-gen3/recipes-kernel/linux/files/refhw-rcar.cfg b/meta-agl-refhw-gen3/recipes-kernel/linux/files/refhw-rcar.cfg index fc8afbc..9fa24e9 100644 --- a/meta-agl-refhw-gen3/recipes-kernel/linux/files/refhw-rcar.cfg +++ b/meta-agl-refhw-gen3/recipes-kernel/linux/files/refhw-rcar.cfg @@ -3,25 +3,31 @@ CONFIG_USB_NET_AX88179_178A=y CONFIG_GPIO_SYSFS=y -CONFIG_RFKILL=y - CONFIG_CAN=y CONFIG_CAN_DEV=y CONFIG_CAN_RCAR_CANFD=y -CONFIG_BT=y -CONFIG_BT_QCA=y -CONFIG_BT_HCIUART=y +CONFIG_BT=m +CONFIG_BT_RFCOMM=m +CONFIG_BT_BNEP=m +CONFIG_BT_HIDP=m + +CONFIG_BT_HCIUART=m CONFIG_BT_HCIUART_SERDEV=y CONFIG_BT_HCIUART_H4=y -CONFIG_BT_HCIUART_QCA=y +CONFIG_BT_HCIUART_BCSP=y +CONFIG_BT_HCIUART_LL=y +CONFIG_BT_HCIUART_BCM=y -CONFIG_CFG80211=y +CONFIG_WEXT_CORE=y +CONFIG_WEXT_PROC=y +CONFIG_CFG80211_WEXT=y CONFIG_MAC80211=y -CONFIG_ATH_COMMON=y -CONFIG_WLAN_VENDOR_ATH=y -CONFIG_ATH10K=y -CONFIG_ATH10K_PCI=m +CONFIG_WLAN=y +CONFIG_WLCORE=m +CONFIG_WLCORE_SDIO=m +CONFIG_WL18xx=m +CONFIG_SND_SOC_WL18XX=y CONFIG_USB_GADGET=y CONFIG_USB_RENESAS_USB3=y diff --git a/meta-agl-refhw-gen3/recipes-kernel/linux/linux-renesas_%.bbappend b/meta-agl-refhw-gen3/recipes-kernel/linux/linux-renesas_%.bbappend index 82c4a2a..325e507 100644 --- a/meta-agl-refhw-gen3/recipes-kernel/linux/linux-renesas_%.bbappend +++ b/meta-agl-refhw-gen3/recipes-kernel/linux/linux-renesas_%.bbappend @@ -4,6 +4,8 @@ SRC_URI_append = " \ file://0001-create-r8a7795-usb-ovc-pinmux-groups.patch \ file://0001-add-agl-refhw.patch \ file://0003-rcar3-dw-hdmi-cec-mute.patch \ + file://0001-Add-support-for-TI-WL1837.patch \ + file://0002-revert-e233201a.patch \ file://refhw-rcar.cfg \ " -- cgit 1.2.3-korg