Message ID | 20221103160625.15574-3-richard.yu@hpe.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp624520wru; Thu, 3 Nov 2022 09:11:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7M7p78VDa+bq9Zg6FxShlb/Wds/HNiBz9oZEbNdjQ+3kD1SAyXsZHTFYsJvpyHa2GFiKi0 X-Received: by 2002:a17:907:6d25:b0:7aa:f5a4:5f66 with SMTP id sa37-20020a1709076d2500b007aaf5a45f66mr28995086ejc.216.1667491883512; Thu, 03 Nov 2022 09:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667491883; cv=none; d=google.com; s=arc-20160816; b=zjJHlFSjzd5akA3R2aWcvR2oebWJpGZuPsEMh0g8hkzusZlFKudofzXlJtyfzQ7TC2 wagSqszGY3aFpYK4X50AINsObo5umnFAi9GgxwtQ8TXOQCDZgeLOQVz//sa7A1HXwpI1 kIKJKPDC8CRRRfFKQlj3TyX6Kwgt+SJiqT4g8yFkauOHg2hKw7vhUr2IrWf/wKwQi0pU xyG/UWFi8im2AWOHxPSEHDPbDpGGFjpuM3VDgdTfvObLH7VIVtjpNwX8/zNJh3apY/wl NyQPQrQBkGLagWBvh/otOBSjcCn5q4O94D/Woh37K33EiQnzjODuRplPjsgX0jgGzj1b aa+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=LhiAKVp9m688wUxXx2M1ClnBoWdFG6OPFXaTZB32dSk=; b=vlUdurzxXcK5uU8M6NNTfvNyK5Pc37C77BAmNsxfHz9Son2Jo/BMXxUfar0cM5isNv mIFI3l8752d0xP8BWwphtT8qFeDVcOcBYpFEhbpfe/ytJAVeisacA7ur181+vFqT2+/f qZV3wHK/Wjt9z/UfbUFZ2P4e7wXgJmFFj5NCsHLH3GoeVs8VKZ1xhLX3GFSfmuW6epck 8H+Oj9lTptDzPQVfJ0AG6LiZh1MHOcbqS3rHOZE8TYBb+fVn3XN6FvH89XODFFhNZvYR Rad7wPl0kp0I29dzyBrwrq+zWzlA1+k6+o3o9prhMJ3//9tU8yqDtW7FTSvJJfdy7DFZ Zd2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hpe.com header.s=pps0720 header.b="Su64QcL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hpe.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a50eb8a000000b0045d15f39bf4si1585190edr.479.2022.11.03.09.10.53; Thu, 03 Nov 2022 09:11:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@hpe.com header.s=pps0720 header.b="Su64QcL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hpe.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbiKCQJC (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Thu, 3 Nov 2022 12:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231545AbiKCQIB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Nov 2022 12:08:01 -0400 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1CB3186C3; Thu, 3 Nov 2022 09:08:00 -0700 (PDT) Received: from pps.filterd (m0150244.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A3G4rqr031962; Thu, 3 Nov 2022 16:07:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version; s=pps0720; bh=LhiAKVp9m688wUxXx2M1ClnBoWdFG6OPFXaTZB32dSk=; b=Su64QcL/uZfaCQ5VE7mo0vmEw9KTeay7KK024q0P1dWB1RONf9IicefqwifsHl7rLrhg s8XyDMxTkxBUqiNjkDDmK60BUAZAHYQKBoLtvKn5K4/J2e6yyB8xImNlRsjn9M6H/raH RmluNUE1V1sE5XHBcDuPS0Oi2yi62T5t08voBso1OGPiKMIjwdy6efA8OHrXjHX4yCGZ hr4z6YkRVBmjR5gC6Z4LxMwwaZzRIsxYj+y29bUxA/ZY5rnPqAjhQaMLdCyajh5NRJvy 66EMtCzbFxelirmW/zvtiRtFxWWHlaDaVum5yLRi7XTak/i8nXxbd5c53/bJmbUtD82c zQ== Received: from p1lg14881.it.hpe.com (p1lg14881.it.hpe.com [16.230.97.202]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3kmg470c05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Nov 2022 16:07:35 +0000 Received: from p1lg14885.dc01.its.hpecorp.net (unknown [10.119.18.236]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14881.it.hpe.com (Postfix) with ESMTPS id 21B8E804723; Thu, 3 Nov 2022 16:07:33 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14885.dc01.its.hpecorp.net (Postfix) with ESMTP id 67AC78036BB; Thu, 3 Nov 2022 16:07:33 +0000 (UTC) From: richard.yu@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, richard.yu@hpe.com, gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux@armlinux.org.uk, balbi@kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 2/7] dt-bindings: usb: hpe,gxp-udc: Add binding for gxp gadget Date: Thu, 3 Nov 2022 11:06:20 -0500 Message-Id: <20221103160625.15574-3-richard.yu@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221103160625.15574-1-richard.yu@hpe.com> References: <20221103160625.15574-1-richard.yu@hpe.com> X-Proofpoint-GUID: 2w5h7FawyUsJ5gpQ1DXL198IZylJJfmr X-Proofpoint-ORIG-GUID: 2w5h7FawyUsJ5gpQ1DXL198IZylJJfmr X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-03_04,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=664 impostorscore=0 phishscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211030107 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748491968842431056?= X-GMAIL-MSGID: =?utf-8?q?1748491968842431056?= |
Series |
Add USB Driver for HPE GXP Architecture
|
|
Commit Message
Yu, Richard
Nov. 3, 2022, 4:06 p.m. UTC
From: Richard Yu <richard.yu@hpe.com> Create documentation for the hpe,gxp-udc binding to support access to the virtual USB device. Signed-off-by: Richard Yu <richard.yu@hpe.com> --- .../devicetree/bindings/usb/hpe,gxp-udc.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml
Comments
On 03/11/2022 12:06, richard.yu@hpe.com wrote: > From: Richard Yu <richard.yu@hpe.com> > Subject: Drop redundant second "binding" word. > Create documentation for the hpe,gxp-udc binding to support access to > the virtual USB device. > > Signed-off-by: Richard Yu <richard.yu@hpe.com> > --- > .../devicetree/bindings/usb/hpe,gxp-udc.yaml | 57 +++++++++++++++++++ > 1 file changed, 57 insertions(+) > create mode 100644 Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml > > diff --git a/Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml b/Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml > new file mode 100644 > index 000000000000..f1ec4df8c3d3 > --- /dev/null > +++ b/Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml > @@ -0,0 +1,57 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/usb/hpe,gxp-udc.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: HPE GXP Gadget Universal Device Controller (UDC) > + > +maintainers: > + - Richard Yu <richard.yu@hpe.com> > + - Jean-Marie Verdun <verdun@hpe.com> > + - Nick Hawkins <nick.hawkins@hpe.com> > + > +properties: > + compatible: > + const: hpe,gxp-udc > + > + reg: > + maxItems: 1 > + > + interrupts: > + maxItems: 1 > + > + vdevnum: > + description: > + virtual device number. That's unusual property... Why numbering devices is part of DT (hardware description)? > + > + fepnum: > + description: > + number of the flexible end-points this device is needed. Similar question. BTW, if you end sentence with '.', it means it is an sentence, so you need to start it with capital letter. > + > + hpe,syscon-phandle: phandle is redudant. You need rather specific name, so "hpe,ehci-syscon" or whatever it is. > + $ref: '/schemas/types.yaml#/definitions/phandle' No quotes. > + description: > + Phandle to the gxp vEHCI controller access vDevice registers. Drop "Phandle to" Isn't "gxp" a GXP? > + > +required: > + - compatible > + - reg > + - interrupts > + - vdevnum > + - fepnum > + - hpe,syscon-phandle > + > +additionalProperties: false > + > +examples: > + - | > + udc@80401000 { Node name "usb", I think it is more popular for USB controllers. > + compatible = "hpe,gxp-udc"; > + reg = <0x80401000 0x1000>; > + interrupts = <13>; > + interrupt-parent = <&vic1>; > + vdevnum = <0>; > + fepnum = <7>; > + hpe,syscon-phandle = <&udc_system_controller>; > + }; Best regards, Krzysztof
Hi Mr. Kozlowski, Thank you very much for your quick review and feedbacks. I will modify the patches based on your feedback accordingly. On this specific patch, you have questions on how we defined the device/gadget configurations: vdevnum and fepnum. Please see my answers following the questions: > + vdevnum: > + description: > + virtual device number. That's unusual property... Why numbering devices is part of DT (hardware description)? >> Richard: In HPE GXP virtual EHCI controller chipset, it can support up to 8 virtual devices(gadgets). Each device/gadget will be represented by a bit in 8 bits register. For example, the interrupt register bit 0 indicates the interrupt from device 0, bit 1 for device 1 ... so on. When an user defines a device/gadget, he/she can define the device number as between 0 and 7. Thus, the driver can up to the bit position. That is why we have numbering devices as port of DT. > + > + fepnum: > + description: > + number of the flexible end-points this device is needed. Similar question. >>Richard: In HPE GXP virtual EHCI Controller chipset, there is a flexible EP pool. Each flexible EP has its own mapping register. The mapping register bit 0 to 3 is for device number (vdevnum) and bit 4 to 7 is for EP number inside the device. The device driver configures the mapping register to assign a flexible EP to a specific device. Here, "fepnum" is the input letting the driver know how many EP is needed for this device/gadget. Hope I have answered your questions on "vdevnum" and "fepnum". I will modify this patch to address your other review feedback. Thank you very much again. Richard. -----Original Message----- From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Sent: Thursday, November 3, 2022 11:30 AM To: Yu, Richard <richard.yu@hpe.com>; Verdun, Jean-Marie <verdun@hpe.com>; Hawkins, Nick <nick.hawkins@hpe.com>; gregkh@linuxfoundation.org; robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org; linux@armlinux.org.uk; balbi@kernel.org; linux-usb@vger.kernel.org; devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 2/7] dt-bindings: usb: hpe,gxp-udc: Add binding for gxp gadget On 03/11/2022 12:06, richard.yu@hpe.com wrote: > From: Richard Yu <richard.yu@hpe.com> > Subject: Drop redundant second "binding" word. > Create documentation for the hpe,gxp-udc binding to support access to > the virtual USB device. > > Signed-off-by: Richard Yu <richard.yu@hpe.com> > --- > .../devicetree/bindings/usb/hpe,gxp-udc.yaml | 57 > +++++++++++++++++++ > 1 file changed, 57 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml > > diff --git a/Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml > b/Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml > new file mode 100644 > index 000000000000..f1ec4df8c3d3 > --- /dev/null > +++ b/Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml > @@ -0,0 +1,57 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause %YAML 1.2 > +--- > +$id: > +INVALID URI REMOVED > +-udc.yaml*__;Iw!!NpxR!lKDMWE_W38KLY2gXH0dY1rG-bU4JwIyme_DMzeppYO9DQ1S > +wvXeID3RDEEuKBSG81_hsD5gntF_elZhC9yiXT-MvFA$ > +$schema: > +INVALID URI REMOVED > +aml*__;Iw!!NpxR!lKDMWE_W38KLY2gXH0dY1rG-bU4JwIyme_DMzeppYO9DQ1SwvXeID > +3RDEEuKBSG81_hsD5gntF_elZhC9yi3VX-gPg$ > + > +title: HPE GXP Gadget Universal Device Controller (UDC) > + > +maintainers: > + - Richard Yu <richard.yu@hpe.com> > + - Jean-Marie Verdun <verdun@hpe.com> > + - Nick Hawkins <nick.hawkins@hpe.com> > + > +properties: > + compatible: > + const: hpe,gxp-udc > + > + reg: > + maxItems: 1 > + > + interrupts: > + maxItems: 1 > + > + vdevnum: > + description: > + virtual device number. That's unusual property... Why numbering devices is part of DT (hardware description)? > + > + fepnum: > + description: > + number of the flexible end-points this device is needed. Similar question. BTW, if you end sentence with '.', it means it is an sentence, so you need to start it with capital letter. > + > + hpe,syscon-phandle: phandle is redudant. You need rather specific name, so "hpe,ehci-syscon" or whatever it is. > + $ref: '/schemas/types.yaml#/definitions/phandle' No quotes. > + description: > + Phandle to the gxp vEHCI controller access vDevice registers. Drop "Phandle to" Isn't "gxp" a GXP? > + > +required: > + - compatible > + - reg > + - interrupts > + - vdevnum > + - fepnum > + - hpe,syscon-phandle > + > +additionalProperties: false > + > +examples: > + - | > + udc@80401000 { Node name "usb", I think it is more popular for USB controllers. > + compatible = "hpe,gxp-udc"; > + reg = <0x80401000 0x1000>; > + interrupts = <13>; > + interrupt-parent = <&vic1>; > + vdevnum = <0>; > + fepnum = <7>; > + hpe,syscon-phandle = <&udc_system_controller>; > + }; Best regards, Krzysztof
On 04/11/2022 16:03, Yu, Richard wrote: > Hi Mr. Kozlowski, > > Thank you very much for your quick review and feedbacks. > > I will modify the patches based on your feedback accordingly. > > On this specific patch, you have questions on how we defined the device/gadget configurations: vdevnum and fepnum. > > Please see my answers following the questions: > >> + vdevnum: >> + description: >> + virtual device number. > > That's unusual property... Why numbering devices is part of DT (hardware description)? > >>> Richard: In HPE GXP virtual EHCI controller chipset, it can support up to 8 virtual devices(gadgets). Each device/gadget will be represented by a bit in 8 bits register. For example, the interrupt register bit 0 indicates the interrupt from device 0, bit 1 for device 1 ... so on. When an user defines a device/gadget, he/she can define the device number as between 0 and 7. Thus, the driver can up to the bit position. That is why we have numbering devices as port of DT. > >> + >> + fepnum: >> + description: >> + number of the flexible end-points this device is needed. > > Similar question. > >>> Richard: In HPE GXP virtual EHCI Controller chipset, there is a flexible EP pool. Each flexible EP has its own mapping register. The mapping register bit 0 to 3 is for device number (vdevnum) and bit 4 to 7 is for EP number inside the device. The device driver configures the mapping register to assign a flexible EP to a specific device. Here, "fepnum" is the input letting the driver know how many EP is needed for this device/gadget. > > Hope I have answered your questions on "vdevnum" and "fepnum". Unfortunately I don't see your answers... Or actually I am not sure what is the answer and what is not. What is unusual, you did not quote my email but quoted something else. Please send it again, but following normal mailing list netiquette for replies. Here is one: https://en.opensuse.org/openSUSE:Mailing_list_netiquette Just don't use corporate style of emails on mailing list. We usually cannot handle them... Best regards, Krzysztof
Hi Mr. Kozlowski, > > + > > + vdevnum: > > + description: > > + virtual device number. > That's unusual property... Why numbering devices is part of DT (hardware description)? In HPE GXP virtual EHCI controller chipset, it can support up to 8 virtual devices(gadgets). Each device/gadget will be represented by a bit in 8 bits register. For example, the interrupt register bit 0 indicates the interrupt from device 0, bit 1 for device 1 ... so on. When a user defines a device/gadget, he/she can define the device number as between 0 and 7. Thus, the driver can look up to the bit position. That is why we have numbering devices as part of DT. > > + > > + fepnum: > > + description: > > + number of the flexible end-points this device is needed. > Similar question. In HPE GXP virtual EHCI Controller chipset, there is a flexible End-Point(EP) pool. Each flexible EP has its own mapping register. The mapping register bit 0 to 3 is for device number (vdevnum) and bit 4 to 7 is for EP number inside the device. The device driver configures the mapping register to assign a flexible EP to a specific device. Here, "fepnum" is the input letting the driver know how many EPs are needed for this device/gadget. Thanks Richard.
On 07/11/2022 21:16, Yu, Richard wrote: > Hi Mr. Kozlowski, > >>> + >>> + vdevnum: >>> + description: >>> + virtual device number. > >> That's unusual property... Why numbering devices is part of DT (hardware description)? > > In HPE GXP virtual EHCI controller chipset, it can support up to 8 virtual devices(gadgets). Each device/gadget will be represented by a bit in 8 bits register. For example, the interrupt register bit 0 indicates the interrupt from device 0, bit 1 for device 1 ... so on. When a user defines a device/gadget, he/she can define the device number as between 0 and 7. Thus, the driver can look up to the bit position. That is why we have numbering devices as part of DT. Wrap your lines properly, it's impossible to reply in-line to such messages. Then how do you specify two devices? You allow here only one, right? Which bit in which register? Your devices have separate address space, so why they cannot poke the same register, right? Then just always set it to 0... I might miss here something but so far it looks to me like some hacky description matching the driver, not hardware, not existing bindings. > >>> + >>> + fepnum: >>> + description: >>> + number of the flexible end-points this device is needed. > >> Similar question. > > In HPE GXP virtual EHCI Controller chipset, there is a flexible End-Point(EP) pool. Each flexible EP has its own mapping register. The mapping register bit 0 to 3 is for device number (vdevnum) and bit 4 to 7 is for EP number inside the device. The device driver configures the mapping register to assign a flexible EP to a specific device. Here, "fepnum" is the input letting the driver know how many EPs are needed for this device/gadget. Nope. So you create here some weird IDs to poke into syscon register. First, syscon has offset if you need. You could treat it maybe as bits? I don't know... but even then your design is poor - two devices changing the same register. Even though it is sunchronized by regmap, it is conflicting, obfuscated access. Best regards, Krzysztof
Hi Mr. Kozlowski, Thank you very much for inputs. >>>> + >>>> + vdevnum: >>>> + description: >>>> + virtual device number. > >>> That's unusual property... Why numbering devices is part of DT (hardware description)? > >> In HPE GXP virtual EHCI controller chipset, it can support up to 8 >> virtual devices(gadgets). Each device/gadget will be represented by >> a bit in 8 bits register. For example, the interrupt register bit 0 >> indicates the interrupt from device 0, bit 1 for device 1 ... so on. >> When a user defines a device/gadget, he/she can define the device >> number as between 0 and 7. Thus, the driver can look up to the bit >> position. That is why we have numbering devices as part of DT. > Wrap your lines properly, it's impossible to reply in-line to such messages. Sorry for the improper wrapping. Hope the above fixed the problem. > Then how do you specify two devices? You allow here only one, right? In our current design, to specify two devices, we added the gadget structure into the device tree, such as gadget0:udc@80401000{}; gadget1:udc@80402000{};.... No, we can allow up to 8 devices by adding the gadget structure, such as gadget0:udc@80401000{}; gadget1:udc@80402000{};....gadget8:udc@80408000{}; > Which bit in which register? Your devices have separate address space, so why they cannot poke the same register, right? Then just always set it to 0... In HPE GXP vEHCI controller, there are three register groups: standard USB EHCI registers, virtual device global registers, and virtual device registers. Standard USB EHCI registers ---- We defined as "hpe,gxp-vudc" in the device tree (vuhc0) Virtual device global registers --- We defined as "hpe,gxp-udcg" Virtual device registers -- We defined as "hpe,gxp-udc" Each virtual device will have its own separate address space. There is only single address space for the virtual device global registers. The virtual device global registers are including vDevice Global Interrupt Status register(EVGISTAT), vDevice Global Interrupt Enable register(EVGIEN), vEHCI FlexEndpoint Mapping register (EVFEMAP) .... We need the vdevnum for the bit position in EVGISTAT and EVGIEN for each device. We write vdevnum into the EVFEMAP register to assign an EP to a specific device. > I might miss here something but so far it looks to me like some hacky description matching the driver, not hardware, not existing bindings. We create "vdevnum" as device configuration parameter due to our hardware need. >>>> + >>>> + fepnum: >>>> + description: >>> >+ number of the flexible end-points this device is needed. > > >> >Similar question. > > > >In HPE GXP virtual EHCI Controller chipset, there is a flexible End-Point(EP) pool. >>Each flexible EP has its own mapping register. The mapping register >>bit 0 to 3 is for device number (vdevnum) and bit 4 to 7 is for EP number inside the device. >>The device driver configures the mapping register to assign a flexible >>EP to a specific device. Here, "fepnum" is the input letting the >>driver know how many EPs are needed for this device/gadget. >Nope. So you create here some weird IDs to poke into syscon register. >First, syscon has offset if you need. You could treat it maybe as bits? >I don't know... but even then your design is poor - two devices >changing the same register. Even though it is sunchronized by regmap, it is conflicting, obfuscated access. The "fepnum" is the input parameter to define how many end-points (EPs) is needed for the device. You are correct that all devices need to access the virtual device global registers during the runtime. Thus, we create " hpe,syscon-phandle = <&udc_system_controller>;' for the driver getting the vDevice Global registers address. In our current chip registers layout with the vDevice Global registers, I don’t see a way to avoid "two devices changing the same register". Thank you very much for your time. Richard.
On 09/11/2022 04:37, Yu, Richard wrote: > Hi Mr. Kozlowski, > > Thank you very much for inputs. > >>>>> + >>>>> + vdevnum: >>>>> + description: >>>>> + virtual device number. >> >>>> That's unusual property... Why numbering devices is part of DT (hardware description)? >> >>> In HPE GXP virtual EHCI controller chipset, it can support up to 8 >>> virtual devices(gadgets). Each device/gadget will be represented by >>> a bit in 8 bits register. For example, the interrupt register bit 0 >>> indicates the interrupt from device 0, bit 1 for device 1 ... so on. >>> When a user defines a device/gadget, he/she can define the device >>> number as between 0 and 7. Thus, the driver can look up to the bit >>> position. That is why we have numbering devices as part of DT. > >> Wrap your lines properly, it's impossible to reply in-line to such messages. > > Sorry for the improper wrapping. Hope the above fixed the problem. > >> Then how do you specify two devices? You allow here only one, right? > > In our current design, to specify two devices, we added the gadget > structure into the device tree, such as gadget0:udc@80401000{}; gadget1:udc@80402000{};.... > > No, we can allow up to 8 devices by adding the gadget structure, > such as gadget0:udc@80401000{}; gadget1:udc@80402000{};....gadget8:udc@80408000{}; > >> Which bit in which register? Your devices have separate address space, so why they cannot poke the same register, right? Then just always set it to 0... > > In HPE GXP vEHCI controller, there are three register groups: standard USB EHCI registers, > virtual device global registers, and virtual device registers. > > Standard USB EHCI registers ---- We defined as "hpe,gxp-vudc" in the device tree (vuhc0) > Virtual device global registers --- We defined as "hpe,gxp-udcg" > Virtual device registers -- We defined as "hpe,gxp-udc" > > Each virtual device will have its own separate address space. > There is only single address space for the virtual device global registers. > > The virtual device global registers are including vDevice Global Interrupt Status register(EVGISTAT), > vDevice Global Interrupt Enable register(EVGIEN), vEHCI FlexEndpoint Mapping register (EVFEMAP) .... > We need the vdevnum for the bit position in EVGISTAT and EVGIEN for each device. > We write vdevnum into the EVFEMAP register to assign an EP to a specific device. > >> I might miss here something but so far it looks to me like some hacky description matching the driver, not hardware, not existing bindings. > > We create "vdevnum" as device configuration parameter due to our hardware need. That's not an argument... everything can be a "hardware need". > >>>>> + >>>>> + fepnum: >>>>> + description: >>>>> + number of the flexible end-points this device is needed. >>> >>>> Similar question. >>> >>> In HPE GXP virtual EHCI Controller chipset, there is a flexible End-Point(EP) pool. >>> Each flexible EP has its own mapping register. The mapping register >>> bit 0 to 3 is for device number (vdevnum) and bit 4 to 7 is for EP number inside the device. >>> The device driver configures the mapping register to assign a flexible >>> EP to a specific device. Here, "fepnum" is the input letting the >>> driver know how many EPs are needed for this device/gadget. > >> Nope. So you create here some weird IDs to poke into syscon register. >> First, syscon has offset if you need. You could treat it maybe as bits? >> I don't know... but even then your design is poor - two devices >> changing the same register. Even though it is sunchronized by regmap, it is conflicting, obfuscated access. > > The "fepnum" is the input parameter to define how many end-points (EPs) is needed > for the device. > > You are correct that all devices need to access the virtual > device global registers during the runtime. > Thus, we create " hpe,syscon-phandle = <&udc_system_controller>;' > for the driver getting the vDevice Global registers address. And how do you solve poking into the same register by two devices? Who owns it? You don't... > > In our current chip registers layout with the vDevice Global registers, I don’t see > a way to avoid "two devices changing the same register". I see at least an idea - create proper hierarchy, where parent device instantiates its children (thus knows and increments the IDs) and is responsible for proper handling of shared register (thus the parent owns the register). I understand why you created vdevnum/fepnum properties but the reason is not matching DT bindings. These are not additional hardware properties which deserve their own DT properties - they are already part of unit address and/or just incremented ID based on device number managed by a parent. Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml b/Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml new file mode 100644 index 000000000000..f1ec4df8c3d3 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/hpe,gxp-udc.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/hpe,gxp-udc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: HPE GXP Gadget Universal Device Controller (UDC) + +maintainers: + - Richard Yu <richard.yu@hpe.com> + - Jean-Marie Verdun <verdun@hpe.com> + - Nick Hawkins <nick.hawkins@hpe.com> + +properties: + compatible: + const: hpe,gxp-udc + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + vdevnum: + description: + virtual device number. + + fepnum: + description: + number of the flexible end-points this device is needed. + + hpe,syscon-phandle: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: + Phandle to the gxp vEHCI controller access vDevice registers. + +required: + - compatible + - reg + - interrupts + - vdevnum + - fepnum + - hpe,syscon-phandle + +additionalProperties: false + +examples: + - | + udc@80401000 { + compatible = "hpe,gxp-udc"; + reg = <0x80401000 0x1000>; + interrupts = <13>; + interrupt-parent = <&vic1>; + vdevnum = <0>; + fepnum = <7>; + hpe,syscon-phandle = <&udc_system_controller>; + };