Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9617712imu; Wed, 5 Dec 2018 07:40:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/V2FPJAOhyoIlZrBmVmPupPqaz4oFjkzhU2D9w4D+Hr4DcTRRkYFQVqPP5EPONX56oue20l X-Received: by 2002:a17:902:6bc4:: with SMTP id m4mr23516182plt.93.1544024415929; Wed, 05 Dec 2018 07:40:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544024415; cv=none; d=google.com; s=arc-20160816; b=KLHizxmQPY2/nsdZlCvJyyqvUc5QJpmr4MqnpNBDotG23/zIIMDJ4yLQHGyMpQzH7A hh2ATxVwE1wVgF8FhmffZj6iFuu/dcOyWA/JmJsZ4iil0JeQsPZxMhD92YwV8ZSvYEvi 0VYaI9tm5gqR2DP8YX/oOp5063GOUaH/G7IfVQX7zKuV30Rjn+qpOeRs88g3UArGGG/+ luc3rL9fcIPzWonidhowWrOHsxDsEdRp5bTFw5YqUYPOnZ+DYuSu4e7xrusvqvEmzAk+ ufWu2fuhv2pP76tO0jzWHUJJq3Vm3TKdl7F8DZ2lEaAjZSUkxTCcb/XMkAKVLTe6Fzvu 2qgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=h/XFwuE/C9TLle+Bju0W+UKGFFPuBXHWbSsfi3HGwdU=; b=zQ6AlWYDcBgrA4Oz62Zbyn0guKP6O4Na+GJwGZAJV7il1H5FflvDgD7NwB8HITx8XE UebW41HdlIvNiVP+6dLmzoysarbYlB+PhY3tg1I4oqF7VdEq268uapqvvEr6qqzc4Yvn MtSBcLS8jOUuFu9oDqjNcXkLJQ22m3TizsZaUjIL/UlwaMSSd0pEBA2KpSnhTfCPA1Yn NV0pst0eu+EcGBUPG6LfEwcXGKKduZmcEYof1zVutR+Oex8yly6G56wQZ0HAFhOgRWJt fdEL20yfy22XtZX0+AC2pbWNXFm0+fT7zeeHO3z9/oczHnh3JZIlTGydPb2qY4sdunx5 iLzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="Z2B/1bAR"; 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 z29si14767012pfi.9.2018.12.05.07.39.59; Wed, 05 Dec 2018 07:40:15 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b="Z2B/1bAR"; 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 S1728052AbeLEPjR (ORCPT + 99 others); Wed, 5 Dec 2018 10:39:17 -0500 Received: from mail-lf1-f54.google.com ([209.85.167.54]:45792 "EHLO mail-lf1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727182AbeLEPjQ (ORCPT ); Wed, 5 Dec 2018 10:39:16 -0500 Received: by mail-lf1-f54.google.com with SMTP id b20so15031853lfa.12; Wed, 05 Dec 2018 07:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=h/XFwuE/C9TLle+Bju0W+UKGFFPuBXHWbSsfi3HGwdU=; b=Z2B/1bARbGfzrqgYTyMW1Pglc9VC56G5oQ//7NFAHfFj/P8efMo71RDB7SufW2UQYl doxZNuy2rM+R6+lokAadGhSz0+R1IZDsf2z8kZlDG7Rx3stN/HCbdTnhXb7o4ZUbmewl vsAXQmSJUWPmM9gO07P0gwPcHg90KBEJPVRjSslAiL69FbdUbHAYcxRK4KfMMgSQX0pg IcH/Bonpo7v2YctIclHpR87oVuDgq9elWXHs3OqphmN1q1778qSHkhFYMxDX4NIrqZlC GPYWTRDzhL03l1TrNURkWR096lU2OkjpLHWbMxqXahUn7rUThY/cXFw15uQiR4qiGZ8P ++Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=h/XFwuE/C9TLle+Bju0W+UKGFFPuBXHWbSsfi3HGwdU=; b=r3XLy9a/aviS+nU8dx+YrtxiRGPzf5zl88stbsbltPWL9dX55B3hoff2gxr+FMCSYE micp+29jYc7CLumikA9keoJGv+N0NY06CrtTl5153JISofmuXAeOpjZbbeMERxcpEiPx NZ8axRYI+9rZdLAevRuGCIrN7WfMYRfVJEtbePZRP93Cq+WXhY1eNO7HPs8hR9NNL2pl AriG2o5koKD4rdDDzjiM3YN4N9zNWZqF08UjNGzRYGPvDNQK3sou9p39rFRrrS9W9WDY xLPRl7sBLOCappfxRafD7oC1TXT104Ps/2LPgNZgVtib9udtGWyOV49KtdmYi5iRrxNR e/Dw== X-Gm-Message-State: AA+aEWYIw97A9EVBfxuINoXtY05FhSjh1q+6hAuby1EUWsGQSVGbjITD 4biZIr1muyNgWL3H0I51RIY= X-Received: by 2002:a19:a502:: with SMTP id o2mr14388597lfe.92.1544024353176; Wed, 05 Dec 2018 07:39:13 -0800 (PST) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id r199sm3596313lff.50.2018.12.05.07.39.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 07:39:12 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1gUZGc-0004Cw-Ie; Wed, 05 Dec 2018 16:39:15 +0100 Date: Wed, 5 Dec 2018 16:39:14 +0100 From: Johan Hovold To: Anatolij Gustschin Cc: Song Qiang , johan@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: usb: thoughts of adding more support for FT232H Message-ID: <20181205153914.GL15689@localhost> References: <48bc71bb-68e4-8b29-f609-940c9aedc0a9@gmail.com> <20181205161718.7451d98f@crub> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181205161718.7451d98f@crub> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 05, 2018 at 04:17:18PM +0100, Anatolij Gustschin wrote: > Hi, > > On Wed, 5 Dec 2018 22:10:40 +0800 > Song Qiang songqiang1304521@gmail.com wrote: > ... > >I've been developing some iio device drivers and found that some people > >would like to test their devices with a qemu system which requires an > >i2c or spi port on our development hosts. Usually this is achieved with > >a DLN-2 adapter, while this is a bit difficult for me because it costs > >~175$ in my country. Then I found that FTDI's FT232H supports both these > >two modes and costs only less than 5$ but without full support in kernel. > >The ftdi-sio driver supports FT232H only as a serial converter. > >So I'm planning to write a mfd driver for it supports both these three > >modes, here are my thoughts: > > There already has been a discussion [1] about adding an MFD driver for > FT232H, since the operating modes are mutually exclusive (and bus pins > shared between different modes), the MFD approach doesn't seem to be > a good fit. > > > ?- This device cannot support these three modes together because they > > ?? share some common pins, so I'm planning to add a sysfs entry > > ?? 'current_mode' for selecting which mode the device should be working > > ?? on. > > ?- This device is in uart mode on reset, so default mode would be reset, > > ?? too. This also helps for people only want to use this as a serial > > ?? converter feels nothing has happened (compatible). > > ?- I was trying to reuse the ftdi-sio driver but it seems like mfd can > > ?? only register platform devices, while this is a usb driver. I may > > ?? have to copy some functions from this driver. > > > >Would you share any ideas? I'd appreciate it. > > There is a patch series [2] adding an interface driver for FT232H- > based adapter devices, it already supports adding custom MPSSE based > SPI busses with SPI slaves for a custom USB PID. It already supports > adding custom CBUS-/MPSSE-GPIO adapters for user-defined USB PID. > Adding I2C driver/adapter support should be easy, too. Maybe you can > re-use it. > [1] https://patchwork.kernel.org/patch/9828985 > [2] https://patchwork.kernel.org/project/linux-usb/list/?series=48255 I was going to refer to these series, but Anatolij beat me to it (haven't looked at [2] myself yet, though). Thanks, Johan