mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 15:02:32 +00:00
e927456ec3
Commit947b44d
("ipq807x: fix wrong define for LAN and WAN ess mask") started fixing wrong switch_lan_bmp that defined lan there weren't actually present. This displayed a fragility in the malibu phy init code in qca-ssdk. Add patch to fix this. Also update each DTS with the new required property if needed. The new binding malibu_phy_start_addr is required with devices that place the malibu first PHY referring port1 on a different PHY addres than 0. The most common configuration is 0 but some device (for example Qnap 301W) place the malibu PHY at an offset to address 16. Refer to ipq8074-ess dtsi for extensive description on how to derive this value. Quoting the patch detailed description: The usage of first_phy_addr is EXTREMELY FRAGILE and results in dangerous results if the OEM (or anyone that by chance try to implement things in a logical manner) deviates from the default values from the "magical template". To be in more details. With QSDK 12.4, some tweaks were done to improve autoneg and now on every call of port status, the phydev is tried to add. This resulted in the call and log spam of an error with ports that are actually not present on the system with qsdk reporting phydev is NULL. This itself is not an error and printing the error is correct. What is actually an error from ages is setting generic bitmap reporting presence of port that are actually not present. This is very common on OEM where the switch_lan_bmp is always a variant of 0x1e (that on bitmap results in PORT1 PORT2 PORT3 PORT4 present) or 0x3e (PORT1 PORT2 PORT3 PORT4 PORT5). Reality is that many device are used as AP with one LAN port or one WAN port. (or even exotic configuration with PORT1 not present and PORT2 PORT3 PORT4 present (Xiaomi 3600) With this finding one can say... ok nice, then lets update the DT and set the correct bitmap... Again world is a bad place and reality is that this cause wonderful regression in some case of by extreme luck the first ever connected port working and the rest of the switch dead. The problem has been bisected to all the device that doesn't have the PORT1 declared in any of the bitmap. With this prefaction in mind, on to the REAL problem. malibu_phy_hw_init FOR SOME REASON, set a global variable first_phy_addr to the first detected PHY addr that coincidentally is always PORT1. PORT1 addr is 0x0. The entire code in malibu_phy use this variable to derive the phy addrs in some function. Declaring a bitmap where the PORT1 is missing (or worse PORT4 the only one connected) result in first_phy_addr set to 1 or whatever phy addr is detected first setting wrong value all over the init stage. To fix this, introduce a new binding malibu_first_phy_addr to manually declare the first phy that the malibu PHY driver should use and permit to detach it from port bmp detection. The legacy detection is kept for compatibility reason. Fixes: #13945 Fixes:947b44d9ae
("ipq807x: fix wrong define for LAN and WAN ess mask") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Tested-by: Robert Marko <robimarko@gmail.com> # Qnap 301W Reviewed-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
83 lines
2.9 KiB
Makefile
83 lines
2.9 KiB
Makefile
include $(TOPDIR)/rules.mk
|
|
|
|
PKG_NAME:=qca-ssdk
|
|
PKG_RELEASE:=2
|
|
|
|
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git
|
|
PKG_SOURCE_PROTO:=git
|
|
PKG_SOURCE_DATE:=2023-10-04
|
|
PKG_SOURCE_VERSION:=23a5aa4a4d5834da7a07efb58baebfbee91786b0
|
|
PKG_MIRROR_HASH:=9d169ce924a46a4e530031061d3183b92f23c7f46b3106f0b9ba3587846a73ee
|
|
|
|
PKG_FLAGS:=nonshared
|
|
PKG_BUILD_FLAGS:=no-lto
|
|
|
|
include $(INCLUDE_DIR)/kernel.mk
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
define KernelPackage/qca-ssdk
|
|
SECTION:=kernel
|
|
CATEGORY:=Kernel modules
|
|
SUBMENU:=Network Devices
|
|
TITLE:=Qualcom SSDK switch driver
|
|
DEPENDS:=@(TARGET_qualcommax)
|
|
FILES:=$(PKG_BUILD_DIR)/build/bin/qca-ssdk.ko
|
|
AUTOLOAD:=$(call AutoLoad,30,qca-ssdk)
|
|
endef
|
|
|
|
define KernelPackage/qca-ssdk/Description
|
|
Driver for Qualcomm Atheros switches.
|
|
endef
|
|
|
|
GCC_VERSION=$(shell echo "$(CONFIG_GCC_VERSION)" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
|
|
|
|
LNX_CONFIG_OPTS = LNX_MAKEOPTS='$(KERNEL_MAKEOPTS)' MODULE_TYPE=KSLIB modules
|
|
|
|
MAKE_FLAGS+= \
|
|
TARGET_NAME=$(CONFIG_TARGET_NAME) \
|
|
TOOL_PATH=$(firstword $(TOOLCHAIN_BIN_DIRS)) \
|
|
SYS_PATH=$(LINUX_DIR) \
|
|
TOOLPREFIX=$(TARGET_CROSS) \
|
|
KVER=$(LINUX_VERSION) \
|
|
ARCH=$(LINUX_KARCH) \
|
|
TARGET_SUFFIX=$(CONFIG_TARGET_SUFFIX) \
|
|
GCC_VERSION=$(GCC_VERSION) \
|
|
EXTRA_CFLAGS=-fno-stack-protector -I$(STAGING_DIR)/usr/include \
|
|
$(LNX_CONFIG_OPTS)
|
|
|
|
ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq807x")
|
|
MAKE_FLAGS+= CHIP_TYPE=HPPE PTP_FEATURE=disable SWCONFIG_FEATURE=disable
|
|
endif
|
|
|
|
define Build/InstallDev
|
|
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk
|
|
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/api
|
|
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/ref
|
|
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/fal
|
|
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/sal
|
|
$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/init
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/api/sw_ioctl.h $(1)/usr/include/qca-ssdk/api
|
|
if [ -f $(PKG_BUILD_DIR)/include/ref/ref_vsi.h ]; then \
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/ref/ref_vsi.h $(1)/usr/include/qca-ssdk/ref/; \
|
|
fi
|
|
if [ -f $(PKG_BUILD_DIR)/include/ref/ref_fdb.h ]; then \
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/ref/ref_fdb.h $(1)/usr/include/qca-ssdk/ref/; \
|
|
fi
|
|
if [ -f $(PKG_BUILD_DIR)/include/ref/ref_port_ctrl.h ]; then \
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/ref/ref_port_ctrl.h $(1)/usr/include/qca-ssdk/ref/; \
|
|
fi
|
|
if [ -f $(PKG_BUILD_DIR)/include/init/ssdk_init.h ]; then \
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/init/ssdk_init.h $(1)/usr/include/qca-ssdk/init/; \
|
|
fi
|
|
if [ -f $(PKG_BUILD_DIR)/include/init/ssdk_netlink.h ]; then \
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/init/ssdk_netlink.h $(1)/usr/include/qca-ssdk/init/; \
|
|
fi
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/fal $(1)/usr/include/qca-ssdk
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/common/*.h $(1)/usr/include/qca-ssdk
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/linux/*.h $(1)/usr/include/qca-ssdk
|
|
$(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/*.h $(1)/usr/include/qca-ssdk
|
|
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,qca-ssdk))
|