Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9595516imu; Wed, 5 Dec 2018 07:19:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/UGFW6ew/guINQhv5KkH/HcJQyr4pmI44BPIkdU484shjx0hxjgxDxftQpAwIaGPHZd6+tJ X-Received: by 2002:a63:da14:: with SMTP id c20mr19891150pgh.233.1544023197025; Wed, 05 Dec 2018 07:19:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544023196; cv=none; d=google.com; s=arc-20160816; b=wMsaue3fgQyZhEWO6NTWYRmCog1H2M48XZHpCzTy8ht/GpEM5eK4mNMxilkh1fYK+v xa4cJD7EkCoe2fCUuVjNOSyLxEwLL1S2ESPF5cvnZKilWVr+eKRwi3uYy6tT3WY0sEXk S3WRHX33zZ/HvEftEztpw/tI7btkfVo0U8EF2Xr3Sm3Z40j2xI22B/dOChTDnEn3/00v VgvevsmIhIA0vjXwaNSOYIdPPaLue0Z1SOgXN1bugha7bi5KNg5BU3LhQ2QwOA+H6TbL bQgLzo3ViToD82w+k1s+E9b11byZlFqHmA9WK3SODGbqjFCvV6/4n2+GPHhNSPdpMeM3 usmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=DHHybzttZp8h9oGbyRFMcIE2QR84ipqqRD3LqhUhNTY=; b=Yo45FovrRQJVprDnh350C3gg9OlQa590tHGk9qcZoia/OD0rbqSZnP/Nyx5TXPUpY0 PMerIJp3DAbkaDhwUZfDuXC3PlvR37b5TXwEBoRQeyTRwTr6YvWsWuM6toQpGzANUWSq j7jVLQZpMIJfMgS7tp4AyujsOkc3AGizBgn2yLJ4XIAlFCet8Zf8cYO1LDSttx50AEa7 b3EVbw4rBWwo5O1dDpY+eCaEm5tmtMOFqGO9LPtW2Bbj6bkXeJELNINs/22N6KL/tIQZ URPU5R+4Jk7dqBAKAKf4kT1gduHJZYWYwYY9BHnS5Z0QHRgz4t5zJ9uSkhUWv+HKeRsh 9KZg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g184si20837174pfb.288.2018.12.05.07.19.40; Wed, 05 Dec 2018 07:19:56 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727692AbeLEPRc convert rfc822-to-8bit (ORCPT + 99 others); Wed, 5 Dec 2018 10:17:32 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:53041 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726918AbeLEPRc (ORCPT ); Wed, 5 Dec 2018 10:17:32 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4392Qx69T5z1qxkk; Wed, 5 Dec 2018 16:17:29 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4392Qx5Zdxz1qsJW; Wed, 5 Dec 2018 16:17:29 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 7VgH6MA1Z3GN; Wed, 5 Dec 2018 16:17:23 +0100 (CET) X-Auth-Info: HKX1L2szS1Wgg4ZSEcLRd6n5x2DpFHEyBOQ7oDLhJdU= Received: from crub (p508DE362.dip0.t-ipconnect.de [80.141.227.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 5 Dec 2018 16:17:23 +0100 (CET) Date: Wed, 5 Dec 2018 16:17:18 +0100 From: Anatolij Gustschin To: Song Qiang Cc: 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: <20181205161718.7451d98f@crub> In-Reply-To: <48bc71bb-68e4-8b29-f609-940c9aedc0a9@gmail.com> References: <48bc71bb-68e4-8b29-f609-940c9aedc0a9@gmail.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Anatolij [1] https://patchwork.kernel.org/patch/9828985 [2] https://patchwork.kernel.org/project/linux-usb/list/?series=48255