Re: Re: [PATCH RFC] aquantia-firmware: package MediaTek's Aquantia AQR113C firmware

2024-02-25 Thread Qingfang DENG
It's actually possible to access the flash from Linux, as I tested a
year ago.

---
 drivers/net/phy/aquantia_main.c | 462 +++-
 1 file changed, 461 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c
index 6ecbc3f33..6b3079b3a 100644
--- a/drivers/net/phy/aquantia_main.c
+++ b/drivers/net/phy/aquantia_main.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "aquantia.h"
 
@@ -155,6 +156,39 @@
 #define MDIO_PHYXS_VEND_PROV2  0xc441
 #define MDIO_PHYXS_VEND_PROV2_USX_AN   BIT(3)
 
+// SPI NOR controller regs
+#define VEND1_GLOBAL_NVR_OP0x100
+#define VEND1_GLOBAL_NVR_OP_START  BIT(15)
+#define VEND1_GLOBAL_NVR_OP_WR BIT(14)
+#define VEND1_GLOBAL_NVR_OP_RESET_CRC  BIT(12)
+#define VEND1_GLOBAL_NVR_OP_BURST  BIT(10)
+#define VEND1_GLOBAL_NVR_OP_BUSY   BIT(8)
+#define VEND1_GLOBAL_NVR_OP_CODE   GENMASK(7, 0)
+
+#define VEND1_GLOBAL_NVR_MAILBOX_CRC   0x101
+#define VEND1_GLOBAL_NVR_ADDR_MSW  0x102
+#define VEND1_GLOBAL_NVR_ADDR_LSW  0x103
+#define VEND1_GLOBAL_NVR_DATA_MSW  0x104
+#define VEND1_GLOBAL_NVR_DATA_LSW  0x105
+#define VEND1_GLOBAL_NVR_PROV1 0xc450
+#define VEND1_GLOBAL_NVR_PROV1_DATA_LENGENMASK(10, 8)
+#define VEND1_GLOBAL_NVR_PROV1_DUMMY_LEN   GENMASK(6, 4)
+#define VEND1_GLOBAL_NVR_PROV1_ADDR_LENGENMASK(1, 0)
+
+#define VEND1_GLOBAL_NVR_PROV2 0xc451
+#define VEND1_GLOBAL_NVR_PROV2_ADDR_LEN_OVRBIT(8)
+#define VEND1_GLOBAL_NVR_PROV2_CLK_DIV GENMASK(7, 0)
+
+#define VEND1_GLOBAL_NVR_PROV3 0xc452
+#define VEND1_GLOBAL_NVR_PROV3_CLK_DIV_OVR BIT(1)
+#define VEND1_GLOBAL_NVR_PROV3_DAISY_DIS   BIT(0)
+
+#define VEND1_GLOBAL_NVR_PROV4 0xc453
+#define VEND1_GLOBAL_NVR_PROV4_RESET_SPI   BIT(4)
+
+#define VEND1_GLOBAL_UP_CONTROL0xc001
+#define VEND1_GLOBAL_UP_CONTROL_STALL  BIT(0)
+
 struct aqr107_hw_stat {
const char *name;
int reg;
@@ -180,6 +214,11 @@ struct aqr107_priv {
u64 sgmii_stats[AQR107_SGMII_STAT_SZ];
 };
 
+struct aqr113c_priv {
+   struct aqr107_priv aqr107_priv; // Must be first
+   struct spi_nor nor;
+};
+
 static int aqr107_get_sset_count(struct phy_device *phydev)
 {
return AQR107_SGMII_STAT_SZ;
@@ -718,6 +757,426 @@ static int aqr107_probe(struct phy_device *phydev)
return aqr_hwmon_probe(phydev);
 }
 
+static int aqr113c_nor_poll(struct phy_device *phydev)
+{
+   int val;
+
+   return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1,
+VEND1_GLOBAL_NVR_OP, val,
+!(val & VEND1_GLOBAL_NVR_OP_BUSY), 0,
+10, 0);
+}
+
+/**
+ * aqr113c_nor_read_chunk - read a 4-byte chunk from the flash
+ *
+ * Caller must configure data len in 0x1e.0xc450 to 4 prior to this function
+ */
+static int aqr113c_nor_read_chunk(struct phy_device *phydev, u8 opcode,
+ u8 *buf)
+{
+   int ret;
+
+   ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_NVR_OP,
+   VEND1_GLOBAL_NVR_OP_START |
+   VEND1_GLOBAL_NVR_OP_BURST | opcode);
+   if (ret)
+   return ret;
+
+   ret = aqr113c_nor_poll(phydev);
+   if (ret)
+   return ret;
+
+   ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_NVR_DATA_LSW);
+   if (ret < 0)
+   return ret;
+
+   buf[0] = ret;
+   buf[1] = (u16)ret >> 8;
+
+   ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_NVR_DATA_MSW);
+   if (ret < 0)
+   return ret;
+
+   buf[2] = ret;
+   buf[3] = (u16)ret >> 8;
+
+   return 0;
+}
+
+/**
+ * aqr113c_nor_write_chunk - write a 4-byte chunk
+ *
+ * Caller must configure data len in 0x1e.0xc450 to 4 prior to this function
+ */
+static int aqr113c_nor_write_chunk(struct phy_device *phydev, u8 opcode,
+  const u8 *buf)
+{
+   int ret;
+
+   ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_NVR_DATA_LSW,
+   get_unaligned((const u16 *)buf));
+   if (ret)
+   return ret;
+
+   ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_NVR_DATA_MSW,
+   get_unaligned((const u16 *)buf + 1));
+   if (ret)
+   return ret;
+
+   ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_NVR_OP,
+   VEND1_GLOBAL_NVR_OP_START |
+   VEND1_GLOBAL_NVR_OP_BURST |
+   VEND1_GLOBAL_NVR_OP_WR | opcode);
+   if (ret)
+   return ret;
+
+   return 

Re: [PATCH RFC] aquantia-firmware: package MediaTek's Aquantia AQR113C firmware

2024-02-06 Thread Arınç ÜNAL

On 5.02.2024 22:10, Rafał Miłecki wrote:

On 5.02.2024 15:15, Robert Marko wrote:

On Mon, 5 Feb 2024 at 14:23, Rafał Miłecki  wrote:


From: Rafał Miłecki 

Aquantia AQR113C is PHY that needs loading a firmware. Some devices may
have it stored on flash and some need filesystem to provide it.

MediaTek holds its own AQR113C firmware file for its boards. Package it.


Hi Rafal, not going into details of this patch, but what is the
license situation with
redistributing the AQR firmware?


Good question. I don't know.

Cc linux-mediatek@
Can we get some licensing help, please?



Initial firmware file
Rhe-05.06-Candidate7-AQR_Mediatek_23B_StartOff_ID45623_VER36657.cld was
added in the commit:

commit 24ba51c5be18613127b2d8407b0223174624b130
Author: developer 
Date:   Tue Nov 15 11:22:46 2022 +0800

     [][kernel][mt7988][eth][Change AQR113C firmware download method to MDIO 
gangload]

     [Description]
     Change AQR113C firmware download method to MDIO gangload.

     If without this patch, AQR113C cannot boot from MDIO gangload.

     [Release-log]
     N/A


     Change-Id: Iddc29f5e1c73c772bcea9313938b6daccc10025a
     Reviewed-on: 
https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6781059

with not licensing details.



Later there was a firmware update update handled by adding file:
Rhe-05.06-Candidate9-AQR_Mediatek_23B_P5_ID45824_LCLVER1.cld in the commit:

commit 405b1e31f924b97d379719fb39f0d28c0fac43a9
Author: developer 
Date:   Tue Mar 28 17:00:41 2023 +0800

     [][kernel][mt7988][eth][Fix AQR113C 5GBASE-T compliance test mode4 tone1 
fail issue]

     [Description]
     Fix AQR113C 5GBASE-T compliance test mode4 tone1 fail issue by
     updating firmware version to
     Rhe-05.06-Candidate9-AQR_Mediatek_23B_P5_ID45824_LCLVER1.cld.

     If without this patch, AQR113C might not pass the 5GBASE-T mode4 tone1
     items for the compliance test.

     [Release-log]
     N/A


     Change-Id: I3b2c6e6cf1a6ba8183daa7e30110ff2c839c5989
     Reviewed-on: 
https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7305781

but again with not licensing info.



I also can't find any readme file specifying licensing of those files.


Maybe these should be submitted to the linux-firmware repository (by
MediaTek or with MediaTek's approval) and the license specified on the
WHENCE file.

https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/

Arınç

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


Re: [PATCH RFC] aquantia-firmware: package MediaTek's Aquantia AQR113C firmware

2024-02-05 Thread Christian Marangi
On Mon, Feb 05, 2024 at 08:21:43PM +0100, Rafał Miłecki wrote:
> On 5.02.2024 15:21, Daniel Golle wrote:
> > On Mon, Feb 05, 2024 at 02:23:08PM +0100, Rafał Miłecki wrote:
> > > From: Rafał Miłecki 
> > > 
> > > Aquantia AQR113C is PHY that needs loading a firmware. Some devices may
> > > have it stored on flash and some need filesystem to provide it.
> > 
> > Are you aware of any MediaTek boards which do come with AQR113C but
> > don't bring their own dedicated firmware flash/EEPROM IC connected
> > directly to first PHY?
> > UniFi 6 LR v1/v2 (Aquantia AQR112C) and MT7988RFB (Aquantia AQR113C)
> > both come with a dedidated flash/EEPROM IC for the PHY firmware.
> > However, that firmware (esp. on the UniFi 6 LR) may of course be
> > outdated by now and we may want to load newer firmware from within
> > Linux anyway.
> 
> I'm not sure if I can verify using Linux if there is EEPROM attached to
> any of two PHYs on my board. I don't believe Linux's PHY driver exposes
> possibly-attached EEPROM as any Linux device.
> 
> I think however that with EEPROM present I wouldn't need Linux driver
> to load PHY firmware. In my board case I need to do that which makes me
> believe there is no EEPROM chip with firmware present.
>

Just to be clear, the EEPROM (actually it's a spi) is attached directly
to the PHY internally, you don't have a way to expose it in linux...

Also in that configuration, the FW is loaded automatically and with the
current driver, fw loading is skipped as a correct FW version is read
from the PHY. (FW loading from attached EEPROM is setup by hw strapping)

There is no need to verify if an EEPROM is attached, the check we do
is either a FW is present and loaded or a FW is not loaded and the PHY
FW version reg answer with 0.0.0 (or 0xff if held in reset state)

-- 
Ansuel

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


Re: [PATCH RFC] aquantia-firmware: package MediaTek's Aquantia AQR113C firmware

2024-02-05 Thread Rafał Miłecki

On 5.02.2024 15:21, Daniel Golle wrote:

On Mon, Feb 05, 2024 at 02:23:08PM +0100, Rafał Miłecki wrote:

From: Rafał Miłecki 

Aquantia AQR113C is PHY that needs loading a firmware. Some devices may
have it stored on flash and some need filesystem to provide it.


Are you aware of any MediaTek boards which do come with AQR113C but
don't bring their own dedicated firmware flash/EEPROM IC connected
directly to first PHY?
UniFi 6 LR v1/v2 (Aquantia AQR112C) and MT7988RFB (Aquantia AQR113C)
both come with a dedidated flash/EEPROM IC for the PHY firmware.
However, that firmware (esp. on the UniFi 6 LR) may of course be
outdated by now and we may want to load newer firmware from within
Linux anyway.


I'm not sure if I can verify using Linux if there is EEPROM attached to
any of two PHYs on my board. I don't believe Linux's PHY driver exposes
possibly-attached EEPROM as any Linux device.

I think however that with EEPROM present I wouldn't need Linux driver
to load PHY firmware. In my board case I need to do that which makes me
believe there is no EEPROM chip with firmware present.

--
Rafał Miłecki

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


Re: [PATCH RFC] aquantia-firmware: package MediaTek's Aquantia AQR113C firmware

2024-02-05 Thread Rafał Miłecki

On 5.02.2024 15:15, Robert Marko wrote:

On Mon, 5 Feb 2024 at 14:23, Rafał Miłecki  wrote:


From: Rafał Miłecki 

Aquantia AQR113C is PHY that needs loading a firmware. Some devices may
have it stored on flash and some need filesystem to provide it.

MediaTek holds its own AQR113C firmware file for its boards. Package it.


Hi Rafal, not going into details of this patch, but what is the
license situation with
redistributing the AQR firmware?


Good question. I don't know.

Cc linux-mediatek@
Can we get some licensing help, please?



Initial firmware file
Rhe-05.06-Candidate7-AQR_Mediatek_23B_StartOff_ID45623_VER36657.cld was
added in the commit:

commit 24ba51c5be18613127b2d8407b0223174624b130
Author: developer 
Date:   Tue Nov 15 11:22:46 2022 +0800

[][kernel][mt7988][eth][Change AQR113C firmware download method to MDIO 
gangload]

[Description]
Change AQR113C firmware download method to MDIO gangload.

If without this patch, AQR113C cannot boot from MDIO gangload.

[Release-log]
N/A


Change-Id: Iddc29f5e1c73c772bcea9313938b6daccc10025a
Reviewed-on: 
https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6781059

with not licensing details.



Later there was a firmware update update handled by adding file:
Rhe-05.06-Candidate9-AQR_Mediatek_23B_P5_ID45824_LCLVER1.cld in the commit:

commit 405b1e31f924b97d379719fb39f0d28c0fac43a9
Author: developer 
Date:   Tue Mar 28 17:00:41 2023 +0800

[][kernel][mt7988][eth][Fix AQR113C 5GBASE-T compliance test mode4 tone1 
fail issue]

[Description]
Fix AQR113C 5GBASE-T compliance test mode4 tone1 fail issue by
updating firmware version to
Rhe-05.06-Candidate9-AQR_Mediatek_23B_P5_ID45824_LCLVER1.cld.

If without this patch, AQR113C might not pass the 5GBASE-T mode4 tone1
items for the compliance test.

[Release-log]
N/A


Change-Id: I3b2c6e6cf1a6ba8183daa7e30110ff2c839c5989
Reviewed-on: 
https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7305781

but again with not licensing info.



I also can't find any readme file specifying licensing of those files.


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


Re: [PATCH RFC] aquantia-firmware: package MediaTek's Aquantia AQR113C firmware

2024-02-05 Thread Daniel Golle
On Mon, Feb 05, 2024 at 02:23:08PM +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki 
> 
> Aquantia AQR113C is PHY that needs loading a firmware. Some devices may
> have it stored on flash and some need filesystem to provide it.

Are you aware of any MediaTek boards which do come with AQR113C but
don't bring their own dedicated firmware flash/EEPROM IC connected
directly to first PHY?
UniFi 6 LR v1/v2 (Aquantia AQR112C) and MT7988RFB (Aquantia AQR113C)
both come with a dedidated flash/EEPROM IC for the PHY firmware.
However, that firmware (esp. on the UniFi 6 LR) may of course be
outdated by now and we may want to load newer firmware from within
Linux anyway.

> 
> MediaTek holds its own AQR113C firmware file for its boards. Package it.
> 
> The problem is obtaining that firmware:
> 1. Cloning whole repo seems like an overkill for copying a single file
> 2. Public git server doesn't support git protocol (and so git archive)
> 3. Gitiles UI doesn't allow downloading raw files (nor binaries as text)
> 
> The only option seems to be downloading tar archive of "firmware"
> directory. The problem is such archives generated by Gitiles differ on
> every download so a checksum can't be specified.
> 
> Due to all above a custom download is implemented in "Build/Prepare".
> Then firmware gets simply extracted and packaged.
> 
> Cc: Robert Marko 
> Cc: Christian Marangi 
> Cc: Daniel Golle 
> Signed-off-by: Rafał Miłecki 
> ---
>  package/firmware/aquantia-firmware/Makefile | 36 +
>  1 file changed, 36 insertions(+)
>  create mode 100644 package/firmware/aquantia-firmware/Makefile
> 
> diff --git a/package/firmware/aquantia-firmware/Makefile 
> b/package/firmware/aquantia-firmware/Makefile
> new file mode 100644
> index 00..9cf67f41bb
> --- /dev/null
> +++ b/package/firmware/aquantia-firmware/Makefile
> @@ -0,0 +1,36 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=aquantia-firmware
> +PKG_RELEASE:=1

PKG_VERSION ?

PKG_LICENSE ?

> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +define Package/aquantia-mediatek-aqr113c-firmware
> +  SECTION:=firmware
> +  CATEGORY:=Firmware
> +  TITLE:=MediaTek's firmware for Aquantia AQR113C
> +endef
> +
> +define Build/Prepare
> + mkdir -p $(PKG_BUILD_DIR)
> +
> + # Download for "aquantia-mediatek-aqr113c-firmware" package
> + wget \
> + -O 
> $(DL_DIR)/mtk-openwrt-feeds-refs_heads_master-21.02-files-target-linux-mediatek-mt7988-base-files-lib-firmware.tar.gz
>  \
> + 
> "https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+archive/refs/heads/master/21.02/files/target/linux/mediatek/mt7988/base-files/lib/firmware.tar.gz;
> + tar xf 
> $(DL_DIR)/mtk-openwrt-feeds-refs_heads_master-21.02-files-target-linux-mediatek-mt7988-base-files-lib-firmware.tar.gz
>  -C $(PKG_BUILD_DIR)
> + # TODO: Verify extracted firmware checksum
> +endef
> +
> +define Build/Compile
> +
> +endef
> +
> +define Package/aquantia-mediatek-aqr113c-firmware/install
> + $(INSTALL_DIR) $(1)/lib/firmware
> + $(INSTALL_DATA) 
> $(PKG_BUILD_DIR)/Rhe-05.06-Candidate9-AQR_Mediatek_23B_P5_ID45824_LCLVER1.cld 
> $(1)/lib/firmware/
> +endef
> +
> +$(eval $(call BuildPackage,aquantia-mediatek-aqr113c-firmware))
> -- 
> 2.35.3
> 

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


Re: [PATCH RFC] aquantia-firmware: package MediaTek's Aquantia AQR113C firmware

2024-02-05 Thread Robert Marko
On Mon, 5 Feb 2024 at 14:23, Rafał Miłecki  wrote:
>
> From: Rafał Miłecki 
>
> Aquantia AQR113C is PHY that needs loading a firmware. Some devices may
> have it stored on flash and some need filesystem to provide it.
>
> MediaTek holds its own AQR113C firmware file for its boards. Package it.

Hi Rafal, not going into details of this patch, but what is the
license situation with
redistributing the AQR firmware?

Regards,
Robert
>
> The problem is obtaining that firmware:
> 1. Cloning whole repo seems like an overkill for copying a single file
> 2. Public git server doesn't support git protocol (and so git archive)
> 3. Gitiles UI doesn't allow downloading raw files (nor binaries as text)
>
> The only option seems to be downloading tar archive of "firmware"
> directory. The problem is such archives generated by Gitiles differ on
> every download so a checksum can't be specified.
>
> Due to all above a custom download is implemented in "Build/Prepare".
> Then firmware gets simply extracted and packaged.
>
> Cc: Robert Marko 
> Cc: Christian Marangi 
> Cc: Daniel Golle 
> Signed-off-by: Rafał Miłecki 
> ---
>  package/firmware/aquantia-firmware/Makefile | 36 +
>  1 file changed, 36 insertions(+)
>  create mode 100644 package/firmware/aquantia-firmware/Makefile
>
> diff --git a/package/firmware/aquantia-firmware/Makefile 
> b/package/firmware/aquantia-firmware/Makefile
> new file mode 100644
> index 00..9cf67f41bb
> --- /dev/null
> +++ b/package/firmware/aquantia-firmware/Makefile
> @@ -0,0 +1,36 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=aquantia-firmware
> +PKG_RELEASE:=1
> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +define Package/aquantia-mediatek-aqr113c-firmware
> +  SECTION:=firmware
> +  CATEGORY:=Firmware
> +  TITLE:=MediaTek's firmware for Aquantia AQR113C
> +endef
> +
> +define Build/Prepare
> +   mkdir -p $(PKG_BUILD_DIR)
> +
> +   # Download for "aquantia-mediatek-aqr113c-firmware" package
> +   wget \
> +   -O 
> $(DL_DIR)/mtk-openwrt-feeds-refs_heads_master-21.02-files-target-linux-mediatek-mt7988-base-files-lib-firmware.tar.gz
>  \
> +   
> "https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+archive/refs/heads/master/21.02/files/target/linux/mediatek/mt7988/base-files/lib/firmware.tar.gz;
> +   tar xf 
> $(DL_DIR)/mtk-openwrt-feeds-refs_heads_master-21.02-files-target-linux-mediatek-mt7988-base-files-lib-firmware.tar.gz
>  -C $(PKG_BUILD_DIR)
> +   # TODO: Verify extracted firmware checksum
> +endef
> +
> +define Build/Compile
> +
> +endef
> +
> +define Package/aquantia-mediatek-aqr113c-firmware/install
> +   $(INSTALL_DIR) $(1)/lib/firmware
> +   $(INSTALL_DATA) 
> $(PKG_BUILD_DIR)/Rhe-05.06-Candidate9-AQR_Mediatek_23B_P5_ID45824_LCLVER1.cld 
> $(1)/lib/firmware/
> +endef
> +
> +$(eval $(call BuildPackage,aquantia-mediatek-aqr113c-firmware))
> --
> 2.35.3
>

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


[PATCH RFC] aquantia-firmware: package MediaTek's Aquantia AQR113C firmware

2024-02-05 Thread Rafał Miłecki
From: Rafał Miłecki 

Aquantia AQR113C is PHY that needs loading a firmware. Some devices may
have it stored on flash and some need filesystem to provide it.

MediaTek holds its own AQR113C firmware file for its boards. Package it.

The problem is obtaining that firmware:
1. Cloning whole repo seems like an overkill for copying a single file
2. Public git server doesn't support git protocol (and so git archive)
3. Gitiles UI doesn't allow downloading raw files (nor binaries as text)

The only option seems to be downloading tar archive of "firmware"
directory. The problem is such archives generated by Gitiles differ on
every download so a checksum can't be specified.

Due to all above a custom download is implemented in "Build/Prepare".
Then firmware gets simply extracted and packaged.

Cc: Robert Marko 
Cc: Christian Marangi 
Cc: Daniel Golle 
Signed-off-by: Rafał Miłecki 
---
 package/firmware/aquantia-firmware/Makefile | 36 +
 1 file changed, 36 insertions(+)
 create mode 100644 package/firmware/aquantia-firmware/Makefile

diff --git a/package/firmware/aquantia-firmware/Makefile 
b/package/firmware/aquantia-firmware/Makefile
new file mode 100644
index 00..9cf67f41bb
--- /dev/null
+++ b/package/firmware/aquantia-firmware/Makefile
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=aquantia-firmware
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/aquantia-mediatek-aqr113c-firmware
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  TITLE:=MediaTek's firmware for Aquantia AQR113C
+endef
+
+define Build/Prepare
+   mkdir -p $(PKG_BUILD_DIR)
+
+   # Download for "aquantia-mediatek-aqr113c-firmware" package
+   wget \
+   -O 
$(DL_DIR)/mtk-openwrt-feeds-refs_heads_master-21.02-files-target-linux-mediatek-mt7988-base-files-lib-firmware.tar.gz
 \
+   
"https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+archive/refs/heads/master/21.02/files/target/linux/mediatek/mt7988/base-files/lib/firmware.tar.gz;
+   tar xf 
$(DL_DIR)/mtk-openwrt-feeds-refs_heads_master-21.02-files-target-linux-mediatek-mt7988-base-files-lib-firmware.tar.gz
 -C $(PKG_BUILD_DIR)
+   # TODO: Verify extracted firmware checksum
+endef
+
+define Build/Compile
+
+endef
+
+define Package/aquantia-mediatek-aqr113c-firmware/install
+   $(INSTALL_DIR) $(1)/lib/firmware
+   $(INSTALL_DATA) 
$(PKG_BUILD_DIR)/Rhe-05.06-Candidate9-AQR_Mediatek_23B_P5_ID45824_LCLVER1.cld 
$(1)/lib/firmware/
+endef
+
+$(eval $(call BuildPackage,aquantia-mediatek-aqr113c-firmware))
-- 
2.35.3


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