linux-fslc: ccimx6som: Add support for wireless module variants

The ConnectCore 6UL System-On-Module comes on different hardware
variants. This commit adds support for the wireless variant with
Qualcomm's QCA6564 WiFi / Bluetooth chipset.

* Modifies the device tree to add the SDIO wireless interface
* Patches the Linux kernel with QCA6564 specific feature additions
* Adds the unused HOSTAP module to the configuration so that the WEXT
  config option is selected, even though the module won't be added to
  to the target. Out-of-tree drivers have no way of selecting the legacy
  WEXT support needed for the QCA6564.
* Removes the probe locking feature from the configuration as the
  QCA6564 driver is not as well designed and it oops with warnings:
* Configure Bluetooth RFCOMM support in the kernel
* Sets the quality of the RNG so that it can be used by the kernel

[   19.479089] ============================================
[   19.484423] WARNING: possible recursive locking detected
[   19.489761] 4.19.5-fslc+g093a10401c15 #1 Tainted: G           O
[   19.496135] --------------------------------------------

Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
Alex Gonzalez 2019-01-11 18:56:42 +01:00 committed by Otavio Salvador
parent 017994915c
commit 1d86d8eea7
6 changed files with 309 additions and 0 deletions

View File

@ -0,0 +1,32 @@
From: Alex Gonzalez <alex.gonzalez@digi.com>
Date: Fri, 14 Sep 2018 12:32:41 +0200
Subject: [PATCH] ARM: dts: imx6ul: ccimx6ulsom: Add empty wireless and
bluetooth placeholders
The vendor provided U-Boot will use these empty nodes to populate the
MAC addresses used for both the Bluetooth and the Wireless chips.
Upstream-Status: Inappropriate [vendor specific]
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
---
arch/arm/boot/dts/imx6ul-ccimx6ulsom.dtsi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/boot/dts/imx6ul-ccimx6ulsom.dtsi b/arch/arm/boot/dts/imx6ul-ccimx6ulsom.dtsi
index b5781c3656d1..82fa176bf138 100644
--- a/arch/arm/boot/dts/imx6ul-ccimx6ulsom.dtsi
+++ b/arch/arm/boot/dts/imx6ul-ccimx6ulsom.dtsi
@@ -24,6 +24,12 @@
linux,cma-default;
};
};
+
+ bluetooth {
+ };
+
+ wireless {
+ };
};
&adc1 {

View File

@ -0,0 +1,77 @@
From: Alex Gonzalez <alex.gonzalez@digi.com>
Date: Mon, 10 Sep 2018 13:38:40 +0200
Subject: [PATCH] net: wireless: Export regulatory_hint_user()
The QCA6564 driver makes use of this kernel API when built with
the QCA_VENDOR_KERNEL flag.
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
---
include/net/cfg80211.h | 26 ++++++++++++++++++++++++++
net/wireless/reg.c | 1 +
net/wireless/reg.h | 3 ---
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e0c41eb1c860..84d47ac0cea4 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5111,6 +5111,32 @@ int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
struct ieee80211_regdomain *rd);
/**
+ * regulatory_hint_user - hint to the wireless core a regulatory domain
+ * which the driver has received from an application
+ * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
+ * should be in. If @rd is set this should be NULL. Note that if you
+ * set this to NULL you should still set rd->alpha2 to some accepted
+ * alpha2.
+ * @user_reg_hint_type: the type of user regulatory hint.
+ *
+ * Wireless drivers can use this function to hint to the wireless core
+ * the current regulatory domain as specified by trusted applications,
+ * it is the driver's responsibilty to estbalish which applications it
+ * trusts.
+ *
+ * The wiphy should be registered to cfg80211 prior to this call.
+ * For cfg80211 drivers this means you must first use wiphy_register(),
+ * for mac80211 drivers you must first use ieee80211_register_hw().
+ *
+ * Drivers should check the return value, its possible you can get
+ * an -ENOMEM or an -EINVAL.
+ *
+ * Return: 0 on success. -ENOMEM, -EINVAL.
+ */
+int regulatory_hint_user(const char *alpha2,
+ enum nl80211_user_reg_hint_type user_reg_hint_type);
+
+/**
* wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
* @wiphy: the wireless device we want to process the regulatory domain on
* @regd: the custom regulatory domain to use for this wiphy
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index dd58b9909ac9..816a8a25b06f 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2912,6 +2912,7 @@ int regulatory_hint_user(const char *alpha2,
return 0;
}
+EXPORT_SYMBOL(regulatory_hint_user);
int regulatory_hint_indoor(bool is_indoor, u32 portid)
{
diff --git a/net/wireless/reg.h b/net/wireless/reg.h
index 9ceeb5f3a7cb..92de47dec466 100644
--- a/net/wireless/reg.h
+++ b/net/wireless/reg.h
@@ -31,9 +31,6 @@ bool is_world_regdom(const char *alpha2);
bool reg_supported_dfs_region(enum nl80211_dfs_regions dfs_region);
enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy);
-int regulatory_hint_user(const char *alpha2,
- enum nl80211_user_reg_hint_type user_reg_hint_type);
-
/**
* regulatory_hint_indoor - hint operation in indoor env. or not
* @is_indoor: if true indicates that user space thinks that the

View File

@ -0,0 +1,62 @@
From: Alex Gonzalez <alex.gonzalez@digi.com>
Date: Fri, 7 Sep 2018 13:12:14 +0200
Subject: [PATCH] net: wireless: Allow for firmware to handle DFS
The QCA6564 driver makes use of this functionality when compiled with
the QCA_VENDOR_KERNEL flag.
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
---
include/net/cfg80211.h | 2 ++
net/wireless/chan.c | 3 ++-
net/wireless/nl80211.c | 3 +++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 84d47ac0cea4..3082f6bf047d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3740,6 +3740,7 @@ struct cfg80211_ops {
* beaconing mode (AP, IBSS, Mesh, ...).
* @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
* before connection.
+ * @WIPHY_FLAG_DFS_OFFLOAD: The driver handles all the DFS related operations.
*/
enum wiphy_flags {
/* use hole at 0 */
@@ -3766,6 +3767,7 @@ enum wiphy_flags {
WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
+ WIPHY_FLAG_DFS_OFFLOAD = BIT(25),
};
/**
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 7dc1bbd0888f..2ef1f908408f 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -321,7 +321,8 @@ static int cfg80211_get_chans_dfs_required(struct wiphy *wiphy,
if (!c)
return -EINVAL;
- if (c->flags & IEEE80211_CHAN_RADAR)
+ if ((c->flags & IEEE80211_CHAN_RADAR) &&
+ !(wiphy->flags & WIPHY_FLAG_DFS_OFFLOAD))
return 1;
}
return 0;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d91a408db113..930670ccfa59 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7956,6 +7956,9 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
if (netif_carrier_ok(dev))
return -EBUSY;
+ if (rdev->wiphy.flags & WIPHY_FLAG_DFS_OFFLOAD)
+ return -EOPNOTSUPP;
+
if (wdev->cac_started)
return -EBUSY;

View File

@ -0,0 +1,95 @@
From: Alex Gonzalez <alex.gonzalez@digi.com>
Date: Fri, 7 Sep 2018 13:01:54 +0200
Subject: [PATCH] net: wireless: Add
cfg80211_is_gratuitous_arp_unsolicited_na()
The QCA6564 driver makes use of this call when compiled with the
QCA_VENDOR_KERNEL flag.
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
---
include/net/cfg80211.h | 10 ++++++++++
net/wireless/util.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 3082f6bf047d..42445bd1c26a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -6736,6 +6736,16 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
/**
+ * cfg80211_is_gratuitous_arp_unsolicited_na - packet is grat. ARP/unsol. NA
+ * @skb: the input packet, must be an ethernet frame already
+ *
+ * Return: %true if the packet is a gratuitous ARP or unsolicited NA packet.
+ * This is used to drop packets that shouldn't occur because the AP implements
+ * a proxy service.
+ */
+bool cfg80211_is_gratuitous_arp_unsolicited_na(struct sk_buff *skb);
+
+/**
* cfg80211_check_combinations - check interface combinations
*
* @wiphy: the wiphy
diff --git a/net/wireless/util.c b/net/wireless/util.c
index ec30e3732c7b..abcefae39e81 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -2061,3 +2061,55 @@ int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *cap,
return max_vht_nss;
}
EXPORT_SYMBOL(ieee80211_get_vht_max_nss);
+
+bool cfg80211_is_gratuitous_arp_unsolicited_na(struct sk_buff *skb)
+{
+ const struct ethhdr *eth = (void *)skb->data;
+
+ const struct {
+ struct arphdr hdr;
+ u8 ar_sha[ETH_ALEN];
+ u8 ar_sip[4];
+ u8 ar_tha[ETH_ALEN];
+ u8 ar_tip[4];
+ } __packed * arp;
+
+ const struct ipv6hdr *ipv6;
+ const struct icmp6hdr *icmpv6;
+
+ switch (eth->h_proto) {
+ case cpu_to_be16(ETH_P_ARP):
+ /* can't say - but will probably be dropped later anyway */
+ if (!pskb_may_pull(skb, sizeof(*eth) + sizeof(*arp)))
+ return false;
+
+ arp = (void *)(eth + 1);
+
+ if ((arp->hdr.ar_op == cpu_to_be16(ARPOP_REPLY) ||
+ arp->hdr.ar_op == cpu_to_be16(ARPOP_REQUEST)) &&
+ !memcmp(arp->ar_sip, arp->ar_tip, sizeof(arp->ar_sip)))
+ return true;
+ break;
+ case cpu_to_be16(ETH_P_IPV6):
+ /* can't say - but will probably be dropped later anyway */
+ if (!pskb_may_pull(skb, sizeof(*eth) + sizeof(*ipv6) +
+ sizeof(*icmpv6)))
+ return false;
+
+ ipv6 = (void *)(eth + 1);
+ icmpv6 = (void *)(ipv6 + 1);
+
+ if (icmpv6->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT &&
+ !memcmp(&ipv6->saddr, &ipv6->daddr, sizeof(ipv6->saddr)))
+ return true;
+ break;
+ default:
+ /* no need to support other protocols, proxy service isn't
+ * specified for any others
+ */
+ break;
+ }
+
+ return false;
+}
+EXPORT_SYMBOL(cfg80211_is_gratuitous_arp_unsolicited_na);

View File

@ -0,0 +1,26 @@
From: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
Date: Wed, 27 Jun 2018 17:39:11 +0200
Subject: [PATCH] linux: crypto: caam set hwrng quality
According to the i.MX6 Security Reference Manual it is a NIST
certifiable RNG, so set high quality to let the HWRNG framework
automatically use it.
Signed-off-by: Jose Diaz de Grenu <Jose.DiazdeGrenu@digi.com>
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
---
drivers/crypto/caam/caamrng.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
index fde07d4ff019..ddca16941640 100644
--- a/drivers/crypto/caam/caamrng.c
+++ b/drivers/crypto/caam/caamrng.c
@@ -292,6 +292,7 @@ static struct hwrng caam_rng = {
.name = "rng-caam",
.cleanup = caam_cleanup,
.read = caam_read,
+ .quality = 1024,
};
static void __exit caam_rng_exit(void)

View File

@ -10,8 +10,25 @@ SRC_URI_append_imx6qdl-variscite-som_use-mainline-bsp = " \
SRC_URI_append_ccimx6ul = " \
file://0001-MLK-11719-4-mtd-gpmi-change-the-BCH-layout-setting-f.patch \
${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'file://0002-ARM-dts-imx6ul-ccimx6ulsom-Add-empty-wireless-and-bl.patch', '', d)} \
${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'file://0003-net-wireless-Export-regulatory_hint_user.patch', '', d)} \
${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'file://0004-net-wireless-Allow-for-firmware-to-handle-DFS.patch', '', d)} \
${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'file://0005-net-wireless-Add-cfg80211_is_gratuitous_arp_unsolici.patch', '', d)} \
file://0006-linux-crypto-caam-set-hwrng-quality.patch \
"
do_configure_prepend_ccimx6ul() {
if ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'true', 'false', d)}; then
kernel_conf_variable HOSTAP m
kernel_conf_variable PROVE_LOCKING n
sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${B}/.config'
fi
if ${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', 'true', 'false', d)}; then
kernel_conf_variable BT_RFCOMM y
sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${B}/.config'
fi
}
do_configure_prepend_imx6qdl-variscite-som() {
cp ${WORKDIR}/imx6*-var*.dts* ${S}/arch/arm/boot/dts
}