Message ID | bd30d8b3853395565d5e81acb98ae3d43ddc1f6e.1539938482.git.lorenzo.bianconi@redhat.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Kalle Valo |
Headers | show |
Series | mt76x0: align mt76x0u and mt76x0e fw version | expand |
On 2018-10-19 10:58, Lorenzo Bianconi wrote: > Unify firmware version used on mt76x0e and mt76x0u drivers. > Fallback to mt7610u fw if mt7610e one is not available > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> > --- > this patch is based on top of: > https://patchwork.kernel.org/patch/10648399/ > --- > .../wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 ++ > .../net/wireless/mediatek/mt76/mt76x0/usb.c | 2 ++ > .../wireless/mediatek/mt76/mt76x0/usb_mcu.c | 23 +++++++++++++++---- > 3 files changed, 23 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c > index a9f14d5149d1..b57c2a11146f 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c > +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c > @@ -22,7 +22,6 @@ > > #define MCU_FW_URB_MAX_PAYLOAD 0x38f8 > #define MCU_FW_URB_SIZE (MCU_FW_URB_MAX_PAYLOAD + 12) > -#define MT7610U_FIRMWARE "mediatek/mt7610u.bin" > > static int > mt76x0u_upload_firmware(struct mt76x02_dev *dev, > @@ -75,6 +74,24 @@ mt76x0u_upload_firmware(struct mt76x02_dev *dev, > return err; > } > > +static int mt76x0_get_firmware(struct mt76x02_dev *dev, > + const struct firmware **fw) > +{ > + int err; > + > + /* try to load mt7610e fw if available > + * otherwise fall back to mt7610u one > + */ > + err = request_firmware(fw, MT7610E_FIRMWARE, dev->mt76.dev); > + if (err) { > + dev_info(dev->mt76.dev, "%s not found, switching to %s", > + MT7610E_FIRMWARE, MT7610U_FIRMWARE); > + return request_firmware(fw, MT7610U_FIRMWARE, > + dev->mt76.dev); > + } > + return 0; > +} You should use firmware_request_nowarn for the first request. - Felix
> > On 2018-10-19 10:58, Lorenzo Bianconi wrote: > > Unify firmware version used on mt76x0e and mt76x0u drivers. > > Fallback to mt7610u fw if mt7610e one is not available > > > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> > > --- > > this patch is based on top of: > > https://patchwork.kernel.org/patch/10648399/ > > --- > > .../wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 ++ > > .../net/wireless/mediatek/mt76/mt76x0/usb.c | 2 ++ > > .../wireless/mediatek/mt76/mt76x0/usb_mcu.c | 23 +++++++++++++++---- > > 3 files changed, 23 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c > > index a9f14d5149d1..b57c2a11146f 100644 > > --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c > > +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c > > @@ -22,7 +22,6 @@ > > > > #define MCU_FW_URB_MAX_PAYLOAD 0x38f8 > > #define MCU_FW_URB_SIZE (MCU_FW_URB_MAX_PAYLOAD + 12) > > -#define MT7610U_FIRMWARE "mediatek/mt7610u.bin" > > > > static int > > mt76x0u_upload_firmware(struct mt76x02_dev *dev, > > @@ -75,6 +74,24 @@ mt76x0u_upload_firmware(struct mt76x02_dev *dev, > > return err; > > } > > > > +static int mt76x0_get_firmware(struct mt76x02_dev *dev, > > + const struct firmware **fw) > > +{ > > + int err; > > + > > + /* try to load mt7610e fw if available > > + * otherwise fall back to mt7610u one > > + */ > > + err = request_firmware(fw, MT7610E_FIRMWARE, dev->mt76.dev); > > + if (err) { > > + dev_info(dev->mt76.dev, "%s not found, switching to %s", > > + MT7610E_FIRMWARE, MT7610U_FIRMWARE); > > + return request_firmware(fw, MT7610U_FIRMWARE, > > + dev->mt76.dev); > > + } > > + return 0; > > +} > You should use firmware_request_nowarn for the first request. > > - Felix Ack, will do in v2. Regards, Lorenzo
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h index 24e817bda500..1871ec98aefb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h @@ -31,6 +31,8 @@ #define MT7610E_FIRMWARE "mediatek/mt7610e.bin" #define MT7650E_FIRMWARE "mediatek/mt7650e.bin" +#define MT7610U_FIRMWARE "mediatek/mt7610u.bin" + #define MT_USB_AGGR_SIZE_LIMIT 21 /* * 1024B */ #define MT_USB_AGGR_TIMEOUT 0x80 /* * 33ns */ diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c index cdbb8a6db608..245eb4aa9764 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c @@ -337,6 +337,8 @@ static int __maybe_unused mt76x0_resume(struct usb_interface *usb_intf) } MODULE_DEVICE_TABLE(usb, mt76x0_device_table); +MODULE_FIRMWARE(MT7610E_FIRMWARE); +MODULE_FIRMWARE(MT7610U_FIRMWARE); MODULE_LICENSE("GPL"); static struct usb_driver mt76x0_driver = { diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c index a9f14d5149d1..b57c2a11146f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c @@ -22,7 +22,6 @@ #define MCU_FW_URB_MAX_PAYLOAD 0x38f8 #define MCU_FW_URB_SIZE (MCU_FW_URB_MAX_PAYLOAD + 12) -#define MT7610U_FIRMWARE "mediatek/mt7610u.bin" static int mt76x0u_upload_firmware(struct mt76x02_dev *dev, @@ -75,6 +74,24 @@ mt76x0u_upload_firmware(struct mt76x02_dev *dev, return err; } +static int mt76x0_get_firmware(struct mt76x02_dev *dev, + const struct firmware **fw) +{ + int err; + + /* try to load mt7610e fw if available + * otherwise fall back to mt7610u one + */ + err = request_firmware(fw, MT7610E_FIRMWARE, dev->mt76.dev); + if (err) { + dev_info(dev->mt76.dev, "%s not found, switching to %s", + MT7610E_FIRMWARE, MT7610U_FIRMWARE); + return request_firmware(fw, MT7610U_FIRMWARE, + dev->mt76.dev); + } + return 0; +} + static int mt76x0u_load_firmware(struct mt76x02_dev *dev) { const struct firmware *fw; @@ -88,7 +105,7 @@ static int mt76x0u_load_firmware(struct mt76x02_dev *dev) if (mt76x0_firmware_running(dev)) return 0; - ret = request_firmware(&fw, MT7610U_FIRMWARE, dev->mt76.dev); + ret = mt76x0_get_firmware(dev, &fw); if (ret) return ret; @@ -171,5 +188,3 @@ int mt76x0u_mcu_init(struct mt76x02_dev *dev) return 0; } - -MODULE_FIRMWARE(MT7610U_FIRMWARE);
Unify firmware version used on mt76x0e and mt76x0u drivers. Fallback to mt7610u fw if mt7610e one is not available Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> --- this patch is based on top of: https://patchwork.kernel.org/patch/10648399/ --- .../wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 ++ .../net/wireless/mediatek/mt76/mt76x0/usb.c | 2 ++ .../wireless/mediatek/mt76/mt76x0/usb_mcu.c | 23 +++++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-)