Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp904059ybl; Wed, 8 Jan 2020 07:47:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwdjYmt7mPfmlsssJVcMfrEYepVdN+SGShQ9zU+tp4tuGfgUC1IcqL2oDF7JC2hfFA5insp X-Received: by 2002:aca:5083:: with SMTP id e125mr3662891oib.96.1578498474849; Wed, 08 Jan 2020 07:47:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578498474; cv=none; d=google.com; s=arc-20160816; b=b4qSTG9AgHJTQJpEcSrv98Kl1BwMKB2R9nDcgcGkP6HI+KbeCpKLeg3LCiaGiqw3V4 jZYIVtySkszNNfxj80bVE0wX8B6CqpHy2h2JemynH0+/vQgUzkYG7dF5DzusLrEAQWCg dC+UtonI/2U9gFUaqF38nZBQVL7RwZBrZDahuRqYyzdhQiYY3dhzp2y/Moir0fPAmqb7 ep+DFEZRCKHa4ME7b53AkjNKuiB9S7u6EEoMFDteOqsJsiS1HehYjgw2xvqOx2Bmchx2 3Q+5GttnALqWtg8jdTIXkSsAvxVs8PZDZGpIcqfgPriznSBmaK0wLtoYOd6pFMCWW39H 2xkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=824DREfVtGOqPtnTTEqvugWfuWheR7SX+op0ZpMFy3Y=; b=QX3eqWSpNv4risj7/n5ddzNoi94sOKCN71ly90JfEuPhGPs+xEHC6w4VzRDzB1YyUV RqIQWHmnZvOka8BOjPH54TXtG9vCTSaNOKxHSSRVvEonleXz6lUPV3gf3YoONdZdSO6u eQpypSeGJDd5UixeVzuE/Anl/fbagxVL/bwQUIkFlXRyc64U5YXAHlXh5DvsUc7LJFCj hTwplHQO039MrO8Q7QOrn2vS99ocPbWrO+HrkGF7185G7ZzQ3dkTEr+WkeNoh2FFMNrO Nfyv4cqfCmK3/EyCePIvta2Ri0Dqsr9QTdd4s/msjiui3PH7MJB/LaOor4nwhYrCR5Ia 6Crw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4si2050591otl.214.2020.01.08.07.47.42; Wed, 08 Jan 2020 07:47:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727787AbgAHOe4 (ORCPT + 99 others); Wed, 8 Jan 2020 09:34:56 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:44357 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726186AbgAHOez (ORCPT ); Wed, 8 Jan 2020 09:34:55 -0500 Received: by mail-lf1-f66.google.com with SMTP id v201so2584686lfa.11; Wed, 08 Jan 2020 06:34:54 -0800 (PST) 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; bh=824DREfVtGOqPtnTTEqvugWfuWheR7SX+op0ZpMFy3Y=; b=BYkHgMeYBiaJp9vlWGlrMmEt3MWURf8MWfH5VoiCvUpXBVQFk1kCpQ+voiDULXlBBW 7wVK9Sn74ihMPE39/nSaWWG2mioQhs18asmVZcOkhnwUw2mSgckXG8ynCialVC0Dn8PR izmDEbQuUmTdx0BYAytA4RCPOM8mPlRzsZhUjgKcMkUGuKDX5ypCX9O+Ng/+n+0epCmU 9EDSJ9RoMpqJk/v1WLZgJdZjH4EsDyfRmqbpm8jt01KVcD777MKZuO6BOJWNnmTafSL5 QSTZUNwsWm+gfvD6mIlWp30/8nMeYcGuGNT9+cHIyoKtrWtOnzLn1ia50iIVLRWLQzh2 /gYA== X-Gm-Message-State: APjAAAVu20sQBz/1hVymzeiTW1ZnMxlFNhMydKsWemoU+GF52XtXLOr6 TVIaZn3qC+DgXvbcw0eFU68= X-Received: by 2002:ac2:5498:: with SMTP id t24mr2915482lfk.84.1578494093653; Wed, 08 Jan 2020 06:34:53 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id g27sm1496050lfj.49.2020.01.08.06.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 06:34:52 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1ipCQI-0001Es-1a; Wed, 08 Jan 2020 15:35:02 +0100 Date: Wed, 8 Jan 2020 15:35:02 +0100 From: Johan Hovold To: "Ji-Ze Hong (Peter Hong)" Cc: Johan Hovold , gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, peter_hong@fintek.com.tw, "Ji-Ze Hong (Peter Hong)" Subject: Re: [PATCH V2 5/7] USB: serial: f81232: Set F81534A serial port with RS232 mode Message-ID: <20200108143502.GJ30908@localhost> References: <20190923022449.10952-1-hpeter+linux_kernel@gmail.com> <20190923022449.10952-6-hpeter+linux_kernel@gmail.com> <20191023115300.GU24768@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, Sorry about the late reply. Had a change to look into this again today. On Thu, Oct 24, 2019 at 04:52:01PM +0800, Ji-Ze Hong (Peter Hong) wrote: > Hi Johan, > > Johan Hovold 於 2019/10/23 下午 07:53 寫道: > > On Mon, Sep 23, 2019 at 10:24:47AM +0800, Ji-Ze Hong (Peter Hong) wrote: > >> The Fintek F81532A/534A/535/536 is USB-to-2/4/8/12 serial ports device > >> and the serial ports are default disabled. Each port contains max 3 pins > >> GPIO and the 3 pins are default pull high with input mode. > >> > >> When the serial port had activated (running probe()), we'll transform the > >> 3 pins from GPIO function publicly to control Tranceiver privately use. > > > > I'm not sure I understand what you're saying here. > > > >> We'll default set to 0/0/1 for control transceiver to RS232 mode. > >> > >> Otherwise, If the serial port is not active, the 3 pins is in GPIO mode > >> and controlled by global GPIO device with VID/PID: 2c42/16f8. > > > > Does this mean that you can control the three GPIOs either through the > > serial device or through the gpio-control device (which are two separate > > USB devices)? > > Yes, when 1 F81534A connect to Host, it'll report device as following. > virtual HUB > GPIO Device. > serial port 1 > ... > serial port n Could you post lsusb -v output for this with a couple of UARTs enabled? > The link are F81534A pin-out: > https://imgur.com/a/AZHqQ1N Do you have a datasheet for the device? I think I'm starting to get an idea of how this work, but I really don't like having to spend this much time on detective work just to understand how the hw works. > So we can control F81534A series all GPIO pins via GPIO Device. > Serial ports are also control MODE0_x, MODE1_x, MODE2_x > (e.g. UART1 MODE0_1, MODE1_1, MODE2_1), but when Serial ports > is h/w disabled (DTR pull low), the mode pin will change to GPIO pin. So you tie a ports DTR pin, even though it's normally an output, and use that at boot to determine whether the UART should be enabled or not? And the GPIO device can only control a pin if the corresponding port is disabled? Can you read back the enable state of each port? > > Ok, so you reset the tranceiver config on every probe. > > > > Are the three GPIOs always connected to one particular tranceiver, or > > are they truly general purpose? > > > > In the latter case, it doesn't seem like a good idea to drive pins 0 > > and 1 low here as you have know idea what they're used for. > > If we want to change the mode pin to GPIO pin, it need do h/w disable. > It the serial ports are activated, the 3 pin will be mode pin and set > default 0/0/1 to RS232 mode due to this driver not implement RS422/485 > currently. What about devices using a different tranceiver? Should the state of the mode pins ultimately be tied to VID/PID (can your customers change VID/PID)? Johan