Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp4860pxb; Thu, 2 Sep 2021 17:42:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznv/y2YAYcU9ErJ3Bm8lO020MjoQaU7E2yktRQiRxpq9DpehayL9L4Ef2mGqtkGPShFLct X-Received: by 2002:a92:c94e:: with SMTP id i14mr636288ilq.143.1630629765007; Thu, 02 Sep 2021 17:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630629765; cv=none; d=google.com; s=arc-20160816; b=nnHB+rcRdPdjEUq8YOHqPTQtsqYmh7dUH74r2qXKYrwdcUtlfPAx7FV7ZR8d+8qYr0 gCwYE+Hc9vjz/arvbH7e2fJWOVMBJT5bvbJUlgYRRDMNCDdzx9RQqm6D02CkIxS5QZdt OS5uHerWkffRqmjgURQJWbRshJTfmacypfU4V/B4h2Nz08XWRsWEAduNTj9+GAckbsLE dIAGLXJKPl/sQMcHFWH46HKShAWSttsr2dLOOejaZvUBI3wBstNVR1KatBSZsxWvtO57 e3uwlvT4R0VZftmGyoRRBBffN1uL1zUbFAs+OMWhNafQ5X0D6DsNlirMKHRu7uLeCNI+ 8E4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=5mwRgrMFwQz0tqWAKg3InojRGPZBklTXN5vGQDujzdc=; b=q5MvANqplD12wZydxX4kiYmgmQs4w5PIW4n6LSeKtD/h3DHBNj8kcf4xYWF8wGyE08 eTxUm+EuO+UUDYFDguhHOb2LKtgFRRV7yAE1VaPzKWKTf+xF63lEEE4zGtFFFxp9WEfo jHLe24D30xz2M3MIxu5TcQDIb2iKz2wvi/Ix8LI+IIsldrHn7IqqPBxh8cjV3qcF/OC2 8sOyyxgldHFhwbBmDKPGlWnrVqcdj9ERsQ29DOVc8VxZNgCn/7+O5R97Q52C+aY4idVz bzqrSEhtNzmX8eQBYjQwcPnTCEFs4ScrV7BCPfAAKhaC4QI3G5xqJKsGguExJ7LSkzun e5AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DujDKssS; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x8si4163764jaq.91.2021.09.02.17.42.33; Thu, 02 Sep 2021 17:42:44 -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=@linaro.org header.s=google header.b=DujDKssS; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347002AbhIBSbC (ORCPT + 99 others); Thu, 2 Sep 2021 14:31:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241834AbhIBSbB (ORCPT ); Thu, 2 Sep 2021 14:31:01 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F237DC061575 for ; Thu, 2 Sep 2021 11:30:02 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id q21so5300408ljj.6 for ; Thu, 02 Sep 2021 11:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5mwRgrMFwQz0tqWAKg3InojRGPZBklTXN5vGQDujzdc=; b=DujDKssSYKnTJZHygGN7EYjvKLL0kxheyMAa8UY5l9+gLdpTFGQB4q/fbtZ1jA2Wfk /UVtiUb0zlzQZ/bL2GVn5G077yhQEA656mYfzZZ/Tss61Qkvg/0zO7WPg6hsIxqPTbQd +Z6u32hy4A/9LbdBdeObvduIYvq6qinYKMAHyOiCwceQSB3MtQ+6VWaDDvYYkPmXvbtT 9gxAs8EqMQfrvdKTshEgnlEFaC78pmDPCwJYH+A/rckS1CjlOFMxUQycZ4l6STXNbZWr UzXAKyQdkwBgOnO4tspcQKEMVMMcrrBwF3/2Uv5tlDATTJ9wpNWr6BfyN/jk6NX047tj 7aKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5mwRgrMFwQz0tqWAKg3InojRGPZBklTXN5vGQDujzdc=; b=d+8Sae/dEpzcgXAbZQ0gs+q3QfzWnLYHwPYtTZs4oOvHugTshCUnJMD+WtmEwGZmyC ZlCASfP7nay2nytrPjYNkyE1332QL77U2V+mp2aqfVaePHFoQ95I1MLch3I+lSw7TJ9F L57dXMtwVGoibC/hKwal8RalpTpS5bRi2UHHKGZ375XgoaiPYCk3drkRY6qdj3N7Iuv0 zWWIMR37t92qLf36Y91DFDEAX+QTvw6sjCcEDKWXWs/Tek56mQWWomqZ/kdPm5pA48zp GNwXkCFPT5evfwnAvJGnczx6oW7txbAU+D8F8MXsEIHM10a7RT0FJKQ8B0LM+YD4KROv ue5w== X-Gm-Message-State: AOAM531J7vRSdTyI92qcxlwLls2GIKdv3lXGuQyHFITsPlOVcltD8XF9 p2SDy8hj1FenaTjLZxwlGfM6mktLYX8vCDp22OqibQ== X-Received: by 2002:a05:651c:510:: with SMTP id o16mr3731605ljp.257.1630607401314; Thu, 02 Sep 2021 11:30:01 -0700 (PDT) MIME-Version: 1.0 References: <20210902151053.7ddfbe3a@coco.lan> <20210902153820.5624b57f@coco.lan> <20210902163529.734b8e0e@coco.lan> In-Reply-To: From: John Stultz Date: Thu, 2 Sep 2021 11:29:49 -0700 Message-ID: Subject: Re: [PATCH v3 2/4] misc: hisi_hikey_usb: change the DT schema To: Matthias Kaehlcke Cc: Mauro Carvalho Chehab , Greg Kroah-Hartman , Rob Herring , linuxarm@huawei.com, mauro.chehab@huawei.com, Arnd Bergmann , lkml , Douglas Anderson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 2, 2021 at 10:28 AM Matthias Kaehlcke wrote: > 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: > > > > 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. Apologies, I may be misunderstanding you, but I think the missing issue there is: "what triggers the hub driver to switch it on or off?" For the hikey960/970 boards, removing/plugging in the usb-c cable is what we use to enable/disable the mux/hub. The current iteration (of which there have been many) of hikey hub driver uses the role switch notification as its trigger. It's not really controlling the role switching, just using that signal. That's why the driver works as an intermediary/relay of the roleswitch notification. We had earlier efforts that had hacks to specific drivers as well as attempts to add notifiers on role switches (but those were terribly racy), so the intermediary/relay approach has been a great improvement on reliability with little impact to other drivers. thanks -john