linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Jackychou <jackychou@asix.com.tw>
Cc: johan@kernel.org, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	louis@asix.com.tw
Subject: Re: [PATCH 1/2 v4] USB: serial: mos7840: Adjust port settings for read and write registers
Date: Wed, 5 Dec 2018 07:03:59 +0100	[thread overview]
Message-ID: <20181205060359.GE18087@localhost> (raw)
In-Reply-To: <20181130063122.24217-1-jackychou@asix.com.tw>

On Fri, Nov 30, 2018 at 02:31:21PM +0800, Jackychou wrote:
> From: JackyChou <jackychou@asix.com.tw>
> 
> In the read/write function, set port 2 independently in the 2-port case.
> 
> When setting the offset of port registers, the offset between port 1 and
> other ports is different, so port 1 is set independently.
> Then in the rest of ports, the port 2 between 2-ports case and 4-ports case
> is different, so port 2 in 2-ports case is set independently.
> 
> Signed-off-by: JackyChou <jackychou@asix.com.tw>
> ---

Thanks for the update.

> +	} else {
> +		u8 port_offset;
> +
> +		if ((mos7840_port->port_num == 2) && (serial->num_ports == 2))
> +			port_offset = 1;
> +		else
> +			port_offset = mos7840_port->port_num - 2;
> +		mos7840_port->SpRegOffset = 0x8 + (2 * port_offset);
> +		mos7840_port->ControlRegOffset = 0x9 + (2 * port_offset);
> +		mos7840_port->DcrRegOffset = 0x16 + (3 * port_offset);

I simplified this further as:

	} else {
		u8 phy_num = mos7840_port->port_num;

		/* Port 2 in the 2-port case uses registers of port 3 */
		if (serial->num_ports == 2)
			phy_num = 3;

		mos7840_port->SpRegOffset = 0x8 + 2 * (phy_num - 2);
		mos7840_port->ControlRegOffset = 0x9 + 2 * (phy_num - 2);
		mos7840_port->DcrRegOffset = 0x16 + 3 * (phy_num - 2);

before applying.

Johan

      parent reply	other threads:[~2018-12-05  6:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-30  6:31 [PATCH 1/2 v4] USB: serial: mos7840: Adjust port settings for read and write registers Jackychou
2018-11-30  6:31 ` [PATCH 2/2 v4] USB: serial: mos7840: Add a product ID for the new product Jackychou
2018-12-05  6:03 ` Johan Hovold [this message]

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=20181205060359.GE18087@localhost \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jackychou@asix.com.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=louis@asix.com.tw \
    /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).