mirror of
https://github.com/LiBwrt-op/openwrt-6.x.git
synced 2025-12-17 01:06:35 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
c8e0c352c4
@ -445,7 +445,7 @@ config KERNEL_DEBUG_INFO
|
||||
|
||||
config KERNEL_DEBUG_INFO_BTF
|
||||
bool "Enable additional BTF type information"
|
||||
default y if (TARGET_armsr || TARGET_bcm27xx || TARGET_ipq806x_chromium || TARGET_mediatek_filogic || TARGET_mvebu_cortexa53 || TARGET_mvebu_cortexa72 || TARGET_rockchip || TARGET_sunxi || TARGET_x86_64) && BUILDBOT
|
||||
default y if (TARGET_armsr || TARGET_bcm27xx_bcm2709 || TARGET_bcm27xx_bcm2710 || TARGET_bcm27xx_bcm2711 || TARGET_bcm27xx_bcm2712 || TARGET_ipq806x_chromium || TARGET_mediatek_filogic || TARGET_mvebu_cortexa53 || TARGET_mvebu_cortexa72 || TARGET_qualcommax || TARGET_rockchip || TARGET_sunxi || TARGET_x86_64) && BUILDBOT
|
||||
depends on !HOST_OS_MACOS
|
||||
depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
|
||||
select DWARVES
|
||||
@ -473,7 +473,7 @@ config KERNEL_MODULE_ALLOW_BTF_MISMATCH
|
||||
|
||||
config KERNEL_DEBUG_INFO_REDUCED
|
||||
bool "Reduce debugging information"
|
||||
default y if !(TARGET_armsr || TARGET_bcm27xx || TARGET_ipq806x_chromium || TARGET_mediatek_filogic || TARGET_mvebu_cortexa53 || TARGET_mvebu_cortexa72 || TARGET_rockchip || TARGET_sunxi || TARGET_x86_64) || !BUILDBOT
|
||||
default y if !(TARGET_armsr || TARGET_bcm27xx_bcm2709 || TARGET_bcm27xx_bcm2710 || TARGET_bcm27xx_bcm2711 || TARGET_bcm27xx_bcm2712 || TARGET_ipq806x_chromium || TARGET_mediatek_filogic || TARGET_mvebu_cortexa53 || TARGET_mvebu_cortexa72 || TARGET_qualcommax || TARGET_rockchip || TARGET_sunxi || TARGET_x86_64) || !BUILDBOT
|
||||
depends on KERNEL_DEBUG_INFO
|
||||
help
|
||||
If you say Y here gcc is instructed to generate less debugging
|
||||
@ -570,7 +570,7 @@ config KERNEL_BPF_EVENTS
|
||||
|
||||
config KERNEL_PROBE_EVENTS_BTF_ARGS
|
||||
bool "Support BTF function arguments for probe events"
|
||||
depends on KERNEL_DEBUG_INFO_BTF && KERNEL_KPROBE_EVENTS && LINUX_6_6
|
||||
depends on KERNEL_DEBUG_INFO_BTF && KERNEL_KPROBE_EVENTS
|
||||
|
||||
config KERNEL_BPF_KPROBE_OVERRIDE
|
||||
bool
|
||||
@ -624,6 +624,10 @@ choice
|
||||
|
||||
config KERNEL_TRANSPARENT_HUGEPAGE_MADVISE
|
||||
bool "madvise"
|
||||
|
||||
config KERNEL_TRANSPARENT_HUGEPAGE_NEVER
|
||||
bool "never"
|
||||
depends on !LINUX_6_6
|
||||
endchoice
|
||||
|
||||
config KERNEL_HUGETLBFS
|
||||
@ -754,6 +758,11 @@ config KERNEL_SLABINFO
|
||||
select KERNEL_SLUB_DEBUG_ON
|
||||
bool "Enable /proc slab debug info"
|
||||
|
||||
config KERNEL_STACKDEPOT_MAX_FRAMES
|
||||
int
|
||||
default 64
|
||||
depends on KERNEL_SLUB_DEBUG
|
||||
|
||||
config KERNEL_PROC_PAGE_MONITOR
|
||||
bool "Enable /proc page monitoring"
|
||||
|
||||
@ -878,6 +887,18 @@ if KERNEL_CGROUPS
|
||||
Memory Nodes and assigning tasks to run only within those sets.
|
||||
This is primarily useful on large SMP or NUMA systems.
|
||||
|
||||
config KERNEL_CPUSETS_V1
|
||||
bool "Legacy cgroup v1 cpusets controller"
|
||||
depends on KERNEL_CPUSETS
|
||||
depends on !LINUX_6_6
|
||||
default n
|
||||
help
|
||||
Legacy cgroup v1 cpusets controller which has been deprecated by
|
||||
cgroup v2 implementation. The v1 is there for legacy applications
|
||||
which haven't migrated to the new cgroup v2 interface yet. If you
|
||||
do not have any such application then you are completely fine leaving
|
||||
this option disabled.
|
||||
|
||||
config KERNEL_PROC_PID_CPUSET
|
||||
bool "Include legacy /proc/<pid>/cpuset file"
|
||||
depends on KERNEL_CPUSETS
|
||||
@ -969,6 +990,22 @@ if KERNEL_CGROUPS
|
||||
Memory Controller, which are page-based, and can be swapped. Users of
|
||||
the kmem extension can use it to guarantee that no group of processes
|
||||
will ever exhaust kernel resources alone.
|
||||
|
||||
config KERNEL_MEMCG_V1
|
||||
bool "Legacy cgroup v1 memory controller"
|
||||
default n
|
||||
depends on KERNEL_MEMCG
|
||||
depends on !LINUX_6_6
|
||||
help
|
||||
Legacy cgroup v1 memory controller which has been deprecated by
|
||||
cgroup v2 implementation. The v1 is there for legacy applications
|
||||
which haven't migrated to the new cgroup v2 interface yet. If you
|
||||
do not have any such application then you are completely fine leaving
|
||||
this option disabled.
|
||||
|
||||
Please note that feature set of the legacy memory controller is likely
|
||||
going to shrink due to deprecation process. New deployments with v1
|
||||
controller are highly discouraged.
|
||||
|
||||
config KERNEL_CGROUP_PERF
|
||||
bool "Enable perf_event per-cpu per-container group (cgroup) monitoring"
|
||||
|
||||
@ -42,7 +42,9 @@ fwtool_check_image() {
|
||||
v "Invalid image metadata"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Step 1. check if oem_name file exist and is not empty
|
||||
# If the above is true store the contents (b3000) in $oem value for later
|
||||
[ -s /tmp/sysinfo/oem_name ] && oem="$(cat /tmp/sysinfo/oem_name)"
|
||||
device="$(cat /tmp/sysinfo/board_name)"
|
||||
devicecompat="$(uci -q get system.@system[0].compat_version)"
|
||||
[ -n "$devicecompat" ] || devicecompat="1.0"
|
||||
@ -61,7 +63,16 @@ fwtool_check_image() {
|
||||
json_get_keys dev_keys
|
||||
for k in $dev_keys; do
|
||||
json_get_var dev "$k"
|
||||
if [ "$dev" = "$device" ]; then
|
||||
# Step 2.
|
||||
# lets start with the original case [ "$dev" = "$device" ]
|
||||
# if the evaluated firmware is vanila openwrt, this evals as true -ie
|
||||
# [ ("$dev" == "glinet.gl-b3000") == ("$device" == "glinet,gl-b3000") ]
|
||||
# however if the firmware is oem then $dev = b3000 and the above check fails resulting
|
||||
# in the erroneous warnings.
|
||||
# so we add the secondary check [ "$dev" = "$oem" ];
|
||||
# If in Step 1 the oem_file was found and valid, the $oem == "b3000" so
|
||||
# [ ("$dev" == "b3000) == ("$oem" == "b3000") ] so firmware is valid oem
|
||||
if [ "$dev" = "$device" ] || [ "$dev" = "$oem" ]; then
|
||||
# major compat version -> no sysupgrade
|
||||
if [ "${devicecompat%.*}" != "${imagecompat%.*}" ]; then
|
||||
v "The device is supported, but this image is incompatible for sysupgrade based on the image version ($devicecompat->$imagecompat)."
|
||||
@ -70,7 +81,16 @@ fwtool_check_image() {
|
||||
fi
|
||||
|
||||
# minor compat version -> sysupgrade with -n required
|
||||
if [ "${devicecompat#.*}" != "${imagecompat#.*}" ] && [ "$SAVE_CONFIG" = "1" ]; then
|
||||
# Step 3.
|
||||
# here we must check if $dev == $oem to use this native compatability check
|
||||
# so we add the check for [ "$dev" = "$oem" ]
|
||||
if (([ "${devicecompat#.*}" != "${imagecompat#.*}" ] || [ "$dev" = "$oem" ])) && [ "$SAVE_CONFIG" = "1" ]; then
|
||||
# Step 4.
|
||||
# here we have to gaurd against the default case, oem may exsist and default will pass
|
||||
# the original check [ "${devicecompat#.*}" != "${imagecompat#.*}" ] so we must
|
||||
# explicitly check $dev == $oem, if it is we update(reuse) the $devicecompat and imagecompat
|
||||
# variable to reflect the case - ( Openwrt -> OEM )
|
||||
[ "$dev" = "$oem" ] && devicecompat="Openwrt " && imagecompat=" OEM"
|
||||
[ "$IGNORE_MINOR_COMPAT" = 1 ] && return 0
|
||||
v "The device is supported, but the config is incompatible to the new image ($devicecompat->$imagecompat). Please upgrade without keeping config (sysupgrade -n)."
|
||||
[ -n "$compatmessage" ] && v "$compatmessage"
|
||||
|
||||
@ -101,7 +101,7 @@ Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
|
||||
#include <asm/arch-rockchip/grf_rk3568.h>
|
||||
#include <asm/arch-rockchip/hardware.h>
|
||||
#include <dt-bindings/clock/rk3568-cru.h>
|
||||
@@ -200,3 +201,26 @@ int checkboard(void)
|
||||
@@ -200,3 +201,17 @@ int checkboard(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -116,15 +116,6 @@ Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
|
||||
+{
|
||||
+ led_setup();
|
||||
+
|
||||
+#if (CONFIG_IS_ENABLED(DM_REGULATOR))
|
||||
+ /*
|
||||
+ * Turning the eMMC and SPI back on (if disabled via the Qseven
|
||||
+ * BIOS_ENABLE) signal is done through a always-on regulator).
|
||||
+ */
|
||||
+ if (regulators_enable_boot_on(false))
|
||||
+ debug("%s: Cannot enable boot on regulator\n", __func__);
|
||||
+#endif
|
||||
+
|
||||
+ setup_boot_mode();
|
||||
+}
|
||||
+#endif
|
||||
|
||||
@ -41,6 +41,7 @@ define KernelPackage/hci-uart
|
||||
DEPENDS:=+kmod-bluetooth +kmod-btbcm
|
||||
KCONFIG:= \
|
||||
CONFIG_BT_HCIUART \
|
||||
CONFIG_BT_HCIUART_AML=n \
|
||||
CONFIG_BT_HCIUART_BCM=y \
|
||||
CONFIG_BT_HCIUART_INTEL=n \
|
||||
CONFIG_BT_HCIUART_H4 \
|
||||
|
||||
@ -558,6 +558,17 @@ endef
|
||||
|
||||
$(eval $(call KernelPackage,crypto-kpp))
|
||||
|
||||
define KernelPackage/crypto-lib-aescfb
|
||||
TITLE:=AES cipher operations feedback mode library
|
||||
DEPENDS:=@!LINUX_6_6
|
||||
KCONFIG:=CONFIG_CRYPTO_LIB_AESCFB
|
||||
FILES:=$(LINUX_DIR)/lib/crypto/libaescfb.ko
|
||||
AUTOLOAD:=$(call AutoLoad,09,libaescfb)
|
||||
$(call AddDepends/crypto)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,crypto-lib-aescfb))
|
||||
|
||||
define KernelPackage/crypto-lib-chacha20
|
||||
TITLE:=ChaCha library interface
|
||||
KCONFIG:=CONFIG_CRYPTO_LIB_CHACHA
|
||||
|
||||
@ -264,7 +264,8 @@ define KernelPackage/fs-fscache
|
||||
TITLE:=General filesystem local cache manager
|
||||
DEPENDS:=+kmod-fs-netfs
|
||||
KCONFIG:=\
|
||||
CONFIG_FSCACHE \
|
||||
CONFIG_FSCACHE@lt6.12 \
|
||||
CONFIG_FSCACHE=y@ge6.12 \
|
||||
CONFIG_FSCACHE_STATS=y \
|
||||
CONFIG_FSCACHE_HISTOGRAM=n \
|
||||
CONFIG_FSCACHE_DEBUG=n \
|
||||
@ -275,7 +276,7 @@ define KernelPackage/fs-fscache
|
||||
CONFIG_CACHEFILES_ERROR_INJECTION=n \
|
||||
CONFIG_CACHEFILES_ONDEMAND=n
|
||||
FILES:= \
|
||||
$(LINUX_DIR)/fs/fscache/fscache.ko \
|
||||
$(LINUX_DIR)/fs/fscache/fscache.ko@lt6.12 \
|
||||
$(LINUX_DIR)/fs/cachefiles/cachefiles.ko
|
||||
AUTOLOAD:=$(call AutoLoad,29,fscache cachefiles)
|
||||
endef
|
||||
@ -564,6 +565,7 @@ $(eval $(call KernelPackage,fs-nfsd))
|
||||
define KernelPackage/fs-ntfs
|
||||
SUBMENU:=$(FS_MENU)
|
||||
TITLE:=NTFS filesystem read-only (old driver) support
|
||||
DEPENDS:=@LINUX_6_6
|
||||
KCONFIG:=CONFIG_NTFS_FS
|
||||
FILES:=$(LINUX_DIR)/fs/ntfs/ntfs.ko
|
||||
AUTOLOAD:=$(call AutoLoad,30,ntfs)
|
||||
|
||||
@ -9,6 +9,7 @@ HWMON_MENU:=Hardware Monitoring Support
|
||||
|
||||
define KernelPackage/hwmon-core
|
||||
SUBMENU:=$(HWMON_MENU)
|
||||
DEPENDS:=+!LINUX_6_6:kmod-i2c-core
|
||||
TITLE:=Hardware monitoring support
|
||||
KCONFIG:= \
|
||||
CONFIG_HWMON \
|
||||
@ -361,7 +362,7 @@ define KernelPackage/hwmon-lm92
|
||||
KCONFIG:=CONFIG_SENSORS_LM92
|
||||
FILES:=$(LINUX_DIR)/drivers/hwmon/lm92.ko
|
||||
AUTOLOAD:=$(call AutoProbe,lm92)
|
||||
$(call AddDepends/hwmon,+kmod-i2c-core)
|
||||
$(call AddDepends/hwmon,+kmod-i2c-core +!LINUX_6_6:kmod-regmap-core)
|
||||
endef
|
||||
|
||||
define KernelPackage/hwmon-lm92/description
|
||||
@ -421,7 +422,7 @@ define KernelPackage/hwmon-max6697
|
||||
KCONFIG:=CONFIG_SENSORS_MAX6697
|
||||
FILES:=$(LINUX_DIR)/drivers/hwmon/max6697.ko
|
||||
AUTOLOAD:=$(call AutoProbe,max6697)
|
||||
$(call AddDepends/hwmon,+kmod-i2c-core)
|
||||
$(call AddDepends/hwmon,+kmod-i2c-core +!LINUX_6_6:kmod-regmap-i2c)
|
||||
endef
|
||||
|
||||
define KernelPackage/hwmon-max6697/description
|
||||
@ -547,7 +548,7 @@ define KernelPackage/hwmon-sch5627
|
||||
$(LINUX_DIR)/drivers/hwmon/sch5627.ko \
|
||||
$(LINUX_DIR)/drivers/hwmon/sch56xx-common.ko
|
||||
AUTOLOAD:=$(call AutoProbe,sch5627)
|
||||
$(call AddDepends/hwmon,+kmod-i2c-core)
|
||||
$(call AddDepends/hwmon,+kmod-i2c-core +!LINUX_6_6:kmod-regmap-core)
|
||||
endef
|
||||
|
||||
define KernelPackage/hwmon-sch5627/description
|
||||
|
||||
@ -150,7 +150,9 @@ I2C_I801_MODULES:= \
|
||||
define KernelPackage/i2c-i801
|
||||
$(call i2c_defaults,$(I2C_I801_MODULES),59)
|
||||
TITLE:=Intel I801 and compatible I2C interfaces
|
||||
DEPENDS:=@PCI_SUPPORT @TARGET_x86 +kmod-i2c-core +kmod-i2c-smbus
|
||||
DEPENDS:= \
|
||||
@PCI_SUPPORT @TARGET_x86 +kmod-i2c-core +kmod-i2c-smbus \
|
||||
(!LINUX_6_6&&PACKAGE_kmod-i2c-mux-gpio):kmod-i2c-mux-gpio
|
||||
endef
|
||||
|
||||
define KernelPackage/i2c-i801/description
|
||||
@ -289,7 +291,7 @@ I2C_PIIX4_MODULES:= \
|
||||
define KernelPackage/i2c-piix4
|
||||
$(call i2c_defaults,$(I2C_PIIX4_MODULES),59)
|
||||
TITLE:=Intel PIIX4 and compatible I2C interfaces
|
||||
DEPENDS:=@PCI_SUPPORT @TARGET_x86 +kmod-i2c-core
|
||||
DEPENDS:=@PCI_SUPPORT @TARGET_x86 +kmod-i2c-core +!LINUX_6_6:kmod-i2c-smbus
|
||||
endef
|
||||
|
||||
define KernelPackage/i2c-piix4/description
|
||||
|
||||
@ -252,7 +252,7 @@ $(eval $(call KernelPackage,iio-bme680-spi))
|
||||
|
||||
define KernelPackage/iio-bmp280
|
||||
TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor
|
||||
DEPENDS:=+kmod-regmap-core
|
||||
DEPENDS:=+kmod-regmap-core +!LINUX_6_6:kmod-industrialio-triggered-buffer
|
||||
KCONFIG:=CONFIG_BMP280
|
||||
FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280.ko
|
||||
$(call AddDepends/iio)
|
||||
|
||||
@ -120,6 +120,38 @@ endef
|
||||
$(eval $(call KernelPackage,atl1e))
|
||||
|
||||
|
||||
define KernelPackage/libie
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Intel Ethernet library
|
||||
DEPENDS:=@!LINUX_6_6 +kmod-libeth
|
||||
KCONFIG:=CONFIG_LIBIE
|
||||
HIDDEN:=1
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/libie/libie.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/libie/description
|
||||
Intel Ethernet library
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,libie))
|
||||
|
||||
|
||||
define KernelPackage/libeth
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Common Intel Ethernet library
|
||||
DEPENDS:=@!LINUX_6_6
|
||||
KCONFIG:=CONFIG_LIBETH
|
||||
HIDDEN:=1
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/libeth/libeth.ko
|
||||
endef
|
||||
|
||||
define KernelPackage/libeth/description
|
||||
Common Intel Ethernet library
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,libeth))
|
||||
|
||||
|
||||
define KernelPackage/libphy
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=PHY library
|
||||
@ -513,7 +545,7 @@ $(eval $(call KernelPackage,phy-airoha-en8811h))
|
||||
define KernelPackage/phy-aquantia
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Aquantia Ethernet PHYs
|
||||
DEPENDS:=+kmod-libphy +kmod-hwmon-core +kmod-lib-crc-ccitt
|
||||
DEPENDS:=+kmod-libphy +kmod-hwmon-core +LINUX_6_6:kmod-lib-crc-ccitt +!LINUX_6_6:kmod-lib-crc-itu-t
|
||||
KCONFIG:=CONFIG_AQUANTIA_PHY
|
||||
FILES:=$(LINUX_DIR)/drivers/net/phy/aquantia/aquantia.ko
|
||||
AUTOLOAD:=$(call AutoLoad,18,aquantia,1)
|
||||
@ -1181,7 +1213,7 @@ $(eval $(call KernelPackage,ixgbevf))
|
||||
define KernelPackage/i40e
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Intel(R) Ethernet Controller XL710 Family support
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-ptp
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-ptp +!LINUX_6_6:kmod-libie
|
||||
KCONFIG:=CONFIG_I40E \
|
||||
CONFIG_I40E_DCB=y
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/i40e/i40e.ko
|
||||
@ -1198,8 +1230,9 @@ $(eval $(call KernelPackage,i40e))
|
||||
define KernelPackage/ice
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Intel(R) Ethernet Controller E810 Series support
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-ptp
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-ptp +!LINUX_6_6:kmod-hwmon-core +!LINUX_6_6:kmod-libie
|
||||
KCONFIG:=CONFIG_ICE \
|
||||
CONFIG_ICE_HWMON=y \
|
||||
CONFIG_ICE_HWTS=y \
|
||||
CONFIG_ICE_SWITCHDEV=y
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/ice/ice.ko
|
||||
@ -1216,7 +1249,7 @@ $(eval $(call KernelPackage,ice))
|
||||
define KernelPackage/iavf
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Intel(R) Ethernet Adaptive Virtual Function support
|
||||
DEPENDS:=@PCI_SUPPORT
|
||||
DEPENDS:=@PCI_SUPPORT +!LINUX_6_6:kmod-libie
|
||||
KCONFIG:= \
|
||||
CONFIG_I40EVF \
|
||||
CONFIG_IAVF
|
||||
@ -1689,6 +1722,7 @@ define KernelPackage/mlx5-core
|
||||
CONFIG_MLX5_FPGA_TLS=n \
|
||||
CONFIG_MLX5_MPFS=y \
|
||||
CONFIG_MLX5_SW_STEERING=n \
|
||||
CONFIG_MLX5_HW_STEERING=n \
|
||||
CONFIG_MLX5_CLS_ACT=n \
|
||||
CONFIG_MLX5_TC_CT=n \
|
||||
CONFIG_MLX5_TLS=n \
|
||||
@ -1892,7 +1926,7 @@ $(eval $(call KernelPackage,sfp))
|
||||
define KernelPackage/pcs-xpcs
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Synopsis DesignWare PCS driver
|
||||
DEPENDS:=@(TARGET_x86_64||TARGET_armsr) +kmod-phylink
|
||||
DEPENDS:=@(TARGET_x86_64||TARGET_armsr) +kmod-phylink +!LINUX_6_6:kmod-mdio-devres
|
||||
KCONFIG:=CONFIG_PCS_XPCS
|
||||
FILES:=$(LINUX_DIR)/drivers/net/pcs/pcs_xpcs.ko
|
||||
AUTOLOAD:=$(call AutoLoad,20,pcs_xpcs)
|
||||
@ -2091,7 +2125,7 @@ $(eval $(call KernelPackage,atlantic))
|
||||
define KernelPackage/lan743x
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Microchip LAN743x PCI Express Gigabit Ethernet NIC
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-mdio-devres +kmod-fixed-phy
|
||||
DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-mdio-devres +kmod-fixed-phy +!LINUX_6_6:kmod-phylink
|
||||
KCONFIG:=CONFIG_LAN743X
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/microchip/lan743x.ko
|
||||
AUTOLOAD:=$(call AutoProbe,lan743x)
|
||||
|
||||
@ -1376,6 +1376,7 @@ $(eval $(call KernelPackage,mpls))
|
||||
define KernelPackage/9pnet
|
||||
SUBMENU:=$(NETWORK_SUPPORT_MENU)
|
||||
TITLE:=Plan 9 Resource Sharing Support (9P2000)
|
||||
DEPENDS:=+!LINUX_6_6:kmod-fs-netfs
|
||||
KCONFIG:= \
|
||||
CONFIG_NET_9P \
|
||||
CONFIG_NET_9P_DEBUG=n \
|
||||
|
||||
@ -687,6 +687,11 @@ $(eval $(call KernelPackage,ikconfig))
|
||||
|
||||
define KernelPackage/zram
|
||||
SUBMENU:=$(OTHER_MENU)
|
||||
DEPENDS:= \
|
||||
+(KERNEL_ZRAM_BACKEND_LZO||KERNEL_ZRAM_DEF_COMP_LZORLE||KERNEL_ZRAM_DEF_COMP_LZO):kmod-lib-lzo \
|
||||
+(KERNEL_ZRAM_BACKEND_LZ4||KERNEL_ZRAM_DEF_COMP_LZ4):kmod-lib-lz4 \
|
||||
+(KERNEL_ZRAM_BACKEND_LZ4HC||KERNEL_ZRAM_DEF_COMP_LZ4HC):kmod-lib-lz4hc \
|
||||
+(KERNEL_ZRAM_BACKEND_ZSTD||KERNEL_ZRAM_DEF_COMP_ZSTD):kmod-lib-zstd
|
||||
TITLE:=ZRAM
|
||||
KCONFIG:= \
|
||||
CONFIG_ZSMALLOC \
|
||||
@ -706,29 +711,46 @@ endef
|
||||
|
||||
define KernelPackage/zram/config
|
||||
if PACKAGE_kmod-zram
|
||||
if !LINUX_6_6
|
||||
config KERNEL_ZRAM_BACKEND_LZO
|
||||
bool "lzo and lzo-rle compression support" if KERNEL_ZRAM_BACKEND_LZ4 || \
|
||||
KERNEL_ZRAM_BACKEND_LZ4HC || KERNEL_ZRAM_BACKEND_ZSTD
|
||||
default !KERNEL_ZRAM_BACKEND_LZ4 && \
|
||||
!KERNEL_ZRAM_BACKEND_LZ4HC && !KERNEL_ZRAM_BACKEND_ZSTD
|
||||
|
||||
config KERNEL_ZRAM_BACKEND_LZ4
|
||||
bool "lz4 compression support"
|
||||
|
||||
config KERNEL_ZRAM_BACKEND_LZ4HC
|
||||
bool "lz4hc compression support"
|
||||
|
||||
config KERNEL_ZRAM_BACKEND_ZSTD
|
||||
bool "zstd compression support"
|
||||
|
||||
endif
|
||||
choice
|
||||
prompt "ZRAM Default compressor"
|
||||
default ZRAM_DEF_COMP_LZORLE
|
||||
default KERNEL_ZRAM_DEF_COMP_LZORLE
|
||||
|
||||
config ZRAM_DEF_COMP_LZORLE
|
||||
config KERNEL_ZRAM_DEF_COMP_LZORLE
|
||||
bool "lzo-rle"
|
||||
select PACKAGE_kmod-lib-lzo
|
||||
depends on KERNEL_ZRAM_BACKEND_LZO || LINUX_6_6
|
||||
|
||||
config ZRAM_DEF_COMP_LZO
|
||||
config KERNEL_ZRAM_DEF_COMP_LZO
|
||||
bool "lzo"
|
||||
select PACKAGE_kmod-lib-lzo
|
||||
depends on KERNEL_ZRAM_BACKEND_LZO || LINUX_6_6
|
||||
|
||||
config ZRAM_DEF_COMP_LZ4
|
||||
config KERNEL_ZRAM_DEF_COMP_LZ4
|
||||
bool "lz4"
|
||||
select PACKAGE_kmod-lib-lz4
|
||||
depends on KERNEL_ZRAM_BACKEND_LZ4 || LINUX_6_6
|
||||
|
||||
config ZRAM_DEF_COMP_LZ4HC
|
||||
config KERNEL_ZRAM_DEF_COMP_LZ4HC
|
||||
bool "lz4-hc"
|
||||
select PACKAGE_kmod-lib-lz4hc
|
||||
depends on KERNEL_ZRAM_BACKEND_LZ4HC || LINUX_6_6
|
||||
|
||||
config ZRAM_DEF_COMP_ZSTD
|
||||
config KERNEL_ZRAM_DEF_COMP_ZSTD
|
||||
bool "zstd"
|
||||
select PACKAGE_kmod-lib-zstd
|
||||
depends on KERNEL_ZRAM_BACKEND_ZSTD || LINUX_6_6
|
||||
|
||||
endchoice
|
||||
endif
|
||||
@ -928,7 +950,10 @@ define KernelPackage/tpm
|
||||
SUBMENU:=$(OTHER_MENU)
|
||||
TITLE:=TPM Hardware Support
|
||||
DEPENDS:= +kmod-random-core +kmod-asn1-decoder \
|
||||
+kmod-asn1-encoder +kmod-oid-registry
|
||||
+kmod-asn1-encoder +kmod-oid-registry \
|
||||
+!LINUX_6_6:kmod-crypto-ecdh \
|
||||
+!LINUX_6_6:kmod-crypto-kpp \
|
||||
+!LINUX_6_6:kmod-crypto-lib-aescfb
|
||||
KCONFIG:= CONFIG_TCG_TPM
|
||||
FILES:= $(LINUX_DIR)/drivers/char/tpm/tpm.ko
|
||||
AUTOLOAD:=$(call AutoLoad,10,tpm,1)
|
||||
|
||||
@ -383,6 +383,20 @@ endef
|
||||
|
||||
$(eval $(call KernelPackage,sound-hda-core))
|
||||
|
||||
define KernelPackage/snd-hda-scodec-component
|
||||
SUBMENU:=$(SOUND_MENU)
|
||||
TITLE:= HD Audio Codec Component
|
||||
DEPENDS:=@!LINUX_6_6
|
||||
KCONFIG:= \
|
||||
CONFIG_SND_HDA_SCODEC_COMPONENT
|
||||
FILES:= \
|
||||
$(LINUX_DIR)/sound/pci/hda/snd-hda-scodec-component.ko
|
||||
AUTOLOAD:=$(call AutoProbe,snd-hda-scodec-component)
|
||||
$(call AddDepends/sound,kmod-sound-hda-core)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,snd-hda-scodec-component))
|
||||
|
||||
define KernelPackage/sound-hda-codec-realtek
|
||||
SUBMENU:=$(SOUND_MENU)
|
||||
TITLE:= HD Audio Realtek Codec
|
||||
@ -391,7 +405,7 @@ define KernelPackage/sound-hda-codec-realtek
|
||||
FILES:= \
|
||||
$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-realtek.ko
|
||||
AUTOLOAD:=$(call AutoProbe,snd-hda-codec-realtek)
|
||||
$(call AddDepends/sound,kmod-sound-hda-core)
|
||||
$(call AddDepends/sound,kmod-sound-hda-core +!LINUX_6_6:kmod-snd-hda-scodec-component)
|
||||
endef
|
||||
|
||||
define KernelPackage/sound-hda-codec-realtek/description
|
||||
|
||||
@ -63,7 +63,7 @@ $(eval $(call KernelPackage,acpi-video))
|
||||
define KernelPackage/backlight
|
||||
SUBMENU:=$(VIDEO_MENU)
|
||||
TITLE:=Backlight support
|
||||
DEPENDS:=@DISPLAY_SUPPORT
|
||||
DEPENDS:=@DISPLAY_SUPPORT +!LINUX_6_6:kmod-fb
|
||||
HIDDEN:=1
|
||||
KCONFIG:=CONFIG_BACKLIGHT_CLASS_DEVICE \
|
||||
CONFIG_BACKLIGHT_LCD_SUPPORT=y \
|
||||
@ -138,8 +138,9 @@ define KernelPackage/fb/description
|
||||
endef
|
||||
|
||||
define KernelPackage/fb/x86
|
||||
FILES+=$(LINUX_DIR)/arch/x86/video/fbdev.ko
|
||||
AUTOLOAD:=$(call AutoLoad,06,fbdev fb font)
|
||||
FILES+=$(LINUX_DIR)/arch/x86/video/fbdev.ko@lt6.12 \
|
||||
$(LINUX_DIR)/arch/x86/video/video-common.ko@ge6.12
|
||||
AUTOLOAD:=$(call AutoLoad,06,fbdev@lt6.12 video-common@ge6.12 fb font)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fb))
|
||||
@ -196,7 +197,9 @@ define KernelPackage/fb-sys-fops
|
||||
SUBMENU:=$(VIDEO_MENU)
|
||||
TITLE:=Framebuffer software sys ops support
|
||||
DEPENDS:=+kmod-fb
|
||||
KCONFIG:=CONFIG_FB_SYS_FOPS
|
||||
KCONFIG:= \
|
||||
CONFIG_FB_SYS_FOPS@lt6.12 \
|
||||
CONFIG_FB_SYSMEM_FOPS@ge6.12
|
||||
FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/fb_sys_fops.ko
|
||||
AUTOLOAD:=$(call AutoLoad,07,fb_sys_fops)
|
||||
endef
|
||||
@ -420,7 +423,7 @@ define KernelPackage/drm-ttm-helper
|
||||
SUBMENU:=$(VIDEO_MENU)
|
||||
TITLE:=Helpers for ttm-based gem objects
|
||||
HIDDEN:=1
|
||||
DEPENDS:=@DISPLAY_SUPPORT +kmod-drm-ttm
|
||||
DEPENDS:=@DISPLAY_SUPPORT +kmod-drm-ttm +!LINUX_6_6:kmod-drm-kms-helper
|
||||
KCONFIG:=CONFIG_DRM_TTM_HELPER
|
||||
FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_ttm_helper.ko
|
||||
AUTOLOAD:=$(call AutoProbe,drm_ttm_helper)
|
||||
|
||||
@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=libnftnl
|
||||
PKG_CPE_ID:=cpe:/a:netfilter:libnftnl
|
||||
PKG_VERSION:=1.2.8
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
|
||||
|
||||
@ -66,9 +66,9 @@ Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
|
||||
expr/socket.c \
|
||||
--- /dev/null
|
||||
+++ b/src/expr/fullcone.c
|
||||
@@ -0,0 +1,172 @@
|
||||
@@ -0,0 +1,174 @@
|
||||
+/*
|
||||
+ * (C) 2022 wongsyrone
|
||||
+ * (C) 2022-2025 wongsyrone
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published
|
||||
@ -111,6 +111,8 @@ Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
|
||||
+ case NFTNL_EXPR_FULLCONE_REG_PROTO_MAX:
|
||||
+ memcpy(&fullcone->sreg_proto_max, data, data_len);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
@ -15,6 +15,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/ead
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
@ -36,7 +37,8 @@ CONFIGURE_PATH = tinysrp
|
||||
TARGET_CFLAGS += \
|
||||
-I$(PKG_BUILD_DIR) \
|
||||
-I$(PKG_BUILD_DIR)/tinysrp \
|
||||
$(TARGET_CPPFLAGS)
|
||||
$(TARGET_CPPFLAGS) \
|
||||
-Wno-error=implicit-function-declaration
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CONFIGURE_ARGS="$(CONFIGURE_ARGS)" \
|
||||
|
||||
@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=fullconenat-nft
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/fullcone-nat-nftables/nft-fullcone.git
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
--- a/src/nft_ext_fullcone.c
|
||||
+++ b/src/nft_ext_fullcone.c
|
||||
@@ -121,7 +121,11 @@ static int exp_event_cb(unsigned int eve
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
|
||||
+static int nft_fullcone_validate(const struct nft_ctx *ctx, const struct nft_expr *expr)
|
||||
+#else
|
||||
static int nft_fullcone_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, const struct nft_data **data)
|
||||
+#endif
|
||||
{
|
||||
int err;
|
||||
|
||||
@ -48,7 +48,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
obj-$(CONFIG_PWM_ATMEL_HLCDC_PWM) += pwm-atmel-hlcdc.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/pwm/pwm-airoha.c
|
||||
@@ -0,0 +1,400 @@
|
||||
@@ -0,0 +1,388 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright 2022 Markus Gothe <markus.gothe@genexis.eu>
|
||||
@ -414,18 +414,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
+ if (IS_ERR(pc->regmap))
|
||||
+ return PTR_ERR(pc->regmap);
|
||||
+
|
||||
+ platform_set_drvdata(pdev, pc);
|
||||
+
|
||||
+ return pwmchip_add(&pc->chip);
|
||||
+}
|
||||
+
|
||||
+static int airoha_pwm_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct airoha_pwm *pc = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ pwmchip_remove(&pc->chip);
|
||||
+
|
||||
+ return 0;
|
||||
+ return devm_pwmchip_add(&pdev->dev, &pc->chip);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id airoha_pwm_of_match[] = {
|
||||
@ -440,7 +429,6 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
+ .of_match_table = airoha_pwm_of_match,
|
||||
+ },
|
||||
+ .probe = airoha_pwm_probe,
|
||||
+ .remove = airoha_pwm_remove,
|
||||
+};
|
||||
+module_platform_driver(airoha_pwm_driver);
|
||||
+
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
From 03cb793b26834ddca170ba87057c8f883772dd45 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Thu, 3 Oct 2024 00:11:41 +0200
|
||||
Subject: [PATCH 1/5] block: add support for defining read-only partitions
|
||||
|
||||
Add support for defining read-only partitions and complete support for
|
||||
it in the cmdline partition parser as the additional "ro" after a
|
||||
partition is scanned but never actually applied.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Link: https://lore.kernel.org/r/20241002221306.4403-2-ansuelsmth@gmail.com
|
||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
||||
---
|
||||
block/blk.h | 1 +
|
||||
block/partitions/cmdline.c | 3 +++
|
||||
block/partitions/core.c | 3 +++
|
||||
3 files changed, 7 insertions(+)
|
||||
|
||||
--- a/block/blk.h
|
||||
+++ b/block/blk.h
|
||||
@@ -555,6 +555,7 @@ void blk_free_ext_minor(unsigned int min
|
||||
#define ADDPART_FLAG_NONE 0
|
||||
#define ADDPART_FLAG_RAID 1
|
||||
#define ADDPART_FLAG_WHOLEDISK 2
|
||||
+#define ADDPART_FLAG_READONLY 4
|
||||
int bdev_add_partition(struct gendisk *disk, int partno, sector_t start,
|
||||
sector_t length);
|
||||
int bdev_del_partition(struct gendisk *disk, int partno);
|
||||
--- a/block/partitions/cmdline.c
|
||||
+++ b/block/partitions/cmdline.c
|
||||
@@ -237,6 +237,9 @@ static int add_part(int slot, struct cmd
|
||||
put_partition(state, slot, subpart->from >> 9,
|
||||
subpart->size >> 9);
|
||||
|
||||
+ if (subpart->flags & PF_RDONLY)
|
||||
+ state->parts[slot].flags |= ADDPART_FLAG_READONLY;
|
||||
+
|
||||
info = &state->parts[slot].info;
|
||||
|
||||
strscpy(info->volname, subpart->name, sizeof(info->volname));
|
||||
--- a/block/partitions/core.c
|
||||
+++ b/block/partitions/core.c
|
||||
@@ -373,6 +373,9 @@ static struct block_device *add_partitio
|
||||
goto out_del;
|
||||
}
|
||||
|
||||
+ if (flags & ADDPART_FLAG_READONLY)
|
||||
+ bdev_set_flag(bdev, BD_READ_ONLY);
|
||||
+
|
||||
/* everything is up and running, commence */
|
||||
err = xa_insert(&disk->part_tbl, partno, bdev, GFP_KERNEL);
|
||||
if (err)
|
||||
@ -0,0 +1,94 @@
|
||||
From e5f587242b6072ffab4f4a084a459a59f3035873 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Thu, 3 Oct 2024 00:11:43 +0200
|
||||
Subject: [PATCH 3/5] block: introduce add_disk_fwnode()
|
||||
|
||||
Introduce add_disk_fwnode() as a replacement of device_add_disk() that
|
||||
permits to pass and attach a fwnode to disk dev.
|
||||
|
||||
This variant can be useful for eMMC that might have the partition table
|
||||
for the disk defined in DT. A parser can later make use of the attached
|
||||
fwnode to parse the related table and init the hardcoded partition for
|
||||
the disk.
|
||||
|
||||
device_add_disk() is converted to a simple wrapper of add_disk_fwnode()
|
||||
with the fwnode entry set as NULL.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Link: https://lore.kernel.org/r/20241002221306.4403-4-ansuelsmth@gmail.com
|
||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
||||
---
|
||||
block/genhd.c | 28 ++++++++++++++++++++++++----
|
||||
include/linux/blkdev.h | 3 +++
|
||||
2 files changed, 27 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/block/genhd.c
|
||||
+++ b/block/genhd.c
|
||||
@@ -383,16 +383,18 @@ int disk_scan_partitions(struct gendisk
|
||||
}
|
||||
|
||||
/**
|
||||
- * device_add_disk - add disk information to kernel list
|
||||
+ * add_disk_fwnode - add disk information to kernel list with fwnode
|
||||
* @parent: parent device for the disk
|
||||
* @disk: per-device partitioning information
|
||||
* @groups: Additional per-device sysfs groups
|
||||
+ * @fwnode: attached disk fwnode
|
||||
*
|
||||
* This function registers the partitioning information in @disk
|
||||
- * with the kernel.
|
||||
+ * with the kernel. Also attach a fwnode to the disk device.
|
||||
*/
|
||||
-int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
|
||||
- const struct attribute_group **groups)
|
||||
+int __must_check add_disk_fwnode(struct device *parent, struct gendisk *disk,
|
||||
+ const struct attribute_group **groups,
|
||||
+ struct fwnode_handle *fwnode)
|
||||
|
||||
{
|
||||
struct device *ddev = disk_to_dev(disk);
|
||||
@@ -452,6 +454,8 @@ int __must_check device_add_disk(struct
|
||||
ddev->parent = parent;
|
||||
ddev->groups = groups;
|
||||
dev_set_name(ddev, "%s", disk->disk_name);
|
||||
+ if (fwnode)
|
||||
+ device_set_node(ddev, fwnode);
|
||||
if (!(disk->flags & GENHD_FL_HIDDEN))
|
||||
ddev->devt = MKDEV(disk->major, disk->first_minor);
|
||||
ret = device_add(ddev);
|
||||
@@ -553,6 +557,22 @@ out_exit_elevator:
|
||||
elevator_exit(disk->queue);
|
||||
return ret;
|
||||
}
|
||||
+EXPORT_SYMBOL_GPL(add_disk_fwnode);
|
||||
+
|
||||
+/**
|
||||
+ * device_add_disk - add disk information to kernel list
|
||||
+ * @parent: parent device for the disk
|
||||
+ * @disk: per-device partitioning information
|
||||
+ * @groups: Additional per-device sysfs groups
|
||||
+ *
|
||||
+ * This function registers the partitioning information in @disk
|
||||
+ * with the kernel.
|
||||
+ */
|
||||
+int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
|
||||
+ const struct attribute_group **groups)
|
||||
+{
|
||||
+ return add_disk_fwnode(parent, disk, groups, NULL);
|
||||
+}
|
||||
EXPORT_SYMBOL(device_add_disk);
|
||||
|
||||
static void blk_report_disk_dead(struct gendisk *disk, bool surprise)
|
||||
--- a/include/linux/blkdev.h
|
||||
+++ b/include/linux/blkdev.h
|
||||
@@ -734,6 +734,9 @@ static inline unsigned int blk_queue_dep
|
||||
#define for_each_bio(_bio) \
|
||||
for (; _bio; _bio = _bio->bi_next)
|
||||
|
||||
+int __must_check add_disk_fwnode(struct device *parent, struct gendisk *disk,
|
||||
+ const struct attribute_group **groups,
|
||||
+ struct fwnode_handle *fwnode);
|
||||
int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
|
||||
const struct attribute_group **groups);
|
||||
static inline int __must_check add_disk(struct gendisk *disk)
|
||||
@ -0,0 +1,104 @@
|
||||
From 45ff6c340ddfc2dade74d5b7a8962c778ab7042c Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Thu, 3 Oct 2024 00:11:44 +0200
|
||||
Subject: [PATCH 4/5] mmc: block: attach partitions fwnode if found in mmc-card
|
||||
|
||||
Attach partitions fwnode if found in mmc-card and register disk with it.
|
||||
|
||||
This permits block partition to reference the node and register a
|
||||
partition table defined in DT for the special case for embedded device
|
||||
that doesn't have a partition table flashed but have an hardcoded
|
||||
partition table passed from the system.
|
||||
|
||||
JEDEC BOOT partition boot0/boot1 are supported but in DT we refer with
|
||||
the JEDEC name of boot1 and boot2 to better adhere to documentation.
|
||||
|
||||
Also JEDEC GP partition gp0/1/2/3 are supported but in DT we refer with
|
||||
the JEDEC name of gp1/2/3/4 to better adhere to documentration.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20241002221306.4403-5-ansuelsmth@gmail.com
|
||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
||||
---
|
||||
drivers/mmc/core/block.c | 55 +++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 54 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/mmc/core/block.c
|
||||
+++ b/drivers/mmc/core/block.c
|
||||
@@ -2517,6 +2517,56 @@ static inline int mmc_blk_readonly(struc
|
||||
!(card->csd.cmdclass & CCC_BLOCK_WRITE);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Search for a declared partitions node for the disk in mmc-card related node.
|
||||
+ *
|
||||
+ * This is to permit support for partition table defined in DT in special case
|
||||
+ * where a partition table is not written in the disk and is expected to be
|
||||
+ * passed from the running system.
|
||||
+ *
|
||||
+ * For the user disk, "partitions" node is searched.
|
||||
+ * For the special HW disk, "partitions-" node with the appended name is used
|
||||
+ * following this conversion table (to adhere to JEDEC naming)
|
||||
+ * - boot0 -> partitions-boot1
|
||||
+ * - boot1 -> partitions-boot2
|
||||
+ * - gp0 -> partitions-gp1
|
||||
+ * - gp1 -> partitions-gp2
|
||||
+ * - gp2 -> partitions-gp3
|
||||
+ * - gp3 -> partitions-gp4
|
||||
+ */
|
||||
+static struct fwnode_handle *mmc_blk_get_partitions_node(struct device *mmc_dev,
|
||||
+ const char *subname)
|
||||
+{
|
||||
+ const char *node_name = "partitions";
|
||||
+
|
||||
+ if (subname) {
|
||||
+ mmc_dev = mmc_dev->parent;
|
||||
+
|
||||
+ /*
|
||||
+ * Check if we are allocating a BOOT disk boot0/1 disk.
|
||||
+ * In DT we use the JEDEC naming boot1/2.
|
||||
+ */
|
||||
+ if (!strcmp(subname, "boot0"))
|
||||
+ node_name = "partitions-boot1";
|
||||
+ if (!strcmp(subname, "boot1"))
|
||||
+ node_name = "partitions-boot2";
|
||||
+ /*
|
||||
+ * Check if we are allocating a GP disk gp0/1/2/3 disk.
|
||||
+ * In DT we use the JEDEC naming gp1/2/3/4.
|
||||
+ */
|
||||
+ if (!strcmp(subname, "gp0"))
|
||||
+ node_name = "partitions-gp1";
|
||||
+ if (!strcmp(subname, "gp1"))
|
||||
+ node_name = "partitions-gp2";
|
||||
+ if (!strcmp(subname, "gp2"))
|
||||
+ node_name = "partitions-gp3";
|
||||
+ if (!strcmp(subname, "gp3"))
|
||||
+ node_name = "partitions-gp4";
|
||||
+ }
|
||||
+
|
||||
+ return device_get_named_child_node(mmc_dev, node_name);
|
||||
+}
|
||||
+
|
||||
static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
|
||||
struct device *parent,
|
||||
sector_t size,
|
||||
@@ -2525,6 +2575,7 @@ static struct mmc_blk_data *mmc_blk_allo
|
||||
int area_type,
|
||||
unsigned int part_type)
|
||||
{
|
||||
+ struct fwnode_handle *disk_fwnode;
|
||||
struct mmc_blk_data *md;
|
||||
int devidx, ret;
|
||||
char cap_str[10];
|
||||
@@ -2626,7 +2677,9 @@ static struct mmc_blk_data *mmc_blk_allo
|
||||
/* used in ->open, must be set before add_disk: */
|
||||
if (area_type == MMC_BLK_DATA_AREA_MAIN)
|
||||
dev_set_drvdata(&card->dev, md);
|
||||
- ret = device_add_disk(md->parent, md->disk, mmc_disk_attr_groups);
|
||||
+ disk_fwnode = mmc_blk_get_partitions_node(parent, subname);
|
||||
+ ret = add_disk_fwnode(md->parent, md->disk, mmc_disk_attr_groups,
|
||||
+ disk_fwnode);
|
||||
if (ret)
|
||||
goto err_put_disk;
|
||||
return md;
|
||||
@ -0,0 +1,200 @@
|
||||
From 884555b557e5e6d41c866e2cd8d7b32f50ec974b Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Thu, 3 Oct 2024 00:11:45 +0200
|
||||
Subject: [PATCH 5/5] block: add support for partition table defined in OF
|
||||
|
||||
Add support for partition table defined in Device Tree. Similar to how
|
||||
it's done with MTD, add support for defining a fixed partition table in
|
||||
device tree.
|
||||
|
||||
A common scenario for this is fixed block (eMMC) embedded devices that
|
||||
have no MBR or GPT partition table to save storage space. Bootloader
|
||||
access the block device with absolute address of data.
|
||||
|
||||
This is to complete the functionality with an equivalent implementation
|
||||
with providing partition table with bootargs, for case where the booargs
|
||||
can't be modified and tweaking the Device Tree is the only solution to
|
||||
have an usabe partition table.
|
||||
|
||||
The implementation follow the fixed-partitions parser used on MTD
|
||||
devices where a "partitions" node is expected to be declared with
|
||||
"fixed-partitions" compatible in the OF node of the disk device
|
||||
(mmc-card for eMMC for example) and each child node declare a label
|
||||
and a reg with offset and size. If label is not declared, the node name
|
||||
is used as fallback. Eventually is also possible to declare the read-only
|
||||
property to flag the partition as read-only.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
||||
Link: https://lore.kernel.org/r/20241002221306.4403-6-ansuelsmth@gmail.com
|
||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
||||
---
|
||||
block/partitions/Kconfig | 9 ++++
|
||||
block/partitions/Makefile | 1 +
|
||||
block/partitions/check.h | 1 +
|
||||
block/partitions/core.c | 3 ++
|
||||
block/partitions/of.c | 110 ++++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 124 insertions(+)
|
||||
create mode 100644 block/partitions/of.c
|
||||
|
||||
--- a/block/partitions/Kconfig
|
||||
+++ b/block/partitions/Kconfig
|
||||
@@ -270,4 +270,13 @@ config CMDLINE_PARTITION
|
||||
Say Y here if you want to read the partition table from bootargs.
|
||||
The format for the command line is just like mtdparts.
|
||||
|
||||
+config OF_PARTITION
|
||||
+ bool "Device Tree partition support" if PARTITION_ADVANCED
|
||||
+ depends on OF
|
||||
+ help
|
||||
+ Say Y here if you want to enable support for partition table
|
||||
+ defined in Device Tree. (mainly for eMMC)
|
||||
+ The format for the device tree node is just like MTD fixed-partition
|
||||
+ schema.
|
||||
+
|
||||
endmenu
|
||||
--- a/block/partitions/Makefile
|
||||
+++ b/block/partitions/Makefile
|
||||
@@ -12,6 +12,7 @@ obj-$(CONFIG_CMDLINE_PARTITION) += cmdli
|
||||
obj-$(CONFIG_MAC_PARTITION) += mac.o
|
||||
obj-$(CONFIG_LDM_PARTITION) += ldm.o
|
||||
obj-$(CONFIG_MSDOS_PARTITION) += msdos.o
|
||||
+obj-$(CONFIG_OF_PARTITION) += of.o
|
||||
obj-$(CONFIG_OSF_PARTITION) += osf.o
|
||||
obj-$(CONFIG_SGI_PARTITION) += sgi.o
|
||||
obj-$(CONFIG_SUN_PARTITION) += sun.o
|
||||
--- a/block/partitions/check.h
|
||||
+++ b/block/partitions/check.h
|
||||
@@ -62,6 +62,7 @@ int karma_partition(struct parsed_partit
|
||||
int ldm_partition(struct parsed_partitions *state);
|
||||
int mac_partition(struct parsed_partitions *state);
|
||||
int msdos_partition(struct parsed_partitions *state);
|
||||
+int of_partition(struct parsed_partitions *state);
|
||||
int osf_partition(struct parsed_partitions *state);
|
||||
int sgi_partition(struct parsed_partitions *state);
|
||||
int sun_partition(struct parsed_partitions *state);
|
||||
--- a/block/partitions/core.c
|
||||
+++ b/block/partitions/core.c
|
||||
@@ -43,6 +43,9 @@ static int (*const check_part[])(struct
|
||||
#ifdef CONFIG_CMDLINE_PARTITION
|
||||
cmdline_partition,
|
||||
#endif
|
||||
+#ifdef CONFIG_OF_PARTITION
|
||||
+ of_partition, /* cmdline have priority to OF */
|
||||
+#endif
|
||||
#ifdef CONFIG_EFI_PARTITION
|
||||
efi_partition, /* this must come before msdos */
|
||||
#endif
|
||||
--- /dev/null
|
||||
+++ b/block/partitions/of.c
|
||||
@@ -0,0 +1,110 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+
|
||||
+#include <linux/blkdev.h>
|
||||
+#include <linux/major.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/string.h>
|
||||
+#include "check.h"
|
||||
+
|
||||
+static int validate_of_partition(struct device_node *np, int slot)
|
||||
+{
|
||||
+ u64 offset, size;
|
||||
+ int len;
|
||||
+
|
||||
+ const __be32 *reg = of_get_property(np, "reg", &len);
|
||||
+ int a_cells = of_n_addr_cells(np);
|
||||
+ int s_cells = of_n_size_cells(np);
|
||||
+
|
||||
+ /* Make sure reg len match the expected addr and size cells */
|
||||
+ if (len / sizeof(*reg) != a_cells + s_cells)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* Validate offset conversion from bytes to sectors */
|
||||
+ offset = of_read_number(reg, a_cells);
|
||||
+ if (offset % SECTOR_SIZE)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* Validate size conversion from bytes to sectors */
|
||||
+ size = of_read_number(reg + a_cells, s_cells);
|
||||
+ if (!size || size % SECTOR_SIZE)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void add_of_partition(struct parsed_partitions *state, int slot,
|
||||
+ struct device_node *np)
|
||||
+{
|
||||
+ struct partition_meta_info *info;
|
||||
+ char tmp[sizeof(info->volname) + 4];
|
||||
+ const char *partname;
|
||||
+ int len;
|
||||
+
|
||||
+ const __be32 *reg = of_get_property(np, "reg", &len);
|
||||
+ int a_cells = of_n_addr_cells(np);
|
||||
+ int s_cells = of_n_size_cells(np);
|
||||
+
|
||||
+ /* Convert bytes to sector size */
|
||||
+ u64 offset = of_read_number(reg, a_cells) / SECTOR_SIZE;
|
||||
+ u64 size = of_read_number(reg + a_cells, s_cells) / SECTOR_SIZE;
|
||||
+
|
||||
+ put_partition(state, slot, offset, size);
|
||||
+
|
||||
+ if (of_property_read_bool(np, "read-only"))
|
||||
+ state->parts[slot].flags |= ADDPART_FLAG_READONLY;
|
||||
+
|
||||
+ /*
|
||||
+ * Follow MTD label logic, search for label property,
|
||||
+ * fallback to node name if not found.
|
||||
+ */
|
||||
+ info = &state->parts[slot].info;
|
||||
+ partname = of_get_property(np, "label", &len);
|
||||
+ if (!partname)
|
||||
+ partname = of_get_property(np, "name", &len);
|
||||
+ strscpy(info->volname, partname, sizeof(info->volname));
|
||||
+
|
||||
+ snprintf(tmp, sizeof(tmp), "(%s)", info->volname);
|
||||
+ strlcat(state->pp_buf, tmp, PAGE_SIZE);
|
||||
+}
|
||||
+
|
||||
+int of_partition(struct parsed_partitions *state)
|
||||
+{
|
||||
+ struct device *ddev = disk_to_dev(state->disk);
|
||||
+ struct device_node *np;
|
||||
+ int slot;
|
||||
+
|
||||
+ struct device_node *partitions_np = of_node_get(ddev->of_node);
|
||||
+
|
||||
+ if (!partitions_np ||
|
||||
+ !of_device_is_compatible(partitions_np, "fixed-partitions"))
|
||||
+ return 0;
|
||||
+
|
||||
+ slot = 1;
|
||||
+ /* Validate parition offset and size */
|
||||
+ for_each_child_of_node(partitions_np, np) {
|
||||
+ if (validate_of_partition(np, slot)) {
|
||||
+ of_node_put(np);
|
||||
+ of_node_put(partitions_np);
|
||||
+
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ slot++;
|
||||
+ }
|
||||
+
|
||||
+ slot = 1;
|
||||
+ for_each_child_of_node(partitions_np, np) {
|
||||
+ if (slot >= state->limit) {
|
||||
+ of_node_put(np);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ add_of_partition(state, slot, np);
|
||||
+
|
||||
+ slot++;
|
||||
+ }
|
||||
+
|
||||
+ strlcat(state->pp_buf, "\n", PAGE_SIZE);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
@ -0,0 +1,38 @@
|
||||
From ae461cde5c559675fc4c0ba351c7c31ace705f56 Mon Sep 17 00:00:00 2001
|
||||
From: Bohdan Chubuk <chbgdn@gmail.com>
|
||||
Date: Sun, 10 Nov 2024 22:50:47 +0200
|
||||
Subject: [PATCH] mtd: spinand: add support for FORESEE F35SQA001G
|
||||
|
||||
Add support for FORESEE F35SQA001G SPI NAND.
|
||||
|
||||
Similar to F35SQA002G, but differs in capacity.
|
||||
Datasheet:
|
||||
- https://cdn.ozdisan.com/ETicaret_Dosya/704795_871495.pdf
|
||||
|
||||
Tested on Xiaomi AX3000T flashed with OpenWRT.
|
||||
|
||||
Signed-off-by: Bohdan Chubuk <chbgdn@gmail.com>
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
---
|
||||
drivers/mtd/nand/spi/foresee.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
--- a/drivers/mtd/nand/spi/foresee.c
|
||||
+++ b/drivers/mtd/nand/spi/foresee.c
|
||||
@@ -81,6 +81,16 @@ static const struct spinand_info foresee
|
||||
SPINAND_HAS_QE_BIT,
|
||||
SPINAND_ECCINFO(&f35sqa002g_ooblayout,
|
||||
f35sqa002g_ecc_get_status)),
|
||||
+ SPINAND_INFO("F35SQA001G",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x71, 0x71),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(1, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&f35sqa002g_ooblayout,
|
||||
+ f35sqa002g_ecc_get_status)),
|
||||
};
|
||||
|
||||
static const struct spinand_manufacturer_ops foresee_spinand_manuf_ops = {
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,880 @@
|
||||
From 1d479f5b345e0c3650fec4dddeef9fc6fab30c8b Mon Sep 17 00:00:00 2001
|
||||
From: Md Sadre Alam <quic_mdalam@quicinc.com>
|
||||
Date: Wed, 20 Nov 2024 14:45:01 +0530
|
||||
Subject: [PATCH 2/4] mtd: rawnand: qcom: Add qcom prefix to common api
|
||||
|
||||
Add qcom prefix to all the api which will be commonly
|
||||
used by spi nand driver and raw nand driver.
|
||||
|
||||
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
|
||||
Signed-off-by: Md Sadre Alam <quic_mdalam@quicinc.com>
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
---
|
||||
drivers/mtd/nand/raw/qcom_nandc.c | 320 +++++++++++++++---------------
|
||||
1 file changed, 160 insertions(+), 160 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/nand/raw/qcom_nandc.c
|
||||
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
|
||||
@@ -53,7 +53,7 @@
|
||||
#define NAND_READ_LOCATION_LAST_CW_2 0xf48
|
||||
#define NAND_READ_LOCATION_LAST_CW_3 0xf4c
|
||||
|
||||
-/* dummy register offsets, used by write_reg_dma */
|
||||
+/* dummy register offsets, used by qcom_write_reg_dma */
|
||||
#define NAND_DEV_CMD1_RESTORE 0xdead
|
||||
#define NAND_DEV_CMD_VLD_RESTORE 0xbeef
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
|
||||
/*
|
||||
* Flags used in DMA descriptor preparation helper functions
|
||||
- * (i.e. read_reg_dma/write_reg_dma/read_data_dma/write_data_dma)
|
||||
+ * (i.e. qcom_read_reg_dma/qcom_write_reg_dma/qcom_read_data_dma/qcom_write_data_dma)
|
||||
*/
|
||||
/* Don't set the EOT in current tx BAM sgl */
|
||||
#define NAND_BAM_NO_EOT BIT(0)
|
||||
@@ -550,7 +550,7 @@ struct qcom_nandc_props {
|
||||
};
|
||||
|
||||
/* Frees the BAM transaction memory */
|
||||
-static void free_bam_transaction(struct qcom_nand_controller *nandc)
|
||||
+static void qcom_free_bam_transaction(struct qcom_nand_controller *nandc)
|
||||
{
|
||||
struct bam_transaction *bam_txn = nandc->bam_txn;
|
||||
|
||||
@@ -559,7 +559,7 @@ static void free_bam_transaction(struct
|
||||
|
||||
/* Allocates and Initializes the BAM transaction */
|
||||
static struct bam_transaction *
|
||||
-alloc_bam_transaction(struct qcom_nand_controller *nandc)
|
||||
+qcom_alloc_bam_transaction(struct qcom_nand_controller *nandc)
|
||||
{
|
||||
struct bam_transaction *bam_txn;
|
||||
size_t bam_txn_size;
|
||||
@@ -595,7 +595,7 @@ alloc_bam_transaction(struct qcom_nand_c
|
||||
}
|
||||
|
||||
/* Clears the BAM transaction indexes */
|
||||
-static void clear_bam_transaction(struct qcom_nand_controller *nandc)
|
||||
+static void qcom_clear_bam_transaction(struct qcom_nand_controller *nandc)
|
||||
{
|
||||
struct bam_transaction *bam_txn = nandc->bam_txn;
|
||||
|
||||
@@ -614,7 +614,7 @@ static void clear_bam_transaction(struct
|
||||
}
|
||||
|
||||
/* Callback for DMA descriptor completion */
|
||||
-static void qpic_bam_dma_done(void *data)
|
||||
+static void qcom_qpic_bam_dma_done(void *data)
|
||||
{
|
||||
struct bam_transaction *bam_txn = data;
|
||||
|
||||
@@ -644,7 +644,7 @@ static void nandc_write(struct qcom_nand
|
||||
iowrite32(val, nandc->base + offset);
|
||||
}
|
||||
|
||||
-static void nandc_dev_to_mem(struct qcom_nand_controller *nandc, bool is_cpu)
|
||||
+static void qcom_nandc_dev_to_mem(struct qcom_nand_controller *nandc, bool is_cpu)
|
||||
{
|
||||
if (!nandc->props->supports_bam)
|
||||
return;
|
||||
@@ -824,9 +824,9 @@ static void update_rw_regs(struct qcom_n
|
||||
* for BAM. This descriptor will be added in the NAND DMA descriptor queue
|
||||
* which will be submitted to DMA engine.
|
||||
*/
|
||||
-static int prepare_bam_async_desc(struct qcom_nand_controller *nandc,
|
||||
- struct dma_chan *chan,
|
||||
- unsigned long flags)
|
||||
+static int qcom_prepare_bam_async_desc(struct qcom_nand_controller *nandc,
|
||||
+ struct dma_chan *chan,
|
||||
+ unsigned long flags)
|
||||
{
|
||||
struct desc_info *desc;
|
||||
struct scatterlist *sgl;
|
||||
@@ -903,9 +903,9 @@ static int prepare_bam_async_desc(struct
|
||||
* NAND_BAM_NEXT_SGL will be used for starting the separate SGL
|
||||
* after the current command element.
|
||||
*/
|
||||
-static int prep_bam_dma_desc_cmd(struct qcom_nand_controller *nandc, bool read,
|
||||
- int reg_off, const void *vaddr,
|
||||
- int size, unsigned int flags)
|
||||
+static int qcom_prep_bam_dma_desc_cmd(struct qcom_nand_controller *nandc, bool read,
|
||||
+ int reg_off, const void *vaddr,
|
||||
+ int size, unsigned int flags)
|
||||
{
|
||||
int bam_ce_size;
|
||||
int i, ret;
|
||||
@@ -943,9 +943,9 @@ static int prep_bam_dma_desc_cmd(struct
|
||||
bam_txn->bam_ce_start = bam_txn->bam_ce_pos;
|
||||
|
||||
if (flags & NAND_BAM_NWD) {
|
||||
- ret = prepare_bam_async_desc(nandc, nandc->cmd_chan,
|
||||
- DMA_PREP_FENCE |
|
||||
- DMA_PREP_CMD);
|
||||
+ ret = qcom_prepare_bam_async_desc(nandc, nandc->cmd_chan,
|
||||
+ DMA_PREP_FENCE |
|
||||
+ DMA_PREP_CMD);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@@ -958,9 +958,8 @@ static int prep_bam_dma_desc_cmd(struct
|
||||
* Prepares the data descriptor for BAM DMA which will be used for NAND
|
||||
* data reads and writes.
|
||||
*/
|
||||
-static int prep_bam_dma_desc_data(struct qcom_nand_controller *nandc, bool read,
|
||||
- const void *vaddr,
|
||||
- int size, unsigned int flags)
|
||||
+static int qcom_prep_bam_dma_desc_data(struct qcom_nand_controller *nandc, bool read,
|
||||
+ const void *vaddr, int size, unsigned int flags)
|
||||
{
|
||||
int ret;
|
||||
struct bam_transaction *bam_txn = nandc->bam_txn;
|
||||
@@ -979,8 +978,8 @@ static int prep_bam_dma_desc_data(struct
|
||||
* is not set, form the DMA descriptor
|
||||
*/
|
||||
if (!(flags & NAND_BAM_NO_EOT)) {
|
||||
- ret = prepare_bam_async_desc(nandc, nandc->tx_chan,
|
||||
- DMA_PREP_INTERRUPT);
|
||||
+ ret = qcom_prepare_bam_async_desc(nandc, nandc->tx_chan,
|
||||
+ DMA_PREP_INTERRUPT);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@@ -989,9 +988,9 @@ static int prep_bam_dma_desc_data(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int prep_adm_dma_desc(struct qcom_nand_controller *nandc, bool read,
|
||||
- int reg_off, const void *vaddr, int size,
|
||||
- bool flow_control)
|
||||
+static int qcom_prep_adm_dma_desc(struct qcom_nand_controller *nandc, bool read,
|
||||
+ int reg_off, const void *vaddr, int size,
|
||||
+ bool flow_control)
|
||||
{
|
||||
struct desc_info *desc;
|
||||
struct dma_async_tx_descriptor *dma_desc;
|
||||
@@ -1069,15 +1068,15 @@ err:
|
||||
}
|
||||
|
||||
/*
|
||||
- * read_reg_dma: prepares a descriptor to read a given number of
|
||||
+ * qcom_read_reg_dma: prepares a descriptor to read a given number of
|
||||
* contiguous registers to the reg_read_buf pointer
|
||||
*
|
||||
* @first: offset of the first register in the contiguous block
|
||||
* @num_regs: number of registers to read
|
||||
* @flags: flags to control DMA descriptor preparation
|
||||
*/
|
||||
-static int read_reg_dma(struct qcom_nand_controller *nandc, int first,
|
||||
- int num_regs, unsigned int flags)
|
||||
+static int qcom_read_reg_dma(struct qcom_nand_controller *nandc, int first,
|
||||
+ int num_regs, unsigned int flags)
|
||||
{
|
||||
bool flow_control = false;
|
||||
void *vaddr;
|
||||
@@ -1089,18 +1088,18 @@ static int read_reg_dma(struct qcom_nand
|
||||
first = dev_cmd_reg_addr(nandc, first);
|
||||
|
||||
if (nandc->props->supports_bam)
|
||||
- return prep_bam_dma_desc_cmd(nandc, true, first, vaddr,
|
||||
+ return qcom_prep_bam_dma_desc_cmd(nandc, true, first, vaddr,
|
||||
num_regs, flags);
|
||||
|
||||
if (first == NAND_READ_ID || first == NAND_FLASH_STATUS)
|
||||
flow_control = true;
|
||||
|
||||
- return prep_adm_dma_desc(nandc, true, first, vaddr,
|
||||
+ return qcom_prep_adm_dma_desc(nandc, true, first, vaddr,
|
||||
num_regs * sizeof(u32), flow_control);
|
||||
}
|
||||
|
||||
/*
|
||||
- * write_reg_dma: prepares a descriptor to write a given number of
|
||||
+ * qcom_write_reg_dma: prepares a descriptor to write a given number of
|
||||
* contiguous registers
|
||||
*
|
||||
* @vaddr: contiguous memory from where register value will
|
||||
@@ -1109,8 +1108,8 @@ static int read_reg_dma(struct qcom_nand
|
||||
* @num_regs: number of registers to write
|
||||
* @flags: flags to control DMA descriptor preparation
|
||||
*/
|
||||
-static int write_reg_dma(struct qcom_nand_controller *nandc, __le32 *vaddr,
|
||||
- int first, int num_regs, unsigned int flags)
|
||||
+static int qcom_write_reg_dma(struct qcom_nand_controller *nandc, __le32 *vaddr,
|
||||
+ int first, int num_regs, unsigned int flags)
|
||||
{
|
||||
bool flow_control = false;
|
||||
|
||||
@@ -1124,18 +1123,18 @@ static int write_reg_dma(struct qcom_nan
|
||||
first = dev_cmd_reg_addr(nandc, NAND_DEV_CMD_VLD);
|
||||
|
||||
if (nandc->props->supports_bam)
|
||||
- return prep_bam_dma_desc_cmd(nandc, false, first, vaddr,
|
||||
+ return qcom_prep_bam_dma_desc_cmd(nandc, false, first, vaddr,
|
||||
num_regs, flags);
|
||||
|
||||
if (first == NAND_FLASH_CMD)
|
||||
flow_control = true;
|
||||
|
||||
- return prep_adm_dma_desc(nandc, false, first, vaddr,
|
||||
+ return qcom_prep_adm_dma_desc(nandc, false, first, vaddr,
|
||||
num_regs * sizeof(u32), flow_control);
|
||||
}
|
||||
|
||||
/*
|
||||
- * read_data_dma: prepares a DMA descriptor to transfer data from the
|
||||
+ * qcom_read_data_dma: prepares a DMA descriptor to transfer data from the
|
||||
* controller's internal buffer to the buffer 'vaddr'
|
||||
*
|
||||
* @reg_off: offset within the controller's data buffer
|
||||
@@ -1143,17 +1142,17 @@ static int write_reg_dma(struct qcom_nan
|
||||
* @size: DMA transaction size in bytes
|
||||
* @flags: flags to control DMA descriptor preparation
|
||||
*/
|
||||
-static int read_data_dma(struct qcom_nand_controller *nandc, int reg_off,
|
||||
- const u8 *vaddr, int size, unsigned int flags)
|
||||
+static int qcom_read_data_dma(struct qcom_nand_controller *nandc, int reg_off,
|
||||
+ const u8 *vaddr, int size, unsigned int flags)
|
||||
{
|
||||
if (nandc->props->supports_bam)
|
||||
- return prep_bam_dma_desc_data(nandc, true, vaddr, size, flags);
|
||||
+ return qcom_prep_bam_dma_desc_data(nandc, true, vaddr, size, flags);
|
||||
|
||||
- return prep_adm_dma_desc(nandc, true, reg_off, vaddr, size, false);
|
||||
+ return qcom_prep_adm_dma_desc(nandc, true, reg_off, vaddr, size, false);
|
||||
}
|
||||
|
||||
/*
|
||||
- * write_data_dma: prepares a DMA descriptor to transfer data from
|
||||
+ * qcom_write_data_dma: prepares a DMA descriptor to transfer data from
|
||||
* 'vaddr' to the controller's internal buffer
|
||||
*
|
||||
* @reg_off: offset within the controller's data buffer
|
||||
@@ -1161,13 +1160,13 @@ static int read_data_dma(struct qcom_nan
|
||||
* @size: DMA transaction size in bytes
|
||||
* @flags: flags to control DMA descriptor preparation
|
||||
*/
|
||||
-static int write_data_dma(struct qcom_nand_controller *nandc, int reg_off,
|
||||
- const u8 *vaddr, int size, unsigned int flags)
|
||||
+static int qcom_write_data_dma(struct qcom_nand_controller *nandc, int reg_off,
|
||||
+ const u8 *vaddr, int size, unsigned int flags)
|
||||
{
|
||||
if (nandc->props->supports_bam)
|
||||
- return prep_bam_dma_desc_data(nandc, false, vaddr, size, flags);
|
||||
+ return qcom_prep_bam_dma_desc_data(nandc, false, vaddr, size, flags);
|
||||
|
||||
- return prep_adm_dma_desc(nandc, false, reg_off, vaddr, size, false);
|
||||
+ return qcom_prep_adm_dma_desc(nandc, false, reg_off, vaddr, size, false);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1178,14 +1177,14 @@ static void config_nand_page_read(struct
|
||||
{
|
||||
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
|
||||
|
||||
- write_reg_dma(nandc, &nandc->regs->addr0, NAND_ADDR0, 2, 0);
|
||||
- write_reg_dma(nandc, &nandc->regs->cfg0, NAND_DEV0_CFG0, 3, 0);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->addr0, NAND_ADDR0, 2, 0);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->cfg0, NAND_DEV0_CFG0, 3, 0);
|
||||
if (!nandc->props->qpic_version2)
|
||||
- write_reg_dma(nandc, &nandc->regs->ecc_buf_cfg, NAND_EBI2_ECC_BUF_CFG, 1, 0);
|
||||
- write_reg_dma(nandc, &nandc->regs->erased_cw_detect_cfg_clr,
|
||||
- NAND_ERASED_CW_DETECT_CFG, 1, 0);
|
||||
- write_reg_dma(nandc, &nandc->regs->erased_cw_detect_cfg_set,
|
||||
- NAND_ERASED_CW_DETECT_CFG, 1, NAND_ERASED_CW_SET | NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->ecc_buf_cfg, NAND_EBI2_ECC_BUF_CFG, 1, 0);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->erased_cw_detect_cfg_clr,
|
||||
+ NAND_ERASED_CW_DETECT_CFG, 1, 0);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->erased_cw_detect_cfg_set,
|
||||
+ NAND_ERASED_CW_DETECT_CFG, 1, NAND_ERASED_CW_SET | NAND_BAM_NEXT_SGL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1204,17 +1203,17 @@ config_nand_cw_read(struct nand_chip *ch
|
||||
reg = &nandc->regs->read_location_last0;
|
||||
|
||||
if (nandc->props->supports_bam)
|
||||
- write_reg_dma(nandc, reg, NAND_READ_LOCATION_0, 4, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, reg, NAND_READ_LOCATION_0, 4, NAND_BAM_NEXT_SGL);
|
||||
|
||||
- write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
- write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
|
||||
if (use_ecc) {
|
||||
- read_reg_dma(nandc, NAND_FLASH_STATUS, 2, 0);
|
||||
- read_reg_dma(nandc, NAND_ERASED_CW_DETECT_STATUS, 1,
|
||||
- NAND_BAM_NEXT_SGL);
|
||||
+ qcom_read_reg_dma(nandc, NAND_FLASH_STATUS, 2, 0);
|
||||
+ qcom_read_reg_dma(nandc, NAND_ERASED_CW_DETECT_STATUS, 1,
|
||||
+ NAND_BAM_NEXT_SGL);
|
||||
} else {
|
||||
- read_reg_dma(nandc, NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_read_reg_dma(nandc, NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1238,11 +1237,11 @@ static void config_nand_page_write(struc
|
||||
{
|
||||
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
|
||||
|
||||
- write_reg_dma(nandc, &nandc->regs->addr0, NAND_ADDR0, 2, 0);
|
||||
- write_reg_dma(nandc, &nandc->regs->cfg0, NAND_DEV0_CFG0, 3, 0);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->addr0, NAND_ADDR0, 2, 0);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->cfg0, NAND_DEV0_CFG0, 3, 0);
|
||||
if (!nandc->props->qpic_version2)
|
||||
- write_reg_dma(nandc, &nandc->regs->ecc_buf_cfg, NAND_EBI2_ECC_BUF_CFG, 1,
|
||||
- NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->ecc_buf_cfg, NAND_EBI2_ECC_BUF_CFG, 1,
|
||||
+ NAND_BAM_NEXT_SGL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1253,17 +1252,18 @@ static void config_nand_cw_write(struct
|
||||
{
|
||||
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
|
||||
|
||||
- write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
- write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
|
||||
- read_reg_dma(nandc, NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_read_reg_dma(nandc, NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);
|
||||
|
||||
- write_reg_dma(nandc, &nandc->regs->clrflashstatus, NAND_FLASH_STATUS, 1, 0);
|
||||
- write_reg_dma(nandc, &nandc->regs->clrreadstatus, NAND_READ_STATUS, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->clrflashstatus, NAND_FLASH_STATUS, 1, 0);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->clrreadstatus, NAND_READ_STATUS, 1,
|
||||
+ NAND_BAM_NEXT_SGL);
|
||||
}
|
||||
|
||||
/* helpers to submit/free our list of dma descriptors */
|
||||
-static int submit_descs(struct qcom_nand_controller *nandc)
|
||||
+static int qcom_submit_descs(struct qcom_nand_controller *nandc)
|
||||
{
|
||||
struct desc_info *desc, *n;
|
||||
dma_cookie_t cookie = 0;
|
||||
@@ -1272,21 +1272,21 @@ static int submit_descs(struct qcom_nand
|
||||
|
||||
if (nandc->props->supports_bam) {
|
||||
if (bam_txn->rx_sgl_pos > bam_txn->rx_sgl_start) {
|
||||
- ret = prepare_bam_async_desc(nandc, nandc->rx_chan, 0);
|
||||
+ ret = qcom_prepare_bam_async_desc(nandc, nandc->rx_chan, 0);
|
||||
if (ret)
|
||||
goto err_unmap_free_desc;
|
||||
}
|
||||
|
||||
if (bam_txn->tx_sgl_pos > bam_txn->tx_sgl_start) {
|
||||
- ret = prepare_bam_async_desc(nandc, nandc->tx_chan,
|
||||
- DMA_PREP_INTERRUPT);
|
||||
+ ret = qcom_prepare_bam_async_desc(nandc, nandc->tx_chan,
|
||||
+ DMA_PREP_INTERRUPT);
|
||||
if (ret)
|
||||
goto err_unmap_free_desc;
|
||||
}
|
||||
|
||||
if (bam_txn->cmd_sgl_pos > bam_txn->cmd_sgl_start) {
|
||||
- ret = prepare_bam_async_desc(nandc, nandc->cmd_chan,
|
||||
- DMA_PREP_CMD);
|
||||
+ ret = qcom_prepare_bam_async_desc(nandc, nandc->cmd_chan,
|
||||
+ DMA_PREP_CMD);
|
||||
if (ret)
|
||||
goto err_unmap_free_desc;
|
||||
}
|
||||
@@ -1296,7 +1296,7 @@ static int submit_descs(struct qcom_nand
|
||||
cookie = dmaengine_submit(desc->dma_desc);
|
||||
|
||||
if (nandc->props->supports_bam) {
|
||||
- bam_txn->last_cmd_desc->callback = qpic_bam_dma_done;
|
||||
+ bam_txn->last_cmd_desc->callback = qcom_qpic_bam_dma_done;
|
||||
bam_txn->last_cmd_desc->callback_param = bam_txn;
|
||||
|
||||
dma_async_issue_pending(nandc->tx_chan);
|
||||
@@ -1314,7 +1314,7 @@ static int submit_descs(struct qcom_nand
|
||||
err_unmap_free_desc:
|
||||
/*
|
||||
* Unmap the dma sg_list and free the desc allocated by both
|
||||
- * prepare_bam_async_desc() and prep_adm_dma_desc() functions.
|
||||
+ * qcom_prepare_bam_async_desc() and qcom_prep_adm_dma_desc() functions.
|
||||
*/
|
||||
list_for_each_entry_safe(desc, n, &nandc->desc_list, node) {
|
||||
list_del(&desc->node);
|
||||
@@ -1333,10 +1333,10 @@ err_unmap_free_desc:
|
||||
}
|
||||
|
||||
/* reset the register read buffer for next NAND operation */
|
||||
-static void clear_read_regs(struct qcom_nand_controller *nandc)
|
||||
+static void qcom_clear_read_regs(struct qcom_nand_controller *nandc)
|
||||
{
|
||||
nandc->reg_read_pos = 0;
|
||||
- nandc_dev_to_mem(nandc, false);
|
||||
+ qcom_nandc_dev_to_mem(nandc, false);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1400,7 +1400,7 @@ static int check_flash_errors(struct qco
|
||||
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
|
||||
int i;
|
||||
|
||||
- nandc_dev_to_mem(nandc, true);
|
||||
+ qcom_nandc_dev_to_mem(nandc, true);
|
||||
|
||||
for (i = 0; i < cw_cnt; i++) {
|
||||
u32 flash = le32_to_cpu(nandc->reg_read_buf[i]);
|
||||
@@ -1427,13 +1427,13 @@ qcom_nandc_read_cw_raw(struct mtd_info *
|
||||
nand_read_page_op(chip, page, 0, NULL, 0);
|
||||
nandc->buf_count = 0;
|
||||
nandc->buf_start = 0;
|
||||
- clear_read_regs(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
host->use_ecc = false;
|
||||
|
||||
if (nandc->props->qpic_version2)
|
||||
raw_cw = ecc->steps - 1;
|
||||
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
set_address(host, host->cw_size * cw, page);
|
||||
update_rw_regs(host, 1, true, raw_cw);
|
||||
config_nand_page_read(chip);
|
||||
@@ -1466,18 +1466,18 @@ qcom_nandc_read_cw_raw(struct mtd_info *
|
||||
|
||||
config_nand_cw_read(chip, false, raw_cw);
|
||||
|
||||
- read_data_dma(nandc, reg_off, data_buf, data_size1, 0);
|
||||
+ qcom_read_data_dma(nandc, reg_off, data_buf, data_size1, 0);
|
||||
reg_off += data_size1;
|
||||
|
||||
- read_data_dma(nandc, reg_off, oob_buf, oob_size1, 0);
|
||||
+ qcom_read_data_dma(nandc, reg_off, oob_buf, oob_size1, 0);
|
||||
reg_off += oob_size1;
|
||||
|
||||
- read_data_dma(nandc, reg_off, data_buf + data_size1, data_size2, 0);
|
||||
+ qcom_read_data_dma(nandc, reg_off, data_buf + data_size1, data_size2, 0);
|
||||
reg_off += data_size2;
|
||||
|
||||
- read_data_dma(nandc, reg_off, oob_buf + oob_size1, oob_size2, 0);
|
||||
+ qcom_read_data_dma(nandc, reg_off, oob_buf + oob_size1, oob_size2, 0);
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure to read raw cw %d\n", cw);
|
||||
return ret;
|
||||
@@ -1575,7 +1575,7 @@ static int parse_read_errors(struct qcom
|
||||
u8 *data_buf_start = data_buf, *oob_buf_start = oob_buf;
|
||||
|
||||
buf = (struct read_stats *)nandc->reg_read_buf;
|
||||
- nandc_dev_to_mem(nandc, true);
|
||||
+ qcom_nandc_dev_to_mem(nandc, true);
|
||||
|
||||
for (i = 0; i < ecc->steps; i++, buf++) {
|
||||
u32 flash, buffer, erased_cw;
|
||||
@@ -1704,8 +1704,8 @@ static int read_page_ecc(struct qcom_nan
|
||||
config_nand_cw_read(chip, true, i);
|
||||
|
||||
if (data_buf)
|
||||
- read_data_dma(nandc, FLASH_BUF_ACC, data_buf,
|
||||
- data_size, 0);
|
||||
+ qcom_read_data_dma(nandc, FLASH_BUF_ACC, data_buf,
|
||||
+ data_size, 0);
|
||||
|
||||
/*
|
||||
* when ecc is enabled, the controller doesn't read the real
|
||||
@@ -1720,8 +1720,8 @@ static int read_page_ecc(struct qcom_nan
|
||||
for (j = 0; j < host->bbm_size; j++)
|
||||
*oob_buf++ = 0xff;
|
||||
|
||||
- read_data_dma(nandc, FLASH_BUF_ACC + data_size,
|
||||
- oob_buf, oob_size, 0);
|
||||
+ qcom_read_data_dma(nandc, FLASH_BUF_ACC + data_size,
|
||||
+ oob_buf, oob_size, 0);
|
||||
}
|
||||
|
||||
if (data_buf)
|
||||
@@ -1730,7 +1730,7 @@ static int read_page_ecc(struct qcom_nan
|
||||
oob_buf += oob_size;
|
||||
}
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure to read page/oob\n");
|
||||
return ret;
|
||||
@@ -1751,7 +1751,7 @@ static int copy_last_cw(struct qcom_nand
|
||||
int size;
|
||||
int ret;
|
||||
|
||||
- clear_read_regs(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
|
||||
size = host->use_ecc ? host->cw_data : host->cw_size;
|
||||
|
||||
@@ -1763,9 +1763,9 @@ static int copy_last_cw(struct qcom_nand
|
||||
|
||||
config_nand_single_cw_page_read(chip, host->use_ecc, ecc->steps - 1);
|
||||
|
||||
- read_data_dma(nandc, FLASH_BUF_ACC, nandc->data_buffer, size, 0);
|
||||
+ qcom_read_data_dma(nandc, FLASH_BUF_ACC, nandc->data_buffer, size, 0);
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret)
|
||||
dev_err(nandc->dev, "failed to copy last codeword\n");
|
||||
|
||||
@@ -1851,14 +1851,14 @@ static int qcom_nandc_read_page(struct n
|
||||
nandc->buf_count = 0;
|
||||
nandc->buf_start = 0;
|
||||
host->use_ecc = true;
|
||||
- clear_read_regs(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
set_address(host, 0, page);
|
||||
update_rw_regs(host, ecc->steps, true, 0);
|
||||
|
||||
data_buf = buf;
|
||||
oob_buf = oob_required ? chip->oob_poi : NULL;
|
||||
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
return read_page_ecc(host, data_buf, oob_buf, page);
|
||||
}
|
||||
@@ -1899,8 +1899,8 @@ static int qcom_nandc_read_oob(struct na
|
||||
if (host->nr_boot_partitions)
|
||||
qcom_nandc_codeword_fixup(host, page);
|
||||
|
||||
- clear_read_regs(nandc);
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
host->use_ecc = true;
|
||||
set_address(host, 0, page);
|
||||
@@ -1927,8 +1927,8 @@ static int qcom_nandc_write_page(struct
|
||||
set_address(host, 0, page);
|
||||
nandc->buf_count = 0;
|
||||
nandc->buf_start = 0;
|
||||
- clear_read_regs(nandc);
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
data_buf = (u8 *)buf;
|
||||
oob_buf = chip->oob_poi;
|
||||
@@ -1949,8 +1949,8 @@ static int qcom_nandc_write_page(struct
|
||||
oob_size = ecc->bytes;
|
||||
}
|
||||
|
||||
- write_data_dma(nandc, FLASH_BUF_ACC, data_buf, data_size,
|
||||
- i == (ecc->steps - 1) ? NAND_BAM_NO_EOT : 0);
|
||||
+ qcom_write_data_dma(nandc, FLASH_BUF_ACC, data_buf, data_size,
|
||||
+ i == (ecc->steps - 1) ? NAND_BAM_NO_EOT : 0);
|
||||
|
||||
/*
|
||||
* when ECC is enabled, we don't really need to write anything
|
||||
@@ -1962,8 +1962,8 @@ static int qcom_nandc_write_page(struct
|
||||
if (qcom_nandc_is_last_cw(ecc, i)) {
|
||||
oob_buf += host->bbm_size;
|
||||
|
||||
- write_data_dma(nandc, FLASH_BUF_ACC + data_size,
|
||||
- oob_buf, oob_size, 0);
|
||||
+ qcom_write_data_dma(nandc, FLASH_BUF_ACC + data_size,
|
||||
+ oob_buf, oob_size, 0);
|
||||
}
|
||||
|
||||
config_nand_cw_write(chip);
|
||||
@@ -1972,7 +1972,7 @@ static int qcom_nandc_write_page(struct
|
||||
oob_buf += oob_size;
|
||||
}
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure to write page\n");
|
||||
return ret;
|
||||
@@ -1997,8 +1997,8 @@ static int qcom_nandc_write_page_raw(str
|
||||
qcom_nandc_codeword_fixup(host, page);
|
||||
|
||||
nand_prog_page_begin_op(chip, page, 0, NULL, 0);
|
||||
- clear_read_regs(nandc);
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
data_buf = (u8 *)buf;
|
||||
oob_buf = chip->oob_poi;
|
||||
@@ -2024,28 +2024,28 @@ static int qcom_nandc_write_page_raw(str
|
||||
oob_size2 = host->ecc_bytes_hw + host->spare_bytes;
|
||||
}
|
||||
|
||||
- write_data_dma(nandc, reg_off, data_buf, data_size1,
|
||||
- NAND_BAM_NO_EOT);
|
||||
+ qcom_write_data_dma(nandc, reg_off, data_buf, data_size1,
|
||||
+ NAND_BAM_NO_EOT);
|
||||
reg_off += data_size1;
|
||||
data_buf += data_size1;
|
||||
|
||||
- write_data_dma(nandc, reg_off, oob_buf, oob_size1,
|
||||
- NAND_BAM_NO_EOT);
|
||||
+ qcom_write_data_dma(nandc, reg_off, oob_buf, oob_size1,
|
||||
+ NAND_BAM_NO_EOT);
|
||||
reg_off += oob_size1;
|
||||
oob_buf += oob_size1;
|
||||
|
||||
- write_data_dma(nandc, reg_off, data_buf, data_size2,
|
||||
- NAND_BAM_NO_EOT);
|
||||
+ qcom_write_data_dma(nandc, reg_off, data_buf, data_size2,
|
||||
+ NAND_BAM_NO_EOT);
|
||||
reg_off += data_size2;
|
||||
data_buf += data_size2;
|
||||
|
||||
- write_data_dma(nandc, reg_off, oob_buf, oob_size2, 0);
|
||||
+ qcom_write_data_dma(nandc, reg_off, oob_buf, oob_size2, 0);
|
||||
oob_buf += oob_size2;
|
||||
|
||||
config_nand_cw_write(chip);
|
||||
}
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure to write raw page\n");
|
||||
return ret;
|
||||
@@ -2075,7 +2075,7 @@ static int qcom_nandc_write_oob(struct n
|
||||
qcom_nandc_codeword_fixup(host, page);
|
||||
|
||||
host->use_ecc = true;
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
/* calculate the data and oob size for the last codeword/step */
|
||||
data_size = ecc->size - ((ecc->steps - 1) << 2);
|
||||
@@ -2090,11 +2090,11 @@ static int qcom_nandc_write_oob(struct n
|
||||
update_rw_regs(host, 1, false, 0);
|
||||
|
||||
config_nand_page_write(chip);
|
||||
- write_data_dma(nandc, FLASH_BUF_ACC,
|
||||
- nandc->data_buffer, data_size + oob_size, 0);
|
||||
+ qcom_write_data_dma(nandc, FLASH_BUF_ACC,
|
||||
+ nandc->data_buffer, data_size + oob_size, 0);
|
||||
config_nand_cw_write(chip);
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure to write oob\n");
|
||||
return ret;
|
||||
@@ -2121,7 +2121,7 @@ static int qcom_nandc_block_bad(struct n
|
||||
*/
|
||||
host->use_ecc = false;
|
||||
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
ret = copy_last_cw(host, page);
|
||||
if (ret)
|
||||
goto err;
|
||||
@@ -2148,8 +2148,8 @@ static int qcom_nandc_block_markbad(stru
|
||||
struct nand_ecc_ctrl *ecc = &chip->ecc;
|
||||
int page, ret;
|
||||
|
||||
- clear_read_regs(nandc);
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
/*
|
||||
* to mark the BBM as bad, we flash the entire last codeword with 0s.
|
||||
@@ -2166,11 +2166,11 @@ static int qcom_nandc_block_markbad(stru
|
||||
update_rw_regs(host, 1, false, ecc->steps - 1);
|
||||
|
||||
config_nand_page_write(chip);
|
||||
- write_data_dma(nandc, FLASH_BUF_ACC,
|
||||
- nandc->data_buffer, host->cw_size, 0);
|
||||
+ qcom_write_data_dma(nandc, FLASH_BUF_ACC,
|
||||
+ nandc->data_buffer, host->cw_size, 0);
|
||||
config_nand_cw_write(chip);
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure to update BBM\n");
|
||||
return ret;
|
||||
@@ -2410,14 +2410,14 @@ static int qcom_nand_attach_chip(struct
|
||||
mtd_set_ooblayout(mtd, &qcom_nand_ooblayout_ops);
|
||||
/* Free the initially allocated BAM transaction for reading the ONFI params */
|
||||
if (nandc->props->supports_bam)
|
||||
- free_bam_transaction(nandc);
|
||||
+ qcom_free_bam_transaction(nandc);
|
||||
|
||||
nandc->max_cwperpage = max_t(unsigned int, nandc->max_cwperpage,
|
||||
cwperpage);
|
||||
|
||||
/* Now allocate the BAM transaction based on updated max_cwperpage */
|
||||
if (nandc->props->supports_bam) {
|
||||
- nandc->bam_txn = alloc_bam_transaction(nandc);
|
||||
+ nandc->bam_txn = qcom_alloc_bam_transaction(nandc);
|
||||
if (!nandc->bam_txn) {
|
||||
dev_err(nandc->dev,
|
||||
"failed to allocate bam transaction\n");
|
||||
@@ -2617,7 +2617,7 @@ static int qcom_wait_rdy_poll(struct nan
|
||||
unsigned long start = jiffies + msecs_to_jiffies(time_ms);
|
||||
u32 flash;
|
||||
|
||||
- nandc_dev_to_mem(nandc, true);
|
||||
+ qcom_nandc_dev_to_mem(nandc, true);
|
||||
|
||||
do {
|
||||
flash = le32_to_cpu(nandc->reg_read_buf[0]);
|
||||
@@ -2657,23 +2657,23 @@ static int qcom_read_status_exec(struct
|
||||
nandc->buf_start = 0;
|
||||
host->use_ecc = false;
|
||||
|
||||
- clear_read_regs(nandc);
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
nandc->regs->cmd = q_op.cmd_reg;
|
||||
nandc->regs->exec = cpu_to_le32(1);
|
||||
|
||||
- write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
- write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
- read_reg_dma(nandc, NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_read_reg_dma(nandc, NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure in submitting status descriptor\n");
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
- nandc_dev_to_mem(nandc, true);
|
||||
+ qcom_nandc_dev_to_mem(nandc, true);
|
||||
|
||||
for (i = 0; i < num_cw; i++) {
|
||||
flash_status = le32_to_cpu(nandc->reg_read_buf[i]);
|
||||
@@ -2714,8 +2714,8 @@ static int qcom_read_id_type_exec(struct
|
||||
nandc->buf_start = 0;
|
||||
host->use_ecc = false;
|
||||
|
||||
- clear_read_regs(nandc);
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
nandc->regs->cmd = q_op.cmd_reg;
|
||||
nandc->regs->addr0 = q_op.addr1_reg;
|
||||
@@ -2723,12 +2723,12 @@ static int qcom_read_id_type_exec(struct
|
||||
nandc->regs->chip_sel = cpu_to_le32(nandc->props->supports_bam ? 0 : DM_EN);
|
||||
nandc->regs->exec = cpu_to_le32(1);
|
||||
|
||||
- write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, 4, NAND_BAM_NEXT_SGL);
|
||||
- write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, 4, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
|
||||
- read_reg_dma(nandc, NAND_READ_ID, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_read_reg_dma(nandc, NAND_READ_ID, 1, NAND_BAM_NEXT_SGL);
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure in submitting read id descriptor\n");
|
||||
goto err_out;
|
||||
@@ -2738,7 +2738,7 @@ static int qcom_read_id_type_exec(struct
|
||||
op_id = q_op.data_instr_idx;
|
||||
len = nand_subop_get_data_len(subop, op_id);
|
||||
|
||||
- nandc_dev_to_mem(nandc, true);
|
||||
+ qcom_nandc_dev_to_mem(nandc, true);
|
||||
memcpy(instr->ctx.data.buf.in, nandc->reg_read_buf, len);
|
||||
|
||||
err_out:
|
||||
@@ -2774,20 +2774,20 @@ static int qcom_misc_cmd_type_exec(struc
|
||||
nandc->buf_start = 0;
|
||||
host->use_ecc = false;
|
||||
|
||||
- clear_read_regs(nandc);
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
nandc->regs->cmd = q_op.cmd_reg;
|
||||
nandc->regs->exec = cpu_to_le32(1);
|
||||
|
||||
- write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, instrs, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->cmd, NAND_FLASH_CMD, instrs, NAND_BAM_NEXT_SGL);
|
||||
if (q_op.cmd_reg == cpu_to_le32(OP_BLOCK_ERASE))
|
||||
- write_reg_dma(nandc, &nandc->regs->cfg0, NAND_DEV0_CFG0, 2, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->cfg0, NAND_DEV0_CFG0, 2, NAND_BAM_NEXT_SGL);
|
||||
|
||||
- write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
- read_reg_dma(nandc, NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->exec, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_read_reg_dma(nandc, NAND_FLASH_STATUS, 1, NAND_BAM_NEXT_SGL);
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure in submitting misc descriptor\n");
|
||||
goto err_out;
|
||||
@@ -2820,8 +2820,8 @@ static int qcom_param_page_type_exec(str
|
||||
nandc->buf_count = 0;
|
||||
nandc->buf_start = 0;
|
||||
host->use_ecc = false;
|
||||
- clear_read_regs(nandc);
|
||||
- clear_bam_transaction(nandc);
|
||||
+ qcom_clear_read_regs(nandc);
|
||||
+ qcom_clear_bam_transaction(nandc);
|
||||
|
||||
nandc->regs->cmd = q_op.cmd_reg;
|
||||
nandc->regs->addr0 = 0;
|
||||
@@ -2864,8 +2864,8 @@ static int qcom_param_page_type_exec(str
|
||||
nandc_set_read_loc(chip, 0, 0, 0, len, 1);
|
||||
|
||||
if (!nandc->props->qpic_version2) {
|
||||
- write_reg_dma(nandc, &nandc->regs->vld, NAND_DEV_CMD_VLD, 1, 0);
|
||||
- write_reg_dma(nandc, &nandc->regs->cmd1, NAND_DEV_CMD1, 1, NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->vld, NAND_DEV_CMD_VLD, 1, 0);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->cmd1, NAND_DEV_CMD1, 1, NAND_BAM_NEXT_SGL);
|
||||
}
|
||||
|
||||
nandc->buf_count = len;
|
||||
@@ -2873,17 +2873,17 @@ static int qcom_param_page_type_exec(str
|
||||
|
||||
config_nand_single_cw_page_read(chip, false, 0);
|
||||
|
||||
- read_data_dma(nandc, FLASH_BUF_ACC, nandc->data_buffer,
|
||||
- nandc->buf_count, 0);
|
||||
+ qcom_read_data_dma(nandc, FLASH_BUF_ACC, nandc->data_buffer,
|
||||
+ nandc->buf_count, 0);
|
||||
|
||||
/* restore CMD1 and VLD regs */
|
||||
if (!nandc->props->qpic_version2) {
|
||||
- write_reg_dma(nandc, &nandc->regs->orig_cmd1, NAND_DEV_CMD1_RESTORE, 1, 0);
|
||||
- write_reg_dma(nandc, &nandc->regs->orig_vld, NAND_DEV_CMD_VLD_RESTORE, 1,
|
||||
- NAND_BAM_NEXT_SGL);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->orig_cmd1, NAND_DEV_CMD1_RESTORE, 1, 0);
|
||||
+ qcom_write_reg_dma(nandc, &nandc->regs->orig_vld, NAND_DEV_CMD_VLD_RESTORE, 1,
|
||||
+ NAND_BAM_NEXT_SGL);
|
||||
}
|
||||
|
||||
- ret = submit_descs(nandc);
|
||||
+ ret = qcom_submit_descs(nandc);
|
||||
if (ret) {
|
||||
dev_err(nandc->dev, "failure in submitting param page descriptor\n");
|
||||
goto err_out;
|
||||
@@ -3067,7 +3067,7 @@ static int qcom_nandc_alloc(struct qcom_
|
||||
* maximum codeword size
|
||||
*/
|
||||
nandc->max_cwperpage = 1;
|
||||
- nandc->bam_txn = alloc_bam_transaction(nandc);
|
||||
+ nandc->bam_txn = qcom_alloc_bam_transaction(nandc);
|
||||
if (!nandc->bam_txn) {
|
||||
dev_err(nandc->dev,
|
||||
"failed to allocate bam transaction\n");
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,198 @@
|
||||
From 0c08080fd71cd5dd59643104b39d3c89d793ab3c Mon Sep 17 00:00:00 2001
|
||||
From: Md Sadre Alam <quic_mdalam@quicinc.com>
|
||||
Date: Wed, 20 Nov 2024 14:45:03 +0530
|
||||
Subject: [PATCH 4/4] mtd: rawnand: qcom: use FIELD_PREP and GENMASK
|
||||
|
||||
Use the bitfield macro FIELD_PREP, and GENMASK to
|
||||
do the shift and mask in one go. This makes the code
|
||||
more readable.
|
||||
|
||||
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
|
||||
Signed-off-by: Md Sadre Alam <quic_mdalam@quicinc.com>
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
---
|
||||
drivers/mtd/nand/raw/qcom_nandc.c | 97 ++++++++++++++--------------
|
||||
include/linux/mtd/nand-qpic-common.h | 31 +++++----
|
||||
2 files changed, 67 insertions(+), 61 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/nand/raw/qcom_nandc.c
|
||||
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
|
||||
@@ -281,7 +281,7 @@ static void update_rw_regs(struct qcom_n
|
||||
(num_cw - 1) << CW_PER_PAGE);
|
||||
|
||||
cfg1 = cpu_to_le32(host->cfg1_raw);
|
||||
- ecc_bch_cfg = cpu_to_le32(1 << ECC_CFG_ECC_DISABLE);
|
||||
+ ecc_bch_cfg = cpu_to_le32(ECC_CFG_ECC_DISABLE);
|
||||
}
|
||||
|
||||
nandc->regs->cmd = cmd;
|
||||
@@ -1494,42 +1494,41 @@ static int qcom_nand_attach_chip(struct
|
||||
host->cw_size = host->cw_data + ecc->bytes;
|
||||
bad_block_byte = mtd->writesize - host->cw_size * (cwperpage - 1) + 1;
|
||||
|
||||
- host->cfg0 = (cwperpage - 1) << CW_PER_PAGE
|
||||
- | host->cw_data << UD_SIZE_BYTES
|
||||
- | 0 << DISABLE_STATUS_AFTER_WRITE
|
||||
- | 5 << NUM_ADDR_CYCLES
|
||||
- | host->ecc_bytes_hw << ECC_PARITY_SIZE_BYTES_RS
|
||||
- | 0 << STATUS_BFR_READ
|
||||
- | 1 << SET_RD_MODE_AFTER_STATUS
|
||||
- | host->spare_bytes << SPARE_SIZE_BYTES;
|
||||
-
|
||||
- host->cfg1 = 7 << NAND_RECOVERY_CYCLES
|
||||
- | 0 << CS_ACTIVE_BSY
|
||||
- | bad_block_byte << BAD_BLOCK_BYTE_NUM
|
||||
- | 0 << BAD_BLOCK_IN_SPARE_AREA
|
||||
- | 2 << WR_RD_BSY_GAP
|
||||
- | wide_bus << WIDE_FLASH
|
||||
- | host->bch_enabled << ENABLE_BCH_ECC;
|
||||
-
|
||||
- host->cfg0_raw = (cwperpage - 1) << CW_PER_PAGE
|
||||
- | host->cw_size << UD_SIZE_BYTES
|
||||
- | 5 << NUM_ADDR_CYCLES
|
||||
- | 0 << SPARE_SIZE_BYTES;
|
||||
-
|
||||
- host->cfg1_raw = 7 << NAND_RECOVERY_CYCLES
|
||||
- | 0 << CS_ACTIVE_BSY
|
||||
- | 17 << BAD_BLOCK_BYTE_NUM
|
||||
- | 1 << BAD_BLOCK_IN_SPARE_AREA
|
||||
- | 2 << WR_RD_BSY_GAP
|
||||
- | wide_bus << WIDE_FLASH
|
||||
- | 1 << DEV0_CFG1_ECC_DISABLE;
|
||||
-
|
||||
- host->ecc_bch_cfg = !host->bch_enabled << ECC_CFG_ECC_DISABLE
|
||||
- | 0 << ECC_SW_RESET
|
||||
- | host->cw_data << ECC_NUM_DATA_BYTES
|
||||
- | 1 << ECC_FORCE_CLK_OPEN
|
||||
- | ecc_mode << ECC_MODE
|
||||
- | host->ecc_bytes_hw << ECC_PARITY_SIZE_BYTES_BCH;
|
||||
+ host->cfg0 = FIELD_PREP(CW_PER_PAGE_MASK, (cwperpage - 1)) |
|
||||
+ FIELD_PREP(UD_SIZE_BYTES_MASK, host->cw_data) |
|
||||
+ FIELD_PREP(DISABLE_STATUS_AFTER_WRITE, 0) |
|
||||
+ FIELD_PREP(NUM_ADDR_CYCLES_MASK, 5) |
|
||||
+ FIELD_PREP(ECC_PARITY_SIZE_BYTES_RS, host->ecc_bytes_hw) |
|
||||
+ FIELD_PREP(STATUS_BFR_READ, 0) |
|
||||
+ FIELD_PREP(SET_RD_MODE_AFTER_STATUS, 1) |
|
||||
+ FIELD_PREP(SPARE_SIZE_BYTES_MASK, host->spare_bytes);
|
||||
+
|
||||
+ host->cfg1 = FIELD_PREP(NAND_RECOVERY_CYCLES_MASK, 7) |
|
||||
+ FIELD_PREP(BAD_BLOCK_BYTE_NUM_MASK, bad_block_byte) |
|
||||
+ FIELD_PREP(BAD_BLOCK_IN_SPARE_AREA, 0) |
|
||||
+ FIELD_PREP(WR_RD_BSY_GAP_MASK, 2) |
|
||||
+ FIELD_PREP(WIDE_FLASH, wide_bus) |
|
||||
+ FIELD_PREP(ENABLE_BCH_ECC, host->bch_enabled);
|
||||
+
|
||||
+ host->cfg0_raw = FIELD_PREP(CW_PER_PAGE_MASK, (cwperpage - 1)) |
|
||||
+ FIELD_PREP(UD_SIZE_BYTES_MASK, host->cw_size) |
|
||||
+ FIELD_PREP(NUM_ADDR_CYCLES_MASK, 5) |
|
||||
+ FIELD_PREP(SPARE_SIZE_BYTES_MASK, 0);
|
||||
+
|
||||
+ host->cfg1_raw = FIELD_PREP(NAND_RECOVERY_CYCLES_MASK, 7) |
|
||||
+ FIELD_PREP(CS_ACTIVE_BSY, 0) |
|
||||
+ FIELD_PREP(BAD_BLOCK_BYTE_NUM_MASK, 17) |
|
||||
+ FIELD_PREP(BAD_BLOCK_IN_SPARE_AREA, 1) |
|
||||
+ FIELD_PREP(WR_RD_BSY_GAP_MASK, 2) |
|
||||
+ FIELD_PREP(WIDE_FLASH, wide_bus) |
|
||||
+ FIELD_PREP(DEV0_CFG1_ECC_DISABLE, 1);
|
||||
+
|
||||
+ host->ecc_bch_cfg = FIELD_PREP(ECC_CFG_ECC_DISABLE, !host->bch_enabled) |
|
||||
+ FIELD_PREP(ECC_SW_RESET, 0) |
|
||||
+ FIELD_PREP(ECC_NUM_DATA_BYTES_MASK, host->cw_data) |
|
||||
+ FIELD_PREP(ECC_FORCE_CLK_OPEN, 1) |
|
||||
+ FIELD_PREP(ECC_MODE_MASK, ecc_mode) |
|
||||
+ FIELD_PREP(ECC_PARITY_SIZE_BYTES_BCH_MASK, host->ecc_bytes_hw);
|
||||
|
||||
if (!nandc->props->qpic_version2)
|
||||
host->ecc_buf_cfg = 0x203 << NUM_STEPS;
|
||||
@@ -1882,21 +1881,21 @@ static int qcom_param_page_type_exec(str
|
||||
nandc->regs->addr0 = 0;
|
||||
nandc->regs->addr1 = 0;
|
||||
|
||||
- nandc->regs->cfg0 = cpu_to_le32(0 << CW_PER_PAGE |
|
||||
- 512 << UD_SIZE_BYTES |
|
||||
- 5 << NUM_ADDR_CYCLES |
|
||||
- 0 << SPARE_SIZE_BYTES);
|
||||
-
|
||||
- nandc->regs->cfg1 = cpu_to_le32(7 << NAND_RECOVERY_CYCLES |
|
||||
- 0 << CS_ACTIVE_BSY |
|
||||
- 17 << BAD_BLOCK_BYTE_NUM |
|
||||
- 1 << BAD_BLOCK_IN_SPARE_AREA |
|
||||
- 2 << WR_RD_BSY_GAP |
|
||||
- 0 << WIDE_FLASH |
|
||||
- 1 << DEV0_CFG1_ECC_DISABLE);
|
||||
+ host->cfg0 = FIELD_PREP(CW_PER_PAGE_MASK, 0) |
|
||||
+ FIELD_PREP(UD_SIZE_BYTES_MASK, 512) |
|
||||
+ FIELD_PREP(NUM_ADDR_CYCLES_MASK, 5) |
|
||||
+ FIELD_PREP(SPARE_SIZE_BYTES_MASK, 0);
|
||||
+
|
||||
+ host->cfg1 = FIELD_PREP(NAND_RECOVERY_CYCLES_MASK, 7) |
|
||||
+ FIELD_PREP(BAD_BLOCK_BYTE_NUM_MASK, 17) |
|
||||
+ FIELD_PREP(CS_ACTIVE_BSY, 0) |
|
||||
+ FIELD_PREP(BAD_BLOCK_IN_SPARE_AREA, 1) |
|
||||
+ FIELD_PREP(WR_RD_BSY_GAP_MASK, 2) |
|
||||
+ FIELD_PREP(WIDE_FLASH, 0) |
|
||||
+ FIELD_PREP(DEV0_CFG1_ECC_DISABLE, 1);
|
||||
|
||||
if (!nandc->props->qpic_version2)
|
||||
- nandc->regs->ecc_buf_cfg = cpu_to_le32(1 << ECC_CFG_ECC_DISABLE);
|
||||
+ nandc->regs->ecc_buf_cfg = cpu_to_le32(ECC_CFG_ECC_DISABLE);
|
||||
|
||||
/* configure CMD1 and VLD for ONFI param probing in QPIC v1 */
|
||||
if (!nandc->props->qpic_version2) {
|
||||
--- a/include/linux/mtd/nand-qpic-common.h
|
||||
+++ b/include/linux/mtd/nand-qpic-common.h
|
||||
@@ -70,35 +70,42 @@
|
||||
#define BS_CORRECTABLE_ERR_MSK 0x1f
|
||||
|
||||
/* NAND_DEVn_CFG0 bits */
|
||||
-#define DISABLE_STATUS_AFTER_WRITE 4
|
||||
+#define DISABLE_STATUS_AFTER_WRITE BIT(4)
|
||||
#define CW_PER_PAGE 6
|
||||
+#define CW_PER_PAGE_MASK GENMASK(8, 6)
|
||||
#define UD_SIZE_BYTES 9
|
||||
#define UD_SIZE_BYTES_MASK GENMASK(18, 9)
|
||||
-#define ECC_PARITY_SIZE_BYTES_RS 19
|
||||
+#define ECC_PARITY_SIZE_BYTES_RS GENMASK(22, 19)
|
||||
#define SPARE_SIZE_BYTES 23
|
||||
#define SPARE_SIZE_BYTES_MASK GENMASK(26, 23)
|
||||
#define NUM_ADDR_CYCLES 27
|
||||
-#define STATUS_BFR_READ 30
|
||||
-#define SET_RD_MODE_AFTER_STATUS 31
|
||||
+#define NUM_ADDR_CYCLES_MASK GENMASK(29, 27)
|
||||
+#define STATUS_BFR_READ BIT(30)
|
||||
+#define SET_RD_MODE_AFTER_STATUS BIT(31)
|
||||
|
||||
/* NAND_DEVn_CFG0 bits */
|
||||
-#define DEV0_CFG1_ECC_DISABLE 0
|
||||
-#define WIDE_FLASH 1
|
||||
+#define DEV0_CFG1_ECC_DISABLE BIT(0)
|
||||
+#define WIDE_FLASH BIT(1)
|
||||
#define NAND_RECOVERY_CYCLES 2
|
||||
-#define CS_ACTIVE_BSY 5
|
||||
+#define NAND_RECOVERY_CYCLES_MASK GENMASK(4, 2)
|
||||
+#define CS_ACTIVE_BSY BIT(5)
|
||||
#define BAD_BLOCK_BYTE_NUM 6
|
||||
-#define BAD_BLOCK_IN_SPARE_AREA 16
|
||||
+#define BAD_BLOCK_BYTE_NUM_MASK GENMASK(15, 6)
|
||||
+#define BAD_BLOCK_IN_SPARE_AREA BIT(16)
|
||||
#define WR_RD_BSY_GAP 17
|
||||
-#define ENABLE_BCH_ECC 27
|
||||
+#define WR_RD_BSY_GAP_MASK GENMASK(22, 17)
|
||||
+#define ENABLE_BCH_ECC BIT(27)
|
||||
|
||||
/* NAND_DEV0_ECC_CFG bits */
|
||||
-#define ECC_CFG_ECC_DISABLE 0
|
||||
-#define ECC_SW_RESET 1
|
||||
+#define ECC_CFG_ECC_DISABLE BIT(0)
|
||||
+#define ECC_SW_RESET BIT(1)
|
||||
#define ECC_MODE 4
|
||||
+#define ECC_MODE_MASK GENMASK(5, 4)
|
||||
#define ECC_PARITY_SIZE_BYTES_BCH 8
|
||||
+#define ECC_PARITY_SIZE_BYTES_BCH_MASK GENMASK(12, 8)
|
||||
#define ECC_NUM_DATA_BYTES 16
|
||||
#define ECC_NUM_DATA_BYTES_MASK GENMASK(25, 16)
|
||||
-#define ECC_FORCE_CLK_OPEN 30
|
||||
+#define ECC_FORCE_CLK_OPEN BIT(30)
|
||||
|
||||
/* NAND_DEV_CMD1 bits */
|
||||
#define READ_ADDR 0
|
||||
@ -0,0 +1,64 @@
|
||||
From 9d4ffbcfde283f2a87ea45128ddf7e6651facdd9 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Fri, 7 Feb 2025 20:42:38 +0100
|
||||
Subject: [PATCH] mtd: rawnand: qcom: fix broken config in
|
||||
qcom_param_page_type_exec
|
||||
|
||||
Fix broken config in qcom_param_page_type_exec caused by copy-paste error
|
||||
from commit 0c08080fd71c ("mtd: rawnand: qcom: use FIELD_PREP and GENMASK")
|
||||
|
||||
In qcom_param_page_type_exec the value needs to be set to
|
||||
nandc->regs->cfg0 instead of host->cfg0. This wrong configuration caused
|
||||
the Qcom NANDC driver to malfunction on any device that makes use of it
|
||||
(IPQ806x, IPQ40xx, IPQ807x, IPQ60xx) with the following error:
|
||||
|
||||
[ 0.885369] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xaa
|
||||
[ 0.885909] nand: Micron NAND 256MiB 1,8V 8-bit
|
||||
[ 0.892499] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
|
||||
[ 0.896823] nand: ECC (step, strength) = (512, 8) does not fit in OOB
|
||||
[ 0.896836] qcom-nandc 79b0000.nand-controller: No valid ECC settings possible
|
||||
[ 0.910996] bam-dma-engine 7984000.dma-controller: Cannot free busy channel
|
||||
[ 0.918070] qcom-nandc: probe of 79b0000.nand-controller failed with error -28
|
||||
|
||||
Restore original configuration fix the problem and makes the driver work
|
||||
again.
|
||||
|
||||
Cc: stable@vger.kernel.org
|
||||
Fixes: 0c08080fd71c ("mtd: rawnand: qcom: use FIELD_PREP and GENMASK")
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
drivers/mtd/nand/raw/qcom_nandc.c | 24 ++++++++++++------------
|
||||
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/nand/raw/qcom_nandc.c
|
||||
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
|
||||
@@ -1881,18 +1881,18 @@ static int qcom_param_page_type_exec(str
|
||||
nandc->regs->addr0 = 0;
|
||||
nandc->regs->addr1 = 0;
|
||||
|
||||
- host->cfg0 = FIELD_PREP(CW_PER_PAGE_MASK, 0) |
|
||||
- FIELD_PREP(UD_SIZE_BYTES_MASK, 512) |
|
||||
- FIELD_PREP(NUM_ADDR_CYCLES_MASK, 5) |
|
||||
- FIELD_PREP(SPARE_SIZE_BYTES_MASK, 0);
|
||||
+ nandc->regs->cfg0 = FIELD_PREP(CW_PER_PAGE_MASK, 0) |
|
||||
+ FIELD_PREP(UD_SIZE_BYTES_MASK, 512) |
|
||||
+ FIELD_PREP(NUM_ADDR_CYCLES_MASK, 5) |
|
||||
+ FIELD_PREP(SPARE_SIZE_BYTES_MASK, 0);
|
||||
|
||||
- host->cfg1 = FIELD_PREP(NAND_RECOVERY_CYCLES_MASK, 7) |
|
||||
- FIELD_PREP(BAD_BLOCK_BYTE_NUM_MASK, 17) |
|
||||
- FIELD_PREP(CS_ACTIVE_BSY, 0) |
|
||||
- FIELD_PREP(BAD_BLOCK_IN_SPARE_AREA, 1) |
|
||||
- FIELD_PREP(WR_RD_BSY_GAP_MASK, 2) |
|
||||
- FIELD_PREP(WIDE_FLASH, 0) |
|
||||
- FIELD_PREP(DEV0_CFG1_ECC_DISABLE, 1);
|
||||
+ nandc->regs->cfg1 = FIELD_PREP(NAND_RECOVERY_CYCLES_MASK, 7) |
|
||||
+ FIELD_PREP(BAD_BLOCK_BYTE_NUM_MASK, 17) |
|
||||
+ FIELD_PREP(CS_ACTIVE_BSY, 0) |
|
||||
+ FIELD_PREP(BAD_BLOCK_IN_SPARE_AREA, 1) |
|
||||
+ FIELD_PREP(WR_RD_BSY_GAP_MASK, 2) |
|
||||
+ FIELD_PREP(WIDE_FLASH, 0) |
|
||||
+ FIELD_PREP(DEV0_CFG1_ECC_DISABLE, 1);
|
||||
|
||||
if (!nandc->props->qpic_version2)
|
||||
nandc->regs->ecc_buf_cfg = cpu_to_le32(ECC_CFG_ECC_DISABLE);
|
||||
@ -0,0 +1,77 @@
|
||||
From b9371866799d67a80be0ea9e01bd41987db22f26 Mon Sep 17 00:00:00 2001
|
||||
From: Md Sadre Alam <quic_mdalam@quicinc.com>
|
||||
Date: Mon, 6 Jan 2025 18:45:58 +0530
|
||||
Subject: [PATCH] mtd: rawnand: qcom: Fix build issue on x86 architecture
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fix a buffer overflow issue in qcom_clear_bam_transaction by using
|
||||
struct_group to group related fields and avoid FORTIFY_SOURCE warnings.
|
||||
|
||||
On x86 architecture, the following error occurs due to warnings being
|
||||
treated as errors:
|
||||
|
||||
In function ‘fortify_memset_chk’,
|
||||
inlined from ‘qcom_clear_bam_transaction’ at
|
||||
drivers/mtd/nand/qpic_common.c:88:2:
|
||||
./include/linux/fortify-string.h:480:25: error: call to ‘__write_overflow_field’
|
||||
declared with attribute warning: detected write beyond size of field
|
||||
(1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
|
||||
480 | __write_overflow_field(p_size_field, size);
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
LD [M] drivers/mtd/nand/nandcore.o
|
||||
CC [M] drivers/w1/masters/mxc_w1.o
|
||||
cc1: all warnings being treated as errors
|
||||
|
||||
This patch addresses the issue by grouping the related fields in
|
||||
struct bam_transaction using struct_group and updating the memset call
|
||||
accordingly.
|
||||
|
||||
Fixes: 8c52932da5e6 ("mtd: rawnand: qcom: cleanup qcom_nandc driver")
|
||||
Signed-off-by: Md Sadre Alam <quic_mdalam@quicinc.com>
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
---
|
||||
drivers/mtd/nand/qpic_common.c | 2 +-
|
||||
include/linux/mtd/nand-qpic-common.h | 19 +++++++++++--------
|
||||
2 files changed, 12 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/nand/qpic_common.c
|
||||
+++ b/drivers/mtd/nand/qpic_common.c
|
||||
@@ -85,7 +85,7 @@ void qcom_clear_bam_transaction(struct q
|
||||
if (!nandc->props->supports_bam)
|
||||
return;
|
||||
|
||||
- memset(&bam_txn->bam_ce_pos, 0, sizeof(u32) * 8);
|
||||
+ memset(&bam_txn->bam_positions, 0, sizeof(bam_txn->bam_positions));
|
||||
bam_txn->last_data_desc = NULL;
|
||||
|
||||
sg_init_table(bam_txn->cmd_sgl, nandc->max_cwperpage *
|
||||
--- a/include/linux/mtd/nand-qpic-common.h
|
||||
+++ b/include/linux/mtd/nand-qpic-common.h
|
||||
@@ -254,14 +254,17 @@ struct bam_transaction {
|
||||
struct dma_async_tx_descriptor *last_data_desc;
|
||||
struct dma_async_tx_descriptor *last_cmd_desc;
|
||||
struct completion txn_done;
|
||||
- u32 bam_ce_pos;
|
||||
- u32 bam_ce_start;
|
||||
- u32 cmd_sgl_pos;
|
||||
- u32 cmd_sgl_start;
|
||||
- u32 tx_sgl_pos;
|
||||
- u32 tx_sgl_start;
|
||||
- u32 rx_sgl_pos;
|
||||
- u32 rx_sgl_start;
|
||||
+ struct_group(bam_positions,
|
||||
+ u32 bam_ce_pos;
|
||||
+ u32 bam_ce_start;
|
||||
+ u32 cmd_sgl_pos;
|
||||
+ u32 cmd_sgl_start;
|
||||
+ u32 tx_sgl_pos;
|
||||
+ u32 tx_sgl_start;
|
||||
+ u32 rx_sgl_pos;
|
||||
+ u32 rx_sgl_start;
|
||||
+
|
||||
+ );
|
||||
};
|
||||
|
||||
/*
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
From cf1ba3cb245020459f2ca446b7a7b199839f5d83 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Carpenter <dan.carpenter@linaro.org>
|
||||
Date: Thu, 6 Mar 2025 12:40:01 +0300
|
||||
Subject: [PATCH] spi: spi-qpic-snand: Fix ECC_CFG_ECC_DISABLE shift in
|
||||
qcom_spi_read_last_cw()
|
||||
|
||||
The ECC_CFG_ECC_DISABLE define is BIT(0). It's supposed to be used
|
||||
directly instead of used as a shifter.
|
||||
|
||||
Fixes: 7304d1909080 ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
|
||||
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
|
||||
Link: https://patch.msgid.link/2f4b0a0b-2c03-41c0-8a4a-3d789a83832d@stanley.mountain
|
||||
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||||
---
|
||||
drivers/spi/spi-qpic-snand.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/spi/spi-qpic-snand.c
|
||||
+++ b/drivers/spi/spi-qpic-snand.c
|
||||
@@ -514,7 +514,7 @@ static int qcom_spi_read_last_cw(struct
|
||||
cfg0 = (ecc_cfg->cfg0_raw & ~(7U << CW_PER_PAGE)) |
|
||||
0 << CW_PER_PAGE;
|
||||
cfg1 = ecc_cfg->cfg1_raw;
|
||||
- ecc_bch_cfg = 1 << ECC_CFG_ECC_DISABLE;
|
||||
+ ecc_bch_cfg = ECC_CFG_ECC_DISABLE;
|
||||
|
||||
snandc->regs->cmd = snandc->qspi->cmd;
|
||||
snandc->regs->cfg0 = cpu_to_le32(cfg0);
|
||||
@ -0,0 +1,35 @@
|
||||
From d450cdd9c4398add1f2aa7200f2c95f1e3b9f9fa Mon Sep 17 00:00:00 2001
|
||||
From: Gabor Juhos <j4g8y7@gmail.com>
|
||||
Date: Thu, 13 Mar 2025 19:31:21 +0100
|
||||
Subject: [PATCH] spi: spi-qpic-snand: avoid memleak in
|
||||
qcom_spi_ecc_init_ctx_pipelined()
|
||||
|
||||
When the allocation of the OOB buffer fails, the
|
||||
qcom_spi_ecc_init_ctx_pipelined() function returns without freeing
|
||||
the memory allocated for 'ecc_cfg' thus it can cause a memory leak.
|
||||
|
||||
Call kfree() to free 'ecc_cfg' before returning from the function
|
||||
to avoid that.
|
||||
|
||||
Fixes: 7304d1909080 ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
|
||||
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
|
||||
Link: https://patch.msgid.link/20250313-qpic-snand-memleak-fix-v1-1-e54e78d1da3a@gmail.com
|
||||
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||||
---
|
||||
drivers/spi/spi-qpic-snand.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/spi/spi-qpic-snand.c
|
||||
+++ b/drivers/spi/spi-qpic-snand.c
|
||||
@@ -263,8 +263,10 @@ static int qcom_spi_ecc_init_ctx_pipelin
|
||||
return -ENOMEM;
|
||||
snandc->qspi->oob_buf = kzalloc(mtd->writesize + mtd->oobsize,
|
||||
GFP_KERNEL);
|
||||
- if (!snandc->qspi->oob_buf)
|
||||
+ if (!snandc->qspi->oob_buf) {
|
||||
+ kfree(ecc_cfg);
|
||||
return -ENOMEM;
|
||||
+ }
|
||||
|
||||
memset(snandc->qspi->oob_buf, 0xff, mtd->writesize + mtd->oobsize);
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
From d32c4e58545f17caaa854415f854691e32d42075 Mon Sep 17 00:00:00 2001
|
||||
From: Geert Uytterhoeven <geert+renesas@glider.be>
|
||||
Date: Wed, 26 Mar 2025 15:22:19 +0100
|
||||
Subject: [PATCH] spi: SPI_QPIC_SNAND should be tristate and depend on MTD
|
||||
|
||||
SPI_QPIC_SNAND is the only driver that selects MTD instead of depending
|
||||
on it, which could lead to circular dependencies. Moreover, as
|
||||
SPI_QPIC_SNAND is bool, this forces MTD (and various related symbols) to
|
||||
be built-in, as can be seen in an allmodconfig kernel.
|
||||
|
||||
Except for a missing semicolon, there is no reason why SPI_QPIC_SNAND
|
||||
cannot be tristate; all MODULE_*() boilerplate is already present.
|
||||
Hence make SPI_QPIC_SNAND tristate, let it depend on MTD, and add the
|
||||
missing semicolon.
|
||||
|
||||
Fixes: 7304d1909080ef0c ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
|
||||
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
|
||||
Link: https://patch.msgid.link/b63db431cbf35223a4400e44c296293d32c4543c.1742998909.git.geert+renesas@glider.be
|
||||
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||||
---
|
||||
drivers/spi/Kconfig | 4 ++--
|
||||
drivers/spi/spi-qpic-snand.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/spi/Kconfig
|
||||
+++ b/drivers/spi/Kconfig
|
||||
@@ -899,9 +899,9 @@ config SPI_QCOM_QSPI
|
||||
QSPI(Quad SPI) driver for Qualcomm QSPI controller.
|
||||
|
||||
config SPI_QPIC_SNAND
|
||||
- bool "QPIC SNAND controller"
|
||||
+ tristate "QPIC SNAND controller"
|
||||
depends on ARCH_QCOM || COMPILE_TEST
|
||||
- select MTD
|
||||
+ depends on MTD
|
||||
help
|
||||
QPIC_SNAND (QPIC SPI NAND) driver for Qualcomm QPIC controller.
|
||||
QPIC controller supports both parallel nand and serial nand.
|
||||
--- a/drivers/spi/spi-qpic-snand.c
|
||||
+++ b/drivers/spi/spi-qpic-snand.c
|
||||
@@ -1614,7 +1614,7 @@ static const struct of_device_id qcom_sn
|
||||
.data = &ipq9574_snandc_props,
|
||||
},
|
||||
{}
|
||||
-}
|
||||
+};
|
||||
MODULE_DEVICE_TABLE(of, qcom_snandc_of_match);
|
||||
|
||||
static struct platform_driver qcom_spi_driver = {
|
||||
@ -0,0 +1,29 @@
|
||||
From f48d80503504257682e493dc17408f2f0b47bcfa Mon Sep 17 00:00:00 2001
|
||||
From: Gabor Juhos <j4g8y7@gmail.com>
|
||||
Date: Thu, 20 Mar 2025 19:11:59 +0100
|
||||
Subject: [PATCH] spi: spi-qpic-snand: use kmalloc() for OOB buffer allocation
|
||||
|
||||
The qcom_spi_ecc_init_ctx_pipelined() function allocates zeroed
|
||||
memory for the OOB buffer, then it fills the buffer with '0xff'
|
||||
bytes right after the allocation. In this case zeroing the memory
|
||||
during allocation is superfluous, so use kmalloc() instead of
|
||||
kzalloc() to avoid that.
|
||||
|
||||
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
|
||||
Link: https://patch.msgid.link/20250320-qpic-snand-kmalloc-v1-1-94e267550675@gmail.com
|
||||
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||||
---
|
||||
drivers/spi/spi-qpic-snand.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/spi/spi-qpic-snand.c
|
||||
+++ b/drivers/spi/spi-qpic-snand.c
|
||||
@@ -261,7 +261,7 @@ static int qcom_spi_ecc_init_ctx_pipelin
|
||||
ecc_cfg = kzalloc(sizeof(*ecc_cfg), GFP_KERNEL);
|
||||
if (!ecc_cfg)
|
||||
return -ENOMEM;
|
||||
- snandc->qspi->oob_buf = kzalloc(mtd->writesize + mtd->oobsize,
|
||||
+ snandc->qspi->oob_buf = kmalloc(mtd->writesize + mtd->oobsize,
|
||||
GFP_KERNEL);
|
||||
if (!snandc->qspi->oob_buf) {
|
||||
kfree(ecc_cfg);
|
||||
@ -0,0 +1,157 @@
|
||||
From 952d7325362ffbefa6ce5619fb4e53c2159ec7a7 Mon Sep 17 00:00:00 2001
|
||||
From: Qingfang Deng <dqfext@gmail.com>
|
||||
Date: Mon, 17 Feb 2025 17:40:21 +0800
|
||||
Subject: [PATCH] net: ethernet: mediatek: add EEE support
|
||||
|
||||
Add EEE support to MediaTek SoC Ethernet. The register fields are
|
||||
similar to the ones in MT7531, except that the LPI threshold is in
|
||||
milliseconds.
|
||||
|
||||
Signed-off-by: Qingfang Deng <dqfext@gmail.com>
|
||||
---
|
||||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 64 +++++++++++++++++++++
|
||||
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 11 ++++
|
||||
2 files changed, 75 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -786,6 +786,7 @@ static void mtk_mac_link_up(struct phyli
|
||||
|
||||
mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
||||
mcr &= ~(MAC_MCR_SPEED_100 | MAC_MCR_SPEED_1000 |
|
||||
+ MAC_MCR_EEE100M | MAC_MCR_EEE1G |
|
||||
MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC |
|
||||
MAC_MCR_FORCE_RX_FC);
|
||||
|
||||
@@ -811,6 +812,15 @@ static void mtk_mac_link_up(struct phyli
|
||||
if (rx_pause)
|
||||
mcr |= MAC_MCR_FORCE_RX_FC;
|
||||
|
||||
+ if (mode == MLO_AN_PHY && phy && mac->tx_lpi_enabled && phy_init_eee(phy, false) >= 0) {
|
||||
+ mcr |= MAC_MCR_EEE100M | MAC_MCR_EEE1G;
|
||||
+ mtk_w32(mac->hw,
|
||||
+ FIELD_PREP(MAC_EEE_WAKEUP_TIME_1000, 17) |
|
||||
+ FIELD_PREP(MAC_EEE_WAKEUP_TIME_100, 36) |
|
||||
+ FIELD_PREP(MAC_EEE_LPI_TXIDLE_THD, mac->txidle_thd_ms),
|
||||
+ MTK_MAC_EEECR(mac->id));
|
||||
+ }
|
||||
+
|
||||
mcr |= MAC_MCR_TX_EN | MAC_MCR_RX_EN | MAC_MCR_FORCE_LINK;
|
||||
mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
|
||||
}
|
||||
@@ -4485,6 +4495,61 @@ static int mtk_set_pauseparam(struct net
|
||||
return phylink_ethtool_set_pauseparam(mac->phylink, pause);
|
||||
}
|
||||
|
||||
+static int mtk_get_eee(struct net_device *dev, struct ethtool_eee *eee)
|
||||
+{
|
||||
+ struct mtk_mac *mac = netdev_priv(dev);
|
||||
+ u32 reg;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = phylink_ethtool_get_eee(mac->phylink, eee);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ reg = mtk_r32(mac->hw, MTK_MAC_EEECR(mac->id));
|
||||
+ eee->tx_lpi_enabled = mac->tx_lpi_enabled;
|
||||
+ eee->tx_lpi_timer = FIELD_GET(MAC_EEE_LPI_TXIDLE_THD, reg) * 1000;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mtk_set_eee(struct net_device *dev, struct ethtool_eee *eee)
|
||||
+{
|
||||
+ struct mtk_mac *mac = netdev_priv(dev);
|
||||
+ u32 txidle_thd_ms, reg;
|
||||
+ int ret;
|
||||
+
|
||||
+ /* Tx idle timer in ms */
|
||||
+ txidle_thd_ms = DIV_ROUND_UP(eee->tx_lpi_timer, 1000);
|
||||
+ if (!FIELD_FIT(MAC_EEE_LPI_TXIDLE_THD, txidle_thd_ms))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ reg = FIELD_PREP(MAC_EEE_LPI_TXIDLE_THD, txidle_thd_ms);
|
||||
+
|
||||
+ /* PHY Wake-up time, this field does not have a reset value, so use the
|
||||
+ * reset value from MT7531 (36us for 100BaseT and 17us for 1000BaseT).
|
||||
+ */
|
||||
+ reg |= FIELD_PREP(MAC_EEE_WAKEUP_TIME_1000, 17) |
|
||||
+ FIELD_PREP(MAC_EEE_WAKEUP_TIME_100, 36);
|
||||
+
|
||||
+ if (!txidle_thd_ms)
|
||||
+ /* Force LPI Mode without a delay */
|
||||
+ reg |= MAC_EEE_LPI_MODE;
|
||||
+
|
||||
+ ret = phylink_ethtool_set_eee(mac->phylink, eee);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ mac->tx_lpi_enabled = eee->tx_lpi_enabled;
|
||||
+ mac->txidle_thd_ms = txidle_thd_ms;
|
||||
+ mtk_w32(mac->hw, reg, MTK_MAC_EEECR(mac->id));
|
||||
+ if (eee->eee_enabled && eee->eee_active && eee->tx_lpi_enabled)
|
||||
+ mtk_m32(mac->hw, 0, MAC_MCR_EEE100M | MAC_MCR_EEE1G, MTK_MAC_MCR(mac->id));
|
||||
+ else
|
||||
+ mtk_m32(mac->hw, MAC_MCR_EEE100M | MAC_MCR_EEE1G, 0, MTK_MAC_MCR(mac->id));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb,
|
||||
struct net_device *sb_dev)
|
||||
{
|
||||
@@ -4517,6 +4582,8 @@ static const struct ethtool_ops mtk_etht
|
||||
.set_pauseparam = mtk_set_pauseparam,
|
||||
.get_rxnfc = mtk_get_rxnfc,
|
||||
.set_rxnfc = mtk_set_rxnfc,
|
||||
+ .get_eee = mtk_get_eee,
|
||||
+ .set_eee = mtk_set_eee,
|
||||
};
|
||||
|
||||
static const struct net_device_ops mtk_netdev_ops = {
|
||||
@@ -4577,6 +4644,8 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||
}
|
||||
mac = netdev_priv(eth->netdev[id]);
|
||||
eth->mac[id] = mac;
|
||||
+ mac->tx_lpi_enabled = true;
|
||||
+ mac->txidle_thd_ms = 1;
|
||||
mac->id = id;
|
||||
mac->hw = eth;
|
||||
mac->of_node = np;
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||
@@ -453,6 +453,8 @@
|
||||
#define MAC_MCR_RX_FIFO_CLR_DIS BIT(12)
|
||||
#define MAC_MCR_BACKOFF_EN BIT(9)
|
||||
#define MAC_MCR_BACKPR_EN BIT(8)
|
||||
+#define MAC_MCR_EEE1G BIT(7)
|
||||
+#define MAC_MCR_EEE100M BIT(6)
|
||||
#define MAC_MCR_FORCE_RX_FC BIT(5)
|
||||
#define MAC_MCR_FORCE_TX_FC BIT(4)
|
||||
#define MAC_MCR_SPEED_1000 BIT(3)
|
||||
@@ -461,6 +463,15 @@
|
||||
#define MAC_MCR_FORCE_LINK BIT(0)
|
||||
#define MAC_MCR_FORCE_LINK_DOWN (MAC_MCR_FORCE_MODE)
|
||||
|
||||
+/* Mac EEE control registers */
|
||||
+#define MTK_MAC_EEECR(x) (0x10104 + (x * 0x100))
|
||||
+#define MAC_EEE_WAKEUP_TIME_1000 GENMASK(31, 24)
|
||||
+#define MAC_EEE_WAKEUP_TIME_100 GENMASK(23, 16)
|
||||
+#define MAC_EEE_LPI_TXIDLE_THD GENMASK(15, 8)
|
||||
+#define MAC_EEE_CKG_TXIDLE BIT(3)
|
||||
+#define MAC_EEE_CKG_RXLPI BIT(2)
|
||||
+#define MAC_EEE_LPI_MODE BIT(0)
|
||||
+
|
||||
/* Mac status registers */
|
||||
#define MTK_MAC_MSR(x) (0x10108 + (x * 0x100))
|
||||
#define MAC_MSR_EEE1G BIT(7)
|
||||
@@ -1308,6 +1319,8 @@ struct mtk_mac {
|
||||
int id;
|
||||
phy_interface_t interface;
|
||||
u8 ppe_idx;
|
||||
+ bool tx_lpi_enabled;
|
||||
+ u8 txidle_thd_ms;
|
||||
int speed;
|
||||
struct device_node *of_node;
|
||||
struct phylink *phylink;
|
||||
@ -0,0 +1,33 @@
|
||||
From 854d71c555dfc3383c1fde7d9989b6046e21093d Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 9 Oct 2024 07:48:05 +0200
|
||||
Subject: [PATCH] r8169: remove original workaround for RTL8125 broken rx issue
|
||||
|
||||
Now that we have b9c7ac4fe22c ("r8169: disable ALDPS per default for
|
||||
RTL8125"), the first attempt to fix the issue shouldn't be needed
|
||||
any longer. So let's effectively revert 621735f59064 ("r8169: fix
|
||||
rare issue with broken rx after link-down on RTL8125") and see
|
||||
whether anybody complains.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/382d8c88-cbce-400f-ad62-fda0181c7e38@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -4777,11 +4777,7 @@ static void r8169_phylink_handler(struct
|
||||
if (netif_carrier_ok(ndev)) {
|
||||
rtl_link_chg_patch(tp);
|
||||
pm_request_resume(d);
|
||||
- netif_wake_queue(tp->dev);
|
||||
} else {
|
||||
- /* In few cases rx is broken after link-down otherwise */
|
||||
- if (rtl_is_8125(tp))
|
||||
- rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE);
|
||||
pm_runtime_idle(d);
|
||||
}
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
From b8bf38440ba94e8ed8e2ae55c5dfb0276d30e843 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 10 Oct 2024 12:58:02 +0200
|
||||
Subject: [PATCH] r8169: enable SG/TSO on selected chip versions per default
|
||||
|
||||
Due to problem reports in the past SG and TSO/TSO6 are disabled per
|
||||
default. It's not fully clear which chip versions are affected, so we
|
||||
may impact also users of unaffected chip versions, unless they know
|
||||
how to use ethtool for enabling SG/TSO/TSO6.
|
||||
Vendor drivers r8168/r8125 enable SG/TSO/TSO6 for selected chip
|
||||
versions per default, I'd interpret this as confirmation that these
|
||||
chip versions are unaffected. So let's do the same here.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 16 +++++++++++-----
|
||||
1 file changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -5489,11 +5489,6 @@ static int rtl_init_one(struct pci_dev *
|
||||
|
||||
dev->features |= dev->hw_features;
|
||||
|
||||
- /* There has been a number of reports that using SG/TSO results in
|
||||
- * tx timeouts. However for a lot of people SG/TSO works fine.
|
||||
- * Therefore disable both features by default, but allow users to
|
||||
- * enable them. Use at own risk!
|
||||
- */
|
||||
if (rtl_chip_supports_csum_v2(tp)) {
|
||||
dev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6;
|
||||
netif_set_tso_max_size(dev, RTL_GSO_MAX_SIZE_V2);
|
||||
@@ -5504,6 +5499,17 @@ static int rtl_init_one(struct pci_dev *
|
||||
netif_set_tso_max_segs(dev, RTL_GSO_MAX_SEGS_V1);
|
||||
}
|
||||
|
||||
+ /* There has been a number of reports that using SG/TSO results in
|
||||
+ * tx timeouts. However for a lot of people SG/TSO works fine.
|
||||
+ * It's not fully clear which chip versions are affected. Vendor
|
||||
+ * drivers enable SG/TSO for certain chip versions per default,
|
||||
+ * let's mimic this here. On other chip versions users can
|
||||
+ * use ethtool to enable SG/TSO, use at own risk!
|
||||
+ */
|
||||
+ if (tp->mac_version >= RTL_GIGA_MAC_VER_46 &&
|
||||
+ tp->mac_version != RTL_GIGA_MAC_VER_61)
|
||||
+ dev->features |= dev->hw_features;
|
||||
+
|
||||
dev->hw_features |= NETIF_F_RXALL;
|
||||
dev->hw_features |= NETIF_F_RXFCS;
|
||||
|
||||
@ -0,0 +1,130 @@
|
||||
From e3fc5139bd8ffaa1498adc21be4e8ecbc6aed508 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Sun, 13 Oct 2024 11:17:39 +0200
|
||||
Subject: [PATCH] r8169: implement additional ethtool stats ops
|
||||
|
||||
This adds support for ethtool standard statistics, and makes use of the
|
||||
extended hardware statistics being available from RTl8125.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/58e0da73-a7dd-4be3-82ae-d5b3f9069bde@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 82 +++++++++++++++++++++++
|
||||
1 file changed, 82 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -2160,6 +2160,19 @@ static void rtl8169_get_ringparam(struct
|
||||
data->tx_pending = NUM_TX_DESC;
|
||||
}
|
||||
|
||||
+static void rtl8169_get_pause_stats(struct net_device *dev,
|
||||
+ struct ethtool_pause_stats *pause_stats)
|
||||
+{
|
||||
+ struct rtl8169_private *tp = netdev_priv(dev);
|
||||
+
|
||||
+ if (!rtl_is_8125(tp))
|
||||
+ return;
|
||||
+
|
||||
+ rtl8169_update_counters(tp);
|
||||
+ pause_stats->tx_pause_frames = le32_to_cpu(tp->counters->tx_pause_on);
|
||||
+ pause_stats->rx_pause_frames = le32_to_cpu(tp->counters->rx_pause_on);
|
||||
+}
|
||||
+
|
||||
static void rtl8169_get_pauseparam(struct net_device *dev,
|
||||
struct ethtool_pauseparam *data)
|
||||
{
|
||||
@@ -2186,6 +2199,69 @@ static int rtl8169_set_pauseparam(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void rtl8169_get_eth_mac_stats(struct net_device *dev,
|
||||
+ struct ethtool_eth_mac_stats *mac_stats)
|
||||
+{
|
||||
+ struct rtl8169_private *tp = netdev_priv(dev);
|
||||
+
|
||||
+ rtl8169_update_counters(tp);
|
||||
+
|
||||
+ mac_stats->FramesTransmittedOK =
|
||||
+ le64_to_cpu(tp->counters->tx_packets);
|
||||
+ mac_stats->SingleCollisionFrames =
|
||||
+ le32_to_cpu(tp->counters->tx_one_collision);
|
||||
+ mac_stats->MultipleCollisionFrames =
|
||||
+ le32_to_cpu(tp->counters->tx_multi_collision);
|
||||
+ mac_stats->FramesReceivedOK =
|
||||
+ le64_to_cpu(tp->counters->rx_packets);
|
||||
+ mac_stats->AlignmentErrors =
|
||||
+ le16_to_cpu(tp->counters->align_errors);
|
||||
+ mac_stats->FramesLostDueToIntMACXmitError =
|
||||
+ le64_to_cpu(tp->counters->tx_errors);
|
||||
+ mac_stats->BroadcastFramesReceivedOK =
|
||||
+ le64_to_cpu(tp->counters->rx_broadcast);
|
||||
+ mac_stats->MulticastFramesReceivedOK =
|
||||
+ le32_to_cpu(tp->counters->rx_multicast);
|
||||
+
|
||||
+ if (!rtl_is_8125(tp))
|
||||
+ return;
|
||||
+
|
||||
+ mac_stats->AlignmentErrors =
|
||||
+ le32_to_cpu(tp->counters->align_errors32);
|
||||
+ mac_stats->OctetsTransmittedOK =
|
||||
+ le64_to_cpu(tp->counters->tx_octets);
|
||||
+ mac_stats->LateCollisions =
|
||||
+ le32_to_cpu(tp->counters->tx_late_collision);
|
||||
+ mac_stats->FramesAbortedDueToXSColls =
|
||||
+ le32_to_cpu(tp->counters->tx_aborted32);
|
||||
+ mac_stats->OctetsReceivedOK =
|
||||
+ le64_to_cpu(tp->counters->rx_octets);
|
||||
+ mac_stats->FramesLostDueToIntMACRcvError =
|
||||
+ le32_to_cpu(tp->counters->rx_mac_error);
|
||||
+ mac_stats->MulticastFramesXmittedOK =
|
||||
+ le64_to_cpu(tp->counters->tx_multicast64);
|
||||
+ mac_stats->BroadcastFramesXmittedOK =
|
||||
+ le64_to_cpu(tp->counters->tx_broadcast64);
|
||||
+ mac_stats->MulticastFramesReceivedOK =
|
||||
+ le64_to_cpu(tp->counters->rx_multicast64);
|
||||
+ mac_stats->FrameTooLongErrors =
|
||||
+ le32_to_cpu(tp->counters->rx_frame_too_long);
|
||||
+}
|
||||
+
|
||||
+static void rtl8169_get_eth_ctrl_stats(struct net_device *dev,
|
||||
+ struct ethtool_eth_ctrl_stats *ctrl_stats)
|
||||
+{
|
||||
+ struct rtl8169_private *tp = netdev_priv(dev);
|
||||
+
|
||||
+ if (!rtl_is_8125(tp))
|
||||
+ return;
|
||||
+
|
||||
+ rtl8169_update_counters(tp);
|
||||
+
|
||||
+ ctrl_stats->UnsupportedOpcodesReceived =
|
||||
+ le32_to_cpu(tp->counters->rx_unknown_opcode);
|
||||
+}
|
||||
+
|
||||
static const struct ethtool_ops rtl8169_ethtool_ops = {
|
||||
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
|
||||
ETHTOOL_COALESCE_MAX_FRAMES,
|
||||
@@ -2207,8 +2283,11 @@ static const struct ethtool_ops rtl8169_
|
||||
.get_link_ksettings = phy_ethtool_get_link_ksettings,
|
||||
.set_link_ksettings = phy_ethtool_set_link_ksettings,
|
||||
.get_ringparam = rtl8169_get_ringparam,
|
||||
+ .get_pause_stats = rtl8169_get_pause_stats,
|
||||
.get_pauseparam = rtl8169_get_pauseparam,
|
||||
.set_pauseparam = rtl8169_set_pauseparam,
|
||||
+ .get_eth_mac_stats = rtl8169_get_eth_mac_stats,
|
||||
+ .get_eth_ctrl_stats = rtl8169_get_eth_ctrl_stats,
|
||||
};
|
||||
|
||||
static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii)
|
||||
@@ -3893,6 +3972,9 @@ static void rtl_hw_start_8125(struct rtl
|
||||
break;
|
||||
}
|
||||
|
||||
+ /* enable extended tally counter */
|
||||
+ r8168_mac_ocp_modify(tp, 0xea84, 0, BIT(1) | BIT(0));
|
||||
+
|
||||
rtl_hw_config(tp);
|
||||
}
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
From ac48430368c1a4f4e6c2fa92243b4b93fd25bee4 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 16 Oct 2024 22:05:57 +0200
|
||||
Subject: [PATCH] r8169: don't take RTNL lock in rtl_task()
|
||||
|
||||
There's not really a benefit here in taking the RTNL lock. The task
|
||||
handler does exception handling only, so we're in trouble anyway when
|
||||
we come here, and there's no need to protect against e.g. a parallel
|
||||
ethtool call.
|
||||
A benefit of removing the RTNL lock here is that we now can
|
||||
synchronously cancel the workqueue from a context holding the RTNL mutex.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -4800,10 +4800,8 @@ static void rtl_task(struct work_struct
|
||||
container_of(work, struct rtl8169_private, wk.work);
|
||||
int ret;
|
||||
|
||||
- rtnl_lock();
|
||||
-
|
||||
if (!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
|
||||
- goto out_unlock;
|
||||
+ return;
|
||||
|
||||
if (test_and_clear_bit(RTL_FLAG_TASK_TX_TIMEOUT, tp->wk.flags)) {
|
||||
/* if chip isn't accessible, reset bus to revive it */
|
||||
@@ -4812,7 +4810,7 @@ static void rtl_task(struct work_struct
|
||||
if (ret < 0) {
|
||||
netdev_err(tp->dev, "Can't reset secondary PCI bus, detach NIC\n");
|
||||
netif_device_detach(tp->dev);
|
||||
- goto out_unlock;
|
||||
+ return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4831,8 +4829,6 @@ reset:
|
||||
} else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) {
|
||||
rtl_reset_work(tp);
|
||||
}
|
||||
-out_unlock:
|
||||
- rtnl_unlock();
|
||||
}
|
||||
|
||||
static int rtl8169_poll(struct napi_struct *napi, int budget)
|
||||
@ -0,0 +1,41 @@
|
||||
From 1c105bacb160b5918e917ab811552b7be69fc69c Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 16 Oct 2024 22:29:39 +0200
|
||||
Subject: [PATCH] r8169: avoid duplicated messages if loading firmware fails
|
||||
and switch to warn level
|
||||
|
||||
In case of a problem with firmware loading we inform at the driver level,
|
||||
in addition the firmware load code itself issues warnings. Therefore
|
||||
switch to firmware_request_nowarn() to avoid duplicated error messages.
|
||||
In addition switch to warn level because the firmware is optional and
|
||||
typically just fixes compatibility issues.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Message-ID: <d9c5094c-89a6-40e2-b5fe-8df7df4624ef@gmail.com>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_firmware.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_firmware.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_firmware.c
|
||||
@@ -215,7 +215,7 @@ int rtl_fw_request_firmware(struct rtl_f
|
||||
{
|
||||
int rc;
|
||||
|
||||
- rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
|
||||
+ rc = firmware_request_nowarn(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
|
||||
if (rc < 0)
|
||||
goto out;
|
||||
|
||||
@@ -227,7 +227,7 @@ int rtl_fw_request_firmware(struct rtl_f
|
||||
|
||||
return 0;
|
||||
out:
|
||||
- dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
|
||||
- rtl_fw->fw_name, rc);
|
||||
+ dev_warn(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
|
||||
+ rtl_fw->fw_name, rc);
|
||||
return rc;
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
From d64113c6bb5ea5a70b7c9c3a6bcadef307638187 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 16 Oct 2024 22:31:10 +0200
|
||||
Subject: [PATCH] r8169: remove rtl_dash_loop_wait_high/low
|
||||
|
||||
Remove rtl_dash_loop_wait_high/low to simplify the code.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Message-ID: <fb8c490c-2d92-48f5-8bbf-1fc1f2ee1649@gmail.com>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 35 ++++++-----------------
|
||||
1 file changed, 8 insertions(+), 27 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -1346,40 +1346,19 @@ static void rtl8168ep_stop_cmac(struct r
|
||||
RTL_W8(tp, IBCR0, RTL_R8(tp, IBCR0) & ~0x01);
|
||||
}
|
||||
|
||||
-static void rtl_dash_loop_wait(struct rtl8169_private *tp,
|
||||
- const struct rtl_cond *c,
|
||||
- unsigned long usecs, int n, bool high)
|
||||
-{
|
||||
- if (!tp->dash_enabled)
|
||||
- return;
|
||||
- rtl_loop_wait(tp, c, usecs, n, high);
|
||||
-}
|
||||
-
|
||||
-static void rtl_dash_loop_wait_high(struct rtl8169_private *tp,
|
||||
- const struct rtl_cond *c,
|
||||
- unsigned long d, int n)
|
||||
-{
|
||||
- rtl_dash_loop_wait(tp, c, d, n, true);
|
||||
-}
|
||||
-
|
||||
-static void rtl_dash_loop_wait_low(struct rtl8169_private *tp,
|
||||
- const struct rtl_cond *c,
|
||||
- unsigned long d, int n)
|
||||
-{
|
||||
- rtl_dash_loop_wait(tp, c, d, n, false);
|
||||
-}
|
||||
-
|
||||
static void rtl8168dp_driver_start(struct rtl8169_private *tp)
|
||||
{
|
||||
r8168dp_oob_notify(tp, OOB_CMD_DRIVER_START);
|
||||
- rtl_dash_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10);
|
||||
+ if (tp->dash_enabled)
|
||||
+ rtl_loop_wait_high(tp, &rtl_dp_ocp_read_cond, 10000, 10);
|
||||
}
|
||||
|
||||
static void rtl8168ep_driver_start(struct rtl8169_private *tp)
|
||||
{
|
||||
r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_START);
|
||||
r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
|
||||
- rtl_dash_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30);
|
||||
+ if (tp->dash_enabled)
|
||||
+ rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30);
|
||||
}
|
||||
|
||||
static void rtl8168_driver_start(struct rtl8169_private *tp)
|
||||
@@ -1393,7 +1372,8 @@ static void rtl8168_driver_start(struct
|
||||
static void rtl8168dp_driver_stop(struct rtl8169_private *tp)
|
||||
{
|
||||
r8168dp_oob_notify(tp, OOB_CMD_DRIVER_STOP);
|
||||
- rtl_dash_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10);
|
||||
+ if (tp->dash_enabled)
|
||||
+ rtl_loop_wait_low(tp, &rtl_dp_ocp_read_cond, 10000, 10);
|
||||
}
|
||||
|
||||
static void rtl8168ep_driver_stop(struct rtl8169_private *tp)
|
||||
@@ -1401,7 +1381,8 @@ static void rtl8168ep_driver_stop(struct
|
||||
rtl8168ep_stop_cmac(tp);
|
||||
r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP);
|
||||
r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01);
|
||||
- rtl_dash_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
|
||||
+ if (tp->dash_enabled)
|
||||
+ rtl_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
|
||||
}
|
||||
|
||||
static void rtl8168_driver_stop(struct rtl8169_private *tp)
|
||||
@ -0,0 +1,28 @@
|
||||
From c4e64095c00cb2de413cd6b90be047c273bcd491 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 17 Oct 2024 22:27:44 +0200
|
||||
Subject: [PATCH] r8169: enable EEE at 2.5G per default on RTL8125B
|
||||
|
||||
Register a6d/12 is shadowing register MDIO_AN_EEE_ADV2. So this line
|
||||
disables advertisement of EEE at 2.5G. Latest vendor driver r8125
|
||||
doesn't do this (any longer?), so this mode seems to be safe.
|
||||
EEE saves quite some energy, therefore enable this mode per default.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Message-ID: <95dd5a0c-09ea-4847-94d9-b7aa3063e8ff@gmail.com>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_phy_config.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -99,7 +99,6 @@ static void rtl8125a_config_eee_phy(stru
|
||||
|
||||
static void rtl8125b_config_eee_phy(struct phy_device *phydev)
|
||||
{
|
||||
- phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000);
|
||||
phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000);
|
||||
phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000);
|
||||
phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000);
|
||||
@ -0,0 +1,143 @@
|
||||
From f75d1fbe7809bc5ed134204b920fd9e2fc5db1df Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 24 Oct 2024 22:42:33 +0200
|
||||
Subject: [PATCH] r8169: add support for RTL8125D
|
||||
|
||||
This adds support for new chip version RTL8125D, which can be found on
|
||||
boards like Gigabyte X870E AORUS ELITE WIFI7. Firmware rtl8125d-1.fw
|
||||
for this chip version is available in linux-firmware already.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/d0306912-e88e-4c25-8b5d-545ae8834c0c@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169.h | 1 +
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 23 +++++++++++++------
|
||||
.../net/ethernet/realtek/r8169_phy_config.c | 10 ++++++++
|
||||
3 files changed, 27 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169.h
|
||||
+++ b/drivers/net/ethernet/realtek/r8169.h
|
||||
@@ -68,6 +68,7 @@ enum mac_version {
|
||||
/* support for RTL_GIGA_MAC_VER_60 has been removed */
|
||||
RTL_GIGA_MAC_VER_61,
|
||||
RTL_GIGA_MAC_VER_63,
|
||||
+ RTL_GIGA_MAC_VER_64,
|
||||
RTL_GIGA_MAC_VER_65,
|
||||
RTL_GIGA_MAC_VER_66,
|
||||
RTL_GIGA_MAC_NONE
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -55,6 +55,7 @@
|
||||
#define FIRMWARE_8107E_2 "rtl_nic/rtl8107e-2.fw"
|
||||
#define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw"
|
||||
#define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw"
|
||||
+#define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw"
|
||||
#define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw"
|
||||
#define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw"
|
||||
|
||||
@@ -138,6 +139,7 @@ static const struct {
|
||||
[RTL_GIGA_MAC_VER_61] = {"RTL8125A", FIRMWARE_8125A_3},
|
||||
/* reserve 62 for CFG_METHOD_4 in the vendor driver */
|
||||
[RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2},
|
||||
+ [RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1},
|
||||
[RTL_GIGA_MAC_VER_65] = {"RTL8126A", FIRMWARE_8126A_2},
|
||||
[RTL_GIGA_MAC_VER_66] = {"RTL8126A", FIRMWARE_8126A_3},
|
||||
};
|
||||
@@ -707,6 +709,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3);
|
||||
MODULE_FIRMWARE(FIRMWARE_8107E_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125A_3);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125B_2);
|
||||
+MODULE_FIRMWARE(FIRMWARE_8125D_1);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_3);
|
||||
|
||||
@@ -2079,10 +2082,7 @@ static void rtl_set_eee_txidle_timer(str
|
||||
tp->tx_lpi_timer = timer_val;
|
||||
r8168_mac_ocp_write(tp, 0xe048, timer_val);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_61:
|
||||
- case RTL_GIGA_MAC_VER_63:
|
||||
- case RTL_GIGA_MAC_VER_65:
|
||||
- case RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66:
|
||||
tp->tx_lpi_timer = timer_val;
|
||||
RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val);
|
||||
break;
|
||||
@@ -2293,6 +2293,9 @@ static enum mac_version rtl8169_get_mac_
|
||||
{ 0x7cf, 0x64a, RTL_GIGA_MAC_VER_66 },
|
||||
{ 0x7cf, 0x649, RTL_GIGA_MAC_VER_65 },
|
||||
|
||||
+ /* 8125D family. */
|
||||
+ { 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 },
|
||||
+
|
||||
/* 8125B family. */
|
||||
{ 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 },
|
||||
|
||||
@@ -2560,9 +2563,7 @@ static void rtl_init_rxcfg(struct rtl816
|
||||
case RTL_GIGA_MAC_VER_61:
|
||||
RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_63:
|
||||
- case RTL_GIGA_MAC_VER_65:
|
||||
- case RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_66:
|
||||
RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST |
|
||||
RX_PAUSE_SLOT_ON);
|
||||
break;
|
||||
@@ -3874,6 +3875,12 @@ static void rtl_hw_start_8125b(struct rt
|
||||
rtl_hw_start_8125_common(tp);
|
||||
}
|
||||
|
||||
+static void rtl_hw_start_8125d(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ rtl_set_def_aspm_entry_latency(tp);
|
||||
+ rtl_hw_start_8125_common(tp);
|
||||
+}
|
||||
+
|
||||
static void rtl_hw_start_8126a(struct rtl8169_private *tp)
|
||||
{
|
||||
rtl_set_def_aspm_entry_latency(tp);
|
||||
@@ -3922,6 +3929,7 @@ static void rtl_hw_config(struct rtl8169
|
||||
[RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117,
|
||||
[RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b,
|
||||
+ [RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d,
|
||||
[RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a,
|
||||
[RTL_GIGA_MAC_VER_66] = rtl_hw_start_8126a,
|
||||
};
|
||||
@@ -3939,6 +3947,7 @@ static void rtl_hw_start_8125(struct rtl
|
||||
/* disable interrupt coalescing */
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_61:
|
||||
+ case RTL_GIGA_MAC_VER_64:
|
||||
for (i = 0xa00; i < 0xb00; i += 4)
|
||||
RTL_W32(tp, i, 0);
|
||||
break;
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1103,6 +1103,15 @@ static void rtl8125b_hw_phy_config(struc
|
||||
rtl8125b_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
+static void rtl8125d_hw_phy_config(struct rtl8169_private *tp,
|
||||
+ struct phy_device *phydev)
|
||||
+{
|
||||
+ r8169_apply_firmware(tp);
|
||||
+ rtl8125_legacy_force_mode(phydev);
|
||||
+ rtl8168g_disable_aldps(phydev);
|
||||
+ rtl8125b_config_eee_phy(phydev);
|
||||
+}
|
||||
+
|
||||
static void rtl8126a_hw_phy_config(struct rtl8169_private *tp,
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
@@ -1159,6 +1168,7 @@ void r8169_hw_phy_config(struct rtl8169_
|
||||
[RTL_GIGA_MAC_VER_53] = rtl8117_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config,
|
||||
+ [RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_65] = rtl8126a_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_66] = rtl8126a_hw_phy_config,
|
||||
};
|
||||
@ -0,0 +1,30 @@
|
||||
From b8bd8c44a266c9a7dcb907eab10fbb119e3f6494 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 24 Oct 2024 22:48:59 +0200
|
||||
Subject: [PATCH] r8169: fix inconsistent indenting in
|
||||
rtl8169_get_eth_mac_stats
|
||||
|
||||
This fixes an inconsistent indenting introduced with e3fc5139bd8f
|
||||
("r8169: implement additional ethtool stats ops").
|
||||
|
||||
Reported-by: kernel test robot <lkp@intel.com>
|
||||
Closes: https://lore.kernel.org/oe-kbuild-all/202410220413.1gAxIJ4t-lkp@intel.com/
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/20fd6f39-3c1b-4af0-9adc-7d1f49728fad@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -2225,7 +2225,7 @@ static void rtl8169_get_eth_mac_stats(st
|
||||
le64_to_cpu(tp->counters->tx_broadcast64);
|
||||
mac_stats->MulticastFramesReceivedOK =
|
||||
le64_to_cpu(tp->counters->rx_multicast64);
|
||||
- mac_stats->FrameTooLongErrors =
|
||||
+ mac_stats->FrameTooLongErrors =
|
||||
le32_to_cpu(tp->counters->rx_frame_too_long);
|
||||
}
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
From eb90f876b7961d702d7fc549e14614860f531e60 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 31 Oct 2024 22:42:52 +0100
|
||||
Subject: [PATCH] r8169: align RTL8125 EEE config with vendor driver
|
||||
|
||||
Align the EEE config for RTL8125A/RTL8125B with vendor driver r8125.
|
||||
This should help to avoid compatibility issues.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/044c925e-8669-4b98-87df-95b4056f4f5f@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
.../net/ethernet/realtek/r8169_phy_config.c | 18 ++++++++++++------
|
||||
1 file changed, 12 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -89,19 +89,25 @@ static void rtl8168h_config_eee_phy(stru
|
||||
phy_modify_paged(phydev, 0xa42, 0x14, 0x0000, 0x0080);
|
||||
}
|
||||
|
||||
-static void rtl8125a_config_eee_phy(struct phy_device *phydev)
|
||||
+static void rtl8125_common_config_eee_phy(struct phy_device *phydev)
|
||||
{
|
||||
- rtl8168h_config_eee_phy(phydev);
|
||||
+ phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000);
|
||||
+ phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000);
|
||||
+ phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000);
|
||||
+}
|
||||
|
||||
+static void rtl8125a_config_eee_phy(struct phy_device *phydev)
|
||||
+{
|
||||
+ rtl8168g_config_eee_phy(phydev);
|
||||
+ /* disable EEE at 2.5Gbps */
|
||||
phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000);
|
||||
- phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000);
|
||||
+ rtl8125_common_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
static void rtl8125b_config_eee_phy(struct phy_device *phydev)
|
||||
{
|
||||
- phy_modify_paged(phydev, 0xa6d, 0x14, 0x0010, 0x0000);
|
||||
- phy_modify_paged(phydev, 0xa42, 0x14, 0x0080, 0x0000);
|
||||
- phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000);
|
||||
+ rtl8168g_config_eee_phy(phydev);
|
||||
+ rtl8125_common_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
static void rtl8169s_hw_phy_config(struct rtl8169_private *tp,
|
||||
@ -0,0 +1,46 @@
|
||||
From 4af2f60bf7378bd5c92b15a528d8c6c7d02bed6c Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 31 Oct 2024 22:43:45 +0100
|
||||
Subject: [PATCH] r8169: align RTL8125/RTL8126 PHY config with vendor driver
|
||||
|
||||
This aligns some parameters with vendor driver r8125/r8126 to avoid
|
||||
compatibility issues. Note that for RTL8125B there's no functional
|
||||
change, just the open-coded version of the function is replaced.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/a8a9d896-fbe6-41f2-bf87-666567d3cdb3@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_phy_config.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1073,8 +1073,8 @@ static void rtl8125b_hw_phy_config(struc
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
r8169_apply_firmware(tp);
|
||||
+ rtl8168g_enable_gphy_10m(phydev);
|
||||
|
||||
- phy_modify_paged(phydev, 0xa44, 0x11, 0x0000, 0x0800);
|
||||
phy_modify_paged(phydev, 0xac4, 0x13, 0x00f0, 0x0090);
|
||||
phy_modify_paged(phydev, 0xad3, 0x10, 0x0003, 0x0001);
|
||||
|
||||
@@ -1113,6 +1113,7 @@ static void rtl8125d_hw_phy_config(struc
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
r8169_apply_firmware(tp);
|
||||
+ rtl8168g_enable_gphy_10m(phydev);
|
||||
rtl8125_legacy_force_mode(phydev);
|
||||
rtl8168g_disable_aldps(phydev);
|
||||
rtl8125b_config_eee_phy(phydev);
|
||||
@@ -1122,6 +1123,9 @@ static void rtl8126a_hw_phy_config(struc
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
r8169_apply_firmware(tp);
|
||||
+ rtl8168g_enable_gphy_10m(phydev);
|
||||
+ rtl8125_legacy_force_mode(phydev);
|
||||
+ rtl8168g_disable_aldps(phydev);
|
||||
}
|
||||
|
||||
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
|
||||
@ -0,0 +1,25 @@
|
||||
From a3d8520e6a19ab018da6c7fc22512c913697a829 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 31 Oct 2024 22:44:36 +0100
|
||||
Subject: [PATCH] r8169: align RTL8126 EEE config with vendor driver
|
||||
|
||||
Align the EEE config for RTL8126A with vendor driver r8126 to avoid
|
||||
compatibility issues.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/71e4859e-4cd0-4b6b-b7fa-621d7721992f@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_phy_config.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1126,6 +1126,7 @@ static void rtl8126a_hw_phy_config(struc
|
||||
rtl8168g_enable_gphy_10m(phydev);
|
||||
rtl8125_legacy_force_mode(phydev);
|
||||
rtl8168g_disable_aldps(phydev);
|
||||
+ rtl8125_common_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
|
||||
@ -0,0 +1,38 @@
|
||||
From 2cd02f2fdd8a92e5b6b85ff64eab0fc549b30c07 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Sat, 2 Nov 2024 14:49:01 +0100
|
||||
Subject: [PATCH] r8169: improve initialization of RSS registers on
|
||||
RTL8125/RTL8126
|
||||
|
||||
Replace the register addresses with the names used in r8125/r8126
|
||||
vendor driver, and consider that RSS_CTRL_8125 is a 32 bit register.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/3bf2f340-b369-4174-97bf-fd38d4217492@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -346,6 +346,8 @@ enum rtl8125_registers {
|
||||
TxPoll_8125 = 0x90,
|
||||
LEDSEL3 = 0x96,
|
||||
MAC0_BKP = 0x19e0,
|
||||
+ RSS_CTRL_8125 = 0x4500,
|
||||
+ Q_NUM_CTRL_8125 = 0x4800,
|
||||
EEE_TXIDLE_TIMER_8125 = 0x6048,
|
||||
};
|
||||
|
||||
@@ -3768,8 +3770,8 @@ static void rtl_hw_start_8125_common(str
|
||||
rtl_pcie_state_l2l3_disable(tp);
|
||||
|
||||
RTL_W16(tp, 0x382, 0x221b);
|
||||
- RTL_W8(tp, 0x4500, 0);
|
||||
- RTL_W16(tp, 0x4800, 0);
|
||||
+ RTL_W32(tp, RSS_CTRL_8125, 0);
|
||||
+ RTL_W16(tp, Q_NUM_CTRL_8125, 0);
|
||||
|
||||
/* disable UPS */
|
||||
r8168_mac_ocp_modify(tp, 0xd40a, 0x0010, 0x0000);
|
||||
@ -0,0 +1,113 @@
|
||||
From 83cb4b470c66b37b19a347a35cea01e0cbdd258d Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Mon, 4 Nov 2024 23:16:20 +0100
|
||||
Subject: [PATCH] r8169: remove leftover locks after reverted change
|
||||
|
||||
After e31a9fedc7d8 ("Revert "r8169: disable ASPM during NAPI poll"")
|
||||
these locks aren't needed any longer.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/680f2606-ac7d-4ced-8694-e5033855da9b@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 29 ++---------------------
|
||||
1 file changed, 2 insertions(+), 27 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -662,13 +662,9 @@ struct rtl8169_private {
|
||||
struct work_struct work;
|
||||
} wk;
|
||||
|
||||
- raw_spinlock_t config25_lock;
|
||||
raw_spinlock_t mac_ocp_lock;
|
||||
struct mutex led_lock; /* serialize LED ctrl RMW access */
|
||||
|
||||
- raw_spinlock_t cfg9346_usage_lock;
|
||||
- int cfg9346_usage_count;
|
||||
-
|
||||
unsigned supports_gmii:1;
|
||||
unsigned aspm_manageable:1;
|
||||
unsigned dash_enabled:1;
|
||||
@@ -722,22 +718,12 @@ static inline struct device *tp_to_dev(s
|
||||
|
||||
static void rtl_lock_config_regs(struct rtl8169_private *tp)
|
||||
{
|
||||
- unsigned long flags;
|
||||
-
|
||||
- raw_spin_lock_irqsave(&tp->cfg9346_usage_lock, flags);
|
||||
- if (!--tp->cfg9346_usage_count)
|
||||
- RTL_W8(tp, Cfg9346, Cfg9346_Lock);
|
||||
- raw_spin_unlock_irqrestore(&tp->cfg9346_usage_lock, flags);
|
||||
+ RTL_W8(tp, Cfg9346, Cfg9346_Lock);
|
||||
}
|
||||
|
||||
static void rtl_unlock_config_regs(struct rtl8169_private *tp)
|
||||
{
|
||||
- unsigned long flags;
|
||||
-
|
||||
- raw_spin_lock_irqsave(&tp->cfg9346_usage_lock, flags);
|
||||
- if (!tp->cfg9346_usage_count++)
|
||||
- RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
|
||||
- raw_spin_unlock_irqrestore(&tp->cfg9346_usage_lock, flags);
|
||||
+ RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
|
||||
}
|
||||
|
||||
static void rtl_pci_commit(struct rtl8169_private *tp)
|
||||
@@ -748,24 +734,18 @@ static void rtl_pci_commit(struct rtl816
|
||||
|
||||
static void rtl_mod_config2(struct rtl8169_private *tp, u8 clear, u8 set)
|
||||
{
|
||||
- unsigned long flags;
|
||||
u8 val;
|
||||
|
||||
- raw_spin_lock_irqsave(&tp->config25_lock, flags);
|
||||
val = RTL_R8(tp, Config2);
|
||||
RTL_W8(tp, Config2, (val & ~clear) | set);
|
||||
- raw_spin_unlock_irqrestore(&tp->config25_lock, flags);
|
||||
}
|
||||
|
||||
static void rtl_mod_config5(struct rtl8169_private *tp, u8 clear, u8 set)
|
||||
{
|
||||
- unsigned long flags;
|
||||
u8 val;
|
||||
|
||||
- raw_spin_lock_irqsave(&tp->config25_lock, flags);
|
||||
val = RTL_R8(tp, Config5);
|
||||
RTL_W8(tp, Config5, (val & ~clear) | set);
|
||||
- raw_spin_unlock_irqrestore(&tp->config25_lock, flags);
|
||||
}
|
||||
|
||||
static bool rtl_is_8125(struct rtl8169_private *tp)
|
||||
@@ -1571,7 +1551,6 @@ static void __rtl8169_set_wol(struct rtl
|
||||
{ WAKE_MAGIC, Config3, MagicPacket }
|
||||
};
|
||||
unsigned int i, tmp = ARRAY_SIZE(cfg);
|
||||
- unsigned long flags;
|
||||
u8 options;
|
||||
|
||||
rtl_unlock_config_regs(tp);
|
||||
@@ -1590,14 +1569,12 @@ static void __rtl8169_set_wol(struct rtl
|
||||
r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0);
|
||||
}
|
||||
|
||||
- raw_spin_lock_irqsave(&tp->config25_lock, flags);
|
||||
for (i = 0; i < tmp; i++) {
|
||||
options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask;
|
||||
if (wolopts & cfg[i].opt)
|
||||
options |= cfg[i].mask;
|
||||
RTL_W8(tp, cfg[i].reg, options);
|
||||
}
|
||||
- raw_spin_unlock_irqrestore(&tp->config25_lock, flags);
|
||||
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06:
|
||||
@@ -5458,8 +5435,6 @@ static int rtl_init_one(struct pci_dev *
|
||||
tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1;
|
||||
tp->ocp_base = OCP_STD_PHY_BASE;
|
||||
|
||||
- raw_spin_lock_init(&tp->cfg9346_usage_lock);
|
||||
- raw_spin_lock_init(&tp->config25_lock);
|
||||
raw_spin_lock_init(&tp->mac_ocp_lock);
|
||||
mutex_init(&tp->led_lock);
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
From c507e96b5763b36b63ad50ad804341f72ea000e4 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 6 Nov 2024 17:55:45 +0100
|
||||
Subject: [PATCH] r8169: improve __rtl8169_set_wol
|
||||
|
||||
Add helper r8169_mod_reg8_cond() what allows to significantly simplify
|
||||
__rtl8169_set_wol().
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/697b197a-8eac-40c6-8847-27093cacec36@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 55 ++++++++++-------------
|
||||
1 file changed, 24 insertions(+), 31 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -748,6 +748,20 @@ static void rtl_mod_config5(struct rtl81
|
||||
RTL_W8(tp, Config5, (val & ~clear) | set);
|
||||
}
|
||||
|
||||
+static void r8169_mod_reg8_cond(struct rtl8169_private *tp, int reg,
|
||||
+ u8 bits, bool cond)
|
||||
+{
|
||||
+ u8 val, old_val;
|
||||
+
|
||||
+ old_val = RTL_R8(tp, reg);
|
||||
+ if (cond)
|
||||
+ val = old_val | bits;
|
||||
+ else
|
||||
+ val = old_val & ~bits;
|
||||
+ if (val != old_val)
|
||||
+ RTL_W8(tp, reg, val);
|
||||
+}
|
||||
+
|
||||
static bool rtl_is_8125(struct rtl8169_private *tp)
|
||||
{
|
||||
return tp->mac_version >= RTL_GIGA_MAC_VER_61;
|
||||
@@ -1538,58 +1552,37 @@ static void rtl8169_get_wol(struct net_d
|
||||
|
||||
static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts)
|
||||
{
|
||||
- static const struct {
|
||||
- u32 opt;
|
||||
- u16 reg;
|
||||
- u8 mask;
|
||||
- } cfg[] = {
|
||||
- { WAKE_PHY, Config3, LinkUp },
|
||||
- { WAKE_UCAST, Config5, UWF },
|
||||
- { WAKE_BCAST, Config5, BWF },
|
||||
- { WAKE_MCAST, Config5, MWF },
|
||||
- { WAKE_ANY, Config5, LanWake },
|
||||
- { WAKE_MAGIC, Config3, MagicPacket }
|
||||
- };
|
||||
- unsigned int i, tmp = ARRAY_SIZE(cfg);
|
||||
- u8 options;
|
||||
-
|
||||
rtl_unlock_config_regs(tp);
|
||||
|
||||
if (rtl_is_8168evl_up(tp)) {
|
||||
- tmp--;
|
||||
if (wolopts & WAKE_MAGIC)
|
||||
rtl_eri_set_bits(tp, 0x0dc, MagicPacket_v2);
|
||||
else
|
||||
rtl_eri_clear_bits(tp, 0x0dc, MagicPacket_v2);
|
||||
} else if (rtl_is_8125(tp)) {
|
||||
- tmp--;
|
||||
if (wolopts & WAKE_MAGIC)
|
||||
r8168_mac_ocp_modify(tp, 0xc0b6, 0, BIT(0));
|
||||
else
|
||||
r8168_mac_ocp_modify(tp, 0xc0b6, BIT(0), 0);
|
||||
+ } else {
|
||||
+ r8169_mod_reg8_cond(tp, Config3, MagicPacket,
|
||||
+ wolopts & WAKE_MAGIC);
|
||||
}
|
||||
|
||||
- for (i = 0; i < tmp; i++) {
|
||||
- options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask;
|
||||
- if (wolopts & cfg[i].opt)
|
||||
- options |= cfg[i].mask;
|
||||
- RTL_W8(tp, cfg[i].reg, options);
|
||||
- }
|
||||
+ r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY);
|
||||
+ r8169_mod_reg8_cond(tp, Config5, UWF, wolopts & WAKE_UCAST);
|
||||
+ r8169_mod_reg8_cond(tp, Config5, BWF, wolopts & WAKE_BCAST);
|
||||
+ r8169_mod_reg8_cond(tp, Config5, MWF, wolopts & WAKE_MCAST);
|
||||
+ r8169_mod_reg8_cond(tp, Config5, LanWake, wolopts);
|
||||
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06:
|
||||
- options = RTL_R8(tp, Config1) & ~PMEnable;
|
||||
- if (wolopts)
|
||||
- options |= PMEnable;
|
||||
- RTL_W8(tp, Config1, options);
|
||||
+ r8169_mod_reg8_cond(tp, Config1, PMEnable, wolopts);
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_34:
|
||||
case RTL_GIGA_MAC_VER_37:
|
||||
case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66:
|
||||
- if (wolopts)
|
||||
- rtl_mod_config2(tp, 0, PME_SIGNAL);
|
||||
- else
|
||||
- rtl_mod_config2(tp, PME_SIGNAL, 0);
|
||||
+ r8169_mod_reg8_cond(tp, Config2, PME_SIGNAL, wolopts);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -0,0 +1,44 @@
|
||||
From 330dc2297c82953dff402e0b4176a5383a618538 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 6 Nov 2024 17:56:28 +0100
|
||||
Subject: [PATCH] r8169: improve rtl_set_d3_pll_down
|
||||
|
||||
Make use of new helper r8169_mod_reg8_cond() and move from a switch()
|
||||
to an if() clause. Benefit is that we don't have to touch this piece of
|
||||
code each time support for a new chip version is added.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/e1ccdb85-a4ed-4800-89c2-89770ff06452@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 18 +++++-------------
|
||||
1 file changed, 5 insertions(+), 13 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -1431,19 +1431,11 @@ static enum rtl_dash_type rtl_get_dash_t
|
||||
|
||||
static void rtl_set_d3_pll_down(struct rtl8169_private *tp, bool enable)
|
||||
{
|
||||
- switch (tp->mac_version) {
|
||||
- case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_26:
|
||||
- case RTL_GIGA_MAC_VER_29 ... RTL_GIGA_MAC_VER_30:
|
||||
- case RTL_GIGA_MAC_VER_32 ... RTL_GIGA_MAC_VER_37:
|
||||
- case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66:
|
||||
- if (enable)
|
||||
- RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~D3_NO_PLL_DOWN);
|
||||
- else
|
||||
- RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) | D3_NO_PLL_DOWN);
|
||||
- break;
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
+ if (tp->mac_version >= RTL_GIGA_MAC_VER_25 &&
|
||||
+ tp->mac_version != RTL_GIGA_MAC_VER_28 &&
|
||||
+ tp->mac_version != RTL_GIGA_MAC_VER_31 &&
|
||||
+ tp->mac_version != RTL_GIGA_MAC_VER_38)
|
||||
+ r8169_mod_reg8_cond(tp, PMCH, D3_NO_PLL_DOWN, !enable);
|
||||
}
|
||||
|
||||
static void rtl_reset_packet_filter(struct rtl8169_private *tp)
|
||||
@ -0,0 +1,29 @@
|
||||
From e3e9e9039fa6ae885c7d5c954d7b9f105fa23e8f Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 6 Nov 2024 17:57:08 +0100
|
||||
Subject: [PATCH] r8169: align WAKE_PHY handling with r8125/r8126 vendor
|
||||
drivers
|
||||
|
||||
Vendor drivers r8125/r8126 apply this additional magic setting when
|
||||
enabling WAKE_PHY, so do the same here.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/51130715-45be-4db5-abb7-05d87e1f5df9@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -1562,6 +1562,9 @@ static void __rtl8169_set_wol(struct rtl
|
||||
}
|
||||
|
||||
r8169_mod_reg8_cond(tp, Config3, LinkUp, wolopts & WAKE_PHY);
|
||||
+ if (rtl_is_8125(tp))
|
||||
+ r8168_mac_ocp_modify(tp, 0xe0c6, 0x3f,
|
||||
+ wolopts & WAKE_PHY ? 0x13 : 0);
|
||||
r8169_mod_reg8_cond(tp, Config5, UWF, wolopts & WAKE_UCAST);
|
||||
r8169_mod_reg8_cond(tp, Config5, BWF, wolopts & WAKE_BCAST);
|
||||
r8169_mod_reg8_cond(tp, Config5, MWF, wolopts & WAKE_MCAST);
|
||||
@ -0,0 +1,117 @@
|
||||
From 7a3bcd39ae1f0e3ab896d9df62339ab4297a0bfd Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Sat, 9 Nov 2024 23:12:12 +0100
|
||||
Subject: [PATCH] r8169: use helper r8169_mod_reg8_cond to simplify
|
||||
rtl_jumbo_config
|
||||
|
||||
Use recently added helper r8169_mod_reg8_cond() to simplify jumbo
|
||||
mode configuration.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/3df1d484-a02e-46e7-8f75-db5b428e422e@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 77 ++++-------------------
|
||||
1 file changed, 11 insertions(+), 66 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -2545,86 +2545,31 @@ static void rtl8169_init_ring_indexes(st
|
||||
tp->dirty_tx = tp->cur_tx = tp->cur_rx = 0;
|
||||
}
|
||||
|
||||
-static void r8168c_hw_jumbo_enable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | Jumbo_En1);
|
||||
-}
|
||||
-
|
||||
-static void r8168c_hw_jumbo_disable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~Jumbo_En1);
|
||||
-}
|
||||
-
|
||||
-static void r8168dp_hw_jumbo_enable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
|
||||
-}
|
||||
-
|
||||
-static void r8168dp_hw_jumbo_disable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
|
||||
-}
|
||||
-
|
||||
-static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, MaxTxPacketSize, 0x24);
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) | Jumbo_En0);
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | 0x01);
|
||||
-}
|
||||
-
|
||||
-static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, MaxTxPacketSize, 0x3f);
|
||||
- RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Jumbo_En0);
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~0x01);
|
||||
-}
|
||||
-
|
||||
-static void r8168b_1_hw_jumbo_enable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) | (1 << 0));
|
||||
-}
|
||||
-
|
||||
-static void r8168b_1_hw_jumbo_disable(struct rtl8169_private *tp)
|
||||
-{
|
||||
- RTL_W8(tp, Config4, RTL_R8(tp, Config4) & ~(1 << 0));
|
||||
-}
|
||||
-
|
||||
static void rtl_jumbo_config(struct rtl8169_private *tp)
|
||||
{
|
||||
bool jumbo = tp->dev->mtu > ETH_DATA_LEN;
|
||||
int readrq = 4096;
|
||||
|
||||
+ if (jumbo && tp->mac_version >= RTL_GIGA_MAC_VER_17 &&
|
||||
+ tp->mac_version <= RTL_GIGA_MAC_VER_26)
|
||||
+ readrq = 512;
|
||||
+
|
||||
rtl_unlock_config_regs(tp);
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_17:
|
||||
- if (jumbo) {
|
||||
- readrq = 512;
|
||||
- r8168b_1_hw_jumbo_enable(tp);
|
||||
- } else {
|
||||
- r8168b_1_hw_jumbo_disable(tp);
|
||||
- }
|
||||
+ r8169_mod_reg8_cond(tp, Config4, BIT(0), jumbo);
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_26:
|
||||
- if (jumbo) {
|
||||
- readrq = 512;
|
||||
- r8168c_hw_jumbo_enable(tp);
|
||||
- } else {
|
||||
- r8168c_hw_jumbo_disable(tp);
|
||||
- }
|
||||
+ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo);
|
||||
+ r8169_mod_reg8_cond(tp, Config4, Jumbo_En1, jumbo);
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_28:
|
||||
- if (jumbo)
|
||||
- r8168dp_hw_jumbo_enable(tp);
|
||||
- else
|
||||
- r8168dp_hw_jumbo_disable(tp);
|
||||
+ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo);
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_31 ... RTL_GIGA_MAC_VER_33:
|
||||
- if (jumbo)
|
||||
- r8168e_hw_jumbo_enable(tp);
|
||||
- else
|
||||
- r8168e_hw_jumbo_disable(tp);
|
||||
+ RTL_W8(tp, MaxTxPacketSize, jumbo ? 0x24 : 0x3f);
|
||||
+ r8169_mod_reg8_cond(tp, Config3, Jumbo_En0, jumbo);
|
||||
+ r8169_mod_reg8_cond(tp, Config4, BIT(0), jumbo);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -0,0 +1,82 @@
|
||||
From e340bff27e63ed61a1e9895bed546107859e48a7 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Fri, 8 Nov 2024 08:08:24 +0100
|
||||
Subject: [PATCH] r8169: copy vendor driver 2.5G/5G EEE advertisement
|
||||
constraints
|
||||
|
||||
Vendor driver r8125 doesn't advertise 2.5G EEE on RTL8125A, and r8126
|
||||
doesn't advertise 5G EEE. Likely there are compatibility issues,
|
||||
therefore do the same in r8169.
|
||||
With this change we don't have to disable 2.5G EEE advertisement in
|
||||
rtl8125a_config_eee_phy() any longer.
|
||||
We use new phylib accessor phy_set_eee_broken() to mark the respective
|
||||
EEE modes as broken.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/ce185e10-8a2f-4cf8-a49b-fd8fb3c3c8a1@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 6 ++++++
|
||||
drivers/net/ethernet/realtek/r8169_phy_config.c | 16 ++++------------
|
||||
2 files changed, 10 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -5234,6 +5234,11 @@ static int r8169_mdio_register(struct rt
|
||||
phy_support_eee(tp->phydev);
|
||||
phy_support_asym_pause(tp->phydev);
|
||||
|
||||
+ /* mimic behavior of r8125/r8126 vendor drivers */
|
||||
+ if (tp->mac_version == RTL_GIGA_MAC_VER_61)
|
||||
+ tp->phydev->eee_broken_modes |= MDIO_EEE_2_5GT;
|
||||
+ tp->phydev->eee_broken_modes |= MDIO_EEE_5GT;
|
||||
+
|
||||
/* PHY will be woken up in rtl_open() */
|
||||
phy_suspend(tp->phydev);
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -96,15 +96,7 @@ static void rtl8125_common_config_eee_ph
|
||||
phy_modify_paged(phydev, 0xa4a, 0x11, 0x0200, 0x0000);
|
||||
}
|
||||
|
||||
-static void rtl8125a_config_eee_phy(struct phy_device *phydev)
|
||||
-{
|
||||
- rtl8168g_config_eee_phy(phydev);
|
||||
- /* disable EEE at 2.5Gbps */
|
||||
- phy_modify_paged(phydev, 0xa6d, 0x12, 0x0001, 0x0000);
|
||||
- rtl8125_common_config_eee_phy(phydev);
|
||||
-}
|
||||
-
|
||||
-static void rtl8125b_config_eee_phy(struct phy_device *phydev)
|
||||
+static void rtl8125_config_eee_phy(struct phy_device *phydev)
|
||||
{
|
||||
rtl8168g_config_eee_phy(phydev);
|
||||
rtl8125_common_config_eee_phy(phydev);
|
||||
@@ -1066,7 +1058,7 @@ static void rtl8125a_2_hw_phy_config(str
|
||||
rtl8168g_enable_gphy_10m(phydev);
|
||||
|
||||
rtl8168g_disable_aldps(phydev);
|
||||
- rtl8125a_config_eee_phy(phydev);
|
||||
+ rtl8125_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
static void rtl8125b_hw_phy_config(struct rtl8169_private *tp,
|
||||
@@ -1106,7 +1098,7 @@ static void rtl8125b_hw_phy_config(struc
|
||||
|
||||
rtl8125_legacy_force_mode(phydev);
|
||||
rtl8168g_disable_aldps(phydev);
|
||||
- rtl8125b_config_eee_phy(phydev);
|
||||
+ rtl8125_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
static void rtl8125d_hw_phy_config(struct rtl8169_private *tp,
|
||||
@@ -1116,7 +1108,7 @@ static void rtl8125d_hw_phy_config(struc
|
||||
rtl8168g_enable_gphy_10m(phydev);
|
||||
rtl8125_legacy_force_mode(phydev);
|
||||
rtl8168g_disable_aldps(phydev);
|
||||
- rtl8125b_config_eee_phy(phydev);
|
||||
+ rtl8125_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
static void rtl8126a_hw_phy_config(struct rtl8169_private *tp,
|
||||
@ -0,0 +1,35 @@
|
||||
From 2e20bf8cc05766dcd0357cdfcada49e1bc45512b Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Mon, 2 Dec 2024 21:14:35 +0100
|
||||
Subject: [PATCH] r8169: remove unused flag RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE
|
||||
|
||||
After 854d71c555dfc3 ("r8169: remove original workaround for RTL8125
|
||||
broken rx issue") this flag isn't used any longer. So remove it.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
|
||||
Link: https://patch.msgid.link/d9dd214b-3027-4f60-b0e8-6f34a0c76582@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -623,7 +623,6 @@ struct rtl8169_tc_offsets {
|
||||
enum rtl_flag {
|
||||
RTL_FLAG_TASK_ENABLED = 0,
|
||||
RTL_FLAG_TASK_RESET_PENDING,
|
||||
- RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE,
|
||||
RTL_FLAG_TASK_TX_TIMEOUT,
|
||||
RTL_FLAG_MAX
|
||||
};
|
||||
@@ -4728,8 +4727,6 @@ static void rtl_task(struct work_struct
|
||||
reset:
|
||||
rtl_reset_work(tp);
|
||||
netif_wake_queue(tp->dev);
|
||||
- } else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) {
|
||||
- rtl_reset_work(tp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,114 @@
|
||||
From bb18265c3aba92b91a1355609769f3e967b65dee Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Mon, 2 Dec 2024 21:20:02 +0100
|
||||
Subject: [PATCH] r8169: remove support for chip version 11
|
||||
|
||||
This is a follow-up to 982300c115d2 ("r8169: remove detection of chip
|
||||
version 11 (early RTL8168b)"). Nobody complained yet, so remove
|
||||
support for this chip version.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/b689ab6d-20b5-4b64-bd7e-531a0a972ba3@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169.h | 2 +-
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 14 +-------------
|
||||
drivers/net/ethernet/realtek/r8169_phy_config.c | 10 ----------
|
||||
3 files changed, 2 insertions(+), 24 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169.h
|
||||
+++ b/drivers/net/ethernet/realtek/r8169.h
|
||||
@@ -23,7 +23,7 @@ enum mac_version {
|
||||
RTL_GIGA_MAC_VER_08,
|
||||
RTL_GIGA_MAC_VER_09,
|
||||
RTL_GIGA_MAC_VER_10,
|
||||
- RTL_GIGA_MAC_VER_11,
|
||||
+ /* support for RTL_GIGA_MAC_VER_11 has been removed */
|
||||
/* RTL_GIGA_MAC_VER_12 was handled the same as VER_17 */
|
||||
/* RTL_GIGA_MAC_VER_13 was merged with VER_10 */
|
||||
RTL_GIGA_MAC_VER_14,
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -103,7 +103,6 @@ static const struct {
|
||||
[RTL_GIGA_MAC_VER_08] = {"RTL8102e" },
|
||||
[RTL_GIGA_MAC_VER_09] = {"RTL8102e/RTL8103e" },
|
||||
[RTL_GIGA_MAC_VER_10] = {"RTL8101e/RTL8100e" },
|
||||
- [RTL_GIGA_MAC_VER_11] = {"RTL8168b/8111b" },
|
||||
[RTL_GIGA_MAC_VER_14] = {"RTL8401" },
|
||||
[RTL_GIGA_MAC_VER_17] = {"RTL8168b/8111b" },
|
||||
[RTL_GIGA_MAC_VER_18] = {"RTL8168cp/8111cp" },
|
||||
@@ -2335,7 +2334,7 @@ static enum mac_version rtl8169_get_mac_
|
||||
|
||||
/* 8168B family. */
|
||||
{ 0x7c8, 0x380, RTL_GIGA_MAC_VER_17 },
|
||||
- /* This one is very old and rare, let's see if anybody complains.
|
||||
+ /* This one is very old and rare, support has been removed.
|
||||
* { 0x7c8, 0x300, RTL_GIGA_MAC_VER_11 },
|
||||
*/
|
||||
|
||||
@@ -3805,7 +3804,6 @@ static void rtl_hw_config(struct rtl8169
|
||||
[RTL_GIGA_MAC_VER_08] = rtl_hw_start_8102e_3,
|
||||
[RTL_GIGA_MAC_VER_09] = rtl_hw_start_8102e_2,
|
||||
[RTL_GIGA_MAC_VER_10] = NULL,
|
||||
- [RTL_GIGA_MAC_VER_11] = rtl_hw_start_8168b,
|
||||
[RTL_GIGA_MAC_VER_14] = rtl_hw_start_8401,
|
||||
[RTL_GIGA_MAC_VER_17] = rtl_hw_start_8168b,
|
||||
[RTL_GIGA_MAC_VER_18] = rtl_hw_start_8168cp_1,
|
||||
@@ -4681,12 +4679,6 @@ static irqreturn_t rtl8169_interrupt(int
|
||||
if (status & LinkChg)
|
||||
phy_mac_interrupt(tp->phydev);
|
||||
|
||||
- if (unlikely(status & RxFIFOOver &&
|
||||
- tp->mac_version == RTL_GIGA_MAC_VER_11)) {
|
||||
- netif_stop_queue(tp->dev);
|
||||
- rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING);
|
||||
- }
|
||||
-
|
||||
rtl_irq_disable(tp);
|
||||
napi_schedule(&tp->napi);
|
||||
out:
|
||||
@@ -5106,9 +5098,6 @@ static void rtl_set_irq_mask(struct rtl8
|
||||
|
||||
if (tp->mac_version <= RTL_GIGA_MAC_VER_06)
|
||||
tp->irq_mask |= SYSErr | RxFIFOOver;
|
||||
- else if (tp->mac_version == RTL_GIGA_MAC_VER_11)
|
||||
- /* special workaround needed */
|
||||
- tp->irq_mask |= RxFIFOOver;
|
||||
}
|
||||
|
||||
static int rtl_alloc_irq(struct rtl8169_private *tp)
|
||||
@@ -5302,7 +5291,6 @@ static int rtl_jumbo_max(struct rtl8169_
|
||||
case RTL_GIGA_MAC_VER_02 ... RTL_GIGA_MAC_VER_06:
|
||||
return JUMBO_7K;
|
||||
/* RTL8168b */
|
||||
- case RTL_GIGA_MAC_VER_11:
|
||||
case RTL_GIGA_MAC_VER_17:
|
||||
return JUMBO_4K;
|
||||
/* RTL8168c */
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -276,15 +276,6 @@ static void rtl8169sce_hw_phy_config(str
|
||||
rtl_writephy_batch(phydev, phy_reg_init);
|
||||
}
|
||||
|
||||
-static void rtl8168bb_hw_phy_config(struct rtl8169_private *tp,
|
||||
- struct phy_device *phydev)
|
||||
-{
|
||||
- phy_write(phydev, 0x1f, 0x0001);
|
||||
- phy_set_bits(phydev, 0x16, BIT(0));
|
||||
- phy_write(phydev, 0x10, 0xf41b);
|
||||
- phy_write(phydev, 0x1f, 0x0000);
|
||||
-}
|
||||
-
|
||||
static void rtl8168bef_hw_phy_config(struct rtl8169_private *tp,
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
@@ -1136,7 +1127,6 @@ void r8169_hw_phy_config(struct rtl8169_
|
||||
[RTL_GIGA_MAC_VER_08] = rtl8102e_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_09] = rtl8102e_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_10] = NULL,
|
||||
- [RTL_GIGA_MAC_VER_11] = rtl8168bb_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_14] = rtl8401_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_17] = rtl8168bef_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_18] = rtl8168cp_1_hw_phy_config,
|
||||
@ -0,0 +1,257 @@
|
||||
From b299ea0069284186b0d3d54aebe87f0d195d457a Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Fri, 13 Dec 2024 20:01:41 +0100
|
||||
Subject: [PATCH] r8169: adjust version numbering for RTL8126
|
||||
|
||||
Adjust version numbering for RTL8126, so that it doesn't overlap with
|
||||
new RTL8125 versions.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/6a354364-20e9-48ad-a198-468264288757@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169.h | 4 +-
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 62 +++++++++----------
|
||||
.../net/ethernet/realtek/r8169_phy_config.c | 4 +-
|
||||
3 files changed, 35 insertions(+), 35 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169.h
|
||||
+++ b/drivers/net/ethernet/realtek/r8169.h
|
||||
@@ -69,8 +69,8 @@ enum mac_version {
|
||||
RTL_GIGA_MAC_VER_61,
|
||||
RTL_GIGA_MAC_VER_63,
|
||||
RTL_GIGA_MAC_VER_64,
|
||||
- RTL_GIGA_MAC_VER_65,
|
||||
- RTL_GIGA_MAC_VER_66,
|
||||
+ RTL_GIGA_MAC_VER_70,
|
||||
+ RTL_GIGA_MAC_VER_71,
|
||||
RTL_GIGA_MAC_NONE
|
||||
};
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -139,8 +139,8 @@ static const struct {
|
||||
/* reserve 62 for CFG_METHOD_4 in the vendor driver */
|
||||
[RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2},
|
||||
[RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1},
|
||||
- [RTL_GIGA_MAC_VER_65] = {"RTL8126A", FIRMWARE_8126A_2},
|
||||
- [RTL_GIGA_MAC_VER_66] = {"RTL8126A", FIRMWARE_8126A_3},
|
||||
+ [RTL_GIGA_MAC_VER_70] = {"RTL8126A", FIRMWARE_8126A_2},
|
||||
+ [RTL_GIGA_MAC_VER_71] = {"RTL8126A", FIRMWARE_8126A_3},
|
||||
};
|
||||
|
||||
static const struct pci_device_id rtl8169_pci_tbl[] = {
|
||||
@@ -1228,7 +1228,7 @@ static void rtl_writephy(struct rtl8169_
|
||||
case RTL_GIGA_MAC_VER_31:
|
||||
r8168dp_2_mdio_write(tp, location, val);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71:
|
||||
r8168g_mdio_write(tp, location, val);
|
||||
break;
|
||||
default:
|
||||
@@ -1243,7 +1243,7 @@ static int rtl_readphy(struct rtl8169_pr
|
||||
case RTL_GIGA_MAC_VER_28:
|
||||
case RTL_GIGA_MAC_VER_31:
|
||||
return r8168dp_2_mdio_read(tp, location);
|
||||
- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71:
|
||||
return r8168g_mdio_read(tp, location);
|
||||
default:
|
||||
return r8169_mdio_read(tp, location);
|
||||
@@ -1574,7 +1574,7 @@ static void __rtl8169_set_wol(struct rtl
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_34:
|
||||
case RTL_GIGA_MAC_VER_37:
|
||||
- case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_39 ... RTL_GIGA_MAC_VER_71:
|
||||
r8169_mod_reg8_cond(tp, Config2, PME_SIGNAL, wolopts);
|
||||
break;
|
||||
default:
|
||||
@@ -2047,7 +2047,7 @@ static void rtl_set_eee_txidle_timer(str
|
||||
tp->tx_lpi_timer = timer_val;
|
||||
r8168_mac_ocp_write(tp, 0xe048, timer_val);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71:
|
||||
tp->tx_lpi_timer = timer_val;
|
||||
RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val);
|
||||
break;
|
||||
@@ -2255,8 +2255,8 @@ static enum mac_version rtl8169_get_mac_
|
||||
enum mac_version ver;
|
||||
} mac_info[] = {
|
||||
/* 8126A family. */
|
||||
- { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_66 },
|
||||
- { 0x7cf, 0x649, RTL_GIGA_MAC_VER_65 },
|
||||
+ { 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71 },
|
||||
+ { 0x7cf, 0x649, RTL_GIGA_MAC_VER_70 },
|
||||
|
||||
/* 8125D family. */
|
||||
{ 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 },
|
||||
@@ -2528,7 +2528,7 @@ static void rtl_init_rxcfg(struct rtl816
|
||||
case RTL_GIGA_MAC_VER_61:
|
||||
RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_71:
|
||||
RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST |
|
||||
RX_PAUSE_SLOT_ON);
|
||||
break;
|
||||
@@ -2660,7 +2660,7 @@ static void rtl_wait_txrx_fifo_empty(str
|
||||
case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_61:
|
||||
rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_63 ... RTL_GIGA_MAC_VER_71:
|
||||
RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq);
|
||||
rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42);
|
||||
rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond_2, 100, 42);
|
||||
@@ -2903,7 +2903,7 @@ static void rtl_enable_exit_l1(struct rt
|
||||
case RTL_GIGA_MAC_VER_37 ... RTL_GIGA_MAC_VER_38:
|
||||
rtl_eri_set_bits(tp, 0xd4, 0x0c00);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71:
|
||||
r8168_mac_ocp_modify(tp, 0xc0ac, 0, 0x1f80);
|
||||
break;
|
||||
default:
|
||||
@@ -2917,7 +2917,7 @@ static void rtl_disable_exit_l1(struct r
|
||||
case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_38:
|
||||
rtl_eri_clear_bits(tp, 0xd4, 0x1f00);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71:
|
||||
r8168_mac_ocp_modify(tp, 0xc0ac, 0x1f80, 0);
|
||||
break;
|
||||
default:
|
||||
@@ -2943,8 +2943,8 @@ static void rtl_hw_aspm_clkreq_enable(st
|
||||
|
||||
rtl_mod_config5(tp, 0, ASPM_en);
|
||||
switch (tp->mac_version) {
|
||||
- case RTL_GIGA_MAC_VER_65:
|
||||
- case RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_70:
|
||||
+ case RTL_GIGA_MAC_VER_71:
|
||||
val8 = RTL_R8(tp, INT_CFG0_8125) | INT_CFG0_CLKREQEN;
|
||||
RTL_W8(tp, INT_CFG0_8125, val8);
|
||||
break;
|
||||
@@ -2955,7 +2955,7 @@ static void rtl_hw_aspm_clkreq_enable(st
|
||||
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_46 ... RTL_GIGA_MAC_VER_48:
|
||||
- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71:
|
||||
/* reset ephy tx/rx disable timer */
|
||||
r8168_mac_ocp_modify(tp, 0xe094, 0xff00, 0);
|
||||
/* chip can trigger L1.2 */
|
||||
@@ -2967,7 +2967,7 @@ static void rtl_hw_aspm_clkreq_enable(st
|
||||
} else {
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_46 ... RTL_GIGA_MAC_VER_48:
|
||||
- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71:
|
||||
r8168_mac_ocp_modify(tp, 0xe092, 0x00ff, 0);
|
||||
break;
|
||||
default:
|
||||
@@ -2975,8 +2975,8 @@ static void rtl_hw_aspm_clkreq_enable(st
|
||||
}
|
||||
|
||||
switch (tp->mac_version) {
|
||||
- case RTL_GIGA_MAC_VER_65:
|
||||
- case RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_70:
|
||||
+ case RTL_GIGA_MAC_VER_71:
|
||||
val8 = RTL_R8(tp, INT_CFG0_8125) & ~INT_CFG0_CLKREQEN;
|
||||
RTL_W8(tp, INT_CFG0_8125, val8);
|
||||
break;
|
||||
@@ -3696,12 +3696,12 @@ static void rtl_hw_start_8125_common(str
|
||||
/* disable new tx descriptor format */
|
||||
r8168_mac_ocp_modify(tp, 0xeb58, 0x0001, 0x0000);
|
||||
|
||||
- if (tp->mac_version == RTL_GIGA_MAC_VER_65 ||
|
||||
- tp->mac_version == RTL_GIGA_MAC_VER_66)
|
||||
+ if (tp->mac_version == RTL_GIGA_MAC_VER_70 ||
|
||||
+ tp->mac_version == RTL_GIGA_MAC_VER_71)
|
||||
RTL_W8(tp, 0xD8, RTL_R8(tp, 0xD8) & ~0x02);
|
||||
|
||||
- if (tp->mac_version == RTL_GIGA_MAC_VER_65 ||
|
||||
- tp->mac_version == RTL_GIGA_MAC_VER_66)
|
||||
+ if (tp->mac_version == RTL_GIGA_MAC_VER_70 ||
|
||||
+ tp->mac_version == RTL_GIGA_MAC_VER_71)
|
||||
r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0400);
|
||||
else if (tp->mac_version == RTL_GIGA_MAC_VER_63)
|
||||
r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0200);
|
||||
@@ -3719,8 +3719,8 @@ static void rtl_hw_start_8125_common(str
|
||||
r8168_mac_ocp_modify(tp, 0xe056, 0x00f0, 0x0030);
|
||||
r8168_mac_ocp_modify(tp, 0xe040, 0x1000, 0x0000);
|
||||
r8168_mac_ocp_modify(tp, 0xea1c, 0x0003, 0x0001);
|
||||
- if (tp->mac_version == RTL_GIGA_MAC_VER_65 ||
|
||||
- tp->mac_version == RTL_GIGA_MAC_VER_66)
|
||||
+ if (tp->mac_version == RTL_GIGA_MAC_VER_70 ||
|
||||
+ tp->mac_version == RTL_GIGA_MAC_VER_71)
|
||||
r8168_mac_ocp_modify(tp, 0xea1c, 0x0300, 0x0000);
|
||||
else
|
||||
r8168_mac_ocp_modify(tp, 0xea1c, 0x0004, 0x0000);
|
||||
@@ -3839,8 +3839,8 @@ static void rtl_hw_config(struct rtl8169
|
||||
[RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b,
|
||||
[RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d,
|
||||
- [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a,
|
||||
- [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8126a,
|
||||
+ [RTL_GIGA_MAC_VER_70] = rtl_hw_start_8126a,
|
||||
+ [RTL_GIGA_MAC_VER_71] = rtl_hw_start_8126a,
|
||||
};
|
||||
|
||||
if (hw_configs[tp->mac_version])
|
||||
@@ -3861,8 +3861,8 @@ static void rtl_hw_start_8125(struct rtl
|
||||
RTL_W32(tp, i, 0);
|
||||
break;
|
||||
case RTL_GIGA_MAC_VER_63:
|
||||
- case RTL_GIGA_MAC_VER_65:
|
||||
- case RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_70:
|
||||
+ case RTL_GIGA_MAC_VER_71:
|
||||
for (i = 0xa00; i < 0xa80; i += 4)
|
||||
RTL_W32(tp, i, 0);
|
||||
RTL_W16(tp, INT_CFG1_8125, 0x0000);
|
||||
@@ -4094,7 +4094,7 @@ static void rtl8169_cleanup(struct rtl81
|
||||
RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq);
|
||||
rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_71:
|
||||
rtl_enable_rxdvgate(tp);
|
||||
fsleep(2000);
|
||||
break;
|
||||
@@ -4251,7 +4251,7 @@ static unsigned int rtl_quirk_packet_pad
|
||||
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_34:
|
||||
- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71:
|
||||
padto = max_t(unsigned int, padto, ETH_ZLEN);
|
||||
break;
|
||||
default:
|
||||
@@ -5272,7 +5272,7 @@ static void rtl_hw_initialize(struct rtl
|
||||
case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48:
|
||||
rtl_hw_init_8168g(tp);
|
||||
break;
|
||||
- case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_66:
|
||||
+ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71:
|
||||
rtl_hw_init_8125(tp);
|
||||
break;
|
||||
default:
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1162,8 +1162,8 @@ void r8169_hw_phy_config(struct rtl8169_
|
||||
[RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config,
|
||||
- [RTL_GIGA_MAC_VER_65] = rtl8126a_hw_phy_config,
|
||||
- [RTL_GIGA_MAC_VER_66] = rtl8126a_hw_phy_config,
|
||||
+ [RTL_GIGA_MAC_VER_70] = rtl8126a_hw_phy_config,
|
||||
+ [RTL_GIGA_MAC_VER_71] = rtl8126a_hw_phy_config,
|
||||
};
|
||||
|
||||
if (phy_configs[ver])
|
||||
@ -0,0 +1,90 @@
|
||||
From b3593df26ab19f114d613693fa8a92ab202803d0 Mon Sep 17 00:00:00 2001
|
||||
From: ChunHao Lin <hau@realtek.com>
|
||||
Date: Fri, 13 Dec 2024 20:02:58 +0100
|
||||
Subject: [PATCH] r8169: add support for RTL8125D rev.b
|
||||
|
||||
Add support for RTL8125D rev.b. Its XID is 0x689. It is basically
|
||||
based on the one with XID 0x688, but with different firmware file.
|
||||
|
||||
Signed-off-by: ChunHao Lin <hau@realtek.com>
|
||||
[hkallweit1@gmail.com: rebased after adjusted version numbering]
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/75e5e9ec-d01f-43ac-b0f4-e7456baf18d1@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169.h | 1 +
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 6 ++++++
|
||||
drivers/net/ethernet/realtek/r8169_phy_config.c | 1 +
|
||||
3 files changed, 8 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169.h
|
||||
+++ b/drivers/net/ethernet/realtek/r8169.h
|
||||
@@ -69,6 +69,7 @@ enum mac_version {
|
||||
RTL_GIGA_MAC_VER_61,
|
||||
RTL_GIGA_MAC_VER_63,
|
||||
RTL_GIGA_MAC_VER_64,
|
||||
+ RTL_GIGA_MAC_VER_65,
|
||||
RTL_GIGA_MAC_VER_70,
|
||||
RTL_GIGA_MAC_VER_71,
|
||||
RTL_GIGA_MAC_NONE
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -56,6 +56,7 @@
|
||||
#define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw"
|
||||
#define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw"
|
||||
#define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw"
|
||||
+#define FIRMWARE_8125D_2 "rtl_nic/rtl8125d-2.fw"
|
||||
#define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw"
|
||||
#define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw"
|
||||
|
||||
@@ -139,6 +140,7 @@ static const struct {
|
||||
/* reserve 62 for CFG_METHOD_4 in the vendor driver */
|
||||
[RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2},
|
||||
[RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1},
|
||||
+ [RTL_GIGA_MAC_VER_65] = {"RTL8125D", FIRMWARE_8125D_2},
|
||||
[RTL_GIGA_MAC_VER_70] = {"RTL8126A", FIRMWARE_8126A_2},
|
||||
[RTL_GIGA_MAC_VER_71] = {"RTL8126A", FIRMWARE_8126A_3},
|
||||
};
|
||||
@@ -706,6 +708,7 @@ MODULE_FIRMWARE(FIRMWARE_8107E_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125A_3);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125B_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125D_1);
|
||||
+MODULE_FIRMWARE(FIRMWARE_8125D_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_3);
|
||||
|
||||
@@ -2259,6 +2262,7 @@ static enum mac_version rtl8169_get_mac_
|
||||
{ 0x7cf, 0x649, RTL_GIGA_MAC_VER_70 },
|
||||
|
||||
/* 8125D family. */
|
||||
+ { 0x7cf, 0x689, RTL_GIGA_MAC_VER_65 },
|
||||
{ 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 },
|
||||
|
||||
/* 8125B family. */
|
||||
@@ -3839,6 +3843,7 @@ static void rtl_hw_config(struct rtl8169
|
||||
[RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b,
|
||||
[RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d,
|
||||
+ [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8125d,
|
||||
[RTL_GIGA_MAC_VER_70] = rtl_hw_start_8126a,
|
||||
[RTL_GIGA_MAC_VER_71] = rtl_hw_start_8126a,
|
||||
};
|
||||
@@ -3857,6 +3862,7 @@ static void rtl_hw_start_8125(struct rtl
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_61:
|
||||
case RTL_GIGA_MAC_VER_64:
|
||||
+ case RTL_GIGA_MAC_VER_65:
|
||||
for (i = 0xa00; i < 0xb00; i += 4)
|
||||
RTL_W32(tp, i, 0);
|
||||
break;
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1162,6 +1162,7 @@ void r8169_hw_phy_config(struct rtl8169_
|
||||
[RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config,
|
||||
+ [RTL_GIGA_MAC_VER_65] = rtl8125d_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_70] = rtl8126a_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_71] = rtl8126a_hw_phy_config,
|
||||
};
|
||||
@ -0,0 +1,184 @@
|
||||
From b11bff90f2ad52c5c55c822ecd20326619a73898 Mon Sep 17 00:00:00 2001
|
||||
From: ChunHao Lin <hau@realtek.com>
|
||||
Date: Tue, 7 Jan 2025 14:43:55 +0800
|
||||
Subject: [PATCH] r8169: add support for RTL8125BP rev.b
|
||||
|
||||
Add support for RTL8125BP rev.b. Its XID is 0x689. This chip supports
|
||||
DASH and its dash type is "RTL_DASH_25_BP".
|
||||
|
||||
Signed-off-by: ChunHao Lin <hau@realtek.com>
|
||||
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/20250107064355.104711-1-hau@realtek.com
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169.h | 1 +
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 30 +++++++++++++++++++
|
||||
.../net/ethernet/realtek/r8169_phy_config.c | 23 ++++++++++++++
|
||||
3 files changed, 54 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169.h
|
||||
+++ b/drivers/net/ethernet/realtek/r8169.h
|
||||
@@ -70,6 +70,7 @@ enum mac_version {
|
||||
RTL_GIGA_MAC_VER_63,
|
||||
RTL_GIGA_MAC_VER_64,
|
||||
RTL_GIGA_MAC_VER_65,
|
||||
+ RTL_GIGA_MAC_VER_66,
|
||||
RTL_GIGA_MAC_VER_70,
|
||||
RTL_GIGA_MAC_VER_71,
|
||||
RTL_GIGA_MAC_NONE
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -57,6 +57,7 @@
|
||||
#define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw"
|
||||
#define FIRMWARE_8125D_1 "rtl_nic/rtl8125d-1.fw"
|
||||
#define FIRMWARE_8125D_2 "rtl_nic/rtl8125d-2.fw"
|
||||
+#define FIRMWARE_8125BP_2 "rtl_nic/rtl8125bp-2.fw"
|
||||
#define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-2.fw"
|
||||
#define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw"
|
||||
|
||||
@@ -141,6 +142,7 @@ static const struct {
|
||||
[RTL_GIGA_MAC_VER_63] = {"RTL8125B", FIRMWARE_8125B_2},
|
||||
[RTL_GIGA_MAC_VER_64] = {"RTL8125D", FIRMWARE_8125D_1},
|
||||
[RTL_GIGA_MAC_VER_65] = {"RTL8125D", FIRMWARE_8125D_2},
|
||||
+ [RTL_GIGA_MAC_VER_66] = {"RTL8125BP", FIRMWARE_8125BP_2},
|
||||
[RTL_GIGA_MAC_VER_70] = {"RTL8126A", FIRMWARE_8126A_2},
|
||||
[RTL_GIGA_MAC_VER_71] = {"RTL8126A", FIRMWARE_8126A_3},
|
||||
};
|
||||
@@ -632,6 +634,7 @@ enum rtl_dash_type {
|
||||
RTL_DASH_NONE,
|
||||
RTL_DASH_DP,
|
||||
RTL_DASH_EP,
|
||||
+ RTL_DASH_25_BP,
|
||||
};
|
||||
|
||||
struct rtl8169_private {
|
||||
@@ -709,6 +712,7 @@ MODULE_FIRMWARE(FIRMWARE_8125A_3);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125B_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125D_1);
|
||||
MODULE_FIRMWARE(FIRMWARE_8125D_2);
|
||||
+MODULE_FIRMWARE(FIRMWARE_8125BP_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_2);
|
||||
MODULE_FIRMWARE(FIRMWARE_8126A_3);
|
||||
|
||||
@@ -1361,10 +1365,19 @@ static void rtl8168ep_driver_start(struc
|
||||
rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30);
|
||||
}
|
||||
|
||||
+static void rtl8125bp_driver_start(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ r8168ep_ocp_write(tp, 0x01, 0x14, OOB_CMD_DRIVER_START);
|
||||
+ r8168ep_ocp_write(tp, 0x01, 0x18, 0x00);
|
||||
+ r8168ep_ocp_write(tp, 0x01, 0x10, 0x01);
|
||||
+}
|
||||
+
|
||||
static void rtl8168_driver_start(struct rtl8169_private *tp)
|
||||
{
|
||||
if (tp->dash_type == RTL_DASH_DP)
|
||||
rtl8168dp_driver_start(tp);
|
||||
+ else if (tp->dash_type == RTL_DASH_25_BP)
|
||||
+ rtl8125bp_driver_start(tp);
|
||||
else
|
||||
rtl8168ep_driver_start(tp);
|
||||
}
|
||||
@@ -1385,10 +1398,19 @@ static void rtl8168ep_driver_stop(struct
|
||||
rtl_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10000, 10);
|
||||
}
|
||||
|
||||
+static void rtl8125bp_driver_stop(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ r8168ep_ocp_write(tp, 0x01, 0x14, OOB_CMD_DRIVER_STOP);
|
||||
+ r8168ep_ocp_write(tp, 0x01, 0x18, 0x00);
|
||||
+ r8168ep_ocp_write(tp, 0x01, 0x10, 0x01);
|
||||
+}
|
||||
+
|
||||
static void rtl8168_driver_stop(struct rtl8169_private *tp)
|
||||
{
|
||||
if (tp->dash_type == RTL_DASH_DP)
|
||||
rtl8168dp_driver_stop(tp);
|
||||
+ else if (tp->dash_type == RTL_DASH_25_BP)
|
||||
+ rtl8125bp_driver_stop(tp);
|
||||
else
|
||||
rtl8168ep_driver_stop(tp);
|
||||
}
|
||||
@@ -1411,6 +1433,7 @@ static bool rtl_dash_is_enabled(struct r
|
||||
case RTL_DASH_DP:
|
||||
return r8168dp_check_dash(tp);
|
||||
case RTL_DASH_EP:
|
||||
+ case RTL_DASH_25_BP:
|
||||
return r8168ep_check_dash(tp);
|
||||
default:
|
||||
return false;
|
||||
@@ -1425,6 +1448,8 @@ static enum rtl_dash_type rtl_get_dash_t
|
||||
return RTL_DASH_DP;
|
||||
case RTL_GIGA_MAC_VER_51 ... RTL_GIGA_MAC_VER_53:
|
||||
return RTL_DASH_EP;
|
||||
+ case RTL_GIGA_MAC_VER_66:
|
||||
+ return RTL_DASH_25_BP;
|
||||
default:
|
||||
return RTL_DASH_NONE;
|
||||
}
|
||||
@@ -2261,6 +2286,9 @@ static enum mac_version rtl8169_get_mac_
|
||||
{ 0x7cf, 0x64a, RTL_GIGA_MAC_VER_71 },
|
||||
{ 0x7cf, 0x649, RTL_GIGA_MAC_VER_70 },
|
||||
|
||||
+ /* 8125BP family. */
|
||||
+ { 0x7cf, 0x681, RTL_GIGA_MAC_VER_66 },
|
||||
+
|
||||
/* 8125D family. */
|
||||
{ 0x7cf, 0x689, RTL_GIGA_MAC_VER_65 },
|
||||
{ 0x7cf, 0x688, RTL_GIGA_MAC_VER_64 },
|
||||
@@ -3844,6 +3872,7 @@ static void rtl_hw_config(struct rtl8169
|
||||
[RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b,
|
||||
[RTL_GIGA_MAC_VER_64] = rtl_hw_start_8125d,
|
||||
[RTL_GIGA_MAC_VER_65] = rtl_hw_start_8125d,
|
||||
+ [RTL_GIGA_MAC_VER_66] = rtl_hw_start_8125d,
|
||||
[RTL_GIGA_MAC_VER_70] = rtl_hw_start_8126a,
|
||||
[RTL_GIGA_MAC_VER_71] = rtl_hw_start_8126a,
|
||||
};
|
||||
@@ -3863,6 +3892,7 @@ static void rtl_hw_start_8125(struct rtl
|
||||
case RTL_GIGA_MAC_VER_61:
|
||||
case RTL_GIGA_MAC_VER_64:
|
||||
case RTL_GIGA_MAC_VER_65:
|
||||
+ case RTL_GIGA_MAC_VER_66:
|
||||
for (i = 0xa00; i < 0xb00; i += 4)
|
||||
RTL_W32(tp, i, 0);
|
||||
break;
|
||||
--- a/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c
|
||||
@@ -1102,6 +1102,28 @@ static void rtl8125d_hw_phy_config(struc
|
||||
rtl8125_config_eee_phy(phydev);
|
||||
}
|
||||
|
||||
+static void rtl8125bp_hw_phy_config(struct rtl8169_private *tp,
|
||||
+ struct phy_device *phydev)
|
||||
+{
|
||||
+ r8169_apply_firmware(tp);
|
||||
+ rtl8168g_enable_gphy_10m(phydev);
|
||||
+
|
||||
+ r8168g_phy_param(phydev, 0x8010, 0x0800, 0x0000);
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0b87);
|
||||
+ phy_write(phydev, 0x16, 0x8088);
|
||||
+ phy_modify(phydev, 0x17, 0xff00, 0x9000);
|
||||
+ phy_write(phydev, 0x16, 0x808f);
|
||||
+ phy_modify(phydev, 0x17, 0xff00, 0x9000);
|
||||
+ phy_write(phydev, 0x1f, 0x0000);
|
||||
+
|
||||
+ r8168g_phy_param(phydev, 0x8174, 0x2000, 0x1800);
|
||||
+
|
||||
+ rtl8125_legacy_force_mode(phydev);
|
||||
+ rtl8168g_disable_aldps(phydev);
|
||||
+ rtl8125_config_eee_phy(phydev);
|
||||
+}
|
||||
+
|
||||
static void rtl8126a_hw_phy_config(struct rtl8169_private *tp,
|
||||
struct phy_device *phydev)
|
||||
{
|
||||
@@ -1163,6 +1185,7 @@ void r8169_hw_phy_config(struct rtl8169_
|
||||
[RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_64] = rtl8125d_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_65] = rtl8125d_hw_phy_config,
|
||||
+ [RTL_GIGA_MAC_VER_66] = rtl8125bp_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_70] = rtl8126a_hw_phy_config,
|
||||
[RTL_GIGA_MAC_VER_71] = rtl8126a_hw_phy_config,
|
||||
};
|
||||
@ -0,0 +1,28 @@
|
||||
From 135c3c86a7cef4ba3d368da15b16c275b74582d3 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Mon, 3 Feb 2025 21:35:24 +0100
|
||||
Subject: [PATCH] r8169: make Kconfig option for LED support user-visible
|
||||
|
||||
Make config option R8169_LEDS user-visible, so that users can remove
|
||||
support if not needed.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/d29f0cdb-32bf-435f-b59d-dc96bca1e3ab@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/Kconfig | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/Kconfig
|
||||
+++ b/drivers/net/ethernet/realtek/Kconfig
|
||||
@@ -114,7 +114,8 @@ config R8169
|
||||
will be called r8169. This is recommended.
|
||||
|
||||
config R8169_LEDS
|
||||
- def_bool R8169 && LEDS_TRIGGER_NETDEV
|
||||
+ bool "Support for controlling the NIC LEDs"
|
||||
+ depends on R8169 && LEDS_TRIGGER_NETDEV
|
||||
depends on !(R8169=y && LEDS_CLASS=m)
|
||||
help
|
||||
Optional support for controlling the NIC LED's with the netdev
|
||||
@ -0,0 +1,26 @@
|
||||
From faac69a4ae5abb49e62c79c66b51bb905c9aa5ec Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Tue, 4 Feb 2025 07:58:17 +0100
|
||||
Subject: [PATCH] r8169: don't scan PHY addresses > 0
|
||||
|
||||
The PHY address is a dummy, because r8169 PHY access registers
|
||||
don't support a PHY address. Therefore scan address 0 only.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/830637dd-4016-4a68-92b3-618fcac6589d@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -5229,6 +5229,7 @@ static int r8169_mdio_register(struct rt
|
||||
new_bus->priv = tp;
|
||||
new_bus->parent = &pdev->dev;
|
||||
new_bus->irq[0] = PHY_MAC_INTERRUPT;
|
||||
+ new_bus->phy_mask = GENMASK(31, 1);
|
||||
snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x",
|
||||
pci_domain_nr(pdev->bus), pci_dev_id(pdev));
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
From d30460f42675fef5cd4b44ffbc49b545524555e3 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Wed, 12 Feb 2025 08:03:56 +0100
|
||||
Subject: [PATCH] r8169: add support for Intel Killer E5000
|
||||
|
||||
This adds support for the Intel Killer E5000 which seems to be a
|
||||
rebranded RTL8126. Copied from r8126 vendor driver.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/9db73e9b-e2e8-45de-97a5-041c5f71d774@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -169,6 +169,7 @@ static const struct pci_device_id rtl816
|
||||
{ PCI_VDEVICE(REALTEK, 0x8125) },
|
||||
{ PCI_VDEVICE(REALTEK, 0x8126) },
|
||||
{ PCI_VDEVICE(REALTEK, 0x3000) },
|
||||
+ { PCI_VDEVICE(REALTEK, 0x5000) },
|
||||
{}
|
||||
};
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
From 853e80369cfceb2331bf34f251ba11c6602cc67f Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 13 Feb 2025 20:15:42 +0100
|
||||
Subject: [PATCH] r8169: add PHY c45 ops for MDIO_MMD_VENDOR2 registers
|
||||
|
||||
The integrated PHYs on chip versions from RTL8168g allow to address
|
||||
MDIO_MMD_VEND2 registers. All c22 standard registers are mapped to
|
||||
MDIO_MMD_VEND2 registers. So far the paging mechanism is used to
|
||||
address PHY registers. Add support for c45 ops to address MDIO_MMD_VEND2
|
||||
registers directly, w/o the paging.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/d6f97eaa-0f13-468f-89cb-75a41087bc4a@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 32 +++++++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -5207,6 +5207,33 @@ static int r8169_mdio_write_reg(struct m
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int r8169_mdio_read_reg_c45(struct mii_bus *mii_bus, int addr,
|
||||
+ int devnum, int regnum)
|
||||
+{
|
||||
+ struct rtl8169_private *tp = mii_bus->priv;
|
||||
+
|
||||
+ if (addr > 0)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ if (devnum == MDIO_MMD_VEND2 && regnum > MDIO_STAT2)
|
||||
+ return r8168_phy_ocp_read(tp, regnum);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int r8169_mdio_write_reg_c45(struct mii_bus *mii_bus, int addr,
|
||||
+ int devnum, int regnum, u16 val)
|
||||
+{
|
||||
+ struct rtl8169_private *tp = mii_bus->priv;
|
||||
+
|
||||
+ if (addr > 0 || devnum != MDIO_MMD_VEND2 || regnum <= MDIO_STAT2)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ r8168_phy_ocp_write(tp, regnum, val);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int r8169_mdio_register(struct rtl8169_private *tp)
|
||||
{
|
||||
struct pci_dev *pdev = tp->pci_dev;
|
||||
@@ -5237,6 +5264,11 @@ static int r8169_mdio_register(struct rt
|
||||
new_bus->read = r8169_mdio_read_reg;
|
||||
new_bus->write = r8169_mdio_write_reg;
|
||||
|
||||
+ if (tp->mac_version >= RTL_GIGA_MAC_VER_40) {
|
||||
+ new_bus->read_c45 = r8169_mdio_read_reg_c45;
|
||||
+ new_bus->write_c45 = r8169_mdio_write_reg_c45;
|
||||
+ }
|
||||
+
|
||||
ret = devm_mdiobus_register(&pdev->dev, new_bus);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -0,0 +1,40 @@
|
||||
From 473367a5ffe1607a61be481e2feda684eb5faea9 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Fri, 7 Mar 2025 08:29:47 +0100
|
||||
Subject: [PATCH] r8169: increase max jumbo packet size on RTL8125/RTL8126
|
||||
|
||||
Realtek confirmed that all RTL8125/RTL8126 chip versions support up to
|
||||
16K jumbo packets. Reflect this in the driver.
|
||||
|
||||
Tested by Rui on RTL8125B with 12K jumbo packets.
|
||||
|
||||
Suggested-by: Rui Salvaterra <rsalvaterra@gmail.com>
|
||||
Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/396762ad-cc65-4e60-b01e-8847db89e98b@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -89,6 +89,7 @@
|
||||
#define JUMBO_6K (6 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN)
|
||||
#define JUMBO_7K (7 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN)
|
||||
#define JUMBO_9K (9 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN)
|
||||
+#define JUMBO_16K (SZ_16K - VLAN_ETH_HLEN - ETH_FCS_LEN)
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
@@ -5366,6 +5367,9 @@ static int rtl_jumbo_max(struct rtl8169_
|
||||
/* RTL8168c */
|
||||
case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_24:
|
||||
return JUMBO_6K;
|
||||
+ /* RTL8125/8126 */
|
||||
+ case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71:
|
||||
+ return JUMBO_16K;
|
||||
default:
|
||||
return JUMBO_9K;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
From 3d9b8ac5341269d31e59fd5d58d47266ac78bc32 Mon Sep 17 00:00:00 2001
|
||||
From: ChunHao Lin <hau@realtek.com>
|
||||
Date: Tue, 18 Mar 2025 16:37:20 +0800
|
||||
Subject: [PATCH] r8169: enable RTL8168H/RTL8168EP/RTL8168FP ASPM support
|
||||
|
||||
This patch will enable RTL8168H/RTL8168EP/RTL8168FP ASPM support on
|
||||
the platforms that have tested with ASPM enabled.
|
||||
|
||||
Signed-off-by: ChunHao Lin <hau@realtek.com>
|
||||
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/20250318083721.4127-2-hau@realtek.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -5404,7 +5404,7 @@ done:
|
||||
/* register is set if system vendor successfully tested ASPM 1.2 */
|
||||
static bool rtl_aspm_is_safe(struct rtl8169_private *tp)
|
||||
{
|
||||
- if (tp->mac_version >= RTL_GIGA_MAC_VER_61 &&
|
||||
+ if (tp->mac_version >= RTL_GIGA_MAC_VER_46 &&
|
||||
r8168_mac_ocp_read(tp, 0xc0b2) & 0xf)
|
||||
return true;
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
From b48688ea3c9ac8d5d910c6e91fb7f80d846581f0 Mon Sep 17 00:00:00 2001
|
||||
From: ChunHao Lin <hau@realtek.com>
|
||||
Date: Tue, 18 Mar 2025 16:37:21 +0800
|
||||
Subject: [PATCH] r8169: disable RTL8126 ZRX-DC timeout
|
||||
|
||||
Disable it due to it dose not meet ZRX-DC specification. If it is enabled,
|
||||
device will exit L1 substate every 100ms. Disable it for saving more power
|
||||
in L1 substate.
|
||||
|
||||
Signed-off-by: ChunHao Lin <hau@realtek.com>
|
||||
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/20250318083721.4127-3-hau@realtek.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 27 +++++++++++++++++++++++
|
||||
1 file changed, 27 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -2855,6 +2855,32 @@ static u32 rtl_csi_read(struct rtl8169_p
|
||||
RTL_R32(tp, CSIDR) : ~0;
|
||||
}
|
||||
|
||||
+static void rtl_disable_zrxdc_timeout(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ struct pci_dev *pdev = tp->pci_dev;
|
||||
+ u32 csi;
|
||||
+ int rc;
|
||||
+ u8 val;
|
||||
+
|
||||
+#define RTL_GEN3_RELATED_OFF 0x0890
|
||||
+#define RTL_GEN3_ZRXDC_NONCOMPL 0x1
|
||||
+ if (pdev->cfg_size > RTL_GEN3_RELATED_OFF) {
|
||||
+ rc = pci_read_config_byte(pdev, RTL_GEN3_RELATED_OFF, &val);
|
||||
+ if (rc == PCIBIOS_SUCCESSFUL) {
|
||||
+ val &= ~RTL_GEN3_ZRXDC_NONCOMPL;
|
||||
+ rc = pci_write_config_byte(pdev, RTL_GEN3_RELATED_OFF,
|
||||
+ val);
|
||||
+ if (rc == PCIBIOS_SUCCESSFUL)
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ netdev_notice_once(tp->dev,
|
||||
+ "No native access to PCI extended config space, falling back to CSI\n");
|
||||
+ csi = rtl_csi_read(tp, RTL_GEN3_RELATED_OFF);
|
||||
+ rtl_csi_write(tp, RTL_GEN3_RELATED_OFF, csi & ~RTL_GEN3_ZRXDC_NONCOMPL);
|
||||
+}
|
||||
+
|
||||
static void rtl_set_aspm_entry_latency(struct rtl8169_private *tp, u8 val)
|
||||
{
|
||||
struct pci_dev *pdev = tp->pci_dev;
|
||||
@@ -3827,6 +3853,7 @@ static void rtl_hw_start_8125d(struct rt
|
||||
|
||||
static void rtl_hw_start_8126a(struct rtl8169_private *tp)
|
||||
{
|
||||
+ rtl_disable_zrxdc_timeout(tp);
|
||||
rtl_set_def_aspm_entry_latency(tp);
|
||||
rtl_hw_start_8125_common(tp);
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
From 081c9c0265c91b8333165aa6230c20bcbc6f7cbf Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 10 Oct 2024 14:07:16 +0100
|
||||
Subject: [PATCH 3/5] net: phy: realtek: read duplex and gbit master from PHYSR
|
||||
register
|
||||
|
||||
The PHYSR MMD register is present and defined equally for all RTL82xx
|
||||
Ethernet PHYs.
|
||||
Read duplex and Gbit master bits from rtlgen_decode_speed() and rename
|
||||
it to rtlgen_decode_physr().
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Link: https://patch.msgid.link/b9a76341da851a18c985bc4774fa295babec79bb.1728565530.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 41 +++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 33 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -80,15 +80,18 @@
|
||||
|
||||
#define RTL822X_VND2_GANLPAR 0xa414
|
||||
|
||||
-#define RTL822X_VND2_PHYSR 0xa434
|
||||
-
|
||||
#define RTL8366RB_POWER_SAVE 0x15
|
||||
#define RTL8366RB_POWER_SAVE_ON BIT(12)
|
||||
|
||||
#define RTL9000A_GINMR 0x14
|
||||
#define RTL9000A_GINMR_LINK_STATUS BIT(4)
|
||||
|
||||
-#define RTLGEN_SPEED_MASK 0x0630
|
||||
+#define RTL_VND2_PHYSR 0xa434
|
||||
+#define RTL_VND2_PHYSR_DUPLEX BIT(3)
|
||||
+#define RTL_VND2_PHYSR_SPEEDL GENMASK(5, 4)
|
||||
+#define RTL_VND2_PHYSR_SPEEDH GENMASK(10, 9)
|
||||
+#define RTL_VND2_PHYSR_MASTER BIT(11)
|
||||
+#define RTL_VND2_PHYSR_SPEED_MASK (RTL_VND2_PHYSR_SPEEDL | RTL_VND2_PHYSR_SPEEDH)
|
||||
|
||||
#define RTL_GENERIC_PHYID 0x001cc800
|
||||
#define RTL_8211FVD_PHYID 0x001cc878
|
||||
@@ -660,9 +663,18 @@ static int rtl8366rb_config_init(struct
|
||||
}
|
||||
|
||||
/* get actual speed to cover the downshift case */
|
||||
-static void rtlgen_decode_speed(struct phy_device *phydev, int val)
|
||||
+static void rtlgen_decode_physr(struct phy_device *phydev, int val)
|
||||
{
|
||||
- switch (val & RTLGEN_SPEED_MASK) {
|
||||
+ /* bit 3
|
||||
+ * 0: Half Duplex
|
||||
+ * 1: Full Duplex
|
||||
+ */
|
||||
+ if (val & RTL_VND2_PHYSR_DUPLEX)
|
||||
+ phydev->duplex = DUPLEX_FULL;
|
||||
+ else
|
||||
+ phydev->duplex = DUPLEX_HALF;
|
||||
+
|
||||
+ switch (val & RTL_VND2_PHYSR_SPEED_MASK) {
|
||||
case 0x0000:
|
||||
phydev->speed = SPEED_10;
|
||||
break;
|
||||
@@ -684,6 +696,19 @@ static void rtlgen_decode_speed(struct p
|
||||
default:
|
||||
break;
|
||||
}
|
||||
+
|
||||
+ /* bit 11
|
||||
+ * 0: Slave Mode
|
||||
+ * 1: Master Mode
|
||||
+ */
|
||||
+ if (phydev->speed >= 1000) {
|
||||
+ if (val & RTL_VND2_PHYSR_MASTER)
|
||||
+ phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER;
|
||||
+ else
|
||||
+ phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE;
|
||||
+ } else {
|
||||
+ phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED;
|
||||
+ }
|
||||
}
|
||||
|
||||
static int rtlgen_read_status(struct phy_device *phydev)
|
||||
@@ -701,7 +726,7 @@ static int rtlgen_read_status(struct phy
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
||||
- rtlgen_decode_speed(phydev, val);
|
||||
+ rtlgen_decode_physr(phydev, val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1007,11 +1032,11 @@ static int rtl822x_c45_read_status(struc
|
||||
return 0;
|
||||
|
||||
/* Read actual speed from vendor register. */
|
||||
- val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_PHYSR);
|
||||
+ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR);
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
||||
- rtlgen_decode_speed(phydev, val);
|
||||
+ rtlgen_decode_physr(phydev, val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
From 68d5cd09e8919679ce13b85950debea4b2e98e04 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 10 Oct 2024 14:07:26 +0100
|
||||
Subject: [PATCH 4/5] net: phy: realtek: change order of calls in C22
|
||||
read_status()
|
||||
|
||||
Always call rtlgen_read_status() first, so genphy_read_status() which
|
||||
is called by it clears bits in case auto-negotiation has not completed.
|
||||
Also clear 10GBT link-partner advertisement bits in case auto-negotiation
|
||||
is disabled or has not completed.
|
||||
|
||||
Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Link: https://patch.msgid.link/b15929a41621d215c6b2b57393368086589569ec.1728565530.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 22 +++++++++++++++-------
|
||||
1 file changed, 15 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -949,17 +949,25 @@ static void rtl822xb_update_interface(st
|
||||
|
||||
static int rtl822x_read_status(struct phy_device *phydev)
|
||||
{
|
||||
- if (phydev->autoneg == AUTONEG_ENABLE) {
|
||||
- int lpadv = phy_read_paged(phydev, 0xa5d, 0x13);
|
||||
+ int lpadv, ret;
|
||||
|
||||
- if (lpadv < 0)
|
||||
- return lpadv;
|
||||
+ ret = rtlgen_read_status(phydev);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
|
||||
- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising,
|
||||
- lpadv);
|
||||
+ if (phydev->autoneg == AUTONEG_DISABLE ||
|
||||
+ !phydev->autoneg_complete) {
|
||||
+ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
- return rtlgen_read_status(phydev);
|
||||
+ lpadv = phy_read_paged(phydev, 0xa5d, 0x13);
|
||||
+ if (lpadv < 0)
|
||||
+ return lpadv;
|
||||
+
|
||||
+ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, lpadv);
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static int rtl822xb_read_status(struct phy_device *phydev)
|
||||
@ -0,0 +1,30 @@
|
||||
From 5cb409b3960e75467cbb0a8e1e5596b4490570e3 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 10 Oct 2024 14:07:39 +0100
|
||||
Subject: [PATCH 5/5] net: phy: realtek: clear 1000Base-T link partner
|
||||
advertisement
|
||||
|
||||
Clear 1000Base-T link partner advertisement bits in Clause-45
|
||||
read_status() function in case auto-negotiation is disabled or has not
|
||||
been completed.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Link: https://patch.msgid.link/9dc9b47b2d675708afef3ad366bfd78eb584d958.1728565530.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1026,6 +1026,10 @@ static int rtl822x_c45_read_status(struc
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+ if (phydev->autoneg == AUTONEG_DISABLE ||
|
||||
+ !genphy_c45_aneg_done(phydev))
|
||||
+ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
|
||||
+
|
||||
/* Vendor register as C45 has no standardized support for 1000BaseT */
|
||||
if (phydev->autoneg == AUTONEG_ENABLE) {
|
||||
val = phy_read_mmd(phydev, MDIO_MMD_VEND2,
|
||||
@ -0,0 +1,136 @@
|
||||
From f87a17ed3b51fba4dfdd8f8b643b5423a85fc551 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Tue, 15 Oct 2024 07:47:14 +0200
|
||||
Subject: [PATCH] net: phy: realtek: merge the drivers for internal NBase-T
|
||||
PHY's
|
||||
|
||||
The Realtek RTL8125/RTL8126 NBase-T MAC/PHY chips have internal PHY's
|
||||
which are register-compatible, at least for the registers we use here.
|
||||
So let's use just one PHY driver to support all of them.
|
||||
These internal PHY's exist also as external C45 PHY's, but on the
|
||||
internal PHY's no access to MMD registers is possible. This can be
|
||||
used to differentiate between the internal and external version.
|
||||
|
||||
As a side effect the drivers for two now external-only drivers don't
|
||||
require read_mmd/write_mmd hooks any longer.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Link: https://patch.msgid.link/c57081a6-811f-4571-ab35-34f4ca6de9af@gmail.com
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 53 +++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 43 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -95,6 +95,7 @@
|
||||
|
||||
#define RTL_GENERIC_PHYID 0x001cc800
|
||||
#define RTL_8211FVD_PHYID 0x001cc878
|
||||
+#define RTL_8221B 0x001cc840
|
||||
#define RTL_8221B_VB_CG 0x001cc849
|
||||
#define RTL_8221B_VN_CG 0x001cc84a
|
||||
#define RTL_8251B 0x001cc862
|
||||
@@ -1077,6 +1078,23 @@ static bool rtlgen_supports_2_5gbps(stru
|
||||
return val >= 0 && val & MDIO_PMA_SPEED_2_5G;
|
||||
}
|
||||
|
||||
+/* On internal PHY's MMD reads over C22 always return 0.
|
||||
+ * Check a MMD register which is known to be non-zero.
|
||||
+ */
|
||||
+static bool rtlgen_supports_mmd(struct phy_device *phydev)
|
||||
+{
|
||||
+ int val;
|
||||
+
|
||||
+ phy_lock_mdio_bus(phydev);
|
||||
+ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS);
|
||||
+ __phy_write(phydev, MII_MMD_DATA, MDIO_PCS_EEE_ABLE);
|
||||
+ __phy_write(phydev, MII_MMD_CTRL, MDIO_MMD_PCS | MII_MMD_CTRL_NOINCR);
|
||||
+ val = __phy_read(phydev, MII_MMD_DATA);
|
||||
+ phy_unlock_mdio_bus(phydev);
|
||||
+
|
||||
+ return val > 0;
|
||||
+}
|
||||
+
|
||||
static int rtlgen_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
@@ -1086,7 +1104,8 @@ static int rtlgen_match_phy_device(struc
|
||||
static int rtl8226_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
- rtlgen_supports_2_5gbps(phydev);
|
||||
+ rtlgen_supports_2_5gbps(phydev) &&
|
||||
+ rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id,
|
||||
@@ -1098,6 +1117,11 @@ static int rtlgen_is_c45_match(struct ph
|
||||
return !is_c45 && (id == phydev->phy_id);
|
||||
}
|
||||
|
||||
+static int rtl8221b_match_phy_device(struct phy_device *phydev)
|
||||
+{
|
||||
+ return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev);
|
||||
+}
|
||||
+
|
||||
static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false);
|
||||
@@ -1118,9 +1142,21 @@ static int rtl8221b_vn_cg_c45_match_phy_
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true);
|
||||
}
|
||||
|
||||
-static int rtl8251b_c22_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev)
|
||||
{
|
||||
- return rtlgen_is_c45_match(phydev, RTL_8251B, false);
|
||||
+ if (phydev->is_c45)
|
||||
+ return false;
|
||||
+
|
||||
+ switch (phydev->phy_id) {
|
||||
+ case RTL_GENERIC_PHYID:
|
||||
+ case RTL_8221B:
|
||||
+ case RTL_8251B:
|
||||
+ break;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
static int rtl8251b_c45_match_phy_device(struct phy_device *phydev)
|
||||
@@ -1382,10 +1418,8 @@ static struct phy_driver realtek_drvs[]
|
||||
.resume = rtlgen_resume,
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
- .read_mmd = rtl822x_read_mmd,
|
||||
- .write_mmd = rtl822x_write_mmd,
|
||||
}, {
|
||||
- PHY_ID_MATCH_EXACT(0x001cc840),
|
||||
+ .match_phy_device = rtl8221b_match_phy_device,
|
||||
.name = "RTL8226B_RTL8221B 2.5Gbps PHY",
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
@@ -1396,8 +1430,6 @@ static struct phy_driver realtek_drvs[]
|
||||
.resume = rtlgen_resume,
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
- .read_mmd = rtl822x_read_mmd,
|
||||
- .write_mmd = rtl822x_write_mmd,
|
||||
}, {
|
||||
PHY_ID_MATCH_EXACT(0x001cc838),
|
||||
.name = "RTL8226-CG 2.5Gbps PHY",
|
||||
@@ -1475,8 +1507,9 @@ static struct phy_driver realtek_drvs[]
|
||||
.read_page = rtl821x_read_page,
|
||||
.write_page = rtl821x_write_page,
|
||||
}, {
|
||||
- .match_phy_device = rtl8251b_c22_match_phy_device,
|
||||
- .name = "RTL8126A-internal 5Gbps PHY",
|
||||
+ .match_phy_device = rtl_internal_nbaset_match_phy_device,
|
||||
+ .name = "Realtek Internal NBASE-T PHY",
|
||||
+ .flags = PHY_IS_INTERNAL,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.read_status = rtl822x_read_status,
|
||||
@ -0,0 +1,29 @@
|
||||
From 8989bad541133c43550bff2b80edbe37b8fb9659 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 17 Oct 2024 18:01:13 +0200
|
||||
Subject: [PATCH] net: phy: realtek: add RTL8125D-internal PHY
|
||||
|
||||
The first boards show up with Realtek's RTL8125D. This MAC/PHY chip
|
||||
comes with an integrated 2.5Gbps PHY with ID 0x001cc841. It's not
|
||||
clear yet whether there's an external version of this PHY and how
|
||||
Realtek calls it, therefore use the numeric id for now.
|
||||
|
||||
Link: https://lore.kernel.org/netdev/2ada65e1-5dfa-456c-9334-2bc51272e9da@gmail.com/T/
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Message-ID: <7d2924de-053b-44d2-a479-870dc3878170@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1151,6 +1151,7 @@ static int rtl_internal_nbaset_match_phy
|
||||
case RTL_GENERIC_PHYID:
|
||||
case RTL_8221B:
|
||||
case RTL_8251B:
|
||||
+ case 0x001cc841:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
@ -0,0 +1,52 @@
|
||||
From 34d5a86ff7bbe225fba3ad91f9b4dc85fb408e18 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Wed, 15 Jan 2025 14:43:35 +0000
|
||||
Subject: [PATCH] net: phy: realtek: clear 1000Base-T lpa if link is down
|
||||
|
||||
Only read 1000Base-T link partner advertisement if autonegotiation has
|
||||
completed and otherwise 1000Base-T link partner advertisement bits.
|
||||
|
||||
This fixes bogus 1000Base-T link partner advertisement after link goes
|
||||
down (eg. by disconnecting the wire).
|
||||
Fixes: 5cb409b3960e ("net: phy: realtek: clear 1000Base-T link partner advertisement")
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 19 ++++++++-----------
|
||||
1 file changed, 8 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1023,23 +1023,20 @@ static int rtl822x_c45_read_status(struc
|
||||
{
|
||||
int ret, val;
|
||||
|
||||
- ret = genphy_c45_read_status(phydev);
|
||||
- if (ret < 0)
|
||||
- return ret;
|
||||
-
|
||||
- if (phydev->autoneg == AUTONEG_DISABLE ||
|
||||
- !genphy_c45_aneg_done(phydev))
|
||||
- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
|
||||
-
|
||||
/* Vendor register as C45 has no standardized support for 1000BaseT */
|
||||
- if (phydev->autoneg == AUTONEG_ENABLE) {
|
||||
+ if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) {
|
||||
val = phy_read_mmd(phydev, MDIO_MMD_VEND2,
|
||||
RTL822X_VND2_GANLPAR);
|
||||
if (val < 0)
|
||||
return val;
|
||||
-
|
||||
- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val);
|
||||
+ } else {
|
||||
+ val = 0;
|
||||
}
|
||||
+ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val);
|
||||
+
|
||||
+ ret = genphy_c45_read_status(phydev);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
|
||||
if (!phydev->link)
|
||||
return 0;
|
||||
@ -0,0 +1,35 @@
|
||||
From ea8318cb33e593bbfc59d637eae45a69732c5387 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Wed, 15 Jan 2025 14:43:43 +0000
|
||||
Subject: [PATCH] net: phy: realtek: clear master_slave_state if link is down
|
||||
|
||||
rtlgen_decode_physr() which sets master_slave_state isn't called in case
|
||||
the link is down and other than rtlgen_read_status(),
|
||||
rtl822x_c45_read_status() doesn't implicitely clear master_slave_state.
|
||||
|
||||
Avoid stale master_slave_state by always setting it to
|
||||
MASTER_SLAVE_STATE_UNKNOWN in rtl822x_c45_read_status() in case the link
|
||||
is down.
|
||||
|
||||
Fixes: 081c9c0265c9 ("net: phy: realtek: read duplex and gbit master from PHYSR register")
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -1038,8 +1038,10 @@ static int rtl822x_c45_read_status(struc
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
- if (!phydev->link)
|
||||
+ if (!phydev->link) {
|
||||
+ phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN;
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
/* Read actual speed from vendor register. */
|
||||
val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR);
|
||||
@ -0,0 +1,42 @@
|
||||
From d3eb58549842c60ed46f37da7f4da969e3d6ecd3 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Wed, 15 Jan 2025 14:45:00 +0000
|
||||
Subject: [PATCH] net: phy: realtek: always clear NBase-T lpa
|
||||
|
||||
Clear NBase-T link partner advertisement before calling
|
||||
rtlgen_read_status() to avoid phy_resolve_aneg_linkmode() wrongly
|
||||
setting speed and duplex.
|
||||
|
||||
This fixes bogus 2.5G/5G/10G link partner advertisement and thus
|
||||
speed and duplex being set by phy_resolve_aneg_linkmode() due to stale
|
||||
NBase-T lpa.
|
||||
|
||||
Fixes: 68d5cd09e891 ("net: phy: realtek: change order of calls in C22 read_status()")
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -952,15 +952,15 @@ static int rtl822x_read_status(struct ph
|
||||
{
|
||||
int lpadv, ret;
|
||||
|
||||
+ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
|
||||
+
|
||||
ret = rtlgen_read_status(phydev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (phydev->autoneg == AUTONEG_DISABLE ||
|
||||
- !phydev->autoneg_complete) {
|
||||
- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
|
||||
+ !phydev->autoneg_complete)
|
||||
return 0;
|
||||
- }
|
||||
|
||||
lpadv = phy_read_paged(phydev, 0xa5d, 0x13);
|
||||
if (lpadv < 0)
|
||||
@ -0,0 +1,47 @@
|
||||
From 3d483a10327f38595f714f9f9e9dde43a622cb0f Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Sat, 11 Jan 2025 21:49:31 +0100
|
||||
Subject: [PATCH] net: phy: realtek: add support for reading MDIO_MMD_VEND2
|
||||
regs on RTL8125/RTL8126
|
||||
|
||||
RTL8125/RTL8126 don't support MMD access to the internal PHY, but
|
||||
provide a mechanism to access at least all MDIO_MMD_VEND2 registers.
|
||||
By exposing this mechanism standard MMD access functions can be used
|
||||
to access the MDIO_MMD_VEND2 registers.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/e821b302-5fe6-49ab-aabd-05da500581c0@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -736,7 +736,11 @@ static int rtlgen_read_mmd(struct phy_de
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) {
|
||||
+ if (devnum == MDIO_MMD_VEND2) {
|
||||
+ rtl821x_write_page(phydev, regnum >> 4);
|
||||
+ ret = __phy_read(phydev, 0x10 + ((regnum & 0xf) >> 1));
|
||||
+ rtl821x_write_page(phydev, 0);
|
||||
+ } else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) {
|
||||
rtl821x_write_page(phydev, 0xa5c);
|
||||
ret = __phy_read(phydev, 0x12);
|
||||
rtl821x_write_page(phydev, 0);
|
||||
@@ -760,7 +764,11 @@ static int rtlgen_write_mmd(struct phy_d
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) {
|
||||
+ if (devnum == MDIO_MMD_VEND2) {
|
||||
+ rtl821x_write_page(phydev, regnum >> 4);
|
||||
+ ret = __phy_write(phydev, 0x10 + ((regnum & 0xf) >> 1), val);
|
||||
+ rtl821x_write_page(phydev, 0);
|
||||
+ } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) {
|
||||
rtl821x_write_page(phydev, 0xa5d);
|
||||
ret = __phy_write(phydev, 0x10, val);
|
||||
rtl821x_write_page(phydev, 0);
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,180 @@
|
||||
From 33700ca45b7d2e1655d4cad95e25671e8a94e2f0 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Sat, 11 Jan 2025 21:51:24 +0100
|
||||
Subject: [PATCH] net: phy: realtek: add hwmon support for temp sensor on
|
||||
RTL822x
|
||||
|
||||
This adds hwmon support for the temperature sensor on RTL822x.
|
||||
It's available on the standalone versions of the PHY's, and on
|
||||
the integrated PHY's in RTL8125B/RTL8125D/RTL8126.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/ad6bfe9f-6375-4a00-84b4-bfb38a21bd71@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/realtek/Kconfig | 6 ++
|
||||
drivers/net/phy/realtek/Makefile | 1 +
|
||||
drivers/net/phy/realtek/realtek.h | 10 ++++
|
||||
drivers/net/phy/realtek/realtek_hwmon.c | 79 +++++++++++++++++++++++++
|
||||
drivers/net/phy/realtek/realtek_main.c | 12 ++++
|
||||
5 files changed, 108 insertions(+)
|
||||
create mode 100644 drivers/net/phy/realtek/realtek.h
|
||||
create mode 100644 drivers/net/phy/realtek/realtek_hwmon.c
|
||||
|
||||
--- a/drivers/net/phy/realtek/Kconfig
|
||||
+++ b/drivers/net/phy/realtek/Kconfig
|
||||
@@ -3,3 +3,9 @@ config REALTEK_PHY
|
||||
tristate "Realtek PHYs"
|
||||
help
|
||||
Currently supports RTL821x/RTL822x and fast ethernet PHYs
|
||||
+
|
||||
+config REALTEK_PHY_HWMON
|
||||
+ def_bool REALTEK_PHY && HWMON
|
||||
+ depends on !(REALTEK_PHY=y && HWMON=m)
|
||||
+ help
|
||||
+ Optional hwmon support for the temperature sensor
|
||||
--- a/drivers/net/phy/realtek/Makefile
|
||||
+++ b/drivers/net/phy/realtek/Makefile
|
||||
@@ -1,3 +1,4 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
realtek-y += realtek_main.o
|
||||
+realtek-$(CONFIG_REALTEK_PHY_HWMON) += realtek_hwmon.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/phy/realtek/realtek.h
|
||||
@@ -0,0 +1,10 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+
|
||||
+#ifndef REALTEK_H
|
||||
+#define REALTEK_H
|
||||
+
|
||||
+#include <linux/phy.h>
|
||||
+
|
||||
+int rtl822x_hwmon_init(struct phy_device *phydev);
|
||||
+
|
||||
+#endif /* REALTEK_H */
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/phy/realtek/realtek_hwmon.c
|
||||
@@ -0,0 +1,86 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * HWMON support for Realtek PHY's
|
||||
+ *
|
||||
+ * Author: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/hwmon.h>
|
||||
+#include <linux/phy.h>
|
||||
+
|
||||
+#include "realtek.h"
|
||||
+
|
||||
+#define RTL822X_VND2_TSALRM 0xa662
|
||||
+#define RTL822X_VND2_TSRR 0xbd84
|
||||
+#define RTL822X_VND2_TSSR 0xb54c
|
||||
+
|
||||
+static umode_t rtl822x_hwmon_is_visible(const void *drvdata,
|
||||
+ enum hwmon_sensor_types type,
|
||||
+ u32 attr, int channel)
|
||||
+{
|
||||
+ return 0444;
|
||||
+}
|
||||
+
|
||||
+static int rtl822x_hwmon_get_temp(int raw)
|
||||
+{
|
||||
+ if (raw >= 512)
|
||||
+ raw -= 1024;
|
||||
+
|
||||
+ return 1000 * raw / 2;
|
||||
+}
|
||||
+
|
||||
+static int rtl822x_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
|
||||
+ u32 attr, int channel, long *val)
|
||||
+{
|
||||
+ struct phy_device *phydev = dev_get_drvdata(dev);
|
||||
+ int raw;
|
||||
+
|
||||
+ switch (attr) {
|
||||
+ case hwmon_temp_input:
|
||||
+ raw = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_TSRR) & 0x3ff;
|
||||
+ *val = rtl822x_hwmon_get_temp(raw);
|
||||
+ break;
|
||||
+ case hwmon_temp_max:
|
||||
+ /* Chip reduces speed to 1G if threshold is exceeded */
|
||||
+ raw = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_TSSR) >> 6;
|
||||
+ *val = rtl822x_hwmon_get_temp(raw);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct hwmon_ops rtl822x_hwmon_ops = {
|
||||
+ .is_visible = rtl822x_hwmon_is_visible,
|
||||
+ .read = rtl822x_hwmon_read,
|
||||
+};
|
||||
+
|
||||
+static const struct hwmon_channel_info * const rtl822x_hwmon_info[] = {
|
||||
+ HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_MAX),
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
+static const struct hwmon_chip_info rtl822x_hwmon_chip_info = {
|
||||
+ .ops = &rtl822x_hwmon_ops,
|
||||
+ .info = rtl822x_hwmon_info,
|
||||
+};
|
||||
+
|
||||
+int rtl822x_hwmon_init(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device *hwdev, *dev = &phydev->mdio.dev;
|
||||
+ const char *name;
|
||||
+
|
||||
+ /* Ensure over-temp alarm is reset. */
|
||||
+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_TSALRM, 3);
|
||||
+
|
||||
+ name = devm_hwmon_sanitize_name(dev, dev_name(dev));
|
||||
+ if (IS_ERR(name))
|
||||
+ return PTR_ERR(name);
|
||||
+
|
||||
+ hwdev = devm_hwmon_device_register_with_info(dev, name, phydev,
|
||||
+ &rtl822x_hwmon_chip_info,
|
||||
+ NULL);
|
||||
+ return PTR_ERR_OR_ZERO(hwdev);
|
||||
+}
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
+#include "realtek.h"
|
||||
+
|
||||
#define RTL821x_PHYSR 0x11
|
||||
#define RTL821x_PHYSR_DUPLEX BIT(13)
|
||||
#define RTL821x_PHYSR_SPEED GENMASK(15, 14)
|
||||
@@ -820,6 +822,15 @@ static int rtl822x_write_mmd(struct phy_
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int rtl822x_probe(struct phy_device *phydev)
|
||||
+{
|
||||
+ if (IS_ENABLED(CONFIG_REALTEK_PHY_HWMON) &&
|
||||
+ phydev->phy_id != RTL_GENERIC_PHYID)
|
||||
+ return rtl822x_hwmon_init(phydev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int rtl822xb_config_init(struct phy_device *phydev)
|
||||
{
|
||||
bool has_2500, has_sgmii;
|
||||
@@ -1518,6 +1529,7 @@ static struct phy_driver realtek_drvs[]
|
||||
.match_phy_device = rtl_internal_nbaset_match_phy_device,
|
||||
.name = "Realtek Internal NBASE-T PHY",
|
||||
.flags = PHY_IS_INTERNAL,
|
||||
+ .probe = rtl822x_probe,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.read_status = rtl822x_read_status,
|
||||
@ -0,0 +1,64 @@
|
||||
From 64ff63aeefb03139ae27454bd4208244579ae88e Mon Sep 17 00:00:00 2001
|
||||
From: Aleksander Jan Bajkowski <olek2@wp.pl>
|
||||
Date: Fri, 17 Jan 2025 23:24:21 +0100
|
||||
Subject: [PATCH] net: phy: realtek: HWMON support for standalone versions of
|
||||
RTL8221B and RTL8251
|
||||
|
||||
HWMON support has been added for the RTL8221/8251 PHYs integrated together
|
||||
with the MAC inside the RTL8125/8126 chips. This patch extends temperature
|
||||
reading support for standalone variants of the mentioned PHYs.
|
||||
|
||||
I don't know whether the earlier revisions of the RTL8226 also have a
|
||||
built-in temperature sensor, so they have been skipped for now.
|
||||
|
||||
Tested on RTL8221B-VB-CG.
|
||||
|
||||
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/realtek/realtek_main.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -1474,6 +1474,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vb_cg_c22_match_phy_device,
|
||||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)",
|
||||
+ .probe = rtl822x_probe,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.config_init = rtl822xb_config_init,
|
||||
@@ -1486,6 +1487,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vb_cg_c45_match_phy_device,
|
||||
.name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)",
|
||||
+ .probe = rtl822x_probe,
|
||||
.config_init = rtl822xb_config_init,
|
||||
.get_rate_matching = rtl822xb_get_rate_matching,
|
||||
.get_features = rtl822x_c45_get_features,
|
||||
@@ -1496,6 +1498,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vn_cg_c22_match_phy_device,
|
||||
.name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)",
|
||||
+ .probe = rtl822x_probe,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.config_init = rtl822xb_config_init,
|
||||
@@ -1508,6 +1511,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8221b_vn_cg_c45_match_phy_device,
|
||||
.name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)",
|
||||
+ .probe = rtl822x_probe,
|
||||
.config_init = rtl822xb_config_init,
|
||||
.get_rate_matching = rtl822xb_get_rate_matching,
|
||||
.get_features = rtl822x_c45_get_features,
|
||||
@@ -1518,6 +1522,7 @@ static struct phy_driver realtek_drvs[]
|
||||
}, {
|
||||
.match_phy_device = rtl8251b_c45_match_phy_device,
|
||||
.name = "RTL8251B 5Gbps PHY",
|
||||
+ .probe = rtl822x_probe,
|
||||
.get_features = rtl822x_get_features,
|
||||
.config_aneg = rtl822x_config_aneg,
|
||||
.read_status = rtl822x_read_status,
|
||||
@ -0,0 +1,35 @@
|
||||
From 51773846fab24a353bed4ebb660997ced4bc32d7 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Mon, 3 Feb 2025 21:33:39 +0100
|
||||
Subject: [PATCH] net: phy: realtek: make HWMON support a user-visible Kconfig
|
||||
symbol
|
||||
|
||||
Make config symbol REALTEK_PHY_HWMON user-visible, so that users can
|
||||
remove support if not needed.
|
||||
|
||||
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Link: https://patch.msgid.link/3466ee92-166a-4b0f-9ae7-42b9e046f333@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/realtek/Kconfig | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek/Kconfig
|
||||
+++ b/drivers/net/phy/realtek/Kconfig
|
||||
@@ -4,8 +4,12 @@ config REALTEK_PHY
|
||||
help
|
||||
Currently supports RTL821x/RTL822x and fast ethernet PHYs
|
||||
|
||||
+if REALTEK_PHY
|
||||
+
|
||||
config REALTEK_PHY_HWMON
|
||||
- def_bool REALTEK_PHY && HWMON
|
||||
- depends on !(REALTEK_PHY=y && HWMON=m)
|
||||
+ bool "HWMON support for Realtek PHYs"
|
||||
+ depends on HWMON && !(REALTEK_PHY=y && HWMON=m)
|
||||
help
|
||||
Optional hwmon support for the temperature sensor
|
||||
+
|
||||
+endif # REALTEK_PHY
|
||||
@ -0,0 +1,54 @@
|
||||
From 0bea93fdbaf8675b7e8124bdcaf51497dcc8bcfa Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Mon, 3 Feb 2025 21:41:36 +0100
|
||||
Subject: [PATCH] net: phy: realtek: use string choices helpers
|
||||
|
||||
Use string choices helpers to simplify the code.
|
||||
|
||||
Reported-by: kernel test robot <lkp@intel.com>
|
||||
Closes: https://lore.kernel.org/oe-kbuild-all/202501190707.qQS8PGHW-lkp@intel.com/
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/realtek/realtek_main.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/string_choices.h>
|
||||
|
||||
#include "realtek.h"
|
||||
|
||||
@@ -422,11 +423,11 @@ static int rtl8211f_config_init(struct p
|
||||
} else if (ret) {
|
||||
dev_dbg(dev,
|
||||
"%s 2ns TX delay (and changing the value from pin-strapping RXD1 or the bootloader)\n",
|
||||
- val_txdly ? "Enabling" : "Disabling");
|
||||
+ str_enable_disable(val_txdly));
|
||||
} else {
|
||||
dev_dbg(dev,
|
||||
"2ns TX delay was already %s (by pin-strapping RXD1 or bootloader configuration)\n",
|
||||
- val_txdly ? "enabled" : "disabled");
|
||||
+ str_enabled_disabled(val_txdly));
|
||||
}
|
||||
|
||||
ret = phy_modify_paged_changed(phydev, 0xd08, 0x15, RTL8211F_RX_DELAY,
|
||||
@@ -437,11 +438,11 @@ static int rtl8211f_config_init(struct p
|
||||
} else if (ret) {
|
||||
dev_dbg(dev,
|
||||
"%s 2ns RX delay (and changing the value from pin-strapping RXD0 or the bootloader)\n",
|
||||
- val_rxdly ? "Enabling" : "Disabling");
|
||||
+ str_enable_disable(val_rxdly));
|
||||
} else {
|
||||
dev_dbg(dev,
|
||||
"2ns RX delay was already %s (by pin-strapping RXD0 or bootloader configuration)\n",
|
||||
- val_rxdly ? "enabled" : "disabled");
|
||||
+ str_enabled_disabled(val_rxdly));
|
||||
}
|
||||
|
||||
if (priv->has_phycr2) {
|
||||
@ -0,0 +1,134 @@
|
||||
From da681ed73fb980286fc29de707b35d76bb33e123 Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 13 Feb 2025 20:18:17 +0100
|
||||
Subject: [PATCH] net: phy: realtek: improve mmd register access for internal
|
||||
PHY's
|
||||
|
||||
r8169 provides the MDIO bus for the internal PHY's. It has been extended
|
||||
with c45 access functions for addressing MDIO_MMD_VEND2 registers.
|
||||
So we can switch from paged access to directly addressing the
|
||||
MDIO_MMD_VEND2 registers.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/a5f2333c-dda9-48ad-9801-77049766e632@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/realtek/realtek_main.c | 79 +++++++++++---------------
|
||||
1 file changed, 33 insertions(+), 46 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -735,29 +735,31 @@ static int rtlgen_read_status(struct phy
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int rtlgen_read_vend2(struct phy_device *phydev, int regnum)
|
||||
+{
|
||||
+ return __mdiobus_c45_read(phydev->mdio.bus, 0, MDIO_MMD_VEND2, regnum);
|
||||
+}
|
||||
+
|
||||
+static int rtlgen_write_vend2(struct phy_device *phydev, int regnum, u16 val)
|
||||
+{
|
||||
+ return __mdiobus_c45_write(phydev->mdio.bus, 0, MDIO_MMD_VEND2, regnum,
|
||||
+ val);
|
||||
+}
|
||||
+
|
||||
static int rtlgen_read_mmd(struct phy_device *phydev, int devnum, u16 regnum)
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (devnum == MDIO_MMD_VEND2) {
|
||||
- rtl821x_write_page(phydev, regnum >> 4);
|
||||
- ret = __phy_read(phydev, 0x10 + ((regnum & 0xf) >> 1));
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- } else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) {
|
||||
- rtl821x_write_page(phydev, 0xa5c);
|
||||
- ret = __phy_read(phydev, 0x12);
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) {
|
||||
- rtl821x_write_page(phydev, 0xa5d);
|
||||
- ret = __phy_read(phydev, 0x10);
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE) {
|
||||
- rtl821x_write_page(phydev, 0xa5d);
|
||||
- ret = __phy_read(phydev, 0x11);
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- } else {
|
||||
+ if (devnum == MDIO_MMD_VEND2)
|
||||
+ ret = rtlgen_read_vend2(phydev, regnum);
|
||||
+ else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE)
|
||||
+ ret = rtlgen_read_vend2(phydev, 0xa5c4);
|
||||
+ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV)
|
||||
+ ret = rtlgen_read_vend2(phydev, 0xa5d0);
|
||||
+ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE)
|
||||
+ ret = rtlgen_read_vend2(phydev, 0xa5d2);
|
||||
+ else
|
||||
ret = -EOPNOTSUPP;
|
||||
- }
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -767,17 +769,12 @@ static int rtlgen_write_mmd(struct phy_d
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (devnum == MDIO_MMD_VEND2) {
|
||||
- rtl821x_write_page(phydev, regnum >> 4);
|
||||
- ret = __phy_write(phydev, 0x10 + ((regnum & 0xf) >> 1), val);
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) {
|
||||
- rtl821x_write_page(phydev, 0xa5d);
|
||||
- ret = __phy_write(phydev, 0x10, val);
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- } else {
|
||||
+ if (devnum == MDIO_MMD_VEND2)
|
||||
+ ret = rtlgen_write_vend2(phydev, regnum, val);
|
||||
+ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV)
|
||||
+ ret = rtlgen_write_vend2(phydev, regnum, 0xa5d0);
|
||||
+ else
|
||||
ret = -EOPNOTSUPP;
|
||||
- }
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -789,19 +786,12 @@ static int rtl822x_read_mmd(struct phy_d
|
||||
if (ret != -EOPNOTSUPP)
|
||||
return ret;
|
||||
|
||||
- if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2) {
|
||||
- rtl821x_write_page(phydev, 0xa6e);
|
||||
- ret = __phy_read(phydev, 0x16);
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) {
|
||||
- rtl821x_write_page(phydev, 0xa6d);
|
||||
- ret = __phy_read(phydev, 0x12);
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2) {
|
||||
- rtl821x_write_page(phydev, 0xa6d);
|
||||
- ret = __phy_read(phydev, 0x10);
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- }
|
||||
+ if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2)
|
||||
+ ret = rtlgen_read_vend2(phydev, 0xa6ec);
|
||||
+ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2)
|
||||
+ ret = rtlgen_read_vend2(phydev, 0xa6d4);
|
||||
+ else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2)
|
||||
+ ret = rtlgen_read_vend2(phydev, 0xa6d0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -814,11 +804,8 @@ static int rtl822x_write_mmd(struct phy_
|
||||
if (ret != -EOPNOTSUPP)
|
||||
return ret;
|
||||
|
||||
- if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) {
|
||||
- rtl821x_write_page(phydev, 0xa6d);
|
||||
- ret = __phy_write(phydev, 0x12, val);
|
||||
- rtl821x_write_page(phydev, 0);
|
||||
- }
|
||||
+ if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2)
|
||||
+ ret = rtlgen_write_vend2(phydev, 0xa6d4, val);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
From 02d3b306ac2f0b174753d1c5b9e4e5fb8ec5057e Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Thu, 13 Feb 2025 20:19:14 +0100
|
||||
Subject: [PATCH] net: phy: realtek: switch from paged to MMD ops in rtl822x
|
||||
functions
|
||||
|
||||
The MDIO bus provided by r8169 for the internal PHY's now supports
|
||||
c45 ops for the MDIO_MMD_VEND2 device. So we can switch to standard
|
||||
MMD ops here.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/81416f95-0fac-4225-87b4-828e3738b8ed@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/realtek/realtek_main.c | 11 +++++------
|
||||
1 file changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -901,7 +901,7 @@ static int rtl822x_get_features(struct p
|
||||
{
|
||||
int val;
|
||||
|
||||
- val = phy_read_paged(phydev, 0xa61, 0x13);
|
||||
+ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xa616);
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
||||
@@ -922,10 +922,9 @@ static int rtl822x_config_aneg(struct ph
|
||||
if (phydev->autoneg == AUTONEG_ENABLE) {
|
||||
u16 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising);
|
||||
|
||||
- ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12,
|
||||
- MDIO_AN_10GBT_CTRL_ADV2_5G |
|
||||
- MDIO_AN_10GBT_CTRL_ADV5G,
|
||||
- adv);
|
||||
+ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, 0xa5d4,
|
||||
+ MDIO_AN_10GBT_CTRL_ADV2_5G |
|
||||
+ MDIO_AN_10GBT_CTRL_ADV5G, adv);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
@@ -969,7 +968,7 @@ static int rtl822x_read_status(struct ph
|
||||
!phydev->autoneg_complete)
|
||||
return 0;
|
||||
|
||||
- lpadv = phy_read_paged(phydev, 0xa5d, 0x13);
|
||||
+ lpadv = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xa5d6);
|
||||
if (lpadv < 0)
|
||||
return lpadv;
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
From 8af2136e77989a64fae0284bf76fd584e32edd3a Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Fri, 14 Feb 2025 21:31:14 +0100
|
||||
Subject: [PATCH] net: phy: realtek: add helper RTL822X_VND2_C22_REG
|
||||
|
||||
C22 register space is mapped to 0xa400 in MMD VEND2 register space.
|
||||
Add a helper to access mapped C22 registers.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/6344277b-c5c7-449b-ac89-d5425306ca76@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/realtek/realtek_main.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -79,9 +79,7 @@
|
||||
/* RTL822X_VND2_XXXXX registers are only accessible when phydev->is_c45
|
||||
* is set, they cannot be accessed by C45-over-C22.
|
||||
*/
|
||||
-#define RTL822X_VND2_GBCR 0xa412
|
||||
-
|
||||
-#define RTL822X_VND2_GANLPAR 0xa414
|
||||
+#define RTL822X_VND2_C22_REG(reg) (0xa400 + 2 * (reg))
|
||||
|
||||
#define RTL8366RB_POWER_SAVE 0x15
|
||||
#define RTL8366RB_POWER_SAVE_ON BIT(12)
|
||||
@@ -1015,7 +1013,8 @@ static int rtl822x_c45_config_aneg(struc
|
||||
val = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising);
|
||||
|
||||
/* Vendor register as C45 has no standardized support for 1000BaseT */
|
||||
- ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, RTL822X_VND2_GBCR,
|
||||
+ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2,
|
||||
+ RTL822X_VND2_C22_REG(MII_CTRL1000),
|
||||
ADVERTISE_1000FULL, val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -1032,7 +1031,7 @@ static int rtl822x_c45_read_status(struc
|
||||
/* Vendor register as C45 has no standardized support for 1000BaseT */
|
||||
if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) {
|
||||
val = phy_read_mmd(phydev, MDIO_MMD_VEND2,
|
||||
- RTL822X_VND2_GANLPAR);
|
||||
+ RTL822X_VND2_C22_REG(MII_STAT1000));
|
||||
if (val < 0)
|
||||
return val;
|
||||
} else {
|
||||
@ -0,0 +1,113 @@
|
||||
From fabcfd6d10999024a721ae1b965b57eb8a305ace Mon Sep 17 00:00:00 2001
|
||||
From: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Date: Sat, 15 Feb 2025 14:29:15 +0100
|
||||
Subject: [PATCH] net: phy: realtek: add defines for shadowed c45 standard
|
||||
registers
|
||||
|
||||
Realtek shadows standard c45 registers in VEND2 device register space.
|
||||
Add defines for these VEND2 registers, based on the names of the
|
||||
standard c45 registers.
|
||||
|
||||
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/c90bdf76-f8b8-4d06-9656-7a52d5658ee6@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/realtek/realtek_main.c | 33 +++++++++++++++++---------
|
||||
1 file changed, 22 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -94,6 +94,16 @@
|
||||
#define RTL_VND2_PHYSR_MASTER BIT(11)
|
||||
#define RTL_VND2_PHYSR_SPEED_MASK (RTL_VND2_PHYSR_SPEEDL | RTL_VND2_PHYSR_SPEEDH)
|
||||
|
||||
+#define RTL_MDIO_PCS_EEE_ABLE 0xa5c4
|
||||
+#define RTL_MDIO_AN_EEE_ADV 0xa5d0
|
||||
+#define RTL_MDIO_AN_EEE_LPABLE 0xa5d2
|
||||
+#define RTL_MDIO_AN_10GBT_CTRL 0xa5d4
|
||||
+#define RTL_MDIO_AN_10GBT_STAT 0xa5d6
|
||||
+#define RTL_MDIO_PMA_SPEED 0xa616
|
||||
+#define RTL_MDIO_AN_EEE_LPABLE2 0xa6d0
|
||||
+#define RTL_MDIO_AN_EEE_ADV2 0xa6d4
|
||||
+#define RTL_MDIO_PCS_EEE_ABLE2 0xa6ec
|
||||
+
|
||||
#define RTL_GENERIC_PHYID 0x001cc800
|
||||
#define RTL_8211FVD_PHYID 0x001cc878
|
||||
#define RTL_8221B 0x001cc840
|
||||
@@ -751,11 +761,11 @@ static int rtlgen_read_mmd(struct phy_de
|
||||
if (devnum == MDIO_MMD_VEND2)
|
||||
ret = rtlgen_read_vend2(phydev, regnum);
|
||||
else if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE)
|
||||
- ret = rtlgen_read_vend2(phydev, 0xa5c4);
|
||||
+ ret = rtlgen_read_vend2(phydev, RTL_MDIO_PCS_EEE_ABLE);
|
||||
else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV)
|
||||
- ret = rtlgen_read_vend2(phydev, 0xa5d0);
|
||||
+ ret = rtlgen_read_vend2(phydev, RTL_MDIO_AN_EEE_ADV);
|
||||
else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE)
|
||||
- ret = rtlgen_read_vend2(phydev, 0xa5d2);
|
||||
+ ret = rtlgen_read_vend2(phydev, RTL_MDIO_AN_EEE_LPABLE);
|
||||
else
|
||||
ret = -EOPNOTSUPP;
|
||||
|
||||
@@ -770,7 +780,7 @@ static int rtlgen_write_mmd(struct phy_d
|
||||
if (devnum == MDIO_MMD_VEND2)
|
||||
ret = rtlgen_write_vend2(phydev, regnum, val);
|
||||
else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV)
|
||||
- ret = rtlgen_write_vend2(phydev, regnum, 0xa5d0);
|
||||
+ ret = rtlgen_write_vend2(phydev, regnum, RTL_MDIO_AN_EEE_ADV);
|
||||
else
|
||||
ret = -EOPNOTSUPP;
|
||||
|
||||
@@ -785,11 +795,11 @@ static int rtl822x_read_mmd(struct phy_d
|
||||
return ret;
|
||||
|
||||
if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2)
|
||||
- ret = rtlgen_read_vend2(phydev, 0xa6ec);
|
||||
+ ret = rtlgen_read_vend2(phydev, RTL_MDIO_PCS_EEE_ABLE2);
|
||||
else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2)
|
||||
- ret = rtlgen_read_vend2(phydev, 0xa6d4);
|
||||
+ ret = rtlgen_read_vend2(phydev, RTL_MDIO_AN_EEE_ADV2);
|
||||
else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2)
|
||||
- ret = rtlgen_read_vend2(phydev, 0xa6d0);
|
||||
+ ret = rtlgen_read_vend2(phydev, RTL_MDIO_AN_EEE_LPABLE2);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -803,7 +813,7 @@ static int rtl822x_write_mmd(struct phy_
|
||||
return ret;
|
||||
|
||||
if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2)
|
||||
- ret = rtlgen_write_vend2(phydev, 0xa6d4, val);
|
||||
+ ret = rtlgen_write_vend2(phydev, RTL_MDIO_AN_EEE_ADV2, val);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -899,7 +909,7 @@ static int rtl822x_get_features(struct p
|
||||
{
|
||||
int val;
|
||||
|
||||
- val = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xa616);
|
||||
+ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_MDIO_PMA_SPEED);
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
||||
@@ -920,7 +930,8 @@ static int rtl822x_config_aneg(struct ph
|
||||
if (phydev->autoneg == AUTONEG_ENABLE) {
|
||||
u16 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising);
|
||||
|
||||
- ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, 0xa5d4,
|
||||
+ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2,
|
||||
+ RTL_MDIO_AN_10GBT_CTRL,
|
||||
MDIO_AN_10GBT_CTRL_ADV2_5G |
|
||||
MDIO_AN_10GBT_CTRL_ADV5G, adv);
|
||||
if (ret < 0)
|
||||
@@ -966,7 +977,7 @@ static int rtl822x_read_status(struct ph
|
||||
!phydev->autoneg_complete)
|
||||
return 0;
|
||||
|
||||
- lpadv = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xa5d6);
|
||||
+ lpadv = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_MDIO_AN_10GBT_STAT);
|
||||
if (lpadv < 0)
|
||||
return lpadv;
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
From bfc17c1658353f22843c7c13e27c2d31950f1887 Mon Sep 17 00:00:00 2001
|
||||
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
||||
Date: Sun, 16 Mar 2025 12:39:54 +0000
|
||||
Subject: [PATCH] net: phy: realtek: disable PHY-mode EEE
|
||||
|
||||
Realtek RTL8211F has a "PHY-mode" EEE support which interferes with an
|
||||
IEEE 802.3 compliant implementation. This mode defaults to enabled, and
|
||||
results in the MAC receive path not seeing the link transition to LPI
|
||||
state.
|
||||
|
||||
Fix this by disabling PHY-mode EEE.
|
||||
|
||||
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/E1ttnHW-00785s-Uq@rmk-PC.armlinux.org.uk
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/realtek/realtek_main.c | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -33,6 +33,9 @@
|
||||
|
||||
#define RTL8211F_PHYCR1 0x18
|
||||
#define RTL8211F_PHYCR2 0x19
|
||||
+#define RTL8211F_CLKOUT_EN BIT(0)
|
||||
+#define RTL8211F_PHYCR2_PHY_EEE_ENABLE BIT(5)
|
||||
+
|
||||
#define RTL8211F_INSR 0x1d
|
||||
|
||||
#define RTL8211F_LEDCR 0x10
|
||||
@@ -55,8 +58,6 @@
|
||||
#define RTL8211E_TX_DELAY BIT(12)
|
||||
#define RTL8211E_RX_DELAY BIT(11)
|
||||
|
||||
-#define RTL8211F_CLKOUT_EN BIT(0)
|
||||
-
|
||||
#define RTL8201F_ISR 0x1e
|
||||
#define RTL8201F_ISR_ANERR BIT(15)
|
||||
#define RTL8201F_ISR_DUPLEX BIT(13)
|
||||
@@ -453,6 +454,12 @@ static int rtl8211f_config_init(struct p
|
||||
str_enabled_disabled(val_rxdly));
|
||||
}
|
||||
|
||||
+ /* Disable PHY-mode EEE so LPI is passed to the MAC */
|
||||
+ ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2,
|
||||
+ RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
if (priv->has_phycr2) {
|
||||
ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2,
|
||||
RTL8211F_CLKOUT_EN, priv->phycr2);
|
||||
@ -0,0 +1,32 @@
|
||||
From 8cae5a0d91fea01d90ce7c1827e26934a22ca2fa Mon Sep 17 00:00:00 2001
|
||||
From: Rui Salvaterra <rsalvaterra@gmail.com>
|
||||
Date: Wed, 5 Mar 2025 11:53:56 +0000
|
||||
Subject: [PATCH] igc: enable HW vlan tag insertion/stripping by default
|
||||
|
||||
This is enabled by default in other Intel drivers I've checked (e1000, e1000e,
|
||||
iavf, igb and ice). Fixes an out-of-the-box performance issue when running
|
||||
OpenWrt on typical mini-PCs with igc-supported Ethernet controllers and 802.1Q
|
||||
VLAN configurations, as ethtool isn't part of the default packages and sane
|
||||
defaults are expected.
|
||||
|
||||
In my specific case, with an Intel N100-based machine with four I226-V Ethernet
|
||||
controllers, my upload performance increased from under 30 Mb/s to the expected
|
||||
~1 Gb/s.
|
||||
|
||||
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
|
||||
---
|
||||
drivers/net/ethernet/intel/igc/igc_main.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/intel/igc/igc_main.c
|
||||
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
|
||||
@@ -7066,6 +7066,9 @@ static int igc_probe(struct pci_dev *pde
|
||||
netdev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
|
||||
NETDEV_XDP_ACT_XSK_ZEROCOPY;
|
||||
|
||||
+ /* enable HW vlan tag insertion/stripping by default */
|
||||
+ netdev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX;
|
||||
+
|
||||
/* MTU range: 68 - 9216 */
|
||||
netdev->min_mtu = ETH_MIN_MTU;
|
||||
netdev->max_mtu = MAX_STD_JUMBO_FRAME_SIZE;
|
||||
@ -0,0 +1,107 @@
|
||||
From a2e1ba275eae96a8171deb19e9c7c2f5978fee7b Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Fri, 4 Oct 2024 17:18:16 +0100
|
||||
Subject: [PATCH] net: phy: aquantia: allow forcing order of MDI pairs
|
||||
|
||||
Despite supporting Auto MDI-X, it looks like Aquantia only supports
|
||||
swapping pair (1,2) with pair (3,6) like it used to be for MDI-X on
|
||||
100MBit/s networks.
|
||||
|
||||
When all 4 pairs are in use (for 1000MBit/s or faster) the link does not
|
||||
come up with pair order is not configured correctly, either using
|
||||
MDI_CFG pin or using the "PMA Receive Reserved Vendor Provisioning 1"
|
||||
register.
|
||||
|
||||
Normally, the order of MDI pairs being either ABCD or DCBA is configured
|
||||
by pulling the MDI_CFG pin.
|
||||
|
||||
However, some hardware designs require overriding the value configured
|
||||
by that bootstrap pin. The PHY allows doing that by setting a bit in
|
||||
"PMA Receive Reserved Vendor Provisioning 1" register which allows
|
||||
ignoring the state of the MDI_CFG pin and another bit configuring
|
||||
whether the order of MDI pairs should be normal (ABCD) or reverse
|
||||
(DCBA). Pair polarity is not affected and remains identical in both
|
||||
settings.
|
||||
|
||||
Introduce property "marvell,mdi-cfg-order" which allows forcing either
|
||||
normal or reverse order of the MDI pairs from DT.
|
||||
|
||||
If the property isn't present, the behavior is unchanged and MDI pair
|
||||
order configuration is untouched (ie. either the result of MDI_CFG pin
|
||||
pull-up/pull-down, or pair order override already configured by the
|
||||
bootloader before Linux is started).
|
||||
|
||||
Forcing normal pair order is required on the Adtran SDG-8733A Wi-Fi 7
|
||||
residential gateway.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/9ed760ff87d5fc456f31e407ead548bbb754497d.1728058550.git.daniel@makrotopia.org
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/aquantia/aquantia_main.c | 33 ++++++++++++++++++++++++
|
||||
1 file changed, 33 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/aquantia/aquantia_main.c
|
||||
+++ b/drivers/net/phy/aquantia/aquantia_main.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/bitfield.h>
|
||||
+#include <linux/of.h>
|
||||
#include <linux/phy.h>
|
||||
|
||||
#include "aquantia.h"
|
||||
@@ -71,6 +72,11 @@
|
||||
#define MDIO_AN_TX_VEND_INT_MASK2 0xd401
|
||||
#define MDIO_AN_TX_VEND_INT_MASK2_LINK BIT(0)
|
||||
|
||||
+#define PMAPMD_RSVD_VEND_PROV 0xe400
|
||||
+#define PMAPMD_RSVD_VEND_PROV_MDI_CONF GENMASK(1, 0)
|
||||
+#define PMAPMD_RSVD_VEND_PROV_MDI_REVERSE BIT(0)
|
||||
+#define PMAPMD_RSVD_VEND_PROV_MDI_FORCE BIT(1)
|
||||
+
|
||||
#define MDIO_AN_RX_LP_STAT1 0xe820
|
||||
#define MDIO_AN_RX_LP_STAT1_1000BASET_FULL BIT(15)
|
||||
#define MDIO_AN_RX_LP_STAT1_1000BASET_HALF BIT(14)
|
||||
@@ -485,6 +491,29 @@ static void aqr107_chip_info(struct phy_
|
||||
fw_major, fw_minor, build_id, prov_id);
|
||||
}
|
||||
|
||||
+static int aqr107_config_mdi(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device_node *np = phydev->mdio.dev.of_node;
|
||||
+ u32 mdi_conf;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = of_property_read_u32(np, "marvell,mdi-cfg-order", &mdi_conf);
|
||||
+
|
||||
+ /* Do nothing in case property "marvell,mdi-cfg-order" is not present */
|
||||
+ if (ret == -ENOENT)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (mdi_conf & ~PMAPMD_RSVD_VEND_PROV_MDI_REVERSE)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, PMAPMD_RSVD_VEND_PROV,
|
||||
+ PMAPMD_RSVD_VEND_PROV_MDI_CONF,
|
||||
+ mdi_conf | PMAPMD_RSVD_VEND_PROV_MDI_FORCE);
|
||||
+}
|
||||
+
|
||||
static int aqr107_config_init(struct phy_device *phydev)
|
||||
{
|
||||
struct aqr107_priv *priv = phydev->priv;
|
||||
@@ -514,6 +543,10 @@ static int aqr107_config_init(struct phy
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ ret = aqr107_config_mdi(phydev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
/* Restore LED polarity state after reset */
|
||||
for_each_set_bit(led_active_low, &priv->leds_active_low, AQR_MAX_LEDS) {
|
||||
ret = aqr_phy_led_active_low_set(phydev, led_active_low, true);
|
||||
@ -0,0 +1,31 @@
|
||||
From ce21b8fb255ebf0b49913fb4c62741d7eb05c6f6 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Fri, 11 Oct 2024 22:28:43 +0100
|
||||
Subject: [PATCH] net: phy: aquantia: fix return value check in
|
||||
aqr107_config_mdi()
|
||||
|
||||
of_property_read_u32() returns -EINVAL in case the property cannot be
|
||||
found rather than -ENOENT. Fix the check to not abort probing in case
|
||||
of the property being missing, and also in case CONFIG_OF is not set
|
||||
which will result in -ENOSYS.
|
||||
|
||||
Fixes: a2e1ba275eae ("net: phy: aquantia: allow forcing order of MDI pairs")
|
||||
Reported-by: Jon Hunter <jonathanh@nvidia.com>
|
||||
Closes: https://lore.kernel.org/all/114b4c03-5d16-42ed-945d-cf78eabea12b@nvidia.com/
|
||||
Suggested-by: Hans-Frieder Vogt <hfdevel@gmx.net>
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
drivers/net/phy/aquantia/aquantia_main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/phy/aquantia/aquantia_main.c
|
||||
+++ b/drivers/net/phy/aquantia/aquantia_main.c
|
||||
@@ -500,7 +500,7 @@ static int aqr107_config_mdi(struct phy_
|
||||
ret = of_property_read_u32(np, "marvell,mdi-cfg-order", &mdi_conf);
|
||||
|
||||
/* Do nothing in case property "marvell,mdi-cfg-order" is not present */
|
||||
- if (ret == -ENOENT)
|
||||
+ if (ret == -EINVAL || ret == -ENOSYS)
|
||||
return 0;
|
||||
|
||||
if (ret)
|
||||
@ -0,0 +1,53 @@
|
||||
From a274465cc3bef2dfd9c9ea5100848dda0a8641e1 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 10 Oct 2024 13:54:19 +0100
|
||||
Subject: [PATCH 1/4] net: phy: support 'active-high' property for PHY LEDs
|
||||
|
||||
In addition to 'active-low' and 'inactive-high-impedance' also
|
||||
support 'active-high' property for PHY LED pin configuration.
|
||||
As only either 'active-high' or 'active-low' can be set at the
|
||||
same time, WARN and return an error in case both are set.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/91598487773d768f254d5faf06cf65b13e972f0e.1728558223.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/phy_device.c | 6 ++++++
|
||||
include/linux/phy.h | 5 +++--
|
||||
2 files changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -3385,11 +3385,17 @@ static int of_phy_led(struct phy_device
|
||||
if (index > U8_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
+ if (of_property_read_bool(led, "active-high"))
|
||||
+ set_bit(PHY_LED_ACTIVE_HIGH, &modes);
|
||||
if (of_property_read_bool(led, "active-low"))
|
||||
set_bit(PHY_LED_ACTIVE_LOW, &modes);
|
||||
if (of_property_read_bool(led, "inactive-high-impedance"))
|
||||
set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes);
|
||||
|
||||
+ if (WARN_ON(modes & BIT(PHY_LED_ACTIVE_LOW) &&
|
||||
+ modes & BIT(PHY_LED_ACTIVE_HIGH)))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
if (modes) {
|
||||
/* Return error if asked to set polarity modes but not supported */
|
||||
if (!phydev->drv->led_polarity_set)
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -877,8 +877,9 @@ struct phy_plca_status {
|
||||
|
||||
/* Modes for PHY LED configuration */
|
||||
enum phy_led_modes {
|
||||
- PHY_LED_ACTIVE_LOW = 0,
|
||||
- PHY_LED_INACTIVE_HIGH_IMPEDANCE = 1,
|
||||
+ PHY_LED_ACTIVE_HIGH = 0,
|
||||
+ PHY_LED_ACTIVE_LOW = 1,
|
||||
+ PHY_LED_INACTIVE_HIGH_IMPEDANCE = 2,
|
||||
|
||||
/* keep it last */
|
||||
__PHY_LED_MODES_NUM,
|
||||
@ -0,0 +1,108 @@
|
||||
From 9d55e68b19f222e6334ef4021c5527998f5ab537 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 10 Oct 2024 13:55:00 +0100
|
||||
Subject: [PATCH 2/4] net: phy: aquantia: correctly describe LED polarity
|
||||
override
|
||||
|
||||
Use newly defined 'active-high' property to set the
|
||||
VEND1_GLOBAL_LED_DRIVE_VDD bit and let 'active-low' clear that bit. This
|
||||
reflects the technical reality which was inverted in the previous
|
||||
description in which the 'active-low' property was used to actually set
|
||||
the VEND1_GLOBAL_LED_DRIVE_VDD bit, which means that VDD (ie. supply
|
||||
voltage) of the LED is driven rather than GND.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/86a413b4387c42dcb54f587cc2433a06f16aae83.1728558223.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/aquantia/aquantia.h | 1 +
|
||||
drivers/net/phy/aquantia/aquantia_leds.c | 19 ++++++++++++++-----
|
||||
drivers/net/phy/aquantia/aquantia_main.c | 12 +++++++++---
|
||||
3 files changed, 24 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/aquantia/aquantia.h
|
||||
+++ b/drivers/net/phy/aquantia/aquantia.h
|
||||
@@ -177,6 +177,7 @@ static const struct aqr107_hw_stat aqr10
|
||||
struct aqr107_priv {
|
||||
u64 sgmii_stats[AQR107_SGMII_STAT_SZ];
|
||||
unsigned long leds_active_low;
|
||||
+ unsigned long leds_active_high;
|
||||
};
|
||||
|
||||
#if IS_REACHABLE(CONFIG_HWMON)
|
||||
--- a/drivers/net/phy/aquantia/aquantia_leds.c
|
||||
+++ b/drivers/net/phy/aquantia/aquantia_leds.c
|
||||
@@ -121,13 +121,13 @@ int aqr_phy_led_active_low_set(struct ph
|
||||
{
|
||||
return phy_modify_mmd(phydev, MDIO_MMD_VEND1, AQR_LED_DRIVE(index),
|
||||
VEND1_GLOBAL_LED_DRIVE_VDD,
|
||||
- enable ? VEND1_GLOBAL_LED_DRIVE_VDD : 0);
|
||||
+ enable ? 0 : VEND1_GLOBAL_LED_DRIVE_VDD);
|
||||
}
|
||||
|
||||
int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes)
|
||||
{
|
||||
+ bool force_active_low = false, force_active_high = false;
|
||||
struct aqr107_priv *priv = phydev->priv;
|
||||
- bool active_low = false;
|
||||
u32 mode;
|
||||
|
||||
if (index >= AQR_MAX_LEDS)
|
||||
@@ -136,7 +136,10 @@ int aqr_phy_led_polarity_set(struct phy_
|
||||
for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) {
|
||||
switch (mode) {
|
||||
case PHY_LED_ACTIVE_LOW:
|
||||
- active_low = true;
|
||||
+ force_active_low = true;
|
||||
+ break;
|
||||
+ case PHY_LED_ACTIVE_HIGH:
|
||||
+ force_active_high = true;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@@ -144,8 +147,14 @@ int aqr_phy_led_polarity_set(struct phy_
|
||||
}
|
||||
|
||||
/* Save LED driver vdd state to restore on SW reset */
|
||||
- if (active_low)
|
||||
+ if (force_active_low)
|
||||
priv->leds_active_low |= BIT(index);
|
||||
|
||||
- return aqr_phy_led_active_low_set(phydev, index, active_low);
|
||||
+ if (force_active_high)
|
||||
+ priv->leds_active_high |= BIT(index);
|
||||
+
|
||||
+ if (force_active_high || force_active_low)
|
||||
+ return aqr_phy_led_active_low_set(phydev, index, force_active_low);
|
||||
+
|
||||
+ unreachable();
|
||||
}
|
||||
--- a/drivers/net/phy/aquantia/aquantia_main.c
|
||||
+++ b/drivers/net/phy/aquantia/aquantia_main.c
|
||||
@@ -517,7 +517,7 @@ static int aqr107_config_mdi(struct phy_
|
||||
static int aqr107_config_init(struct phy_device *phydev)
|
||||
{
|
||||
struct aqr107_priv *priv = phydev->priv;
|
||||
- u32 led_active_low;
|
||||
+ u32 led_idx;
|
||||
int ret;
|
||||
|
||||
/* Check that the PHY interface type is compatible */
|
||||
@@ -548,8 +548,14 @@ static int aqr107_config_init(struct phy
|
||||
return ret;
|
||||
|
||||
/* Restore LED polarity state after reset */
|
||||
- for_each_set_bit(led_active_low, &priv->leds_active_low, AQR_MAX_LEDS) {
|
||||
- ret = aqr_phy_led_active_low_set(phydev, led_active_low, true);
|
||||
+ for_each_set_bit(led_idx, &priv->leds_active_low, AQR_MAX_LEDS) {
|
||||
+ ret = aqr_phy_led_active_low_set(phydev, led_idx, true);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ for_each_set_bit(led_idx, &priv->leds_active_high, AQR_MAX_LEDS) {
|
||||
+ ret = aqr_phy_led_active_low_set(phydev, led_idx, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@ -0,0 +1,332 @@
|
||||
From 78997e9a5e4d8a4df561e083a92c91ae23010e07 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Tue, 1 Oct 2024 01:17:18 +0100
|
||||
Subject: [PATCH] net: phy: mxl-gpy: add basic LED support
|
||||
|
||||
Add basic support for LEDs connected to MaxLinear GPY2xx and GPY115 PHYs.
|
||||
The PHYs allow up to 4 LEDs to be connected.
|
||||
Implement controlling LEDs in software as well as netdev trigger offloading
|
||||
and LED polarity setup.
|
||||
|
||||
The hardware claims to support 16 PWM brightness levels but there is no
|
||||
documentation on how to use that feature, hence this is not supported.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/b6ec9050339f8244ff898898a1cecc33b13a48fc.1727741563.git.daniel@makrotopia.org
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/mxl-gpy.c | 218 ++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 218 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/mxl-gpy.c
|
||||
+++ b/drivers/net/phy/mxl-gpy.c
|
||||
@@ -38,6 +38,7 @@
|
||||
#define PHY_MIISTAT 0x18 /* MII state */
|
||||
#define PHY_IMASK 0x19 /* interrupt mask */
|
||||
#define PHY_ISTAT 0x1A /* interrupt status */
|
||||
+#define PHY_LED 0x1B /* LEDs */
|
||||
#define PHY_FWV 0x1E /* firmware version */
|
||||
|
||||
#define PHY_MIISTAT_SPD_MASK GENMASK(2, 0)
|
||||
@@ -61,6 +62,11 @@
|
||||
PHY_IMASK_ADSC | \
|
||||
PHY_IMASK_ANC)
|
||||
|
||||
+#define GPY_MAX_LEDS 4
|
||||
+#define PHY_LED_POLARITY(idx) BIT(12 + (idx))
|
||||
+#define PHY_LED_HWCONTROL(idx) BIT(8 + (idx))
|
||||
+#define PHY_LED_ON(idx) BIT(idx)
|
||||
+
|
||||
#define PHY_FWV_REL_MASK BIT(15)
|
||||
#define PHY_FWV_MAJOR_MASK GENMASK(11, 8)
|
||||
#define PHY_FWV_MINOR_MASK GENMASK(7, 0)
|
||||
@@ -72,6 +78,23 @@
|
||||
#define PHY_MDI_MDI_X_CD 0x1
|
||||
#define PHY_MDI_MDI_X_CROSS 0x0
|
||||
|
||||
+/* LED */
|
||||
+#define VSPEC1_LED(idx) (1 + (idx))
|
||||
+#define VSPEC1_LED_BLINKS GENMASK(15, 12)
|
||||
+#define VSPEC1_LED_PULSE GENMASK(11, 8)
|
||||
+#define VSPEC1_LED_CON GENMASK(7, 4)
|
||||
+#define VSPEC1_LED_BLINKF GENMASK(3, 0)
|
||||
+
|
||||
+#define VSPEC1_LED_LINK10 BIT(0)
|
||||
+#define VSPEC1_LED_LINK100 BIT(1)
|
||||
+#define VSPEC1_LED_LINK1000 BIT(2)
|
||||
+#define VSPEC1_LED_LINK2500 BIT(3)
|
||||
+
|
||||
+#define VSPEC1_LED_TXACT BIT(0)
|
||||
+#define VSPEC1_LED_RXACT BIT(1)
|
||||
+#define VSPEC1_LED_COL BIT(2)
|
||||
+#define VSPEC1_LED_NO_CON BIT(3)
|
||||
+
|
||||
/* SGMII */
|
||||
#define VSPEC1_SGMII_CTRL 0x08
|
||||
#define VSPEC1_SGMII_CTRL_ANEN BIT(12) /* Aneg enable */
|
||||
@@ -835,6 +858,156 @@ static int gpy115_loopback(struct phy_de
|
||||
return genphy_soft_reset(phydev);
|
||||
}
|
||||
|
||||
+static int gpy_led_brightness_set(struct phy_device *phydev,
|
||||
+ u8 index, enum led_brightness value)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ if (index >= GPY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* clear HWCONTROL and set manual LED state */
|
||||
+ ret = phy_modify(phydev, PHY_LED,
|
||||
+ ((value == LED_OFF) ? PHY_LED_HWCONTROL(index) : 0) |
|
||||
+ PHY_LED_ON(index),
|
||||
+ (value == LED_OFF) ? 0 : PHY_LED_ON(index));
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* ToDo: set PWM brightness */
|
||||
+
|
||||
+ /* clear HW LED setup */
|
||||
+ if (value == LED_OFF)
|
||||
+ return phy_write_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_LED(index), 0);
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const unsigned long supported_triggers = (BIT(TRIGGER_NETDEV_LINK) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_100) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_1000) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_2500) |
|
||||
+ BIT(TRIGGER_NETDEV_RX) |
|
||||
+ BIT(TRIGGER_NETDEV_TX));
|
||||
+
|
||||
+static int gpy_led_hw_is_supported(struct phy_device *phydev, u8 index,
|
||||
+ unsigned long rules)
|
||||
+{
|
||||
+ if (index >= GPY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* All combinations of the supported triggers are allowed */
|
||||
+ if (rules & ~supported_triggers)
|
||||
+ return -EOPNOTSUPP;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int gpy_led_hw_control_get(struct phy_device *phydev, u8 index,
|
||||
+ unsigned long *rules)
|
||||
+{
|
||||
+ int val;
|
||||
+
|
||||
+ if (index >= GPY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_LED(index));
|
||||
+ if (val < 0)
|
||||
+ return val;
|
||||
+
|
||||
+ if (FIELD_GET(VSPEC1_LED_CON, val) & VSPEC1_LED_LINK10)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_LINK_10);
|
||||
+
|
||||
+ if (FIELD_GET(VSPEC1_LED_CON, val) & VSPEC1_LED_LINK100)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_LINK_100);
|
||||
+
|
||||
+ if (FIELD_GET(VSPEC1_LED_CON, val) & VSPEC1_LED_LINK1000)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_LINK_1000);
|
||||
+
|
||||
+ if (FIELD_GET(VSPEC1_LED_CON, val) & VSPEC1_LED_LINK2500)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_LINK_2500);
|
||||
+
|
||||
+ if (FIELD_GET(VSPEC1_LED_CON, val) == (VSPEC1_LED_LINK10 |
|
||||
+ VSPEC1_LED_LINK100 |
|
||||
+ VSPEC1_LED_LINK1000 |
|
||||
+ VSPEC1_LED_LINK2500))
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_LINK);
|
||||
+
|
||||
+ if (FIELD_GET(VSPEC1_LED_PULSE, val) & VSPEC1_LED_TXACT)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_TX);
|
||||
+
|
||||
+ if (FIELD_GET(VSPEC1_LED_PULSE, val) & VSPEC1_LED_RXACT)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_RX);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int gpy_led_hw_control_set(struct phy_device *phydev, u8 index,
|
||||
+ unsigned long rules)
|
||||
+{
|
||||
+ u16 val = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (index >= GPY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_LINK) ||
|
||||
+ rules & BIT(TRIGGER_NETDEV_LINK_10))
|
||||
+ val |= FIELD_PREP(VSPEC1_LED_CON, VSPEC1_LED_LINK10);
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_LINK) ||
|
||||
+ rules & BIT(TRIGGER_NETDEV_LINK_100))
|
||||
+ val |= FIELD_PREP(VSPEC1_LED_CON, VSPEC1_LED_LINK100);
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_LINK) ||
|
||||
+ rules & BIT(TRIGGER_NETDEV_LINK_1000))
|
||||
+ val |= FIELD_PREP(VSPEC1_LED_CON, VSPEC1_LED_LINK1000);
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_LINK) ||
|
||||
+ rules & BIT(TRIGGER_NETDEV_LINK_2500))
|
||||
+ val |= FIELD_PREP(VSPEC1_LED_CON, VSPEC1_LED_LINK2500);
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_TX))
|
||||
+ val |= FIELD_PREP(VSPEC1_LED_PULSE, VSPEC1_LED_TXACT);
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_RX))
|
||||
+ val |= FIELD_PREP(VSPEC1_LED_PULSE, VSPEC1_LED_RXACT);
|
||||
+
|
||||
+ /* allow RX/TX pulse without link indication */
|
||||
+ if ((rules & BIT(TRIGGER_NETDEV_TX) || rules & BIT(TRIGGER_NETDEV_RX)) &&
|
||||
+ !(val & VSPEC1_LED_CON))
|
||||
+ val |= FIELD_PREP(VSPEC1_LED_PULSE, VSPEC1_LED_NO_CON) | VSPEC1_LED_CON;
|
||||
+
|
||||
+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_LED(index), val);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ return phy_set_bits(phydev, PHY_LED, PHY_LED_HWCONTROL(index));
|
||||
+}
|
||||
+
|
||||
+static int gpy_led_polarity_set(struct phy_device *phydev, int index,
|
||||
+ unsigned long modes)
|
||||
+{
|
||||
+ bool active_low = false;
|
||||
+ u32 mode;
|
||||
+
|
||||
+ if (index >= GPY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) {
|
||||
+ switch (mode) {
|
||||
+ case PHY_LED_ACTIVE_LOW:
|
||||
+ active_low = true;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return phy_modify(phydev, PHY_LED, PHY_LED_POLARITY(index),
|
||||
+ active_low ? 0 : PHY_LED_POLARITY(index));
|
||||
+}
|
||||
+
|
||||
static struct phy_driver gpy_drivers[] = {
|
||||
{
|
||||
PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx),
|
||||
@@ -852,6 +1025,11 @@ static struct phy_driver gpy_drivers[] =
|
||||
.set_wol = gpy_set_wol,
|
||||
.get_wol = gpy_get_wol,
|
||||
.set_loopback = gpy_loopback,
|
||||
+ .led_brightness_set = gpy_led_brightness_set,
|
||||
+ .led_hw_is_supported = gpy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = gpy_led_hw_control_get,
|
||||
+ .led_hw_control_set = gpy_led_hw_control_set,
|
||||
+ .led_polarity_set = gpy_led_polarity_set,
|
||||
},
|
||||
{
|
||||
.phy_id = PHY_ID_GPY115B,
|
||||
@@ -870,6 +1048,11 @@ static struct phy_driver gpy_drivers[] =
|
||||
.set_wol = gpy_set_wol,
|
||||
.get_wol = gpy_get_wol,
|
||||
.set_loopback = gpy115_loopback,
|
||||
+ .led_brightness_set = gpy_led_brightness_set,
|
||||
+ .led_hw_is_supported = gpy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = gpy_led_hw_control_get,
|
||||
+ .led_hw_control_set = gpy_led_hw_control_set,
|
||||
+ .led_polarity_set = gpy_led_polarity_set,
|
||||
},
|
||||
{
|
||||
PHY_ID_MATCH_MODEL(PHY_ID_GPY115C),
|
||||
@@ -887,6 +1070,11 @@ static struct phy_driver gpy_drivers[] =
|
||||
.set_wol = gpy_set_wol,
|
||||
.get_wol = gpy_get_wol,
|
||||
.set_loopback = gpy115_loopback,
|
||||
+ .led_brightness_set = gpy_led_brightness_set,
|
||||
+ .led_hw_is_supported = gpy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = gpy_led_hw_control_get,
|
||||
+ .led_hw_control_set = gpy_led_hw_control_set,
|
||||
+ .led_polarity_set = gpy_led_polarity_set,
|
||||
},
|
||||
{
|
||||
.phy_id = PHY_ID_GPY211B,
|
||||
@@ -905,6 +1093,11 @@ static struct phy_driver gpy_drivers[] =
|
||||
.set_wol = gpy_set_wol,
|
||||
.get_wol = gpy_get_wol,
|
||||
.set_loopback = gpy_loopback,
|
||||
+ .led_brightness_set = gpy_led_brightness_set,
|
||||
+ .led_hw_is_supported = gpy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = gpy_led_hw_control_get,
|
||||
+ .led_hw_control_set = gpy_led_hw_control_set,
|
||||
+ .led_polarity_set = gpy_led_polarity_set,
|
||||
},
|
||||
{
|
||||
PHY_ID_MATCH_MODEL(PHY_ID_GPY211C),
|
||||
@@ -922,6 +1115,11 @@ static struct phy_driver gpy_drivers[] =
|
||||
.set_wol = gpy_set_wol,
|
||||
.get_wol = gpy_get_wol,
|
||||
.set_loopback = gpy_loopback,
|
||||
+ .led_brightness_set = gpy_led_brightness_set,
|
||||
+ .led_hw_is_supported = gpy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = gpy_led_hw_control_get,
|
||||
+ .led_hw_control_set = gpy_led_hw_control_set,
|
||||
+ .led_polarity_set = gpy_led_polarity_set,
|
||||
},
|
||||
{
|
||||
.phy_id = PHY_ID_GPY212B,
|
||||
@@ -940,6 +1138,11 @@ static struct phy_driver gpy_drivers[] =
|
||||
.set_wol = gpy_set_wol,
|
||||
.get_wol = gpy_get_wol,
|
||||
.set_loopback = gpy_loopback,
|
||||
+ .led_brightness_set = gpy_led_brightness_set,
|
||||
+ .led_hw_is_supported = gpy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = gpy_led_hw_control_get,
|
||||
+ .led_hw_control_set = gpy_led_hw_control_set,
|
||||
+ .led_polarity_set = gpy_led_polarity_set,
|
||||
},
|
||||
{
|
||||
PHY_ID_MATCH_MODEL(PHY_ID_GPY212C),
|
||||
@@ -957,6 +1160,11 @@ static struct phy_driver gpy_drivers[] =
|
||||
.set_wol = gpy_set_wol,
|
||||
.get_wol = gpy_get_wol,
|
||||
.set_loopback = gpy_loopback,
|
||||
+ .led_brightness_set = gpy_led_brightness_set,
|
||||
+ .led_hw_is_supported = gpy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = gpy_led_hw_control_get,
|
||||
+ .led_hw_control_set = gpy_led_hw_control_set,
|
||||
+ .led_polarity_set = gpy_led_polarity_set,
|
||||
},
|
||||
{
|
||||
.phy_id = PHY_ID_GPY215B,
|
||||
@@ -975,6 +1183,11 @@ static struct phy_driver gpy_drivers[] =
|
||||
.set_wol = gpy_set_wol,
|
||||
.get_wol = gpy_get_wol,
|
||||
.set_loopback = gpy_loopback,
|
||||
+ .led_brightness_set = gpy_led_brightness_set,
|
||||
+ .led_hw_is_supported = gpy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = gpy_led_hw_control_get,
|
||||
+ .led_hw_control_set = gpy_led_hw_control_set,
|
||||
+ .led_polarity_set = gpy_led_polarity_set,
|
||||
},
|
||||
{
|
||||
PHY_ID_MATCH_MODEL(PHY_ID_GPY215C),
|
||||
@@ -992,6 +1205,11 @@ static struct phy_driver gpy_drivers[] =
|
||||
.set_wol = gpy_set_wol,
|
||||
.get_wol = gpy_get_wol,
|
||||
.set_loopback = gpy_loopback,
|
||||
+ .led_brightness_set = gpy_led_brightness_set,
|
||||
+ .led_hw_is_supported = gpy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = gpy_led_hw_control_get,
|
||||
+ .led_hw_control_set = gpy_led_hw_control_set,
|
||||
+ .led_polarity_set = gpy_led_polarity_set,
|
||||
},
|
||||
{
|
||||
PHY_ID_MATCH_MODEL(PHY_ID_GPY241B),
|
||||
@ -0,0 +1,28 @@
|
||||
From f95b4725e796b12e5f347a0d161e1d3843142aa8 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Fri, 4 Oct 2024 16:56:35 +0100
|
||||
Subject: [PATCH] net: phy: mxl-gpy: add missing support for
|
||||
TRIGGER_NETDEV_LINK_10
|
||||
|
||||
The PHY also support 10MBit/s links as well as the corresponding link
|
||||
indication trigger to be offloaded. Add TRIGGER_NETDEV_LINK_10 to the
|
||||
supported triggers.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/cc5da0a989af8b0d49d823656d88053c4de2ab98.1728057367.git.daniel@makrotopia.org
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/mxl-gpy.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/phy/mxl-gpy.c
|
||||
+++ b/drivers/net/phy/mxl-gpy.c
|
||||
@@ -884,6 +884,7 @@ static int gpy_led_brightness_set(struct
|
||||
}
|
||||
|
||||
static const unsigned long supported_triggers = (BIT(TRIGGER_NETDEV_LINK) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_10) |
|
||||
BIT(TRIGGER_NETDEV_LINK_100) |
|
||||
BIT(TRIGGER_NETDEV_LINK_1000) |
|
||||
BIT(TRIGGER_NETDEV_LINK_2500) |
|
||||
@ -0,0 +1,58 @@
|
||||
From eb89c79c1b8f17fc1611540768678e60df89ac42 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 10 Oct 2024 13:55:17 +0100
|
||||
Subject: [PATCH 3/4] net: phy: mxl-gpy: correctly describe LED polarity
|
||||
|
||||
According the datasheet covering the LED (0x1b) register:
|
||||
0B Active High LEDx pin driven high when activated
|
||||
1B Active Low LEDx pin driven low when activated
|
||||
|
||||
Make use of the now available 'active-high' property and correctly
|
||||
reflect the polarity setting which was previously inverted.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/180ccafa837f09908b852a8a874a3808c5ecd2d0.1728558223.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/mxl-gpy.c | 16 ++++++++++++----
|
||||
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/mxl-gpy.c
|
||||
+++ b/drivers/net/phy/mxl-gpy.c
|
||||
@@ -989,7 +989,7 @@ static int gpy_led_hw_control_set(struct
|
||||
static int gpy_led_polarity_set(struct phy_device *phydev, int index,
|
||||
unsigned long modes)
|
||||
{
|
||||
- bool active_low = false;
|
||||
+ bool force_active_low = false, force_active_high = false;
|
||||
u32 mode;
|
||||
|
||||
if (index >= GPY_MAX_LEDS)
|
||||
@@ -998,15 +998,23 @@ static int gpy_led_polarity_set(struct p
|
||||
for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) {
|
||||
switch (mode) {
|
||||
case PHY_LED_ACTIVE_LOW:
|
||||
- active_low = true;
|
||||
+ force_active_low = true;
|
||||
+ break;
|
||||
+ case PHY_LED_ACTIVE_HIGH:
|
||||
+ force_active_high = true;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
- return phy_modify(phydev, PHY_LED, PHY_LED_POLARITY(index),
|
||||
- active_low ? 0 : PHY_LED_POLARITY(index));
|
||||
+ if (force_active_low)
|
||||
+ return phy_set_bits(phydev, PHY_LED, PHY_LED_POLARITY(index));
|
||||
+
|
||||
+ if (force_active_high)
|
||||
+ return phy_clear_bits(phydev, PHY_LED, PHY_LED_POLARITY(index));
|
||||
+
|
||||
+ unreachable();
|
||||
}
|
||||
|
||||
static struct phy_driver gpy_drivers[] = {
|
||||
@ -0,0 +1,379 @@
|
||||
From 1758af47b98c17da464cb45f476875150955dd48 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 10 Oct 2024 13:55:29 +0100
|
||||
Subject: [PATCH 4/4] net: phy: intel-xway: add support for PHY LEDs
|
||||
|
||||
The intel-xway PHY driver predates the PHY LED framework and currently
|
||||
initializes all LED pins to equal default values.
|
||||
|
||||
Add PHY LED functions to the drivers and don't set default values if
|
||||
LEDs are defined in device tree.
|
||||
|
||||
According the datasheets 3 LEDs are supported on all Intel XWAY PHYs.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Link: https://patch.msgid.link/81f4717ab9acf38f3239727a4540ae96fd01109b.1728558223.git.daniel@makrotopia.org
|
||||
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
---
|
||||
drivers/net/phy/intel-xway.c | 253 +++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 244 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/intel-xway.c
|
||||
+++ b/drivers/net/phy/intel-xway.c
|
||||
@@ -151,6 +151,13 @@
|
||||
#define XWAY_MMD_LED3H 0x01E8
|
||||
#define XWAY_MMD_LED3L 0x01E9
|
||||
|
||||
+#define XWAY_GPHY_MAX_LEDS 3
|
||||
+#define XWAY_GPHY_LED_INV(idx) BIT(12 + (idx))
|
||||
+#define XWAY_GPHY_LED_EN(idx) BIT(8 + (idx))
|
||||
+#define XWAY_GPHY_LED_DA(idx) BIT(idx)
|
||||
+#define XWAY_MMD_LEDxH(idx) (XWAY_MMD_LED0H + 2 * (idx))
|
||||
+#define XWAY_MMD_LEDxL(idx) (XWAY_MMD_LED0L + 2 * (idx))
|
||||
+
|
||||
#define PHY_ID_PHY11G_1_3 0x030260D1
|
||||
#define PHY_ID_PHY22F_1_3 0x030260E1
|
||||
#define PHY_ID_PHY11G_1_4 0xD565A400
|
||||
@@ -229,20 +236,12 @@ static int xway_gphy_rgmii_init(struct p
|
||||
XWAY_MDIO_MIICTRL_TXSKEW_MASK, val);
|
||||
}
|
||||
|
||||
-static int xway_gphy_config_init(struct phy_device *phydev)
|
||||
+static int xway_gphy_init_leds(struct phy_device *phydev)
|
||||
{
|
||||
int err;
|
||||
u32 ledxh;
|
||||
u32 ledxl;
|
||||
|
||||
- /* Mask all interrupts */
|
||||
- err = phy_write(phydev, XWAY_MDIO_IMASK, 0);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- /* Clear all pending interrupts */
|
||||
- phy_read(phydev, XWAY_MDIO_ISTAT);
|
||||
-
|
||||
/* Ensure that integrated led function is enabled for all leds */
|
||||
err = phy_write(phydev, XWAY_MDIO_LED,
|
||||
XWAY_MDIO_LED_LED0_EN |
|
||||
@@ -276,6 +275,26 @@ static int xway_gphy_config_init(struct
|
||||
phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED2H, ledxh);
|
||||
phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED2L, ledxl);
|
||||
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int xway_gphy_config_init(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device_node *np = phydev->mdio.dev.of_node;
|
||||
+ int err;
|
||||
+
|
||||
+ /* Mask all interrupts */
|
||||
+ err = phy_write(phydev, XWAY_MDIO_IMASK, 0);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ /* Use default LED configuration if 'leds' node isn't defined */
|
||||
+ if (!of_get_child_by_name(np, "leds"))
|
||||
+ xway_gphy_init_leds(phydev);
|
||||
+
|
||||
+ /* Clear all pending interrupts */
|
||||
+ phy_read(phydev, XWAY_MDIO_ISTAT);
|
||||
+
|
||||
err = xway_gphy_rgmii_init(phydev);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -347,6 +366,172 @@ static irqreturn_t xway_gphy_handle_inte
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
+static int xway_gphy_led_brightness_set(struct phy_device *phydev,
|
||||
+ u8 index, enum led_brightness value)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ if (index >= XWAY_GPHY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* clear EN and set manual LED state */
|
||||
+ ret = phy_modify(phydev, XWAY_MDIO_LED,
|
||||
+ ((value == LED_OFF) ? XWAY_GPHY_LED_EN(index) : 0) |
|
||||
+ XWAY_GPHY_LED_DA(index),
|
||||
+ (value == LED_OFF) ? 0 : XWAY_GPHY_LED_DA(index));
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* clear HW LED setup */
|
||||
+ if (value == LED_OFF) {
|
||||
+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxH(index), 0);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ return phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxL(index), 0);
|
||||
+ } else {
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static const unsigned long supported_triggers = (BIT(TRIGGER_NETDEV_LINK) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_10) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_100) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_1000) |
|
||||
+ BIT(TRIGGER_NETDEV_RX) |
|
||||
+ BIT(TRIGGER_NETDEV_TX));
|
||||
+
|
||||
+static int xway_gphy_led_hw_is_supported(struct phy_device *phydev, u8 index,
|
||||
+ unsigned long rules)
|
||||
+{
|
||||
+ if (index >= XWAY_GPHY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* activity triggers are not possible without combination with a link
|
||||
+ * trigger.
|
||||
+ */
|
||||
+ if (rules & (BIT(TRIGGER_NETDEV_RX) | BIT(TRIGGER_NETDEV_TX)) &&
|
||||
+ !(rules & (BIT(TRIGGER_NETDEV_LINK) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_10) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_100) |
|
||||
+ BIT(TRIGGER_NETDEV_LINK_1000))))
|
||||
+ return -EOPNOTSUPP;
|
||||
+
|
||||
+ /* All other combinations of the supported triggers are allowed */
|
||||
+ if (rules & ~supported_triggers)
|
||||
+ return -EOPNOTSUPP;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int xway_gphy_led_hw_control_get(struct phy_device *phydev, u8 index,
|
||||
+ unsigned long *rules)
|
||||
+{
|
||||
+ int lval, hval;
|
||||
+
|
||||
+ if (index >= XWAY_GPHY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ hval = phy_read_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxH(index));
|
||||
+ if (hval < 0)
|
||||
+ return hval;
|
||||
+
|
||||
+ lval = phy_read_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxL(index));
|
||||
+ if (lval < 0)
|
||||
+ return lval;
|
||||
+
|
||||
+ if (hval & XWAY_MMD_LEDxH_CON_LINK10)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_LINK_10);
|
||||
+
|
||||
+ if (hval & XWAY_MMD_LEDxH_CON_LINK100)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_LINK_100);
|
||||
+
|
||||
+ if (hval & XWAY_MMD_LEDxH_CON_LINK1000)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_LINK_1000);
|
||||
+
|
||||
+ if ((hval & XWAY_MMD_LEDxH_CON_LINK10) &&
|
||||
+ (hval & XWAY_MMD_LEDxH_CON_LINK100) &&
|
||||
+ (hval & XWAY_MMD_LEDxH_CON_LINK1000))
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_LINK);
|
||||
+
|
||||
+ if (lval & XWAY_MMD_LEDxL_PULSE_TXACT)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_TX);
|
||||
+
|
||||
+ if (lval & XWAY_MMD_LEDxL_PULSE_RXACT)
|
||||
+ *rules |= BIT(TRIGGER_NETDEV_RX);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int xway_gphy_led_hw_control_set(struct phy_device *phydev, u8 index,
|
||||
+ unsigned long rules)
|
||||
+{
|
||||
+ u16 hval = 0, lval = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (index >= XWAY_GPHY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_LINK) ||
|
||||
+ rules & BIT(TRIGGER_NETDEV_LINK_10))
|
||||
+ hval |= XWAY_MMD_LEDxH_CON_LINK10;
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_LINK) ||
|
||||
+ rules & BIT(TRIGGER_NETDEV_LINK_100))
|
||||
+ hval |= XWAY_MMD_LEDxH_CON_LINK100;
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_LINK) ||
|
||||
+ rules & BIT(TRIGGER_NETDEV_LINK_1000))
|
||||
+ hval |= XWAY_MMD_LEDxH_CON_LINK1000;
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_TX))
|
||||
+ lval |= XWAY_MMD_LEDxL_PULSE_TXACT;
|
||||
+
|
||||
+ if (rules & BIT(TRIGGER_NETDEV_RX))
|
||||
+ lval |= XWAY_MMD_LEDxL_PULSE_RXACT;
|
||||
+
|
||||
+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxH(index), hval);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxL(index), lval);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ return phy_set_bits(phydev, XWAY_MDIO_LED, XWAY_GPHY_LED_EN(index));
|
||||
+}
|
||||
+
|
||||
+static int xway_gphy_led_polarity_set(struct phy_device *phydev, int index,
|
||||
+ unsigned long modes)
|
||||
+{
|
||||
+ bool force_active_low = false, force_active_high = false;
|
||||
+ u32 mode;
|
||||
+
|
||||
+ if (index >= XWAY_GPHY_MAX_LEDS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) {
|
||||
+ switch (mode) {
|
||||
+ case PHY_LED_ACTIVE_LOW:
|
||||
+ force_active_low = true;
|
||||
+ break;
|
||||
+ case PHY_LED_ACTIVE_HIGH:
|
||||
+ force_active_high = true;
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (force_active_low)
|
||||
+ return phy_set_bits(phydev, XWAY_MDIO_LED, XWAY_GPHY_LED_INV(index));
|
||||
+
|
||||
+ if (force_active_high)
|
||||
+ return phy_clear_bits(phydev, XWAY_MDIO_LED, XWAY_GPHY_LED_INV(index));
|
||||
+
|
||||
+ unreachable();
|
||||
+}
|
||||
+
|
||||
static struct phy_driver xway_gphy[] = {
|
||||
{
|
||||
.phy_id = PHY_ID_PHY11G_1_3,
|
||||
@@ -359,6 +544,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
}, {
|
||||
.phy_id = PHY_ID_PHY22F_1_3,
|
||||
.phy_id_mask = 0xffffffff,
|
||||
@@ -370,6 +560,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
}, {
|
||||
.phy_id = PHY_ID_PHY11G_1_4,
|
||||
.phy_id_mask = 0xffffffff,
|
||||
@@ -381,6 +576,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
}, {
|
||||
.phy_id = PHY_ID_PHY22F_1_4,
|
||||
.phy_id_mask = 0xffffffff,
|
||||
@@ -392,6 +592,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
}, {
|
||||
.phy_id = PHY_ID_PHY11G_1_5,
|
||||
.phy_id_mask = 0xffffffff,
|
||||
@@ -402,6 +607,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
}, {
|
||||
.phy_id = PHY_ID_PHY22F_1_5,
|
||||
.phy_id_mask = 0xffffffff,
|
||||
@@ -412,6 +622,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
}, {
|
||||
.phy_id = PHY_ID_PHY11G_VR9_1_1,
|
||||
.phy_id_mask = 0xffffffff,
|
||||
@@ -422,6 +637,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
}, {
|
||||
.phy_id = PHY_ID_PHY22F_VR9_1_1,
|
||||
.phy_id_mask = 0xffffffff,
|
||||
@@ -432,6 +652,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
}, {
|
||||
.phy_id = PHY_ID_PHY11G_VR9_1_2,
|
||||
.phy_id_mask = 0xffffffff,
|
||||
@@ -442,6 +667,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
}, {
|
||||
.phy_id = PHY_ID_PHY22F_VR9_1_2,
|
||||
.phy_id_mask = 0xffffffff,
|
||||
@@ -452,6 +682,11 @@ static struct phy_driver xway_gphy[] = {
|
||||
.config_intr = xway_gphy_config_intr,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
+ .led_brightness_set = xway_gphy_led_brightness_set,
|
||||
+ .led_hw_is_supported = xway_gphy_led_hw_is_supported,
|
||||
+ .led_hw_control_get = xway_gphy_led_hw_control_get,
|
||||
+ .led_hw_control_set = xway_gphy_led_hw_control_set,
|
||||
+ .led_polarity_set = xway_gphy_led_polarity_set,
|
||||
},
|
||||
};
|
||||
module_phy_driver(xway_gphy);
|
||||
@ -0,0 +1,30 @@
|
||||
From b0fa00fe38f673c986633c11087274deeb7ce7b0 Mon Sep 17 00:00:00 2001
|
||||
From: Sander Vanheule <sander@svanheule.net>
|
||||
Date: Tue, 7 Jan 2025 21:16:20 +0100
|
||||
Subject: [PATCH] gpio: regmap: Use generic request/free ops
|
||||
|
||||
Set the gpiochip request and free ops to the generic implementations.
|
||||
This way a user can provide a gpio-ranges property defined for a pinmux,
|
||||
easing muxing of gpio functions. Provided that the pin controller
|
||||
implementents the pinmux op .gpio_request_enable(), pins will
|
||||
automatically be muxed to their GPIO function when requested.
|
||||
|
||||
Signed-off-by: Sander Vanheule <sander@svanheule.net>
|
||||
Acked-by: Michael Walle <mwalle@kernel.org>
|
||||
Link: https://lore.kernel.org/r/20250107201621.12467-1-sander@svanheule.net
|
||||
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
|
||||
---
|
||||
drivers/gpio/gpio-regmap.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/drivers/gpio/gpio-regmap.c
|
||||
+++ b/drivers/gpio/gpio-regmap.c
|
||||
@@ -262,6 +262,8 @@ struct gpio_regmap *gpio_regmap_register
|
||||
chip->label = config->label ?: dev_name(config->parent);
|
||||
chip->can_sleep = regmap_might_sleep(config->regmap);
|
||||
|
||||
+ chip->request = gpiochip_generic_request;
|
||||
+ chip->free = gpiochip_generic_free;
|
||||
chip->get = gpio_regmap_get;
|
||||
if (gpio->reg_set_base && gpio->reg_clr_base)
|
||||
chip->set = gpio_regmap_set_with_clear;
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,155 @@
|
||||
From 239d87327dcd361b0098038995f8908f3296864f Mon Sep 17 00:00:00 2001
|
||||
From: Kees Cook <kees@kernel.org>
|
||||
Date: Thu, 12 Dec 2024 17:28:06 -0800
|
||||
Subject: fortify: Hide run-time copy size from value range tracking
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
GCC performs value range tracking for variables as a way to provide better
|
||||
diagnostics. One place this is regularly seen is with warnings associated
|
||||
with bounds-checking, e.g. -Wstringop-overflow, -Wstringop-overread,
|
||||
-Warray-bounds, etc. In order to keep the signal-to-noise ratio high,
|
||||
warnings aren't emitted when a value range spans the entire value range
|
||||
representable by a given variable. For example:
|
||||
|
||||
unsigned int len;
|
||||
char dst[8];
|
||||
...
|
||||
memcpy(dst, src, len);
|
||||
|
||||
If len's value is unknown, it has the full "unsigned int" range of [0,
|
||||
UINT_MAX], and GCC's compile-time bounds checks against memcpy() will
|
||||
be ignored. However, when a code path has been able to narrow the range:
|
||||
|
||||
if (len > 16)
|
||||
return;
|
||||
memcpy(dst, src, len);
|
||||
|
||||
Then the range will be updated for the execution path. Above, len is
|
||||
now [0, 16] when reading memcpy(), so depending on other optimizations,
|
||||
we might see a -Wstringop-overflow warning like:
|
||||
|
||||
error: '__builtin_memcpy' writing between 9 and 16 bytes into region of size 8 [-Werror=stringop-overflow]
|
||||
|
||||
When building with CONFIG_FORTIFY_SOURCE, the fortified run-time bounds
|
||||
checking can appear to narrow value ranges of lengths for memcpy(),
|
||||
depending on how the compiler constructs the execution paths during
|
||||
optimization passes, due to the checks against the field sizes. For
|
||||
example:
|
||||
|
||||
if (p_size_field != SIZE_MAX &&
|
||||
p_size != p_size_field && p_size_field < size)
|
||||
|
||||
As intentionally designed, these checks only affect the kernel warnings
|
||||
emitted at run-time and do not block the potentially overflowing memcpy(),
|
||||
so GCC thinks it needs to produce a warning about the resulting value
|
||||
range that might be reaching the memcpy().
|
||||
|
||||
We have seen this manifest a few times now, with the most recent being
|
||||
with cpumasks:
|
||||
|
||||
In function ‘bitmap_copy’,
|
||||
inlined from ‘cpumask_copy’ at ./include/linux/cpumask.h:839:2,
|
||||
inlined from ‘__padata_set_cpumasks’ at kernel/padata.c:730:2:
|
||||
./include/linux/fortify-string.h:114:33: error: ‘__builtin_memcpy’ reading between 257 and 536870904 bytes from a region of size 256 [-Werror=stringop-overread]
|
||||
114 | #define __underlying_memcpy __builtin_memcpy
|
||||
| ^
|
||||
./include/linux/fortify-string.h:633:9: note: in expansion of macro ‘__underlying_memcpy’
|
||||
633 | __underlying_##op(p, q, __fortify_size); \
|
||||
| ^~~~~~~~~~~~~
|
||||
./include/linux/fortify-string.h:678:26: note: in expansion of macro ‘__fortify_memcpy_chk’
|
||||
678 | #define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \
|
||||
| ^~~~~~~~~~~~~~~~~~~~
|
||||
./include/linux/bitmap.h:259:17: note: in expansion of macro ‘memcpy’
|
||||
259 | memcpy(dst, src, len);
|
||||
| ^~~~~~
|
||||
kernel/padata.c: In function ‘__padata_set_cpumasks’:
|
||||
kernel/padata.c:713:48: note: source object ‘pcpumask’ of size [0, 256]
|
||||
713 | cpumask_var_t pcpumask,
|
||||
| ~~~~~~~~~~~~~~^~~~~~~~
|
||||
|
||||
This warning is _not_ emitted when CONFIG_FORTIFY_SOURCE is disabled,
|
||||
and with the recent -fdiagnostics-details we can confirm the origin of
|
||||
the warning is due to FORTIFY's bounds checking:
|
||||
|
||||
../include/linux/bitmap.h:259:17: note: in expansion of macro 'memcpy'
|
||||
259 | memcpy(dst, src, len);
|
||||
| ^~~~~~
|
||||
'__padata_set_cpumasks': events 1-2
|
||||
../include/linux/fortify-string.h:613:36:
|
||||
612 | if (p_size_field != SIZE_MAX &&
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
613 | p_size != p_size_field && p_size_field < size)
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
|
||||
| |
|
||||
| (1) when the condition is evaluated to false
|
||||
| (2) when the condition is evaluated to true
|
||||
'__padata_set_cpumasks': event 3
|
||||
114 | #define __underlying_memcpy __builtin_memcpy
|
||||
| ^
|
||||
| |
|
||||
| (3) out of array bounds here
|
||||
|
||||
Note that the cpumask warning started appearing since bitmap functions
|
||||
were recently marked __always_inline in commit ed8cd2b3bd9f ("bitmap:
|
||||
Switch from inline to __always_inline"), which allowed GCC to gain
|
||||
visibility into the variables as they passed through the FORTIFY
|
||||
implementation.
|
||||
|
||||
In order to silence these false positives but keep otherwise deterministic
|
||||
compile-time warnings intact, hide the length variable from GCC with
|
||||
OPTIMIZE_HIDE_VAR() before calling the builtin memcpy.
|
||||
|
||||
Additionally add a comment about why all the macro args have copies with
|
||||
const storage.
|
||||
|
||||
Reported-by: "Thomas Weißschuh" <linux@weissschuh.net>
|
||||
Closes: https://lore.kernel.org/all/db7190c8-d17f-4a0d-bc2f-5903c79f36c2@t-8ch.de/
|
||||
Reported-by: Nilay Shroff <nilay@linux.ibm.com>
|
||||
Closes: https://lore.kernel.org/all/20241112124127.1666300-1-nilay@linux.ibm.com/
|
||||
Tested-by: Nilay Shroff <nilay@linux.ibm.com>
|
||||
Acked-by: Yury Norov <yury.norov@gmail.com>
|
||||
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Kees Cook <kees@kernel.org>
|
||||
---
|
||||
include/linux/fortify-string.h | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/include/linux/fortify-string.h
|
||||
+++ b/include/linux/fortify-string.h
|
||||
@@ -616,6 +616,12 @@ __FORTIFY_INLINE bool fortify_memcpy_chk
|
||||
return false;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * To work around what seems to be an optimizer bug, the macro arguments
|
||||
+ * need to have const copies or the values end up changed by the time they
|
||||
+ * reach fortify_warn_once(). See commit 6f7630b1b5bc ("fortify: Capture
|
||||
+ * __bos() results in const temp vars") for more details.
|
||||
+ */
|
||||
#define __fortify_memcpy_chk(p, q, size, p_size, q_size, \
|
||||
p_size_field, q_size_field, op) ({ \
|
||||
const size_t __fortify_size = (size_t)(size); \
|
||||
@@ -623,6 +629,8 @@ __FORTIFY_INLINE bool fortify_memcpy_chk
|
||||
const size_t __q_size = (q_size); \
|
||||
const size_t __p_size_field = (p_size_field); \
|
||||
const size_t __q_size_field = (q_size_field); \
|
||||
+ /* Keep a mutable version of the size for the final copy. */ \
|
||||
+ size_t __copy_size = __fortify_size; \
|
||||
fortify_warn_once(fortify_memcpy_chk(__fortify_size, __p_size, \
|
||||
__q_size, __p_size_field, \
|
||||
__q_size_field, FORTIFY_FUNC_ ##op), \
|
||||
@@ -630,7 +638,11 @@ __FORTIFY_INLINE bool fortify_memcpy_chk
|
||||
__fortify_size, \
|
||||
"field \"" #p "\" at " FILE_LINE, \
|
||||
__p_size_field); \
|
||||
- __underlying_##op(p, q, __fortify_size); \
|
||||
+ /* Hide only the run-time size from value range tracking to */ \
|
||||
+ /* silence compile-time false positive bounds warnings. */ \
|
||||
+ if (!__builtin_constant_p(__copy_size)) \
|
||||
+ OPTIMIZER_HIDE_VAR(__copy_size); \
|
||||
+ __underlying_##op(p, q, __copy_size); \
|
||||
})
|
||||
|
||||
/*
|
||||
7688
target/linux/generic/config-6.12
Normal file
7688
target/linux/generic/config-6.12
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user