rtl838x: Fix firmware handling
authorBirger Koblitz <git@birger-koblitz.de>
Thu, 15 Oct 2020 10:31:05 +0000 (12:31 +0200)
committerJohn Crispin <john@phrozen.org>
Thu, 15 Oct 2020 11:26:57 +0000 (13:26 +0200)
Fix wrong magic number verification for FW files.
Correct handling of external RTL8218B firmware PHY name in firmware.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
target/linux/rtl838x/files-5.4/drivers/net/dsa/rtl838x_phy.c
target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8218b.fw

index aa6ac62c27810931b1e14e4dfc9f9243ad1dd7b0..e5dfdcaa0741a1764e154d9b9b91caa1d733753c 100644 (file)
@@ -251,8 +251,8 @@ rtl838x_request_fw(struct phy_device *phydev, const struct firmware *fw,
        h = (struct fw_header *) fw->data;
        pr_info("Firmware loaded. Size %d, magic: %08x\n", fw->size, h->magic);
 
-       if (h->phy != 0x83800000) {
-               pr_err("Wrong firmware file: PHY mismatch.\n");
+       if (h->magic != 0x83808380) {
+               pr_err("Wrong firmware file: MAGIC mismatch.\n");
                goto out;
        }
 
@@ -415,7 +415,7 @@ static int rtl8380_configure_ext_rtl8218b(struct phy_device *phydev)
        if (!h)
                return -1;
 
-       if (h->phy != 0x8218b00) {
+       if (h->phy != 0x8218b000) {
                phydev_err(phydev, "Wrong firmware file: PHY mismatch.\n");
                return -1;
        }
index a907849fb93124bacdb6bb76d7a2feb731978126..66325ef242a809cffb92bb5297b87e2c6bf3dafd 100644 (file)
Binary files a/target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8218b.fw and b/target/linux/rtl838x/files/firmware/rtl838x_phy/rtl838x_8218b.fw differ