From patchwork Mon Jul 5 08:20:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 470379 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4E1CC07E9D for ; Mon, 5 Jul 2021 08:20:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CC6D613F7 for ; Mon, 5 Jul 2021 08:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230370AbhGEIXW (ORCPT ); Mon, 5 Jul 2021 04:23:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:40910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbhGEIXR (ORCPT ); Mon, 5 Jul 2021 04:23:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DDB1E61415; Mon, 5 Jul 2021 08:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625473240; bh=SYTTcfYK+j/Pfq7K8TLV5XJAAQ7TNgyPYPL1DmPYZgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XzYLpu895mILIUYywEBwmybrW6CpN3rxcCI5ij4RLom+rSkB2Q2DJCJx4Gy9zEq7h L3V+QgzuQMInQumSDAfCQsGT4uAaNHATlfcNLfaoQx3CSGJzNamYL/7PbChrq5Ho0D pwBTyeK7JAxKO+Rju/SdF0fVyXFwIUWBKaeydOmPKbcA2j8gOyAN7B3WE4J3NCDbny C4zyA+S6ZyKTgqI/FeuXj7hUULEEPtHFF1aLP+RNm9LpFJvoPiscuwFj03BkDE9cZO y0Fkc/1nB/Ff8H/sU0EdJhT0NS+KtSwUKnkaSpNCyBQyLNeIgqEbUSzLOBrpD3awk2 q1KxGefktUAog== Received: from johan by xi with local (Exim 4.94.2) (envelope-from ) id 1m0JqF-0004m3-IX; Mon, 05 Jul 2021 10:20:35 +0200 From: Johan Hovold To: Johan Hovold Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/6] USB: serial: cp210x: determine fw version for CP2105 and CP2108 Date: Mon, 5 Jul 2021 10:20:15 +0200 Message-Id: <20210705082015.18286-7-johan@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210705082015.18286-1-johan@kernel.org> References: <20210705082015.18286-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org CP2105, CP2108 and CP2102N have vendor requests that can be used to retrieve the firmware version. Having this information available is essential when trying to work around buggy firmware as a recent CP2102N regression showed. Determine and log the firmware version also for CP2105 and CP2108 during type detection at probe. Signed-off-by: Johan Hovold --- drivers/usb/serial/cp210x.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 6aaf54f16f8c..51670c80bf67 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -399,6 +399,7 @@ struct cp210x_special_chars { }; /* CP210X_VENDOR_SPECIFIC values */ +#define CP210X_GET_FW_VER 0x000E #define CP210X_READ_2NCONFIG 0x000E #define CP210X_GET_FW_VER_2N 0x0010 #define CP210X_READ_LATCH 0x00C2 @@ -2107,6 +2108,10 @@ static void cp210x_determine_type(struct usb_serial *serial) } switch (priv->partnum) { + case CP210X_PARTNUM_CP2105: + case CP210X_PARTNUM_CP2108: + cp210x_get_fw_version(serial, CP210X_GET_FW_VER); + break; case CP210X_PARTNUM_CP2102N_QFN28: case CP210X_PARTNUM_CP2102N_QFN24: case CP210X_PARTNUM_CP2102N_QFN20: