Re: [PATCH firmware-utils] tplink-safeloader: TP-Link Deco M4R-V3 and Deco M5 support

2022-04-24 Thread Sander Vanheule
Hi Ole Kristian,


On Tue, 2022-04-19 at 15:46 +0200, Ole Kristian Lona wrote:
> 
> Support for creating images for TP-Link Deco M4R version 3, and for M5.

Please provide separate patches for:
 * image generation code changes
 * Deco M4R v3
 * Deco M5 

> 
> Partition table and supportlists were extracted from newest OEM image.
> 
> Both devices have partition tables with fallback partitions, like:
> os-image@0 and os-image@1, file-system@0 and file-system@1
> 
> This is assumed to be a fail-safe built into the firmware of the 
> devices.

These devices are not explicitly dual boot then? How does the bootloader decide 
which os-
image will be loaded? If the device alternates between @0 and @1 on firmware 
upgrades, you
will need to specify in the factory install instructions how to select the 
correct image
set.

> Therefore, this naming scheme has been kept, and tplink-safeloader.c
> has been slightly modified to account for this.
> 
> I have tested without these "@1" and "@0" names. This causes the 
> firmware to be
> makred as invalid. Therefore, I made changes to the logic in the app, 
> (re?)adding a name
> parameter to functions, and (last part of the patch) making sure these 
> names are
> sent to the functions correctly.
> 
> Also tested merging os-image and file-system into one "firmware" 
> partition. This rendered
> the firmware invalid, so reverted back to original TP-Link layout.

Is this true when "firmware" is auto-split into "os-image@1" and 
"file-system@1" too?
Typically, when you keep the fixed split, an update will be required in the 
future because
the kernel has outgrown the small (4MB in this case) os-image partition.

> 
> Signed-off-by: Ole Kristian Lona 
> ---
>   src/tplink-safeloader.c | 169 +---
>   1 file changed, 159 insertions(+), 10 deletions(-)
> 
> diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c
> index c4727df..7b5d2d4 100644
> --- a/src/tplink-safeloader.c
> +++ b/src/tplink-safeloader.c
> 

...

> @@ -2895,8 +3026,8 @@ static void set_source_date_epoch() {
>   }
> 
>   /** Generates the partition-table partition */
> -static struct image_partition_entry make_partition_table(const struct 
> flash_partition_entry *p) {
> -   struct image_partition_entry entry = 
> alloc_image_partition("partition-table", 0x800);
> +static struct image_partition_entry make_partition_table(const char 
> *name,const struct flash_partition_entry *p) {

Add a space after the comma

> +   struct image_partition_entry entry = alloc_image_partition(name, 
> 0x800);
> 
> char *s = (char *)entry.data, *end = (char *)(s+entry.size);

...

> 
> @@ -3213,6 +3344,11 @@ static void build_image(const char *output,
> 
> size_t i;
> 
> +   char *part_table_name;
> +   char *soft_ver_name;
> +   char *os_im_name;
> +   char *fs_name;
> +
> struct image_partition_entry parts[7] = {};
> 
> struct flash_partition_entry *firmware_partition = NULL;
> @@ -3256,11 +3392,24 @@ static void build_image(const char *output,
> os_image_partition->size = kernel.st_size;
> }
> 
> -   parts[0] = make_partition_table(info->partitions);
> -   parts[1] = make_soft_version(info, rev);
> +   if (strcasecmp(info->id, "DECO-M4R-V3") == 0 ||
> +   strcasecmp(info->id, "DECO-M5") == 0 ) {
> +   part_table_name="partition-table@1";
> +   soft_ver_name="soft-version@1";
> +   os_im_name="os-image@1";
> +   fs_name="file-system@1";
> +   } else {
> +   part_table_name="partition-table";
> +   soft_ver_name="soft-version";
> +   os_im_name="os-image";
> +   fs_name="file-system";
> +   }
> +
> +   parts[0] = make_partition_table(part_table_name,info->partitions);
> +   parts[1] = make_soft_version(soft_ver_name,info, rev);
> parts[2] = make_support_list(info);
> -   parts[3] = read_file("os-image", kernel_image, false, NULL);
> -   parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof, 
> file_system_partition);
> +   parts[3] = read_file(os_im_name, kernel_image, false, NULL);
> +   parts[4] = read_file(fs_name, rootfs_image, add_jffs2_eof, 
> file_system_partition);
> 
> /* Some devices need the extra-para partition to accept the firmware 
> */
> if (strcasecmp(info->id, "ARCHER-A6-V3") == 0 ||

I'm aware a strcasecmp() is performed for extra-para partition, but I don't 
particularly
like that either. This puts device-specific details in different places, and 
after a while
you don't know where to look anymore to add support for a new device.

The list of generated partition for factory images is fixed. You could create a 
new struct
(e.g. 'factory_partition_names') that contains names for all required 
partitions:

struct factory_partition_names {
const char *partition_table;
const char *soft_ver;
const char *support_li

Re: [PATCH] tplink-safeloader: add TP-Link Deco M4R v1 and v2 support

2022-04-24 Thread Sander Vanheule
Hi,

On Fri, 2022-04-22 at 01:09 +0300, Foica David wrote:
> Support creating images for TP-Link Deco M4R v1 and v2.
> 
> Original partition layout from OEM image:
>  partition fs-uboot base 0x0 size 0x8
>  partition os-image base 0x8 size 0x20
>  partition file-system base 0x28 size 0xc0
>  partition product-info base 0xe8 size 0x05000
>  partition default-mac base 0xe85000 size 0x01000
>  partition device-id base 0xe86000 size 0x01000
>  partition support-list base 0xe87000 size 0x1
>  partition user-config base 0xea7000 size 0x1
>  partition device-config base 0xeb7000 size 0x1
>  partition group-info base 0xec7000 size 0x1
>  partition partition-table base 0xed7000 size 0x02000
>  partition soft-version base 0xed9000 size 0x1
>  partition profile base 0xee9000 size 0x1
>  partition default-config base 0xef9000 size 0x1
>  partition url-sig base 0xfe size 0x1
>  partition radio base 0xff size 0x1
> 
> The 'os-image' and 'file-system' partitions were merged into 'firmware'
> to make use of the automatic mtd split.
> 
> The first 2 versions of the device use the same firmware image,
> v3 and v4 are different.
> 
> Signed-off-by: Foica David 
> ---
>  src/tplink-safeloader.c | 49 +
>  1 file changed, 49 insertions(+)
> 
> diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c
> index c4727df..604cce8 100644
> --- a/src/tplink-safeloader.c
> +++ b/src/tplink-safeloader.c
> @@ -1779,6 +1779,55 @@ static struct device_info boards[] = {
> .last_sysupgrade_partition = "file-system"
> },
>  
> +   /** Firmware layout for the Deco M4R v1 and v2 */
> +   {
> +   .id = "DECO-M4R",

DECO-M4R is too generic in my opinion. Given that this is for v1/v2, and v3/v4 
will use a
different ID. You could this to DECO-M4R-V1 to match the first supported 
version.

> +   .vendor = "",
> +   .support_list =
> +   "SupportList:\n"
> +   
> "{product_name:M4R,product_ver:1.0.0,special_id:5553}\n"
> +   
> "{product_name:M4R,product_ver:1.0.0,special_id:4555}\n"
> +   
> "{product_name:M4R,product_ver:1.0.0,special_id:4341}\n"
> +   
> "{product_name:M4R,product_ver:1.0.0,special_id:4A50}\n"
> +   
> "{product_name:M4R,product_ver:1.0.0,special_id:4155}\n"
> +   
> "{product_name:M4R,product_ver:1.0.0,special_id:4B52}\n"
> +   
> "{product_name:M4R,product_ver:1.0.0,special_id:4944}\n"
> +   
> "{product_name:M4R,product_ver:2.0.0,special_id:5553}\n"
> +   
> "{product_name:M4R,product_ver:2.0.0,special_id:4555}\n"
> +   
> "{product_name:M4R,product_ver:2.0.0,special_id:4341}\n"
> +   
> "{product_name:M4R,product_ver:2.0.0,special_id:4A50}\n"
> +   
> "{product_name:M4R,product_ver:2.0.0,special_id:4155}\n"
> +   
> "{product_name:M4R,product_ver:2.0.0,special_id:4B52}\n"
> +   
> "{product_name:M4R,product_ver:2.0.0,special_id:5457}\n"
> +   
> "{product_name:M4R,product_ver:2.0.0,special_id:4234}\n"
> +   
> "{product_name:M4R,product_ver:2.0.0,special_id:4944}\n",
> +   .part_trail = 0x00,
> +   .soft_ver = SOFT_VER_DEFAULT,
> +
> +   /* We're using a dynamic kernel/rootfs split here */
> +   .partitions = {
> +   {"fs-uboot", 0x0, 0x8},
> +   {"firmware", 0x8, 0xe0},/** Stock: 
> name os-image
> base 0x8 size 0x20 */
> +   /** Stock: 
> name file-
> system base 0x28 size 0xc0 */

These comments aren't really needed, you can drop them. You already included 
the original
layout in the commit message, which is sufficient. There's also no unused 
space, so the
used offset and size are self-explanatory.

Best,
Sander

> +   {"product-info", 0xe8, 0x05000},
> +   {"default-mac", 0xe85000, 0x01000},
> +   {"device-id", 0xe86000, 0x01000},
> +   {"support-list", 0xe87000, 0x1},
> +   {"user-config", 0xea7000, 0x1},
> +   {"device-config", 0xeb7000, 0x1},
> +   {"group-info", 0xec7000, 0x1},
> +   {"partition-table", 0xed7000, 0x02000},
> +   {"soft-version", 0xed9000, 0x1},
> +   {"profile", 0xee9000, 0x1},
> +   {"default-config", 0xef9000, 0x1},
> +   {"url-sig", 0xfe, 0x1},
> + 

OpenWrt 22.03.0-rc1 first release candidate

2022-04-24 Thread Hauke Mehrtens

Hi,

The OpenWrt community is proud to announce the first release candidate 
of the upcoming OpenWrt 22.03 stable version series. It incorporates 
over 3400 commits since branching the previous OpenWrt 21.02 release and 
has been under development for about one year.


This is just a release candidate and not the final release yet.

Download firmware images directly from our download servers:
 * https://downloads.openwrt.org/releases/22.03.0-rc1/

Main changes from OpenWrt 21.02:


Firewall4 based on nftables
===

Firewall4 is used by default instead of firewall3 in the OpenWrt default 
images. Firewall4 uses nftables instead of iptables to configure the 
Linux netfilters.


Firewall4 uses the same UCI firewall configuration. Old firewall 
configurations should still work with firewall4, using nftables now. The 
extra option which allowed to add custom iptables commands does not work 
any more.


iptables is not included in the default images any more, it can be added 
with opkg or ImageBuilder if needed. iptables-nft, arptables-nft, 
ebtables-nft and xtables-nft provide the known command line interface 
from the old tools, but they will create nftables entries instead.



Many new devices added
==

OpenWrt 22.03 supports over 1550 devices. Support for over 160 new 
devices was added in addition to the device support by OpenWrt 21.02. 
OpenWrt 22.03 supports more than 10 devices capable of Wifi 6 (IEEE 
802.11ax) using the MediaTek MT7915 wifi chip.

 * The qoriq target for the NXP QorIQ (PowerPC) was added in OpenWrt
   22.03.
 * The bmips target for the Boardcom MIPS BCM33xx, BCM63xx and BCM7xxx
   SoCs was added.


More targets converted to DSA
=

The following targets or boards were migrated from swconfig to DSA with 
OpenWrt 22.03 in addition to the systems already migrated with OpenWrt 
21.02:

 * bcm53xx: All board using this target were converted to DSA
 * lantiq: All boards using the xrx200 / vr9 SoC
 * sunxi: Bananapi Lamobo R1 (only sunxi board with switch)


Dark mode in LuCI
=

The LuCI bootstrap design supports a dark mode. The default design 
activates dark mode depending on the browser settings. Change it 
manually at “System” -> “System” -> “Language and Style”.



Year 2038 problem handled
=

OpenWrt 22.03 uses musl 1.2.x, which changed the time_t type from 32 bit 
to 64 bit on 32 bit systems, on 64 bit system it was always 64 bit long. 
When a Unix time stamp is stored in a signed 32 bit integer it will 
overflow on 19 January 2038. With the change to 64 bit this will happen 
292 billion years later. This is a change of the musl libc ABI and needs 
a recompilation of all user space applications linked against musl libc. 
For 64 bit systems this was done when the ABI was defined many years 
ago, the glibc ARC ABI already has a 64 bit time_t.



Core components update
==

Core components have the following versions in 22.03.0-rc1:
 * Updated toolchain:
   * musl libc 1.2.3
   * glibc 2.34
   * gcc 11.2.0
   * binutils 2.37
 * Updated Linux kernel
   * 5.10.111 for all targets
 * Network:
   * hostapd 2.10, dnsmasq 2.86, dropbear 2022.82
   * cfg80211/mac80211 from kernel 5.15.33
 * System userland:
   * busybox 1.35.0

In addition to the listed applications, many others were also updated.

-


Full release notes and upgrade instructions are available at
https://openwrt.org/releases/22.03/notes-22.03.0-rc1

In particular, make sure to read the regressions and known issues before 
upgrading:

https://openwrt.org/releases/22.03/notes-22.03.0-rc1#known_issues

For a detailed list of all changes since 21.02, refer to
https://openwrt.org/releases/22.03/changelog-22.03.0-rc1

To download the 22.03.0-rc1 images, navigate to:
https://downloads.openwrt.org/releases/22.03.0-rc1/

As always, a big thank you goes to all our active package maintainers,
testers, documenters, and supporters.

Have fun!

The OpenWrt Community

---

To stay informed of new OpenWrt releases and security advisories, there
are new channels available:

 * a low-volume mailing list for important announcements:
https://lists.openwrt.org/mailman/listinfo/openwrt-announce

 * a dedicated "announcements" section in the forum:
https://forum.openwrt.org/c/announcements/14

 * other announcement channels (such as RSS feeds) might be added in the
   future, they will be listed at https://openwrt.org/contact


OpenPGP_0x93DD20630910B515.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] [firmware-utils PATCH v2] tplink-safeloader: add TP-Link Deco M4R v1 and v2 support

2022-04-24 Thread Foica David
Support creating images for TP-Link Deco M4R v1 and v2.

Original partition layout from OEM image:
 partition fs-uboot base 0x0 size 0x8
 partition os-image base 0x8 size 0x20
 partition file-system base 0x28 size 0xc0
 partition product-info base 0xe8 size 0x05000
 partition default-mac base 0xe85000 size 0x01000
 partition device-id base 0xe86000 size 0x01000
 partition support-list base 0xe87000 size 0x1
 partition user-config base 0xea7000 size 0x1
 partition device-config base 0xeb7000 size 0x1
 partition group-info base 0xec7000 size 0x1
 partition partition-table base 0xed7000 size 0x02000
 partition soft-version base 0xed9000 size 0x1
 partition profile base 0xee9000 size 0x1
 partition default-config base 0xef9000 size 0x1
 partition url-sig base 0xfe size 0x1
 partition radio base 0xff size 0x1

The 'os-image' and 'file-system' partitions were merged into 'firmware'
to make use of the automatic mtd split.

The first 2 versions of the device use the same firmware image,
v3 and v4 are different.

Signed-off-by: Foica David 
---
Changes v1 -> v2:
 - Remove unnecessary comments and switch board name
   to properly differentiate between versions.

---
 src/tplink-safeloader.c | 47 +
 1 file changed, 47 insertions(+)

diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c
index e4021a9..b866ec5 100644
--- a/src/tplink-safeloader.c
+++ b/src/tplink-safeloader.c
@@ -1779,6 +1779,53 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system"
},
 
+   /** Firmware layout for the Deco M4R v1 and v2 */
+   {
+   .id = "DECO-M4R-V1",
+   .vendor = "",
+   .support_list =
+   "SupportList:\n"
+   
"{product_name:M4R,product_ver:1.0.0,special_id:5553}\n"
+   
"{product_name:M4R,product_ver:1.0.0,special_id:4555}\n"
+   
"{product_name:M4R,product_ver:1.0.0,special_id:4341}\n"
+   
"{product_name:M4R,product_ver:1.0.0,special_id:4A50}\n"
+   
"{product_name:M4R,product_ver:1.0.0,special_id:4155}\n"
+   
"{product_name:M4R,product_ver:1.0.0,special_id:4B52}\n"
+   
"{product_name:M4R,product_ver:1.0.0,special_id:4944}\n"
+   
"{product_name:M4R,product_ver:2.0.0,special_id:5553}\n"
+   
"{product_name:M4R,product_ver:2.0.0,special_id:4555}\n"
+   
"{product_name:M4R,product_ver:2.0.0,special_id:4341}\n"
+   
"{product_name:M4R,product_ver:2.0.0,special_id:4A50}\n"
+   
"{product_name:M4R,product_ver:2.0.0,special_id:4155}\n"
+   
"{product_name:M4R,product_ver:2.0.0,special_id:4B52}\n"
+   
"{product_name:M4R,product_ver:2.0.0,special_id:5457}\n"
+   
"{product_name:M4R,product_ver:2.0.0,special_id:4234}\n"
+   
"{product_name:M4R,product_ver:2.0.0,special_id:4944}\n",
+   .part_trail = 0x00,
+   .soft_ver = SOFT_VER_DEFAULT,
+
+   .partitions = {
+   {"fs-uboot", 0x0, 0x8},
+   {"firmware", 0x8, 0xe0},
+   {"product-info", 0xe8, 0x05000},
+   {"default-mac", 0xe85000, 0x01000},
+   {"device-id", 0xe86000, 0x01000},
+   {"support-list", 0xe87000, 0x1},
+   {"user-config", 0xea7000, 0x1},
+   {"device-config", 0xeb7000, 0x1},
+   {"group-info", 0xec7000, 0x1},
+   {"partition-table", 0xed7000, 0x02000},
+   {"soft-version", 0xed9000, 0x1},
+   {"profile", 0xee9000, 0x1},
+   {"default-config", 0xef9000, 0x1},
+   {"url-sig", 0xfe, 0x1},
+   {"radio", 0xff, 0x1},
+   {NULL, 0, 0}
+   },
+   .first_sysupgrade_partition = "os-image",
+   .last_sysupgrade_partition = "file-system",
+   },
+
/** Firmware layout for the TL-WA1201 v2 */
{
.id = "TL-WA1201-V2",
-- 
2.35.1


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


[sdwalker/sdwalker.github.io] 909156: This week's update

2022-04-24 Thread Stephen Walker via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
  Branch: refs/heads/master
  Home:   https://github.com/sdwalker/sdwalker.github.io
  Commit: 909156e85dd0f34e3cd326e939877d5ba799ce26
  
https://github.com/sdwalker/sdwalker.github.io/commit/909156e85dd0f34e3cd326e939877d5ba799ce26
  Author: Stephen Walker 
  Date:   2022-04-24 (Sun, 24 Apr 2022)

  Changed paths:
M uscan/index-19.07.html
M uscan/index-21.02.html
M uscan/index.html

  Log Message:
  ---
  This week's update



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


[PATCH] realtek: do not reset SerDes on link change

2022-04-24 Thread Birger Koblitz
This fixes a bug where frames sent to the switch itself were
flooded to all ports unless the MAC address of the CPU-port
was learned otherwise.

Tested-by: Wenli Looi 
Tested-by: Bjørn Mork 
Signed-off-by: Birger Koblitz 
---
 .../linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c  | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c 
b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
index 4780632983..858b692640 100644
--- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
@@ -205,6 +205,12 @@ static int rtl83xx_setup(struct dsa_switch *ds)

priv->r->l2_learning_setup();

+   // Make sure all frames sent to the switch's MAC are trapped to the 
CPU-port
+   if (priv->family_id == RTL8380_FAMILY_ID)
+   sw_w32(0x2, RTL838X_SPCL_TRAP_SWITCH_MAC_CTRL);  // 0: FWD, 1: 
DROP, 2: TRAP2CPU
+   else
+   sw_w32(0x2, RTL839X_SPCL_TRAP_SWITCH_MAC_CTRL);
+
/* Enable MAC Polling PHY again */
rtl83xx_enable_phy_polling(priv);
pr_debug("Please wait until PHY is settled\n");
-- 
2.25.1


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


Re: [PATCH] realtek: do not reset SerDes on link change

2022-04-24 Thread Bjørn Mork
That subject doesn't look quite right?


Bjørn

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


Re: [PATCH] realtek: do not reset SerDes on link change

2022-04-24 Thread Birger Koblitz
Oops, I was trying to do too many things at the same time
Please forget that and I shall resend the email properly.

Birger

On 24.04.22 20:30, Bjørn Mork wrote:
> That subject doesn't look quite right?
> 
> 
> Bjørn
> 

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


[PATCH] realtek: Trap all frames with switch as destination to CPU-port

2022-04-24 Thread Birger Koblitz
This fixes a bug where frames sent to the switch itself were
flooded to all ports unless the MAC address of the CPU-port
was learned otherwise.

Tested-by: Wenli Looi 
Tested-by: Bjørn Mork 
Signed-off-by: Birger Koblitz 
---
This was previously sent as a patch with a wrong subject
"[PATCH] realtek: do not reset SerDes on link change"

 .../linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c  | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c 
b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
index 4780632983..858b692640 100644
--- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
@@ -205,6 +205,12 @@ static int rtl83xx_setup(struct dsa_switch *ds)

priv->r->l2_learning_setup();

+   // Make sure all frames sent to the switch's MAC are trapped to the 
CPU-port
+   if (priv->family_id == RTL8380_FAMILY_ID)
+   sw_w32(0x2, RTL838X_SPCL_TRAP_SWITCH_MAC_CTRL);  // 0: FWD, 1: 
DROP, 2: TRAP2CPU
+   else
+   sw_w32(0x2, RTL839X_SPCL_TRAP_SWITCH_MAC_CTRL);
+
/* Enable MAC Polling PHY again */
rtl83xx_enable_phy_polling(priv);
pr_debug("Please wait until PHY is settled\n");
-- 
2.25.1


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


[PATCH v2] realtek: do not reset SerDes on link change

2022-04-24 Thread Birger Koblitz
Do not reset the RTL930x SerDes on link changes, instead set up
the SDS with internal PHYs for the SFP+ ports only.
This fixes the 8 1GBit ports on the Zyxel XGS1250 which
do not work without this patch.

Tested-by: Stijn Segers 
Signed-off-by: Birger Koblitz 
---
v2: A different patch was previously sent with this subject.
This is the correct patch.
 target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c  | 3 ++-
 .../linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl83xx.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c 
b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
index 858b692640..5f19a1f590 100644
--- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
@@ -814,7 +814,8 @@ static void rtl93xx_phylink_mac_config(struct dsa_switch 
*ds, int port,
   __func__, phy_modes(state->interface));
return;
}
-   rtl9300_sds_rst(sds_num, sds_mode);
+   if (state->interface == PHY_INTERFACE_MODE_10GBASER)
+   rtl9300_serdes_setup(sds_num, state->interface);
}

reg = sw_r32(priv->r->mac_force_mode_ctrl(port));
diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl83xx.h 
b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl83xx.h
index 0bb11f9b8b..107016469c 100644
--- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl83xx.h
+++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl83xx.h
@@ -121,6 +121,7 @@ irqreturn_t rtl839x_switch_irq(int irq, void *dev_id);
 void rtl930x_vlan_profile_dump(int index);
 int rtl9300_sds_power(int mac, int val);
 void rtl9300_sds_rst(int sds_num, u32 mode);
+int rtl9300_serdes_setup(int sds_num, phy_interface_t phy_mode);
 void rtl930x_print_matrix(void);

 /* RTL931x-specific */
-- 
2.25.1


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


Re: [PATCH] [firmware-utils PATCH v2] tplink-safeloader: add TP-Link Deco M4R v1 and v2 support

2022-04-24 Thread Sander Vanheule
On Sun, 2022-04-24 at 19:09 +0300, Foica David wrote:
> Support creating images for TP-Link Deco M4R v1 and v2.
> 
> Original partition layout from OEM image:
>  partition fs-uboot base 0x0 size 0x8
>  partition os-image base 0x8 size 0x20
>  partition file-system base 0x28 size 0xc0
>  partition product-info base 0xe8 size 0x05000
>  partition default-mac base 0xe85000 size 0x01000
>  partition device-id base 0xe86000 size 0x01000
>  partition support-list base 0xe87000 size 0x1
>  partition user-config base 0xea7000 size 0x1
>  partition device-config base 0xeb7000 size 0x1
>  partition group-info base 0xec7000 size 0x1
>  partition partition-table base 0xed7000 size 0x02000
>  partition soft-version base 0xed9000 size 0x1
>  partition profile base 0xee9000 size 0x1
>  partition default-config base 0xef9000 size 0x1
>  partition url-sig base 0xfe size 0x1
>  partition radio base 0xff size 0x1
> 
> The 'os-image' and 'file-system' partitions were merged into 'firmware'
> to make use of the automatic mtd split.
> 
> The first 2 versions of the device use the same firmware image,
> v3 and v4 are different.
> 
> Signed-off-by: Foica David 

Thanks! Merged into firmware-utils.

Best,
Sander


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


Re: [PATCH] [firmware-utils PATCH v2] tplink-safeloader: add TP-Link Deco M4R v1 and v2 support

2022-04-24 Thread KinteLiX
On Sun, 24 Apr 2022 at 23:37, Sander Vanheule  wrote:
>
> On Sun, 2022-04-24 at 19:09 +0300, Foica David wrote:
> > Support creating images for TP-Link Deco M4R v1 and v2.
> >
> > Original partition layout from OEM image:
> >  partition fs-uboot base 0x0 size 0x8
> >  partition os-image base 0x8 size 0x20
> >  partition file-system base 0x28 size 0xc0
> >  partition product-info base 0xe8 size 0x05000
> >  partition default-mac base 0xe85000 size 0x01000
> >  partition device-id base 0xe86000 size 0x01000
> >  partition support-list base 0xe87000 size 0x1
> >  partition user-config base 0xea7000 size 0x1
> >  partition device-config base 0xeb7000 size 0x1
> >  partition group-info base 0xec7000 size 0x1
> >  partition partition-table base 0xed7000 size 0x02000
> >  partition soft-version base 0xed9000 size 0x1
> >  partition profile base 0xee9000 size 0x1
> >  partition default-config base 0xef9000 size 0x1
> >  partition url-sig base 0xfe size 0x1
> >  partition radio base 0xff size 0x1
> >
> > The 'os-image' and 'file-system' partitions were merged into 'firmware'
> > to make use of the automatic mtd split.
> >
> > The first 2 versions of the device use the same firmware image,
> > v3 and v4 are different.
> >
> > Signed-off-by: Foica David 
>
> Thanks! Merged into firmware-utils.
>
> Best,
> Sander
>

Awesome! Thanks for your help with this, have a nice day!

Regards,
Foica David

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