From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 578AEC04EBF for ; Mon, 23 Sep 2019 10:24:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 28686206C2 for ; Mon, 23 Sep 2019 10:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569234280; bh=E7e1Hbs4h8OUms0NCBWUsQjUxahITztCNRA7a7NutdU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=zhp22VQIq1+G4o3phsTkBGGOHe7POsS4Z7Tyx91Sw7iCCZTHFd975hoIp+UXKJJrj FnC3FH0Q1XXgWV/K7d4XeT5a5N7kwEs5TlAZpbNq345kFhEa6wzX/zyo2SF45KVqfT 6Uc+Zwa2vKYNURWVEkjlnWybaDiWXt1XulJvOlI0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728843AbfIWKYj (ORCPT ); Mon, 23 Sep 2019 06:24:39 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:33055 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726213AbfIWKYj (ORCPT ); Mon, 23 Sep 2019 06:24:39 -0400 Received: by mail-lf1-f67.google.com with SMTP id y127so9697627lfc.0 for ; Mon, 23 Sep 2019 03:24:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=t5YZVn3xQR526vCEfZS1IP+d5wDROTuEm2ajYD12gZM=; b=S+lVnQy8FiZGbHLidGar8esemaqvAE7RHNZYJyFFQ5AZpizryzgFwsh2kDF2LpGOeT MuA2GE7PAkGXZgXsE5Iw5Qi07BfRRCzoM1XDvC733WEtkNr7UvGR8ZRqIVagyw2grYo8 2FnM8H7bM8EH+h5KKVo9GmlBb9yfJ7uqYFb24N7MCq4WxQ6+pdXvS1f3STqpundsxAsG eprJDH9Q8DPSETzgF3WJ1OW2EiT/0s1q67LpFo8rerstJO9SisXuMAbXE6zHLLvelPR/ 1MdHb/vj2U382EIPLnn5lkz2oBV7wicCQtcvAz04Y4wbgGiGhFj6gXKUlSFkJER7mS9J salQ== X-Gm-Message-State: APjAAAUwmZR/c421EKn3mFiOcyog9QiITt9l/4mmnOi266fzeFlQuYPn SqeSpjx8bM7SrPrDgsdyp3r8m9RC X-Google-Smtp-Source: APXvYqwpYQvU4ZvRbaCo6TUFY5vCHnMHwdTmufvR4fGWaKEUr0/3VBi1r15R5pHgM06RAAFUPk65LQ== X-Received: by 2002:a19:22cd:: with SMTP id i196mr15929780lfi.160.1569234277416; Mon, 23 Sep 2019 03:24:37 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id w16sm2182394lji.42.2019.09.23.03.24.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2019 03:24:36 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iCLWK-0007EZ-34; Mon, 23 Sep 2019 12:24:40 +0200 Date: Mon, 23 Sep 2019 12:24:40 +0200 From: Johan Hovold To: Charles Yeh Cc: Johan Hovold , Greg KH , linux-usb@vger.kernel.org, =?utf-8?B?WWVoLkNoYXJsZXMgW+iRieamrumRq10=?= Subject: Re: [PATCH] [PATCH v7] USB: serial: pl2303: Add new PID to support PL2303HXN (TYPE_HXN) Message-ID: <20190923102440.GA30545@localhost> References: <20190702123006.11320-1-charlesyeh522@gmail.com> <20190716084907.GB10939@localhost> <20190920075602.GI30545@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Mon, Sep 23, 2019 at 05:53:34PM +0800, Charles Yeh wrote: > Johan Hovold 於 2019年9月20日 週五 下午3:56寫道: > > Yes, that's better, but you're mixing register addresses, bit values and > > masks above. Perhaps things would be more clear if you but a _REG suffix > > on the register defines and order things as follows: > > > > #define PL2303_HXN__REG 0xX1 > > #define PL2303_HXN___MASK 0xY1 > > #define PL2303_HXN___ 0xZ1 > > > > #define PL2303_HXN__REG 0xX2 > > #define PL2303_HXN___MASK 0xY2 > > #define PL2303_HXN___ 0xZ2 > > > > The idea is simply to keep related defines together and not mix > > register address, masks and value defines. > > > > Keep registers sorted by address, and bit masks and values by bit order > > (e.g. MSB first). > > Thank you for your reply > > Charles Ans: > The new define is follows > > #define PL2303_READ_TYPE_HX_STATUS 0x8080 > > #define PL2303_HXN_FLOWCTRL_REG 0x0A > #define PL2303_HXN_FLOWCTRL_MASK 0x1C > #define PL2303_HXN_FLOWCTRL_NONE 0x1C > #define PL2303_HXN_FLOWCTRL_RTS_CTS 0x18 > #define PL2303_HXN_FLOWCTRL_XON_XOFF 0x0C > > #define PL2303_HXN_RESET_REG 0x07 > #define PL2303_HXN_RESET_UPSTREAM_PIPE 0x02 > #define PL2303_HXN_RESET_DOWNSTREAM_PIPE 0x01 That looks much better. But please move the reset defines above the flow control ones to keep the registers sorted by address (0x7 < 0xa). > > Yes, but that doesn't imply that you need to read back the old value. > > > > I'm assuming it would either always read back as 0, or you would read > > back the previous value written, which means you could end up resetting > > something you did not intend. > > > > Either way, you should not read back the current value when resetting > > the data pipes. > > > > Thank you for your reply > > Charles Ans: > The new code is follows > > pl2303_vendor_write(serial, > PL2303_HXN_RESET_REG, > PL2303_HXN_RESET_UPSTREAM_PIPE | > PL2303_HXN_RESET_DOWNSTREAM_PIPE); > > > Please confirm the above new define & code.. > If there is no problem.. I will write a new Patch file. Also looks good, thanks. Just move the reset define block as mentioned above. Johan