add ASUS RT-AC58U in IPQ40xx
This commit is contained in:
parent
d1f8ddaf6a
commit
a8cd67fa07
@ -18,6 +18,7 @@ menu "Target Images"
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx
|
||||
default TARGET_INITRAMFS_COMPRESSION_NONE
|
||||
depends on TARGET_ROOTFS_INITRAMFS
|
||||
help
|
||||
|
@ -15,12 +15,22 @@ asus,rt-ac58u)
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:blue:wlan2G" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:blue:wlan5G" "phy1tpt"
|
||||
ucidef_set_led_usbport "usb" "USB" "${boardname}:blue:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1"
|
||||
ucidef_set_led_netdev "wan" "WAN" "${boardname}:blue:wan" "eth1"
|
||||
ucidef_set_led_switch "wan" "WAN" "${boardname}:blue:wan" "switch0" "0x20"
|
||||
ucidef_set_led_switch "lan" "LAN" "${boardname}:blue:lan" "switch0" "0x1e"
|
||||
;;
|
||||
asus,rt-acrh17)
|
||||
ucidef_set_led_default "status" "STATUS" "${boardname}:blue:status" "1"
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:blue:wlan2g" "phy1tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:blue:wlan5g" "phy0tpt"
|
||||
ucidef_set_led_switch "wan" "WAN(blue)" "${boardname}:blue:wan" "switch0" "0x20"
|
||||
ucidef_set_led_switch "lan1" "LAN1" "${boardname}:blue:lan1" "switch0" "0x02"
|
||||
ucidef_set_led_switch "lan2" "LAN2" "${boardname}:blue:lan2" "switch0" "0x04"
|
||||
ucidef_set_led_switch "lan3" "LAN3" "${boardname}:blue:lan3" "switch0" "0x08"
|
||||
ucidef_set_led_switch "lan4" "LAN4" "${boardname}:blue:lan4" "switch0" "0x10"
|
||||
;;
|
||||
avm,fritzbox-4040)
|
||||
ucidef_set_led_wlan "wlan" "WLAN" "fritz4040:green:wlan" "phy0tpt" "phy1tpt"
|
||||
ucidef_set_led_netdev "wan" "WAN" "fritz4040:green:wan" "eth1"
|
||||
ucidef_set_led_switch "wan" "WAN" "fritz4040:green:wan" "switch0" "0x20"
|
||||
ucidef_set_led_switch "lan" "LAN" "fritz4040:green:lan" "switch0" "0x1e"
|
||||
;;
|
||||
glinet,gl-b1300)
|
||||
|
@ -16,27 +16,32 @@ asus,rt-ac58u)
|
||||
CI_UBIPART=UBI_DEV
|
||||
wan_mac_addr=$(mtd_get_mac_binary_ubi Factory 20486)
|
||||
lan_mac_addr=$(mtd_get_mac_binary_ubi Factory 4102)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
|
||||
"0t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
|
||||
ucidef_set_interface_macaddr "lan" "$lan_mac_addr"
|
||||
ucidef_set_interface_macaddr "wan" "$wan_mac_addr"
|
||||
;;
|
||||
asus,rt-acrh17)
|
||||
CI_UBIPART=UBI_DEV
|
||||
lan_mac_addr=$(mtd_get_mac_binary_ubi Factory 4102)
|
||||
wan_mac_addr=$(mtd_get_mac_binary_ubi Factory 36870)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
|
||||
ucidef_set_interface_macaddr "lan" "$lan_mac_addr"
|
||||
ucidef_set_interface_macaddr "wan" "$wan_mac_addr"
|
||||
;;
|
||||
avm,fritzbox-4040)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
|
||||
;;
|
||||
compex,wpj428)
|
||||
ucidef_set_interface_lan "eth0 eth1"
|
||||
"0t@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
|
||||
;;
|
||||
glinet,gl-b1300)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0u@eth0" "3:lan" "4:lan"
|
||||
"0t@eth0" "3:lan" "4:lan" "5:wan"
|
||||
;;
|
||||
compex,wpj428|\
|
||||
openmesh,a42)
|
||||
ucidef_set_interfaces_lan_wan "eth1" "eth0"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0t@eth0" "4:lan" "5:wan"
|
||||
;;
|
||||
|
||||
meraki,mr33)
|
||||
|
@ -112,6 +112,7 @@ case "$FIRMWARE" in
|
||||
;;
|
||||
"ath10k/pre-cal-ahb-a000000.wifi.bin")
|
||||
case "$board" in
|
||||
asus,rt-acrh17|\
|
||||
asus,rt-ac58u)
|
||||
CI_UBIPART=UBI_DEV
|
||||
ath10kcal_ubi_extract "Factory" 4096 12064
|
||||
@ -158,6 +159,14 @@ case "$FIRMWARE" in
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"ath10k/pre-cal-pci-0000:01:00.0.bin")
|
||||
case "$board" in
|
||||
asus,rt-acrh17)
|
||||
CI_UBIPART=UBI_DEV
|
||||
ath10kcal_ubi_extract "Factory" 36864 12064
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
|
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f /lib/adjust_network.sh ] && {
|
||||
. /lib/adjust_network.sh
|
||||
|
||||
adjust_eth_queue
|
||||
}
|
18
target/linux/ipq40xx/base-files/etc/init.d/adjust_network
Executable file
18
target/linux/ipq40xx/base-files/etc/init.d/adjust_network
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
|
||||
START=11
|
||||
STOP=98
|
||||
|
||||
adjust_smp_affinity() {
|
||||
test -f /lib/adjust_network.sh && {
|
||||
. /lib/adjust_network.sh
|
||||
|
||||
adjust_edma_smp_affinity
|
||||
adjust_radio_smp_affinity
|
||||
}
|
||||
}
|
||||
|
||||
boot() {
|
||||
adjust_smp_affinity
|
||||
}
|
86
target/linux/ipq40xx/base-files/lib/adjust_network.sh
Normal file
86
target/linux/ipq40xx/base-files/lib/adjust_network.sh
Normal file
@ -0,0 +1,86 @@
|
||||
#!/bin/sh
|
||||
# this scripts is used for adjust cpu's choice of interrupts.
|
||||
#
|
||||
|
||||
################################################
|
||||
# Adjust smp_affinity of edma
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# Remark:
|
||||
# execute only once on start-up.
|
||||
################################################
|
||||
adjust_edma_smp_affinity() {
|
||||
grep -q edma_eth_ /proc/interrupts || return 0
|
||||
local nr=`cat /proc/cpuinfo | grep processor | wc -l`
|
||||
local cpu=0
|
||||
local tx_irq_num
|
||||
|
||||
for tx_num in `seq 0 1 15` ; do
|
||||
cpu=`printf "%x" $((1<<((tx_num/4+3)%nr)))`
|
||||
tx_irq_num=`grep -m1 edma_eth_tx$tx_num /proc/interrupts | cut -d ':' -f 1 | tail -n1 | tr -d ' '`
|
||||
[ -n "$tx_irq_num" ] && echo $cpu > /proc/irq/$tx_irq_num/smp_affinity
|
||||
done
|
||||
|
||||
for rx_num in `seq 0 1 7` ; do
|
||||
cpu=`printf "%x" $((1<<((rx_num/2)%nr)))`
|
||||
rx_irq_num=`grep -m1 edma_eth_rx$rx_num /proc/interrupts | cut -d ':' -f 1 | tail -n1 | tr -d ' '`
|
||||
[ -n "$rx_irq_num" ] && echo $cpu > /proc/irq/$rx_irq_num/smp_affinity
|
||||
done
|
||||
}
|
||||
|
||||
################################################
|
||||
# Adjust smp_affinity of ath10k for 2G and 5G
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# Remark:
|
||||
# execute only once on start-up.
|
||||
################################################
|
||||
adjust_radio_smp_affinity() {
|
||||
local irqs="`grep -E 'ath10k' /proc/interrupts | cut -d ':' -f 1 | tr -d ' '`"
|
||||
local nr=`cat /proc/cpuinfo | grep processor | wc -l`
|
||||
local idx=2
|
||||
|
||||
for irq in $irqs; do
|
||||
cpu=`printf "%x" $((1<<((idx)%nr)))`
|
||||
echo $cpu > /proc/irq/$irq/smp_affinity
|
||||
idx=$((idx+1))
|
||||
done
|
||||
}
|
||||
|
||||
################################################
|
||||
# Adjust queue of eth
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# Remark:
|
||||
# Each network reboot needs to be executed.
|
||||
################################################
|
||||
adjust_eth_queue() {
|
||||
local nr=`cat /proc/cpuinfo | grep processor | wc -l`
|
||||
local cpu=`printf "%x" $(((1<<nr)-1))`
|
||||
|
||||
for epath in /sys/class/net/eth[0-9]*; do
|
||||
test -e $epath || break
|
||||
echo $epath | grep -q "\." && continue
|
||||
eth=`basename $epath`
|
||||
for exps in /sys/class/net/$eth/queues/rx-[0-9]*/rps_cpus; do
|
||||
test -e $exps || break
|
||||
echo $cpu > $exps
|
||||
echo 256 > `dirname $exps`/rps_flow_cnt
|
||||
done
|
||||
which ethtool >/dev/null 2>&1 && ethtool -K $eth gro off
|
||||
done
|
||||
|
||||
echo 1024 > /proc/sys/net/core/rps_sock_flow_entries
|
||||
}
|
@ -4,6 +4,12 @@
|
||||
|
||||
preinit_set_mac_address() {
|
||||
case $(board_name) in
|
||||
asus,rt-acrh17|\
|
||||
asus,rt-ac58u)
|
||||
CI_UBIPART=UBI_DEV
|
||||
mac=$(mtd_get_mac_binary_ubi Factory 4102)
|
||||
ifconfig eth0 hw ether $mac 2>/dev/null
|
||||
;;
|
||||
meraki,mr33)
|
||||
mac_lan=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102)
|
||||
[ -n "$mac_lan" ] && ip link set dev eth0 address "$mac_lan"
|
||||
|
@ -4,37 +4,157 @@ REQUIRE_IMAGE_METADATA=1
|
||||
RAMFS_COPY_BIN='fw_printenv fw_setenv'
|
||||
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
|
||||
|
||||
platform_check_image() {
|
||||
case "$(board_name)" in
|
||||
asus,rt-ac58u)
|
||||
CI_UBIPART="UBI_DEV"
|
||||
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
||||
local asus_root=$(nand_find_volume $ubidev jffs2)
|
||||
ubi_kill_if_exist() {
|
||||
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
local c_ubivol="$( nand_find_volume $ubidev $1 )"
|
||||
umount -f /dev/$c_ubivol 2>/dev/null
|
||||
[ "$c_ubivol" ] && ubirmvol /dev/$ubidev -N $1 || true
|
||||
echo "Partition $1 removed."
|
||||
}
|
||||
|
||||
[ -n "$asus_root" ] || return 0
|
||||
# idea from @981213
|
||||
# Tar sysupgrade for ASUS RT-AC82U/RT-AC58U
|
||||
# An ubi repartition is required due to the strange partition table created by Asus.
|
||||
# We create all the factory partitions to make sure that the U-boot tftp recovery still works.
|
||||
# The reserved kernel partition size should be enough to put the factory image in.
|
||||
asus_nand_upgrade_tar() {
|
||||
local kpart_size="$1"
|
||||
local tar_file="$2"
|
||||
|
||||
cat << EOF
|
||||
jffs2 partition is still present.
|
||||
There's probably no space left
|
||||
to install the filesystem.
|
||||
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
|
||||
board_dir=${board_dir%/}
|
||||
|
||||
You need to delete the jffs2 partition first:
|
||||
# ubirmvol /dev/ubi0 --name=jffs2
|
||||
local kernel_length=`(tar xf $tar_file ${board_dir}/kernel -O | wc -c) 2> /dev/null`
|
||||
local rootfs_length=`(tar xf $tar_file ${board_dir}/root -O | wc -c) 2> /dev/null`
|
||||
|
||||
Once this is done. Retry.
|
||||
EOF
|
||||
local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
|
||||
if [ ! "$mtdnum" ]; then
|
||||
echo "cannot find ubi mtd partition $CI_UBIPART"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
if [ ! "$ubidev" ]; then
|
||||
ubiattach -m "$mtdnum"
|
||||
sync
|
||||
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
fi
|
||||
|
||||
if [ ! "$ubidev" ]; then
|
||||
echo "cannot find ubi device $CI_UBIPART"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local root_ubivol="$( nand_find_volume $ubidev rootfs )"
|
||||
# remove ubiblock device of rootfs
|
||||
local root_ubiblk="ubiblock${root_ubivol:-3}"
|
||||
if [ "$root_ubivol" -a -e "/dev/$root_ubiblk" ]; then
|
||||
echo "removing $root_ubiblk"
|
||||
if ! ubiblock -r /dev/$root_ubivol; then
|
||||
echo "cannot remove $root_ubiblk"
|
||||
return 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
ubi_kill_if_exist linux
|
||||
ubi_kill_if_exist linux2
|
||||
ubi_kill_if_exist rootfs
|
||||
ubi_kill_if_exist rootfs_data
|
||||
ubi_kill_if_exist jffs2
|
||||
|
||||
ubimkvol /dev/$ubidev -N linux -s $kpart_size
|
||||
ubimkvol /dev/$ubidev -N linux2 -s $kpart_size
|
||||
ubimkvol /dev/$ubidev -N jffs2 -s 2539520
|
||||
ubimkvol /dev/$ubidev -N rootfs -s $rootfs_length
|
||||
ubimkvol /dev/$ubidev -N rootfs_data -m
|
||||
|
||||
local kern_ubivol="$(nand_find_volume $ubidev $CI_KERNPART)"
|
||||
echo "Kernel at $kern_ubivol.Writing..."
|
||||
tar xf $tar_file ${board_dir}/kernel -O | \
|
||||
ubiupdatevol /dev/$kern_ubivol -s $kernel_length -
|
||||
echo "Done."
|
||||
|
||||
local root_ubivol="$(nand_find_volume $ubidev rootfs)"
|
||||
echo "Rootfs at $root_ubivol.Writing..."
|
||||
tar xf $tar_file ${board_dir}/root -O | \
|
||||
ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
|
||||
echo "Done."
|
||||
|
||||
nand_do_upgrade_success
|
||||
}
|
||||
|
||||
# idea from @981213
|
||||
# Factory image sysupgrade for ASUS RT-AC82U/RT-AC58U
|
||||
# Delete all the partitions we created before, create "linux" partition and write factory image in.
|
||||
# Skip the first 64bytes which is an uImage header to verify the firmware.
|
||||
# The kernel partition size should be the original one.
|
||||
asus_nand_upgrade_factory() {
|
||||
local kpart_size="$1"
|
||||
local fw_file="$2"
|
||||
|
||||
local mtdnum="$( find_mtd_index "$CI_UBIPART" )"
|
||||
if [ ! "$mtdnum" ]; then
|
||||
echo "cannot find ubi mtd partition $CI_UBIPART"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
if [ ! "$ubidev" ]; then
|
||||
ubiattach -m "$mtdnum"
|
||||
sync
|
||||
ubidev="$( nand_find_ubi "$CI_UBIPART" )"
|
||||
fi
|
||||
|
||||
if [ ! "$ubidev" ]; then
|
||||
echo "cannot find ubi device $CI_UBIPART"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local root_ubivol="$( nand_find_volume $ubidev rootfs )"
|
||||
# remove ubiblock device of rootfs
|
||||
local root_ubiblk="ubiblock${root_ubivol:-3}"
|
||||
if [ "$root_ubivol" -a -e "/dev/$root_ubiblk" ]; then
|
||||
echo "removing $root_ubiblk"
|
||||
if ! ubiblock -r /dev/$root_ubivol; then
|
||||
echo "cannot remove $root_ubiblk"
|
||||
return 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
ubi_kill_if_exist linux
|
||||
ubi_kill_if_exist linux2
|
||||
ubi_kill_if_exist rootfs
|
||||
ubi_kill_if_exist rootfs_data
|
||||
ubi_kill_if_exist jffs2
|
||||
|
||||
ubimkvol /dev/$ubidev -N linux -s $kpart_size
|
||||
|
||||
local kern_ubivol="$(nand_find_volume $ubidev $CI_KERNPART)"
|
||||
echo "Asus linux at $kern_ubivol.Writing..."
|
||||
ubiupdatevol /dev/$kern_ubivol --skip=64 $fw_file
|
||||
echo "Done."
|
||||
|
||||
umount -a
|
||||
reboot -f
|
||||
}
|
||||
|
||||
platform_check_image() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
platform_do_upgrade() {
|
||||
case "$(board_name)" in
|
||||
asus,rt-acrh17|\
|
||||
asus,rt-ac58u)
|
||||
local magic=$(get_magic_long "$1")
|
||||
CI_UBIPART="UBI_DEV"
|
||||
CI_KERNPART="linux"
|
||||
nand_do_upgrade "$1"
|
||||
if [ "$magic" == "27051956" ]; then
|
||||
echo "Got Asus factory image."
|
||||
asus_nand_upgrade_factory 50409472 "$1"
|
||||
else
|
||||
asus_nand_upgrade_tar 20951040 "$1"
|
||||
fi
|
||||
;;
|
||||
openmesh,a42)
|
||||
PART_NAME="inactive"
|
||||
@ -52,10 +172,6 @@ platform_do_upgrade() {
|
||||
|
||||
platform_nand_pre_upgrade() {
|
||||
case "$(board_name)" in
|
||||
asus,rt-ac58u)
|
||||
CI_UBIPART="UBI_DEV"
|
||||
CI_KERNPART="linux"
|
||||
;;
|
||||
meraki,mr33)
|
||||
CI_KERNPART="part.safe"
|
||||
;;
|
||||
|
@ -207,19 +207,7 @@
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
qcom,phy_mdio_addr = <4>;
|
||||
qcom,poll_required = <1>;
|
||||
qcom,forced_speed = <1000>;
|
||||
qcom,forced_duplex = <1>;
|
||||
vlan_tag = <2 0x20>;
|
||||
};
|
||||
|
||||
&gmac1 {
|
||||
qcom,phy_mdio_addr = <3>;
|
||||
qcom,poll_required = <1>;
|
||||
qcom,forced_speed = <1000>;
|
||||
qcom,forced_duplex = <1>;
|
||||
vlan_tag = <1 0x10>;
|
||||
vlan_tag = <1 0x31>;
|
||||
};
|
||||
|
||||
&usb2_hs_phy {
|
||||
|
@ -0,0 +1,244 @@
|
||||
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qcom-ipq4019-ap.dk04.1.dtsi"
|
||||
#include "qcom-ipq4019-bus.dtsi"
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/soc/qcom,tcsr.h>
|
||||
|
||||
/ {
|
||||
model = "ASUS RT-ACRH17";
|
||||
compatible = "asus,rt-acrh17", "qcom,ipq4019";
|
||||
|
||||
memory {
|
||||
device_type = "memory";
|
||||
reg = <0x80000000 0x10000000>;
|
||||
};
|
||||
|
||||
aliases {
|
||||
led-boot = &power;
|
||||
led-failsafe = &power;
|
||||
led-running = &power;
|
||||
led-upgrade = &power;
|
||||
};
|
||||
|
||||
reserved-memory {
|
||||
#address-cells = <0x1>;
|
||||
#size-cells = <0x1>;
|
||||
ranges;
|
||||
|
||||
rsvd1@87E00000 {
|
||||
reg = <0x87e00000 0x200000>;
|
||||
no-map;
|
||||
};
|
||||
};
|
||||
|
||||
soc {
|
||||
spi_0: spi@78b5000 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
tcsr@194b000 {
|
||||
/* select hostmode */
|
||||
compatible = "qcom,tcsr";
|
||||
reg = <0x194b000 0x100>;
|
||||
qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
ess_tcsr@1953000 {
|
||||
compatible = "qcom,tcsr";
|
||||
reg = <0x1953000 0x1000>;
|
||||
qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
|
||||
};
|
||||
|
||||
tcsr@1949000 {
|
||||
compatible = "qcom,tcsr";
|
||||
reg = <0x1949000 0x100>;
|
||||
qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
|
||||
};
|
||||
|
||||
tcsr@1957000 {
|
||||
compatible = "qcom,tcsr";
|
||||
reg = <0x1957000 0x100>;
|
||||
qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
|
||||
};
|
||||
|
||||
mdio@90000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
ess-switch@c000000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
ess-psgmii@98000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
edma@c080000 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
wifi0: wifi@a000000 {
|
||||
status = "ok";
|
||||
core-id = <0x0>;
|
||||
qca,msi_addr = <0x0b006040>;
|
||||
qca,msi_base = <0x40>;
|
||||
wifi_led_num = <2>; /* Wifi 2G */
|
||||
wifi_led_source = <0>; /* source id 0 */
|
||||
qcom,mtd-name = "0:ART";
|
||||
qcom,cal-offset = <0x1000>;
|
||||
qcom,cal-len = <12064>;
|
||||
};
|
||||
|
||||
wifi1: wifi@a800000 {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
gpio-keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "reset";
|
||||
gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
};
|
||||
|
||||
wps {
|
||||
label = "wps";
|
||||
gpios = <&tlmm 11 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_WPS_BUTTON>;
|
||||
};
|
||||
};
|
||||
|
||||
gpio-leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
power: status {
|
||||
label = "rt-acrh17:blue:status";
|
||||
gpios = <&tlmm 40 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
lan1 {
|
||||
label = "rt-acrh17:blue:lan1";
|
||||
gpios = <&tlmm 45 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
lan2 {
|
||||
label = "rt-acrh17:blue:lan2";
|
||||
gpios = <&tlmm 43 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
lan3 {
|
||||
label = "rt-acrh17:blue:lan3";
|
||||
gpios = <&tlmm 42 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
lan4 {
|
||||
label = "rt-acrh17:blue:lan4";
|
||||
gpios = <&tlmm 49 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
wan_blue {
|
||||
label = "rt-acrh17:blue:wan";
|
||||
gpios = <&tlmm 61 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
wan_red {
|
||||
label = "rt-acrh17:red:wan";
|
||||
gpios = <&tlmm 68 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
wlan2g {
|
||||
label = "rt-acrh17:blue:wlan2g";
|
||||
gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
wlan5g {
|
||||
label = "rt-acrh17:blue:wlan5g";
|
||||
gpios = <&tlmm 54 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&nand {
|
||||
pinctrl-0 = <&nand_pins>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
|
||||
nand@0 {
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "Bootloader";
|
||||
reg = <0x000000000000 0x000000400000>;
|
||||
read-only;
|
||||
};
|
||||
partition@1 {
|
||||
label = "UBI_DEV";
|
||||
reg = <0x000000400000 0x000007C00000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>;
|
||||
wake-gpio = <&tlmm 50 GPIO_ACTIVE_LOW>;
|
||||
clkreq-gpio = <&tlmm 39 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
&qpic_bam {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&nand_pins {
|
||||
pullups {
|
||||
pins = "gpio53", "gpio58",
|
||||
"gpio59";
|
||||
function = "qpic";
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
pulldowns {
|
||||
pins = "gpio55", "gpio56",
|
||||
"gpio57", "gpio60",
|
||||
"gpio62", "gpio63", "gpio64",
|
||||
"gpio65", "gpio66", "gpio67",
|
||||
"gpio69";
|
||||
function = "qpic";
|
||||
bias-pull-down;
|
||||
};
|
||||
};
|
||||
|
||||
&i2c_0_pins {
|
||||
pinmux {
|
||||
function = "blsp_i2c0";
|
||||
pins = "gpio10";
|
||||
};
|
||||
pinconf {
|
||||
pins = "gpio10";
|
||||
drive-strength = <16>;
|
||||
bias-disable;
|
||||
};
|
||||
};
|
@ -255,19 +255,7 @@
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
qcom,phy_mdio_addr = <4>;
|
||||
qcom,poll_required = <1>;
|
||||
qcom,forced_speed = <1000>;
|
||||
qcom,forced_duplex = <1>;
|
||||
vlan_tag = <2 0x20>;
|
||||
};
|
||||
|
||||
&gmac1 {
|
||||
qcom,phy_mdio_addr = <3>;
|
||||
qcom,poll_required = <1>;
|
||||
qcom,forced_speed = <1000>;
|
||||
qcom,forced_duplex = <1>;
|
||||
vlan_tag = <1 0x10>;
|
||||
vlan_tag = <1 0x31>;
|
||||
};
|
||||
|
||||
&usb3_ss_phy {
|
||||
|
@ -289,6 +289,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
vlan_tag = <1 0x39>;
|
||||
};
|
||||
|
||||
&usb2_hs_phy {
|
||||
status = "okay";
|
||||
};
|
||||
|
@ -47,11 +47,30 @@ define Device/asus_rt-ac58u
|
||||
# to add a version... or we are very careful not to add '\0' into that
|
||||
# string and call it a day.... Yeah, we do the latter!
|
||||
UIMAGE_NAME:=$(shell echo -e '\03\01\01\01RT-AC58U')
|
||||
KERNEL_INITRAMFS := $$(KERNEL) | uImage none
|
||||
KERNEL_INITRAMFS_SUFFIX := -factory.trx
|
||||
IMAGES := sysupgrade.bin
|
||||
DEVICE_PACKAGES := ipq-wifi-asus_rt-ac58u kmod-usb-ledtrig-usbport
|
||||
endef
|
||||
TARGET_DEVICES += asus_rt-ac58u
|
||||
|
||||
define Device/asus_rt-acrh17
|
||||
$(call Device/FitImageLzma)
|
||||
DEVICE_DTS := qcom-ipq4019-rt-acrh17
|
||||
BLOCKSIZE := 128k
|
||||
PAGESIZE := 2048
|
||||
DTB_SIZE := 65536
|
||||
DEVICE_TITLE := Asus RT-ACRH17
|
||||
IMAGE_SIZE := 20439364
|
||||
FILESYSTEMS := squashfs
|
||||
UIMAGE_NAME:=$(shell echo -e '\03\01\01\01RT-AC82U')
|
||||
KERNEL_INITRAMFS := $$(KERNEL) | uImage none
|
||||
KERNEL_INITRAMFS_SUFFIX := -factory.trx
|
||||
IMAGES := sysupgrade.bin
|
||||
DEVICE_PACKAGES := ath10k-firmware-qca4019 ath10k-firmware-qca9984
|
||||
endef
|
||||
TARGET_DEVICES += asus_rt-acrh17
|
||||
|
||||
define Device/avm_fritzbox-4040
|
||||
$(call Device/FitImageLzma)
|
||||
DEVICE_DTS := qcom-ipq4018-fritz4040
|
||||
|
@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -697,7 +697,14 @@ dtb-$(CONFIG_ARCH_QCOM) += \
|
||||
@@ -697,7 +697,15 @@ dtb-$(CONFIG_ARCH_QCOM) += \
|
||||
qcom-apq8074-dragonboard.dtb \
|
||||
qcom-apq8084-ifc6540.dtb \
|
||||
qcom-apq8084-mtp.dtb \
|
||||
@ -19,6 +19,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
+ qcom-ipq4018-rt-ac58u.dtb \
|
||||
qcom-ipq4019-ap.dk01.1-c1.dtb \
|
||||
+ qcom-ipq4019-ap.dk04.1-c1.dtb \
|
||||
+ qcom-ipq4019-rt-acrh17.dtb \
|
||||
+ qcom-ipq4028-wpj428.dtb \
|
||||
+ qcom-ipq4029-gl-b1300.dtb \
|
||||
+ qcom-ipq4029-mr33.dtb \
|
||||
|
@ -0,0 +1,144 @@
|
||||
From 0bcfbe3c613d6ed8044404bc1cc3c29ff961d89c Mon Sep 17 00:00:00 2001
|
||||
From: Chen Minqiang <ptpt52@gmail.com>
|
||||
Date: Thu, 15 Mar 2018 04:59:57 +0800
|
||||
Subject: [PATCH 1/2] essedma: fixup ethernet driver rx bug
|
||||
|
||||
- modify the error rx ring full conditions
|
||||
- in rare cases, out of memory allocation failure causes the receive queues stop
|
||||
we use the timer to re-alloc rx rings under these circumstances
|
||||
|
||||
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
|
||||
---
|
||||
drivers/net/ethernet/qualcomm/essedma/edma.c | 51 ++++++++++++++++++++++--
|
||||
drivers/net/ethernet/qualcomm/essedma/edma.h | 3 ++
|
||||
drivers/net/ethernet/qualcomm/essedma/edma_axi.c | 8 ++++
|
||||
3 files changed, 58 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.c b/drivers/net/ethernet/qualcomm/essedma/edma.c
|
||||
index fecc0ba..3f1da93 100644
|
||||
--- a/drivers/net/ethernet/qualcomm/essedma/edma.c
|
||||
+++ b/drivers/net/ethernet/qualcomm/essedma/edma.c
|
||||
@@ -530,6 +530,47 @@ static int edma_rx_complete_paged(struct sk_buff *skb, u16 num_rfds, u16 length,
|
||||
return sw_next_to_clean;
|
||||
}
|
||||
|
||||
+static int edma_rfd_desc_unused(struct edma_rfd_desc_ring *erdr)
|
||||
+{
|
||||
+ if (erdr->sw_next_to_clean > erdr->sw_next_to_fill)
|
||||
+ return erdr->sw_next_to_clean - erdr->sw_next_to_fill - 1;
|
||||
+ return erdr->count + erdr->sw_next_to_clean - erdr->sw_next_to_fill - 1;
|
||||
+}
|
||||
+
|
||||
+void edma_rx_realloc(unsigned long data)
|
||||
+{
|
||||
+ struct edma_per_cpu_queues_info *edma_percpu_info = (struct edma_per_cpu_queues_info *)data;
|
||||
+ struct edma_common_info *edma_cinfo = edma_percpu_info->edma_cinfo;
|
||||
+ s32 status = edma_percpu_info->rx_realloc_status;
|
||||
+
|
||||
+ while (status) {
|
||||
+ int queue_id;
|
||||
+ int ret_count;
|
||||
+ struct edma_rfd_desc_ring *erdr;
|
||||
+
|
||||
+ queue_id = ffs(status) - 1;
|
||||
+ erdr = edma_cinfo->rfd_ring[queue_id];
|
||||
+ ret_count = edma_alloc_rx_buf(edma_cinfo, erdr, edma_rfd_desc_unused(erdr), queue_id);
|
||||
+ if (ret_count == 0) {
|
||||
+ edma_percpu_info->rx_realloc_status &= ~(1 << queue_id);
|
||||
+ }
|
||||
+ status &= ~(1 << queue_id);
|
||||
+ }
|
||||
+
|
||||
+ if (edma_percpu_info->rx_realloc_status) {
|
||||
+ mod_timer(&edma_percpu_info->rx_realloc_timer, jiffies + HZ);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static inline void edma_realloc_timer_start(struct napi_struct *napi, int queue_id)
|
||||
+{
|
||||
+ struct edma_per_cpu_queues_info *edma_percpu_info = container_of(napi,
|
||||
+ struct edma_per_cpu_queues_info, napi);
|
||||
+
|
||||
+ edma_percpu_info->rx_realloc_status |= (1 << queue_id);
|
||||
+ mod_timer(&edma_percpu_info->rx_realloc_timer, jiffies + 5 * HZ); /* restart alloc in 5 secs */
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* edma_rx_complete()
|
||||
* Main api called from the poll function to process rx packets.
|
||||
@@ -754,10 +795,12 @@ static void edma_rx_complete(struct edma_common_info *edma_cinfo,
|
||||
erdr->sw_next_to_clean = sw_next_to_clean;
|
||||
|
||||
/* Refill here in case refill threshold wasn't reached */
|
||||
- if (likely(cleaned_count)) {
|
||||
- ret_count = edma_alloc_rx_buf(edma_cinfo, erdr, cleaned_count, queue_id);
|
||||
- if (ret_count)
|
||||
+ if (edma_rfd_desc_unused(erdr)) {
|
||||
+ ret_count = edma_alloc_rx_buf(edma_cinfo, erdr, edma_rfd_desc_unused(erdr), queue_id);
|
||||
+ if (ret_count) {
|
||||
dev_dbg(&pdev->dev, "Not all buffers was reallocated");
|
||||
+ edma_realloc_timer_start(napi, queue_id);
|
||||
+ }
|
||||
edma_write_reg(EDMA_REG_RX_SW_CONS_IDX_Q(queue_id),
|
||||
erdr->sw_next_to_clean);
|
||||
}
|
||||
@@ -1801,7 +1844,7 @@ int edma_configure(struct edma_common_info *edma_cinfo)
|
||||
/* Allocate the RX buffer */
|
||||
for (i = 0, j = 0; i < edma_cinfo->num_rx_queues; i++) {
|
||||
struct edma_rfd_desc_ring *ring = edma_cinfo->rfd_ring[j];
|
||||
- ret_count = edma_alloc_rx_buf(edma_cinfo, ring, ring->count, j);
|
||||
+ ret_count = edma_alloc_rx_buf(edma_cinfo, ring, edma_rfd_desc_unused(ring), j);
|
||||
if (ret_count) {
|
||||
dev_dbg(&edma_cinfo->pdev->dev, "not all rx buffers allocated\n");
|
||||
}
|
||||
diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.h b/drivers/net/ethernet/qualcomm/essedma/edma.h
|
||||
index 5d6dc73..29c8379 100644
|
||||
--- a/drivers/net/ethernet/qualcomm/essedma/edma.h
|
||||
+++ b/drivers/net/ethernet/qualcomm/essedma/edma.h
|
||||
@@ -304,6 +304,8 @@ struct edma_per_cpu_queues_info {
|
||||
u32 tx_start; /* tx queue start */
|
||||
u32 rx_start; /* rx queue start */
|
||||
struct edma_common_info *edma_cinfo; /* edma common info */
|
||||
+ u32 rx_realloc_status;
|
||||
+ struct timer_list rx_realloc_timer;
|
||||
};
|
||||
|
||||
/* edma specific common info */
|
||||
@@ -448,6 +450,7 @@ void edma_change_tx_coalesce(int usecs);
|
||||
void edma_change_rx_coalesce(int usecs);
|
||||
void edma_get_tx_rx_coalesce(u32 *reg_val);
|
||||
void edma_clear_irq_status(void);
|
||||
+void edma_rx_realloc(unsigned long data);
|
||||
void ess_set_port_status_speed(struct edma_common_info *edma_cinfo,
|
||||
struct phy_device *phydev, uint8_t port_id);
|
||||
#endif /* _EDMA_H_ */
|
||||
diff --git a/drivers/net/ethernet/qualcomm/essedma/edma_axi.c b/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
|
||||
index 81fc1e1..d9f8b52 100644
|
||||
--- a/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
|
||||
+++ b/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
|
||||
@@ -1131,6 +1131,11 @@ static int edma_axi_probe(struct platform_device *pdev)
|
||||
edma_cinfo->edma_percpu_info[i].rx_status = 0;
|
||||
edma_cinfo->edma_percpu_info[i].edma_cinfo = edma_cinfo;
|
||||
|
||||
+ edma_cinfo->edma_percpu_info[i].rx_realloc_status = 0;
|
||||
+ init_timer(&edma_cinfo->edma_percpu_info[i].rx_realloc_timer);
|
||||
+ edma_cinfo->edma_percpu_info[i].rx_realloc_timer.function = edma_rx_realloc;
|
||||
+ edma_cinfo->edma_percpu_info[i].rx_realloc_timer.data = (unsigned long)&edma_cinfo->edma_percpu_info[i];
|
||||
+
|
||||
/* Request irq per core */
|
||||
for (j = edma_cinfo->edma_percpu_info[i].tx_start;
|
||||
j < tx_start[i] + 4; j++) {
|
||||
@@ -1259,7 +1264,10 @@ err_configure:
|
||||
err_rmap_add_fail:
|
||||
edma_free_irqs(adapter[0]);
|
||||
for (i = 0; i < CONFIG_NR_CPUS; i++)
|
||||
+ {
|
||||
napi_disable(&edma_cinfo->edma_percpu_info[i].napi);
|
||||
+ del_timer_sync(&edma_cinfo->edma_percpu_info[i].rx_realloc_timer);
|
||||
+ }
|
||||
err_reset:
|
||||
err_unregister_sysctl_tbl:
|
||||
err_rmap_alloc_fail:
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,223 @@
|
||||
From 7be0cb35513b07bf74d93d052d57b12e2c654b43 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Minqiang <ptpt52@gmail.com>
|
||||
Date: Thu, 15 Mar 2018 05:04:37 +0800
|
||||
Subject: [PATCH 2/2] essedma: refine txq to be adaptive of cpus and netdev
|
||||
|
||||
- use 4 queue for each cpu if only 1 netdev
|
||||
- use all 16 txqueue if only 1 netdev
|
||||
|
||||
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
|
||||
---
|
||||
drivers/net/ethernet/qualcomm/essedma/edma.c | 22 +++++--------
|
||||
drivers/net/ethernet/qualcomm/essedma/edma.h | 5 +--
|
||||
drivers/net/ethernet/qualcomm/essedma/edma_axi.c | 40 ++++++++++++++----------
|
||||
3 files changed, 35 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.c b/drivers/net/ethernet/qualcomm/essedma/edma.c
|
||||
index 3f1da93..05f9ce9 100644
|
||||
--- a/drivers/net/ethernet/qualcomm/essedma/edma.c
|
||||
+++ b/drivers/net/ethernet/qualcomm/essedma/edma.c
|
||||
@@ -22,14 +22,6 @@ extern struct net_device *edma_netdev[EDMA_MAX_PORTID_SUPPORTED];
|
||||
bool edma_stp_rstp;
|
||||
u16 edma_ath_eth_type;
|
||||
|
||||
-/* edma_skb_priority_offset()
|
||||
- * get edma skb priority
|
||||
- */
|
||||
-static unsigned int edma_skb_priority_offset(struct sk_buff *skb)
|
||||
-{
|
||||
- return (skb->priority >> 2) & 1;
|
||||
-}
|
||||
-
|
||||
/* edma_alloc_tx_ring()
|
||||
* Allocate Tx descriptors ring
|
||||
*/
|
||||
@@ -1042,13 +1034,14 @@ static inline u16 edma_tpd_available(struct edma_common_info *edma_cinfo,
|
||||
/* edma_tx_queue_get()
|
||||
* Get the starting number of the queue
|
||||
*/
|
||||
-static inline int edma_tx_queue_get(struct edma_adapter *adapter,
|
||||
+static inline int edma_tx_queue_get(struct edma_common_info *edma_cinfo, struct edma_adapter *adapter,
|
||||
struct sk_buff *skb, int txq_id)
|
||||
{
|
||||
/* skb->priority is used as an index to skb priority table
|
||||
* and based on packet priority, correspong queue is assigned.
|
||||
+ * FIXME we just simple use jiffies for time base balance
|
||||
*/
|
||||
- return adapter->tx_start_offset[txq_id] + edma_skb_priority_offset(skb);
|
||||
+ return adapter->tx_start_offset[txq_id] + (jiffies % edma_cinfo->num_txq_per_core_netdev);
|
||||
}
|
||||
|
||||
/* edma_tx_update_hw_idx()
|
||||
@@ -1417,8 +1410,9 @@ netdev_tx_t edma_xmit(struct sk_buff *skb,
|
||||
}
|
||||
|
||||
/* this will be one of the 4 TX queues exposed to linux kernel */
|
||||
- txq_id = skb_get_queue_mapping(skb);
|
||||
- queue_id = edma_tx_queue_get(adapter, skb, txq_id);
|
||||
+ /* XXX what if num_online_cpus() > EDMA_CPU_CORES_SUPPORTED */
|
||||
+ txq_id = smp_processor_id() % EDMA_CPU_CORES_SUPPORTED;
|
||||
+ queue_id = edma_tx_queue_get(edma_cinfo, adapter, skb, txq_id);
|
||||
etdr = edma_cinfo->tpd_ring[queue_id];
|
||||
nq = netdev_get_tx_queue(net_dev, txq_id);
|
||||
|
||||
@@ -1899,8 +1893,8 @@ void edma_free_irqs(struct edma_adapter *adapter)
|
||||
int i, j;
|
||||
int k = ((edma_cinfo->num_rx_queues == 4) ? 1 : 2);
|
||||
|
||||
- for (i = 0; i < CONFIG_NR_CPUS; i++) {
|
||||
- for (j = edma_cinfo->edma_percpu_info[i].tx_start; j < (edma_cinfo->edma_percpu_info[i].tx_start + 4); j++)
|
||||
+ for (i = 0; i < num_online_cpus() && i < EDMA_CPU_CORES_SUPPORTED; i++) {
|
||||
+ for (j = edma_cinfo->edma_percpu_info[i].tx_start; j < (edma_cinfo->edma_percpu_info[i].tx_start + edma_cinfo->num_txq_per_core); j++)
|
||||
free_irq(edma_cinfo->tx_irq[j], &edma_cinfo->edma_percpu_info[i]);
|
||||
|
||||
for (j = edma_cinfo->edma_percpu_info[i].rx_start; j < (edma_cinfo->edma_percpu_info[i].rx_start + k); j++)
|
||||
diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.h b/drivers/net/ethernet/qualcomm/essedma/edma.h
|
||||
index 29c8379..2ba43e0 100644
|
||||
--- a/drivers/net/ethernet/qualcomm/essedma/edma.h
|
||||
+++ b/drivers/net/ethernet/qualcomm/essedma/edma.h
|
||||
@@ -325,6 +325,7 @@ struct edma_common_info {
|
||||
u32 from_cpu; /* from CPU TPD field */
|
||||
u32 num_rxq_per_core; /* Rx queues per core */
|
||||
u32 num_txq_per_core; /* Tx queues per core */
|
||||
+ u32 num_txq_per_core_netdev; /* Tx queues per core per netdev */
|
||||
u16 tx_ring_count; /* Tx ring count */
|
||||
u16 rx_ring_count; /* Rx ring*/
|
||||
u16 rx_head_buffer_len; /* rx buffer length */
|
||||
@@ -332,7 +333,7 @@ struct edma_common_info {
|
||||
u32 page_mode; /* Jumbo frame supported flag */
|
||||
u32 fraglist_mode; /* fraglist supported flag */
|
||||
struct edma_hw hw; /* edma hw specific structure */
|
||||
- struct edma_per_cpu_queues_info edma_percpu_info[CONFIG_NR_CPUS]; /* per cpu information */
|
||||
+ struct edma_per_cpu_queues_info edma_percpu_info[EDMA_CPU_CORES_SUPPORTED]; /* per cpu information */
|
||||
spinlock_t stats_lock; /* protect edma stats area for updation */
|
||||
|
||||
bool is_single_phy;
|
||||
@@ -401,7 +402,7 @@ struct edma_adapter {
|
||||
u32 link_state; /* phy link state */
|
||||
u32 phy_mdio_addr; /* PHY device address on MII interface */
|
||||
u32 poll_required; /* check if link polling is required */
|
||||
- u32 tx_start_offset[CONFIG_NR_CPUS]; /* tx queue start */
|
||||
+ u32 tx_start_offset[EDMA_CPU_CORES_SUPPORTED]; /* tx queue start */
|
||||
u32 default_vlan_tag; /* vlan tag */
|
||||
u32 dp_bitmap;
|
||||
uint8_t phy_id[MII_BUS_ID_SIZE + 3];
|
||||
diff --git a/drivers/net/ethernet/qualcomm/essedma/edma_axi.c b/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
|
||||
index d9f8b52..5824680 100644
|
||||
--- a/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
|
||||
+++ b/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
|
||||
@@ -721,11 +721,7 @@ static int edma_axi_probe(struct platform_device *pdev)
|
||||
int i, j, k, err = 0;
|
||||
int portid_bmp;
|
||||
int idx = 0, idx_mac = 0;
|
||||
-
|
||||
- if (CONFIG_NR_CPUS != EDMA_CPU_CORES_SUPPORTED) {
|
||||
- dev_err(&pdev->dev, "Invalid CPU Cores\n");
|
||||
- return -EINVAL;
|
||||
- }
|
||||
+ int netdev_group = 2;
|
||||
|
||||
if ((num_rxq != 4) && (num_rxq != 8)) {
|
||||
dev_err(&pdev->dev, "Invalid RX queue, edma probe failed\n");
|
||||
@@ -749,7 +745,7 @@ static int edma_axi_probe(struct platform_device *pdev)
|
||||
/* Initialize the netdev array before allocation
|
||||
* to avoid double free
|
||||
*/
|
||||
- for (i = 0 ; i < edma_cinfo->num_gmac ; i++)
|
||||
+ for (i = 0 ; i < EDMA_MAX_PORTID_SUPPORTED; i++)
|
||||
edma_netdev[i] = NULL;
|
||||
|
||||
for (i = 0 ; i < edma_cinfo->num_gmac ; i++) {
|
||||
@@ -770,8 +766,11 @@ static int edma_axi_probe(struct platform_device *pdev)
|
||||
|
||||
/* Fill ring details */
|
||||
edma_cinfo->num_tx_queues = EDMA_MAX_TRANSMIT_QUEUE;
|
||||
- edma_cinfo->num_txq_per_core = (EDMA_MAX_TRANSMIT_QUEUE / 4);
|
||||
+ edma_cinfo->num_txq_per_core = (EDMA_MAX_TRANSMIT_QUEUE / num_online_cpus());
|
||||
+ edma_cinfo->num_txq_per_core_netdev = (EDMA_MAX_TRANSMIT_QUEUE / netdev_group / num_online_cpus());
|
||||
edma_cinfo->tx_ring_count = EDMA_TX_RING_SIZE;
|
||||
+ if (edma_cinfo->num_txq_per_core == 0)
|
||||
+ edma_cinfo->num_txq_per_core = 1;
|
||||
|
||||
/* Update num rx queues based on module parameter */
|
||||
edma_cinfo->num_rx_queues = num_rxq;
|
||||
@@ -941,6 +940,13 @@ static int edma_axi_probe(struct platform_device *pdev)
|
||||
idx_mac++;
|
||||
}
|
||||
|
||||
+ if (edma_cinfo->num_gmac == 1) {
|
||||
+ netdev_group = 1;
|
||||
+ edma_cinfo->num_txq_per_core_netdev = (EDMA_MAX_TRANSMIT_QUEUE / netdev_group / num_online_cpus());
|
||||
+ }
|
||||
+ if (edma_cinfo->num_txq_per_core_netdev == 0)
|
||||
+ edma_cinfo->num_txq_per_core_netdev = 1;
|
||||
+
|
||||
/* Populate the adapter structure register the netdevice */
|
||||
for (i = 0; i < edma_cinfo->num_gmac; i++) {
|
||||
int k, m;
|
||||
@@ -948,17 +954,16 @@ static int edma_axi_probe(struct platform_device *pdev)
|
||||
adapter[i] = netdev_priv(edma_netdev[i]);
|
||||
adapter[i]->netdev = edma_netdev[i];
|
||||
adapter[i]->pdev = pdev;
|
||||
- for (j = 0; j < CONFIG_NR_CPUS; j++) {
|
||||
- m = i % 2;
|
||||
- adapter[i]->tx_start_offset[j] =
|
||||
- ((j << EDMA_TX_CPU_START_SHIFT) + (m << 1));
|
||||
+ for (j = 0; j < num_online_cpus() && j < EDMA_CPU_CORES_SUPPORTED; j++) {
|
||||
+ m = i % netdev_group;
|
||||
+ adapter[i]->tx_start_offset[j] = j * edma_cinfo->num_txq_per_core + m * edma_cinfo->num_txq_per_core_netdev;
|
||||
/* Share the queues with available net-devices.
|
||||
* For instance , with 5 net-devices
|
||||
* eth0/eth2/eth4 will share q0,q1,q4,q5,q8,q9,q12,q13
|
||||
* and eth1/eth3 will get the remaining.
|
||||
*/
|
||||
for (k = adapter[i]->tx_start_offset[j]; k <
|
||||
- (adapter[i]->tx_start_offset[j] + 2); k++) {
|
||||
+ (adapter[i]->tx_start_offset[j] + edma_cinfo->num_txq_per_core_netdev); k++) {
|
||||
if (edma_fill_netdev(edma_cinfo, k, i, j)) {
|
||||
pr_err("Netdev overflow Error\n");
|
||||
goto err_register;
|
||||
@@ -1111,9 +1116,12 @@ static int edma_axi_probe(struct platform_device *pdev)
|
||||
/* populate per_core_info, do a napi_Add, request 16 TX irqs,
|
||||
* 8 RX irqs, do a napi enable
|
||||
*/
|
||||
- for (i = 0; i < CONFIG_NR_CPUS; i++) {
|
||||
+ for (i = 0; i < num_online_cpus() && i < EDMA_MAX_TRANSMIT_QUEUE; i++) {
|
||||
u8 rx_start;
|
||||
|
||||
+ tx_mask[i] = (0xFFFF >> (16 - edma_cinfo->num_txq_per_core)) << (i * edma_cinfo->num_txq_per_core);
|
||||
+ tx_start[i] = i * edma_cinfo->num_txq_per_core;
|
||||
+
|
||||
edma_cinfo->edma_percpu_info[i].napi.state = 0;
|
||||
|
||||
netif_napi_add(edma_netdev[0],
|
||||
@@ -1138,7 +1146,7 @@ static int edma_axi_probe(struct platform_device *pdev)
|
||||
|
||||
/* Request irq per core */
|
||||
for (j = edma_cinfo->edma_percpu_info[i].tx_start;
|
||||
- j < tx_start[i] + 4; j++) {
|
||||
+ j < tx_start[i] + edma_cinfo->num_txq_per_core; j++) {
|
||||
sprintf(&edma_tx_irq[j][0], "edma_eth_tx%d", j);
|
||||
err = request_irq(edma_cinfo->tx_irq[j],
|
||||
edma_interrupt,
|
||||
@@ -1263,7 +1271,7 @@ err_configure:
|
||||
#endif
|
||||
err_rmap_add_fail:
|
||||
edma_free_irqs(adapter[0]);
|
||||
- for (i = 0; i < CONFIG_NR_CPUS; i++)
|
||||
+ for (i = 0; i < num_online_cpus() && i < EDMA_CPU_CORES_SUPPORTED; i++)
|
||||
{
|
||||
napi_disable(&edma_cinfo->edma_percpu_info[i].napi);
|
||||
del_timer_sync(&edma_cinfo->edma_percpu_info[i].rx_realloc_timer);
|
||||
@@ -1314,7 +1322,7 @@ static int edma_axi_remove(struct platform_device *pdev)
|
||||
unregister_netdev(edma_netdev[i]);
|
||||
|
||||
edma_stop_rx_tx(hw);
|
||||
- for (i = 0; i < CONFIG_NR_CPUS; i++)
|
||||
+ for (i = 0; i < num_online_cpus() && i < EDMA_CPU_CORES_SUPPORTED; i++)
|
||||
napi_disable(&edma_cinfo->edma_percpu_info[i].napi);
|
||||
|
||||
edma_irq_disable(edma_cinfo);
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,82 @@
|
||||
From 42b508d91b7f51b054f383e3aa42089ccab9300d Mon Sep 17 00:00:00 2001
|
||||
From: Chen Minqiang <ptpt52@gmail.com>
|
||||
Date: Thu, 15 Mar 2018 05:33:46 +0800
|
||||
Subject: [PATCH] essedma: disable default vlan tagging
|
||||
|
||||
The essedma driver has its own unique take on VLAN management
|
||||
and its configuration. In the original SDK, each VLAN is
|
||||
assigned one virtual ethernet netdev.
|
||||
|
||||
However, this is non-standard. So, this patch does away
|
||||
with the default_vlan_tag property the driver is using
|
||||
and therefore forces the user to use the kernel's vlan
|
||||
feature.
|
||||
|
||||
This patch also removes the "qcom,poll_required = <1>;" from
|
||||
the essedma node.
|
||||
|
||||
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
|
||||
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/qcom-ipq4019.dtsi | 5 ++---
|
||||
drivers/net/ethernet/qualcomm/essedma/edma.c | 14 +++++---------
|
||||
2 files changed, 7 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/qcom-ipq4019.dtsi b/arch/arm/boot/dts/qcom-ipq4019.dtsi
|
||||
index 3c4617f..7c3af8e 100644
|
||||
--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
|
||||
+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
|
||||
@@ -598,8 +598,7 @@
|
||||
qcom,page-mode = <0>;
|
||||
qcom,rx_head_buf_size = <1540>;
|
||||
qcom,mdio_supported;
|
||||
- qcom,poll_required = <1>;
|
||||
- qcom,num_gmac = <2>;
|
||||
+ qcom,num_gmac = <1>;
|
||||
interrupts = <0 65 IRQ_TYPE_EDGE_RISING
|
||||
0 66 IRQ_TYPE_EDGE_RISING
|
||||
0 67 IRQ_TYPE_EDGE_RISING
|
||||
@@ -637,7 +636,7 @@
|
||||
|
||||
gmac0: gmac0 {
|
||||
local-mac-address = [00 00 00 00 00 00];
|
||||
- vlan_tag = <1 0x1f>;
|
||||
+ vlan_tag = <1 0x3f>;
|
||||
};
|
||||
|
||||
gmac1: gmac1 {
|
||||
diff --git a/drivers/net/ethernet/qualcomm/essedma/edma.c b/drivers/net/ethernet/qualcomm/essedma/edma.c
|
||||
index 05f9ce9..a3c0d66 100644
|
||||
--- a/drivers/net/ethernet/qualcomm/essedma/edma.c
|
||||
+++ b/drivers/net/ethernet/qualcomm/essedma/edma.c
|
||||
@@ -750,13 +750,11 @@ static void edma_rx_complete(struct edma_common_info *edma_cinfo,
|
||||
edma_receive_checksum(rd, skb);
|
||||
|
||||
/* Process VLAN HW acceleration indication provided by HW */
|
||||
- if (unlikely(adapter->default_vlan_tag != rd->rrd4)) {
|
||||
- vlan = rd->rrd4;
|
||||
- if (likely(rd->rrd7 & EDMA_RRD_CVLAN))
|
||||
- __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan);
|
||||
- else if (rd->rrd1 & EDMA_RRD_SVLAN)
|
||||
- __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan);
|
||||
- }
|
||||
+ vlan = rd->rrd4;
|
||||
+ if (likely(rd->rrd7 & EDMA_RRD_CVLAN))
|
||||
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan);
|
||||
+ else if (rd->rrd1 & EDMA_RRD_SVLAN)
|
||||
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021AD), vlan);
|
||||
|
||||
/* Update rx statistics */
|
||||
adapter->stats.rx_packets++;
|
||||
@@ -1434,8 +1432,6 @@ netdev_tx_t edma_xmit(struct sk_buff *skb,
|
||||
if (!adapter->edma_cinfo->is_single_phy) {
|
||||
if (unlikely(skb_vlan_tag_present(skb)))
|
||||
flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_FLAG;
|
||||
- else if (adapter->default_vlan_tag)
|
||||
- flags_transmit |= EDMA_VLAN_TX_TAG_INSERT_DEFAULT_FLAG;
|
||||
}
|
||||
|
||||
/* Check and mark checksum offload */
|
||||
--
|
||||
2.7.4
|
||||
|
Loading…
x
Reference in New Issue
Block a user