From patchwork Wed Jul 18 12:25:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10532331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C9646062E for ; Wed, 18 Jul 2018 12:25:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 422BC28DC4 for ; Wed, 18 Jul 2018 12:25:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3701229076; Wed, 18 Jul 2018 12:25:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D972F28F54 for ; Wed, 18 Jul 2018 12:25:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731246AbeGRNDQ (ORCPT ); Wed, 18 Jul 2018 09:03:16 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35667 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730889AbeGRNDP (ORCPT ); Wed, 18 Jul 2018 09:03:15 -0400 Received: by mail-lj1-f196.google.com with SMTP id p10-v6so3929883ljg.2 for ; Wed, 18 Jul 2018 05:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=MB8JAsLdVV5eTplZ0+SdTE19NvzHzIHB5qkrVOZxRBU=; b=OS009S+3+3mOy21WS8g0hOXlQOzI8V83oxqyXenooageJflBP6xYqHV97/U8Tvxbls +2pQF/jqBukQTvneXlsaIykf1mrMXRCH7505TIVBtZjSnjC/OeGcVTiLqvH8qkZTFxnq xspmK09XNUaQJ7pAMv8L6sHWxG8+EXQbBlZKKnrZHwfF9VCey8Zyb68TPz7CEsG53hs3 rgthn0fxcFY7nv0H+2aSVgnE4nHj7XhEKUU3gkDlhnBpqn8GvDXcaRpoJ+l8dTjlqqfE bw3JLk/kNSUZ70V9YvzwGdaRvJExaSs1oUdQFiXgUZ3Hi0uKpHxA4nWrXioNFgNWxQTT ChRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=MB8JAsLdVV5eTplZ0+SdTE19NvzHzIHB5qkrVOZxRBU=; b=DBhSd3/DgXXUErYvOrOBGetrynpNcVnmdS79s8BzInmyfoBywYOJN7gXBGu8Wwi7mY QucWPfZg8fK+mJSoYQ3640SmrllYdFghE6AQldMdMCbWBAgO+TUvuU0Stm900NAkpQJ9 9TwnwyjI3P8FEHCeutcQR+OFdXPnRn3KiUbeKPa9OJ4Iiky91gpO5BKA55R2RxMqh72p HBQ5cT3EKekAR4nwHYO+9EYQqzmRVGHgm4X8BYnMxUTlzGz4Nk6baFc3p67VPSfRbZfB WUq/ys5mxO/t5J7fcjqkIw/QL1+ZA+qZG98v25tBa0HjjgQLYjSVsWdDAcUz2+pFXmYF bu5g== X-Gm-Message-State: AOUpUlF1NjHi1Ud8b0A77x/7D8liq13hSPgP49uWYMLlyYv5F0TqH09A QTRVLrmMpQYMFOeJoEzQGl69U0QZ X-Google-Smtp-Source: AAOMgpfGxRpHHZkQSGU3433IomN7M5Tm2qJ2hQcFBqadhmNvsK0CTm38jnNOSdfIx6eYqcJ7GtJSjg== X-Received: by 2002:a2e:47c8:: with SMTP id u191-v6mr4378243lja.58.1531916732485; Wed, 18 Jul 2018 05:25:32 -0700 (PDT) Received: from xi.terra (c-8bb2e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.178.139]) by smtp.gmail.com with ESMTPSA id p24-v6sm596319lje.0.2018.07.18.05.25.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 05:25:30 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1fflW8-0003tw-PJ; Wed, 18 Jul 2018 14:25:16 +0200 From: Johan Hovold To: Johan Hovold Cc: Greg Kroah-Hartman , Karoly Pados , linux-usb@vger.kernel.org Subject: [PATCH 5/5] USB: serial: cp210x: improve line-speed handling for CP2104 and CP2105 Date: Wed, 18 Jul 2018 14:25:01 +0200 Message-Id: <20180718122501.14926-6-johan@kernel.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180718122501.14926-1-johan@kernel.org> References: <20180718122501.14926-1-johan@kernel.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Greg Kroah-Hartman --- 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: