Re: [PATCH net-next] r8152: support request_firmware for RTL8153
From: Marek Szyprowski
Date: Wed Oct 23 2019 - 06:22:59 EST
Hi Hayes,
On 23.10.2019 11:48, Hayes Wang wrote:
> Marek Szyprowski [mailto:m.szyprowski@xxxxxxxxxxx]
>> Sent: Wednesday, October 23, 2019 5:17 PM
>> Subject: Re: [PATCH net-next] r8152: support request_firmware for RTL8153
>>
>> Hi Hayes,
>>
>> On 16.10.2019 05:02, Hayes Wang wrote:
>>> This patch supports loading additional firmware file through
>>> request_firmware().
>>>
>>> A firmware file may include a header followed by several blocks
>>> which have different types of firmware. Currently, the supported
>>> types are RTL_FW_END, RTL_FW_PLA, and RTL_FW_USB.
>>>
>>> The firmware is used to fix some compatible or hardware issues. For
>>> example, the device couldn't be found after rebooting several times.
>>>
>>> The supported chips are
>>> RTL_VER_04 (rtl8153a-2.fw)
>>> RTL_VER_05 (rtl8153a-3.fw)
>>> RTL_VER_06 (rtl8153a-4.fw)
>>> RTL_VER_09 (rtl8153b-2.fw)
>>>
>>> Signed-off-by: Hayes Wang <hayeswang@xxxxxxxxxxx>
>>> Reviewed-by: Prashant Malani <pmalani@xxxxxxxxxxxx>
>> This patch (which landed in linux-next last days) causes a following
>> kernel oops on the ARM 32bit Exynos5422 SoC based Odroid XU4 board:
> Please try the following patch.
Yes, this fixes the issue. I've applied those changes manually on top of
Linux next-20191022, due to some differences in the context. When you
prepare a final patch, feel free to add:
Reported-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
Fixes: 9370f2d05a2a ("r8152: support request_firmware for RTL8153")
Tested-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index d3c30ccc8577..283b35a76cf0 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -4000,8 +4000,8 @@ static void rtl8152_fw_mac_apply(struct r8152 *tp, struct fw_mac *mac)
> static void rtl8152_apply_firmware(struct r8152 *tp)
> {
> struct rtl_fw *rtl_fw = &tp->rtl_fw;
> - const struct firmware *fw = rtl_fw->fw;
> - struct fw_header *fw_hdr = (struct fw_header *)fw->data;
> + const struct firmware *fw;
> + struct fw_header *fw_hdr;
> struct fw_phy_patch_key *key;
> u16 key_addr = 0;
> int i;
> @@ -4009,6 +4009,9 @@ static void rtl8152_apply_firmware(struct r8152 *tp)
> if (IS_ERR_OR_NULL(rtl_fw->fw))
> return;
>
> + fw = rtl_fw->fw;
> + fw_hdr = (struct fw_header *)fw->data;
> +
> if (rtl_fw->pre_fw)
> rtl_fw->pre_fw(tp);
>
>>> +static void rtl8152_apply_firmware(struct r8152 *tp)
>>> +{
>>> + struct rtl_fw *rtl_fw = &tp->rtl_fw;
>>> + const struct firmware *fw = rtl_fw->fw;
>>> + struct fw_header *fw_hdr = (struct fw_header *)fw->data;
>>> + int i;
>>> +
>>> + if (IS_ERR_OR_NULL(rtl_fw->fw))
>>> + return;
>>> +
>>> + if (rtl_fw->pre_fw)
>>> + rtl_fw->pre_fw(tp);
>>> +
>>>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland