Re: [OpenWrt-Devel] [PATCH] mac80211: switch to upstream owl-loader driver

2019-12-11 Thread Russell Senior
This commit broke wifi on the Buffalo WZR600DHP.  See:
https://bugs.openwrt.org/index.php?do=details_id=2668

On Fri, Nov 22, 2019 at 12:00 PM Christian Lamparter 
wrote:

> On Monday, 18 November 2019 00:34:01 CET Hauke Mehrtens wrote:
> > > +--- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c
> > >  b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c
> > > +@@ -84,6 +84,10 @@
> > > +   val = swahb32(val);
> > > +   }
> > > +
> > > ++#ifdef CONFIG_LANTIQ
> > > ++  val = swab32(val);
> > > ++#endif
> >
> > Lantiq is big endian, are there other big endian system which do not
> > need this byte swap?
>
> From what I vaguely remember (I know that Mathias explained it to me
> once.),
> that special hack was necessary due to Lantiq's pci(e?)-host silicon doing
> byteswaps just for 32-bit writes. The only other system that uses the
> owl-loader
> is ath79/ar71xx. This is a big-endian MIPS as well that didn't need the
> swap.
>
> (That said, I don't remember what was the reason for going with
> __raw_writel
> rather than "iowrite32" though. At least ath9k is using it for the pci
> access
> just fine everywhere.)
>
> Anyone fancy checking out lantiq and ath79 devices with a AR92XX without
> the
> swap above and the __raw_writel replaced by iowrite32?
>
> > > ++
> > > +   __raw_writel(val, mem + reg);
> > > +   usleep_range(100, 120);
> > > +   }
>
> Regards,
> Christian
>
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] mac80211: switch to upstream owl-loader driver

2019-11-22 Thread Christian Lamparter
On Monday, 18 November 2019 00:34:01 CET Hauke Mehrtens wrote:
> > +--- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c
> >  b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c
> > +@@ -84,6 +84,10 @@
> > +   val = swahb32(val);
> > +   }
> > + 
> > ++#ifdef CONFIG_LANTIQ
> > ++  val = swab32(val);
> > ++#endif
> 
> Lantiq is big endian, are there other big endian system which do not
> need this byte swap?

>From what I vaguely remember (I know that Mathias explained it to me once.),
that special hack was necessary due to Lantiq's pci(e?)-host silicon doing
byteswaps just for 32-bit writes. The only other system that uses the owl-loader
is ath79/ar71xx. This is a big-endian MIPS as well that didn't need the swap.

(That said, I don't remember what was the reason for going with __raw_writel
rather than "iowrite32" though. At least ath9k is using it for the pci access
just fine everywhere.)

Anyone fancy checking out lantiq and ath79 devices with a AR92XX without the
swap above and the __raw_writel replaced by iowrite32?
 
> > ++
> > +   __raw_writel(val, mem + reg);
> > +   usleep_range(100, 120);
> > +   } 

Regards,
Christian



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] mac80211: switch to upstream owl-loader driver

2019-11-17 Thread Hauke Mehrtens
On 11/17/19 2:44 AM, Christian Lamparter wrote:
> The Owl Loader (named after the codename that Atheros gave
> these devices back in the day) has been accepted upstream.
> 
> This patch removes the "misc" driver OpenWrt had and adds
> the remaining differences against the version that ships
> with 5.4-rc1 into a separate "120-owl-loader-compat.patch"
> file that can be cut down once AR71XX is being dealt with.
> 
> Note: I decided to keep the existing (kmod-)owl-loader
> package name around for now. The kernel module file in
> the kmod package will be called ath9k_pci_owl_loader.ko
> though.
> 
> Signed-off-by: Christian Lamparter 

Acked-by: Hauke Mehrtens 

> ---
>  package/kernel/linux/modules/wireless.mk  |  21 --
>  package/kernel/mac80211/ath.mk|  20 +-
>  .../patches/ath/120-owl-loader-compat.patch   |  67 +
>  .../generic/files/drivers/misc/owl-loader.c   | 246 --
>  .../hack-4.14/835-misc-owl_loader.patch   |  52 
>  .../hack-4.19/835-misc-owl_loader.patch   |  52 
>  .../hack-4.9/835-misc-owl_loader.patch|  52 
>  7 files changed, 86 insertions(+), 424 deletions(-)
>  create mode 100644 
> package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch
>  delete mode 100644 target/linux/generic/files/drivers/misc/owl-loader.c
>  delete mode 100644 target/linux/generic/hack-4.14/835-misc-owl_loader.patch
>  delete mode 100644 target/linux/generic/hack-4.19/835-misc-owl_loader.patch
>  delete mode 100644 target/linux/generic/hack-4.9/835-misc-owl_loader.patch
> 
> diff --git a/package/kernel/linux/modules/wireless.mk 
> b/package/kernel/linux/modules/wireless.mk
> index 7b1c663567..72e2bf477b 100644
> --- a/package/kernel/linux/modules/wireless.mk
> +++ b/package/kernel/linux/modules/wireless.mk
> @@ -41,24 +41,3 @@ define KernelPackage/net-rtl8192su/description
>  endef
>  
>  $(eval $(call KernelPackage,net-rtl8192su))
> -
> -
> -define KernelPackage/owl-loader
> -  SUBMENU:=$(WIRELESS_MENU)
> -  TITLE:=Owl loader for initializing Atheros PCI(e) Wifi chips
> -  DEPENDS:=@PCI_SUPPORT
> -  KCONFIG:=CONFIG_OWL_LOADER
> -  FILES:=$(LINUX_DIR)/drivers/misc/owl-loader.ko
> -  AUTOLOAD:=$(call AutoProbe,owl-loader)
> -endef
> -
> -define KernelPackage/owl-loader/description
> -  Kernel module that helps to initialize certain Qualcomm
> -  Atheros' PCI(e) Wifi chips, which have the init data
> -  (which contains the PCI device ID for example) stored
> -  together with the calibration data in the file system.
> -
> -  This is necessary for devices like the Cisco Meraki Z1.
> -endef
> -
> -$(eval $(call KernelPackage,owl-loader))
> diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk
> index 64aac41b4d..788131b751 100644
> --- a/package/kernel/mac80211/ath.mk
> +++ b/package/kernel/mac80211/ath.mk
> @@ -1,6 +1,6 @@
>  PKG_DRIVERS += \
>   ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc 
> ath10k \
> - carl9170
> + carl9170 owl-loader
>  
>  PKG_CONFIG_DEPENDS += \
>   CONFIG_PACKAGE_ATH_DEBUG \
> @@ -38,6 +38,7 @@ config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += 
> ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL
>  config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK
>  config-$(call config_package,ath9k) += ATH9K
>  config-$(call config_package,ath9k-common) += ATH9K_COMMON
> +config-$(call config_package,owl-loader) += ATH9K_PCI_NO_EEPROM
>  config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
>  config-$(CONFIG_TARGET_ath79) += ATH9K_AHB
>  config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB
> @@ -274,3 +275,20 @@ define KernelPackage/carl9170
>FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
>AUTOLOAD:=$(call AutoProbe,carl9170)
>  endef
> +
> +define KernelPackage/owl-loader
> +  $(call KernelPackage/mac80211/Default)
> +  TITLE:=Owl loader for initializing Atheros PCI(e) Wifi chips
> +  DEPENDS:=@PCI_SUPPORT +kmod-ath9k
> +  
> FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.ko
> +  AUTOLOAD:=$(call AutoProbe,ath9k_pci_owl_loader)
> +endef
> +
> +define KernelPackage/owl-loader/description
> +  Kernel module that helps to initialize certain Qualcomm
> +  Atheros' PCI(e) Wifi chips, which have the init data
> +  (which contains the PCI device ID for example) stored
> +  together with the calibration data in the file system.
> +
> +  This is necessary for devices like the Cisco Meraki Z1.
> +endef
> diff --git a/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch 
> b/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch
> new file mode 100644
> index 00..256fca45e4
> --- /dev/null
> +++ b/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch
> @@ -0,0 +1,67 @@
> +From: Christian Lamparter 
> +Date: Sat, 16 Nov 2019 19:25:24 +0100
> +Subject: [PATCH] owl_loader: compatibility patch
> +
> +This patch includes OpenWrt specific changes that are
> +not included in the upstream owl-loader.
> +
> +These include:
> +

[OpenWrt-Devel] [PATCH] mac80211: switch to upstream owl-loader driver

2019-11-16 Thread Christian Lamparter
The Owl Loader (named after the codename that Atheros gave
these devices back in the day) has been accepted upstream.

This patch removes the "misc" driver OpenWrt had and adds
the remaining differences against the version that ships
with 5.4-rc1 into a separate "120-owl-loader-compat.patch"
file that can be cut down once AR71XX is being dealt with.

Note: I decided to keep the existing (kmod-)owl-loader
package name around for now. The kernel module file in
the kmod package will be called ath9k_pci_owl_loader.ko
though.

Signed-off-by: Christian Lamparter 
---
 package/kernel/linux/modules/wireless.mk  |  21 --
 package/kernel/mac80211/ath.mk|  20 +-
 .../patches/ath/120-owl-loader-compat.patch   |  67 +
 .../generic/files/drivers/misc/owl-loader.c   | 246 --
 .../hack-4.14/835-misc-owl_loader.patch   |  52 
 .../hack-4.19/835-misc-owl_loader.patch   |  52 
 .../hack-4.9/835-misc-owl_loader.patch|  52 
 7 files changed, 86 insertions(+), 424 deletions(-)
 create mode 100644 
package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch
 delete mode 100644 target/linux/generic/files/drivers/misc/owl-loader.c
 delete mode 100644 target/linux/generic/hack-4.14/835-misc-owl_loader.patch
 delete mode 100644 target/linux/generic/hack-4.19/835-misc-owl_loader.patch
 delete mode 100644 target/linux/generic/hack-4.9/835-misc-owl_loader.patch

diff --git a/package/kernel/linux/modules/wireless.mk 
b/package/kernel/linux/modules/wireless.mk
index 7b1c663567..72e2bf477b 100644
--- a/package/kernel/linux/modules/wireless.mk
+++ b/package/kernel/linux/modules/wireless.mk
@@ -41,24 +41,3 @@ define KernelPackage/net-rtl8192su/description
 endef
 
 $(eval $(call KernelPackage,net-rtl8192su))
-
-
-define KernelPackage/owl-loader
-  SUBMENU:=$(WIRELESS_MENU)
-  TITLE:=Owl loader for initializing Atheros PCI(e) Wifi chips
-  DEPENDS:=@PCI_SUPPORT
-  KCONFIG:=CONFIG_OWL_LOADER
-  FILES:=$(LINUX_DIR)/drivers/misc/owl-loader.ko
-  AUTOLOAD:=$(call AutoProbe,owl-loader)
-endef
-
-define KernelPackage/owl-loader/description
-  Kernel module that helps to initialize certain Qualcomm
-  Atheros' PCI(e) Wifi chips, which have the init data
-  (which contains the PCI device ID for example) stored
-  together with the calibration data in the file system.
-
-  This is necessary for devices like the Cisco Meraki Z1.
-endef
-
-$(eval $(call KernelPackage,owl-loader))
diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk
index 64aac41b4d..788131b751 100644
--- a/package/kernel/mac80211/ath.mk
+++ b/package/kernel/mac80211/ath.mk
@@ -1,6 +1,6 @@
 PKG_DRIVERS += \
ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc 
ath10k \
-   carl9170
+   carl9170 owl-loader
 
 PKG_CONFIG_DEPENDS += \
CONFIG_PACKAGE_ATH_DEBUG \
@@ -38,6 +38,7 @@ config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += 
ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL
 config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK
 config-$(call config_package,ath9k) += ATH9K
 config-$(call config_package,ath9k-common) += ATH9K_COMMON
+config-$(call config_package,owl-loader) += ATH9K_PCI_NO_EEPROM
 config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
 config-$(CONFIG_TARGET_ath79) += ATH9K_AHB
 config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB
@@ -274,3 +275,20 @@ define KernelPackage/carl9170
   FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
   AUTOLOAD:=$(call AutoProbe,carl9170)
 endef
+
+define KernelPackage/owl-loader
+  $(call KernelPackage/mac80211/Default)
+  TITLE:=Owl loader for initializing Atheros PCI(e) Wifi chips
+  DEPENDS:=@PCI_SUPPORT +kmod-ath9k
+  
FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.ko
+  AUTOLOAD:=$(call AutoProbe,ath9k_pci_owl_loader)
+endef
+
+define KernelPackage/owl-loader/description
+  Kernel module that helps to initialize certain Qualcomm
+  Atheros' PCI(e) Wifi chips, which have the init data
+  (which contains the PCI device ID for example) stored
+  together with the calibration data in the file system.
+
+  This is necessary for devices like the Cisco Meraki Z1.
+endef
diff --git a/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch 
b/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch
new file mode 100644
index 00..256fca45e4
--- /dev/null
+++ b/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch
@@ -0,0 +1,67 @@
+From: Christian Lamparter 
+Date: Sat, 16 Nov 2019 19:25:24 +0100
+Subject: [PATCH] owl_loader: compatibility patch
+
+This patch includes OpenWrt specific changes that are
+not included in the upstream owl-loader.
+
+These include:
+   - A Byteswap fix for lantiq's PCI code
+
+   - platform data handling for ar71xx
+
+Signed-off-by: Christian Lamparter 
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c
 b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c
+@@ -84,6 +84,10 @@
+   val =