[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181205060359.GE18087@localhost>
Date: Wed, 5 Dec 2018 07:03:59 +0100
From: Johan Hovold <johan@...nel.org>
To: Jackychou <jackychou@...x.com.tw>
Cc: johan@...nel.org, gregkh@...uxfoundation.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
louis@...x.com.tw
Subject: Re: [PATCH 1/2 v4] USB: serial: mos7840: Adjust port settings for
read and write registers
On Fri, Nov 30, 2018 at 02:31:21PM +0800, Jackychou wrote:
> From: JackyChou <jackychou@...x.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@...x.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
Powered by blists - more mailing lists