All of lore.kernel.org
 help / color / mirror / Atom feed
* [5/5] USB: serial: cp210x: improve line-speed handling for CP2104 and CP2105
@ 2018-07-18 19:57 Johan Hovold
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2018-07-18 19:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Johan Hovold, Karoly Pados, linux-usb

On Wed, Jul 18, 2018 at 03:26:30PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Jul 18, 2018 at 02:25:01PM +0200, Johan Hovold wrote:
> > CP2104 and the ECI interface of CP2105 support further baud rates than
> > the ones specified in AN205 table 1, and we can use the same equations
> > as for CP2102N to determine and report back the actual baud rates used.
> > 
> > Note that this could eventually be generalised also to CP2108, which
> > uses a different base clock. There appears to be an error in the CP2108
> > equations which needs to be confirmed on actual hardware first however
> > (specifically, the subtraction of one from the divisor appears to be
> > incorrect as it introduces larger errors).
> > 
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> >  drivers/usb/serial/cp210x.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks for reviewing, all now applied.

Johan
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [5/5] USB: serial: cp210x: improve line-speed handling for CP2104 and CP2105
@ 2018-07-18 13:26 Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2018-07-18 13:26 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Karoly Pados, linux-usb

On Wed, Jul 18, 2018 at 02:25:01PM +0200, Johan Hovold wrote:
> CP2104 and the ECI interface of CP2105 support further baud rates than
> the ones specified in AN205 table 1, and we can use the same equations
> as for CP2102N to determine and report back the actual baud rates used.
> 
> Note that this could eventually be generalised also to CP2108, which
> uses a different base clock. There appears to be an error in the CP2108
> equations which needs to be confirmed on actual hardware first however
> (specifically, the subtraction of one from the divisor appears to be
> incorrect as it introduces larger errors).
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/usb/serial/cp210x.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [5/5] USB: serial: cp210x: improve line-speed handling for CP2104 and CP2105
@ 2018-07-18 12:25 Johan Hovold
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2018-07-18 12:25 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Greg Kroah-Hartman, Karoly Pados, linux-usb

CP2104 and the ECI interface of CP2105 support further baud rates than
the ones specified in AN205 table 1, and we can use the same equations
as for CP2102N to determine and report back the actual baud rates used.

Note that this could eventually be generalised also to CP2108, which
uses a different base clock. There appears to be an error in the CP2108
equations which needs to be confirmed on actual hardware first however
(specifically, the subtraction of one from the divisor appears to be
incorrect as it introduces larger errors).

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/cp210x.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 957406aac9bd..4a118eb13590 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -1537,14 +1537,19 @@ static void cp210x_init_max_speed(struct usb_serial *serial)
 		max = 1000000;
 		break;
 	case CP210X_PARTNUM_CP2104:
+		use_actual_rate = true;
+		max = 2000000;
+		break;
 	case CP210X_PARTNUM_CP2108:
 		max = 2000000;
 		break;
 	case CP210X_PARTNUM_CP2105:
-		if (cp210x_interface_num(serial) == 0)
+		if (cp210x_interface_num(serial) == 0) {
+			use_actual_rate = true;
 			max = 2000000;	/* ECI */
-		else
+		} else {
 			max = 921600;	/* SCI */
+		}
 		break;
 	case CP210X_PARTNUM_CP2102N_QFN28:
 	case CP210X_PARTNUM_CP2102N_QFN24:

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-18 19:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-18 19:57 [5/5] USB: serial: cp210x: improve line-speed handling for CP2104 and CP2105 Johan Hovold
  -- strict thread matches above, loose matches on Subject: below --
2018-07-18 13:26 Greg Kroah-Hartman
2018-07-18 12:25 Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.