netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hayes Wang <hayeswang@realtek.com>
To: Aaron Ma <aaron.ma@canonical.com>,
	"Mario.Limonciello@amd.com" <Mario.Limonciello@amd.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"henning.schild@siemens.com" <henning.schild@siemens.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"tiwai@suse.de" <tiwai@suse.de>
Subject: RE: [PATCH] net: usb: r8152: Add MAC passthrough support for RTL8153BL
Date: Thu, 27 Jan 2022 11:07:46 +0000	[thread overview]
Message-ID: <35834c36763b4c24a9f1ab8a292732b5@realtek.com> (raw)
In-Reply-To: <20220127100109.12979-1-aaron.ma@canonical.com>

Aaron Ma <aaron.ma@canonical.com>
> Sent: Thursday, January 27, 2022 6:01 PM
[...]
> @@ -1606,31 +1607,34 @@ static int vendor_mac_passthru_addr_read(struct
> r8152 *tp, struct sockaddr *sa)
>  	acpi_object_type mac_obj_type;
>  	int mac_strlen;
> 
> +	/* test for -AD variant of RTL8153 */
> +	ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0);
> +	if ((ocp_data & AD_MASK) == 0x1000) {
> +		/* test for MAC address pass-through bit */
> +		ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, EFUSE);
> +		if ((ocp_data & PASS_THRU_MASK) != 1) {
> +			netif_dbg(tp, probe, tp->netdev,
> +					"No efuse for RTL8153-AD MAC pass through\n");
> +			return -ENODEV;
> +		}
> +	} else {
> +		ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_MISC_1);
> +		if (tp->version == RTL_VER_09 && (ocp_data & BL_MASK)) {
> +			/* test for RTL8153BL for Lenovo */
> +			tp->lenovo_macpassthru = 1;
> +		} else if ((ocp_data & BND_MASK) == 0 && (ocp_data & BD_MASK)
> == 0) {
> +			/* test for RTL8153-BND and RTL8153-BD */
> +			netif_dbg(tp, probe, tp->netdev,
> +					"Invalid variant for MAC pass through\n");
> +			return -ENODEV;

I think the devices with the VID/PID of Lenovo, such as 0x17EF/0x3082 and 0x17EF/0xA387,
would always return -ENODEV here. Is it what you want?


Best Regards,
Hayes


> +		}
> +	}
> +
>  	if (tp->lenovo_macpassthru) {
>  		mac_obj_name = "\\MACA";
>  		mac_obj_type = ACPI_TYPE_STRING;
>  		mac_strlen = 0x16;
>  	} else {
> -		/* test for -AD variant of RTL8153 */
> -		ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0);
> -		if ((ocp_data & AD_MASK) == 0x1000) {
> -			/* test for MAC address pass-through bit */
> -			ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, EFUSE);
> -			if ((ocp_data & PASS_THRU_MASK) != 1) {
> -				netif_dbg(tp, probe, tp->netdev,
> -						"No efuse for RTL8153-AD MAC pass through\n");
> -				return -ENODEV;
> -			}
> -		} else {
> -			/* test for RTL8153-BND and RTL8153-BD */
> -			ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_MISC_1);
> -			if ((ocp_data & BND_MASK) == 0 && (ocp_data & BD_MASK)
> == 0) {
> -				netif_dbg(tp, probe, tp->netdev,
> -						"Invalid variant for MAC pass through\n");
> -				return -ENODEV;
> -			}
> -		}
> -
>  		mac_obj_name = "\\_SB.AMAC";
>  		mac_obj_type = ACPI_TYPE_BUFFER;
>  		mac_strlen = 0x17;
> --
> 2.32.0


  parent reply	other threads:[~2022-01-27 11:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 10:01 [PATCH] net: usb: r8152: Add MAC passthrough support for RTL8153BL Aaron Ma
2022-01-27 10:10 ` Greg KH
2022-01-27 10:14   ` Aaron Ma
2022-01-27 11:07 ` Hayes Wang [this message]
2022-01-28  4:20   ` Aaron Ma
2022-01-27 14:19 ` Andrew Lunn
2022-01-28  4:19   ` Aaron Ma
2022-01-28  4:32 ` [PATCH v3] " Aaron Ma
2022-01-28  8:21   ` Henning Schild
2022-01-28 18:06     ` Andrew Lunn
2022-01-28 18:41       ` Limonciello, Mario
2022-01-28 20:20         ` Henning Schild
2022-01-28 20:29           ` Limonciello, Mario
2022-01-28 21:07             ` Henning Schild
2022-02-08  7:15         ` Hayes Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35834c36763b4c24a9f1ab8a292732b5@realtek.com \
    --to=hayeswang@realtek.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=aaron.ma@canonical.com \
    --cc=davem@davemloft.net \
    --cc=henning.schild@siemens.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).