Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp583859pxb; Thu, 2 Sep 2021 10:29:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmy9un34KIOgg1O1HZ8FL3N1d/BfGLPtZwdy0m+C3KbM0QhNAEY1t3a5oaG96C0erRGJ82 X-Received: by 2002:a05:6e02:20cd:: with SMTP id 13mr3152204ilq.156.1630603771828; Thu, 02 Sep 2021 10:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630603771; cv=none; d=google.com; s=arc-20160816; b=rK9qHzQXuAShln1j4epfctpfULdw7/IoF3u+8B1VarCEgEae71KrSJDmHLeSU6rSk4 lJ4fp/HdZZ1VuSS46mHSMVjuW7EORylXdW8zgWx5rSmR1aF1AOCKMoyW8Iwd+MxCiUKC EvZtM86Bo58AQYZd5lcT7hv244nOe3YBedjN7xKSbjSSfGlqqOs0iva3AqS8Wg6y91wz RAahYiA81TksBYoNR9QGxlgKoJFHghm0x5AzCpXmFeRfUOVAwH5ONaZln4WV6CsTjG49 MPLMVa1WJfA3u6bncBWErqrPABgYK6BIFwcObsmP0UbqQq/PGAukP0UANHbRZgX7myDF 7wjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nN3k3dUPK3S2b7Nats+T83sdUWEKp5nCRR4lWMJTudE=; b=NYiF5iPbLQb/X6DAgtohWq9bR8kFteXKUSWxjP5+8CT4PsekciWIxzFG9P/QLZs7nv dXNcQufIn71+WcXlUtnelIn/oeCh0VmNN3514wXxkIrw4Yn/5idYCyDMU4Jvud2u1uZW N88UkC0QKmLnufRu7Telid4+ko3b+WklZhcRdvyKqhtY8v27XRK4YNmti3E7SHyN3jtA KZxJLmARjTwuaClXwGRKMIgk6HKwHdlA3g9ADVfIeSJlrZfv5s6uc/BItT8tkiJSUNEM VBBqdmG/IsioqQTQUutmeJkYcWHc46BPvv51OIH8Ms3Jh9wYO4UYEo2MCW4W/huEyA8a sVbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nWNOAEMU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m22si2179486jaa.92.2021.09.02.10.29.15; Thu, 02 Sep 2021 10:29:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nWNOAEMU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346582AbhIBR31 (ORCPT + 99 others); Thu, 2 Sep 2021 13:29:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346507AbhIBR30 (ORCPT ); Thu, 2 Sep 2021 13:29:26 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B98EC061575 for ; Thu, 2 Sep 2021 10:28:27 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id n13-20020a17090a4e0d00b0017946980d8dso1958390pjh.5 for ; Thu, 02 Sep 2021 10:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=nN3k3dUPK3S2b7Nats+T83sdUWEKp5nCRR4lWMJTudE=; b=nWNOAEMUfKKG10J5yFzKaL+d1LPZ/vaJ16maYdNimJPFb3bjF18zpQ6wc9etzDEy/d 9xQc4gI4VrrMkBORoD6/t3glawBRoqo69QvPVI651WrYAkLWyoR15rtRe/tHd5HDoLYI OSjDefyQyWTDekFHdpDQkbZlFEI6sIdvQEBMQ= 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:in-reply-to; bh=nN3k3dUPK3S2b7Nats+T83sdUWEKp5nCRR4lWMJTudE=; b=gdXlsfhhv4c1+ZioFAtFOL9qyDpdupmcLYKBhan+iGsugzdRsnYLQuf6N2t1R89anE +MApqkoB0oRD6OjIGNstHyseP7SJ9ayyPf/kuJ4w4hpbsG3pKfg3omeM9fq4/bgetPb+ f2JeE7+zhOTMJWYnx0UnUBm7eKo2lghpHYCRmwuw9qS/S376+ZywqpWAOnvniJVSdftb VNNIzFJKRV70uwdOnC36TTTzXmw5NTAoqPRGhR4hSaulU80nFVQ3NwvEm6WifaNrk9xd 5vdahjDjBQHldYUrcyIhtS9NDgT4wCZjNSD+BrTjFF8cJGjbG2Kw+8EyNbO7zsBFwWh7 3DIA== X-Gm-Message-State: AOAM532Fp3wrRRILKvONfJrfR6Kffd1c3p25Y4D16iBxc4TDbXGPZsEs 8+kQUxQMqp59TWZ9VBSwH7AQ2A== X-Received: by 2002:a17:902:8c90:b0:12f:699b:27 with SMTP id t16-20020a1709028c9000b0012f699b0027mr3900196plo.28.1630603706621; Thu, 02 Sep 2021 10:28:26 -0700 (PDT) Received: from localhost ([2620:15c:202:201:76ac:d178:a633:4fb5]) by smtp.gmail.com with UTF8SMTPSA id k8sm3108494pjg.23.2021.09.02.10.28.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Sep 2021 10:28:26 -0700 (PDT) Date: Thu, 2 Sep 2021 10:28:24 -0700 From: Matthias Kaehlcke To: Mauro Carvalho Chehab Cc: Greg Kroah-Hartman , Rob Herring , linuxarm@huawei.com, mauro.chehab@huawei.com, John Stultz , Arnd Bergmann , linux-kernel@vger.kernel.org, Douglas Anderson Subject: Re: [PATCH v3 2/4] misc: hisi_hikey_usb: change the DT schema Message-ID: References: <20210902151053.7ddfbe3a@coco.lan> <20210902153820.5624b57f@coco.lan> <20210902163529.734b8e0e@coco.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210902163529.734b8e0e@coco.lan> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 02, 2021 at 04:35:29PM +0200, Mauro Carvalho Chehab wrote: > Em Thu, 2 Sep 2021 15:56:36 +0200 > Greg Kroah-Hartman escreveu: > > > On Thu, Sep 02, 2021 at 03:38:20PM +0200, Mauro Carvalho Chehab wrote: > > > Em Thu, 2 Sep 2021 15:10:53 +0200 > > > Mauro Carvalho Chehab escreveu: > > > > > > > Em Thu, 2 Sep 2021 13:40:28 +0200 > > > > Greg Kroah-Hartman escreveu: > > > > > > > > > On Thu, Sep 02, 2021 at 01:28:35PM +0200, Mauro Carvalho Chehab wrote: > > > > > > As there's no upstream DT bindings for this driver, let's > > > > > > update its DT schema, while it is not too late. > > > > > > > > > > So this is for 5.15-final? > > > > > > > > It can either be for 5.15 or 5.16, as there aren't any compatible > > > > under arch/ which uses the DT schema there. All patches adding > > > > such compatible are on this series. So, whatever version this > > > > is applied should be OK. > > > > > > On a separate note, despite having "hisi_" on this driver's name, there's > > > nothing there that is really HiSilicon specific. What this driver does is > > > to control an USB HUB integrated inside a DT-based board, doing those > > > functions: > > > > > > - Power on/off the chip; > > > - reset the HUB; > > > - control its OTG switch; > > > - control power on/off for an USB type-C connector; > > > - set USB role as host or device. > > > > > > This is used on both HiKey 960 and HiKey 970 with the following > > > topology: > > > > > > +-----+ +--------+ +---------+ > > > | SoC | ---> | USB PHY| ---> | USB HUB | ---> USB 3.0 > > > +-----+ +--------+ +---------+ and type-C ports > > > > > > Both Kirin 960 and 970 SoCs have a Synapsys IP (DWC 3). > > > > > > Both HiKey 960 and 970 cards use Richtek RT1711H Type-C Chip Driver > > > as part of the USB PHY logic, but they use different USB HUBs: > > > > > > - HiKey 960 use a Microchip USB5734 HUB > > > - HiKey 970 use a TI TUSB8041 HUB > > > > > > While I'm not sure how generic this driver can be, I'm thinking that > > > maybe a future patch could rename it to 'generic-usb-hub' or > > > something similar - finding a good name is always the hardest > > > part :-) > > > > Try looking at: > > https://lore.kernel.org/r/20210813195228.2003500-1-mka@chromium.org > > for another example of this. > > (C/C Matthias here). > > Interesting to know that someone else is also needing to add support > for USB chips. Yeah, there were several attempts over the years, but so far none of them landed upstream ... > Yet, the approach took there won't work with HiKey 960/970, as > it needs to control not only the regulator, but it should also > work as as usb-role-switch. > > So, besides controlling the regulator, which seems to be basically what > the onboard_usb_hub_driver does, but it should also be able to: > > - (optionally) reset the HUB; > - control its OTG switch; > - control power on/off for an USB type-C connector; > - set USB role as host or device. > Perhaps it would be possible to merge both approaches by modifying > hisi_hikey_usb in order to add the extra bits required by the boards that > Matthias is currently working, and requiring the GPIOs for OTG and > type-C connectors only if DT contains usb-role-switch. I'm not convinced that a hub driver should be in charge of role switching. I wonder if the hub part could remain separate, and the role switching be done by a dedicated driver that interacts with the hub driver through some interface. From the above list the hub driver could still be in charge of: - (optionally) reset the HUB; - control power on/off for an USB type-C connector; Maybe the hub driver could implement a reset controller to allow the role switching driver to switch it on and off (including type-C power). The role switch driver (a leaner version of hisi_hikey_usb) could model the mux and switch the hub on and off, without being concerned about all the details. I fear if we go the route of completely merging the two drivers it might end up in a hodgepodge of vaguely related things, and it would probably re-open the can of worms of the DT binding, which took a long time to settle, even with a more limited functionality.