From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D729C388F7 for ; Mon, 9 Nov 2020 14:38:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07F3D206D8 for ; Mon, 9 Nov 2020 14:38:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604932688; bh=1EhLTYBAx6izuftlV7HeZNLE3o3knmEM9oG0vm1AZ9w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=Xr1itoTMD1TSjrlPPqAUx40IBfD+2M0Ce0tN1EeSAfoZs0J+Qru3DJ8uBKmRcAO0l pjmL9oyUDeZhE7kzRV/BZ4XtCJsnHHRS3EaXLidCSC8537KPlwMmy4cvUny+pr7wr1 VJDPjdmmShAh+yW7g2NwB6PYjq5Vka65JmCQAuWY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730730AbgKIOiH (ORCPT ); Mon, 9 Nov 2020 09:38:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:52714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729976AbgKIOiH (ORCPT ); Mon, 9 Nov 2020 09:38:07 -0500 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5C73B21D46; Mon, 9 Nov 2020 14:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604932686; bh=1EhLTYBAx6izuftlV7HeZNLE3o3knmEM9oG0vm1AZ9w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CTsM6gyzxanTlfPdsXpiDoL5m9MFqh7QirAz2FPLhKk/o38NfXZQVeUvhkJnUvQJR xh1J8KZbOI8rpSgKDLtlB2NMljLr9owbmsVAYpIn5Ps9UDG8W9uHqj2Xfj3d5B/7ZZ p4Anqj89D84g31G3SIUCBHMLRZHyBtPfGMevJwRU= Received: by mail-oo1-f46.google.com with SMTP id l20so2242568oot.3; Mon, 09 Nov 2020 06:38:06 -0800 (PST) X-Gm-Message-State: AOAM533U6cqyO/4K8N+jNCpiTYzKL/8caefOq1TvsXXdLRjU9ZPoQOjF pQfuzJFTpx14+1cNj3wZaN6iRLVK2/T+dAUWQg== X-Google-Smtp-Source: ABdhPJzsywgteDGfcmRGeodpD5h/7LtCCLWwr6TGwQJKLa8WhoWvqJtUY2d1KEdEJc1AuoBHcgBcLu2uKlwEGBlZInw= X-Received: by 2002:a4a:6f4d:: with SMTP id i13mr10267741oof.25.1604932685560; Mon, 09 Nov 2020 06:38:05 -0800 (PST) MIME-Version: 1.0 References: <1604403610-16577-1-git-send-email-jun.li@nxp.com> <20201105222559.GA1701705@bogus> In-Reply-To: From: Rob Herring Date: Mon, 9 Nov 2020 08:37:53 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 1/4] dt-bindings: usb: add documentation for typec switch simple driver To: Jun Li Cc: "heikki.krogerus@linux.intel.com" , "rafael@kernel.org" , "gregkh@linuxfoundation.org" , "andriy.shevchenko@linux.intel.com" , "hdegoede@redhat.com" , "lee.jones@linaro.org" , "mika.westerberg@linux.intel.com" , "dmitry.torokhov@gmail.com" , "prabhakar.mahadev-lad.rj@bp.renesas.com" , "laurent.pinchart+renesas@ideasonboard.com" , "linux-usb@vger.kernel.org" , "devicetree@vger.kernel.org" , dl-linux-imx , Peter Chen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Mon, Nov 9, 2020 at 6:24 AM Jun Li wrote: > > From: Rob Herring > > On Fri, Nov 6, 2020 at 5:07 AM Jun Li wrote: > > > > From: Rob Herring > > > > > +properties: > > > > > + compatible: > > > > > + const: typec-orientation-switch > > > > > + > > > > > + switch-gpios: > > > > > + description: | > > > > > + gpio specifier to switch the super speed active channel, > > > > > + GPIO_ACTIVE_HIGH: GPIO state high for cc1; > > > > > + GPIO_ACTIVE_LOW: GPIO state low for cc1. > > > > > > > > What does active mean? There isn't really an active and inactive state, > > right? > > > > It's more a mux selecting 0 or 1 input? > > > > > > Yes, I will change the description: > > > gpio specifier to select the target channel of mux. > > > > I wonder if the existing mux bindings should be used here. > > If only consider typec switch via "gpio", existing "mux-gpio" > binding may be used with property "mux-control-names" to be > "typec-xxx" for match, but we still need create typec stuff at > mux driver to hook to typec system, so little benefit, considering > this binding is going to be for a generic typec orientation switch > simple driver, I think a new typec binding make sense. You can instantiate drivers without a compatible. That's just the easy way. However, using the mux binding doesn't necessarily mean you have to use 'mux-gpio'. Consider if you need to do more control than just the GPIO line. For example, the chips you mentioned may have a s/w controlled power supply or reset. Also, consider what the mux would look like with different control interfaces. That could be I2C or some sub-block in a PMIC or ??? I'm sure we already have some examples. I'm not happy with these piecemeal additions to TypeC related bindings that don't consider more than 1 h/w possibility. > > > > I think you want flags 0 (aka GPIO_ACTIVE_HIGH) unless there's an > > > > inverter in the middle. > > > > > > This depends on the switch IC design and board design, leave 2 flags > > > (GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW) can cover all possible cases. > > > > > > NXP has 2 diff IC parts for this: > > > 1. PTN36043(used on iMX8MQ) > > > Output selection control > > > When SEL=0, RX_AP_*/TX_AP_* are connected to RX_CON_2*/TX_CON_2*, and > > > RX_CON_1*/TX_CON_1* are connected to VDD thru low ohmic resistor. > > > When SEL=1, RX_AP_*/TX_AP_* are connected to RX_CON_1*/TX_CON_1*, and > > > RX_CON_2*/TX_CON_2* are connected to VDD thru low ohmic resistor. > > > > > > Board design connects RX_CON_1*/TX_CON_1* to typec connector CC1, so > > > GPIO_ACTIVE_HIGH > > > > > > 2. CBTU02043(used on iMX8MP) > > > SEL Function > > > -------------------------------------- > > > Low A to B ports and vice versa > > > High A to C ports and vice versa > > > > > > Board design connects B to typec connector CC1, so GPIO_ACTIVE_LOW > > > > > > Therefore, we need 2 flags. > > > > I'm not saying you don't. Just that the description is a bit odd. > > Please expand the description for how one decides how to set the flags. > > Misunderstood your point, OK, I thought the "how to set the flags" was > simple and clear enough: > Use GPIO_ACTIVE_HIGH if GPIO physical state high is for cc1; or > Use GPIO_ACTIVE_LOW if GPIO physical state low is for cc1. Okay. > > > > > +examples: > > > > > + - | > > > > > + #include > > > > > + ptn36043 { > > > > > + compatible = "typec-orientation-switch"; > > > > > + pinctrl-names = "default"; > > > > > + pinctrl-0 = <&pinctrl_ss_sel>; > > > > > + switch-gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>; > > > > > + > > > > > + port { > > > > > + usb3_data_ss: endpoint { > > > > > + remote-endpoint = <&typec_con_ss>; > > > > > > > > The data goes from the connector to here and then where? You need a > > > > connection to the USB host controller. > > > > > > The orientation switch only need interact with type-c, no any > > > interaction with USB controller, do we still need a connection to it? > > > > If you have 2 USB hosts and 2 connectors (and 2 muxes), how would you describe > > which connector goes with which host? > > One instance of typec orientation switch defined by this binding only for > One typec connector. With that, my understanding is > Whether a connection need be described depends on if the connector > (typec driver) need notify the host controller driver to do something > (e.g. role switch need a connection between controller node and connector > node for controller driver to swap usb role). If the mux/switch control is > transparent to usb host controller (e.g. my case, usb controller drivers > normally don't need do anything for orientation change), there is no need > to describe connection between orientation switch node and host controller > node. There can be several reasons you need to know the association. When writing the DT you can't assume what information is or isn't needed. That may vary by h/w or can evolve in an OS and the DT shouldn't change. Rob