From patchwork Mon May 15 06:25:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Looijmans X-Patchwork-Id: 13240833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59750C77B7D for ; Mon, 15 May 2023 06:25:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239690AbjEOGZf (ORCPT ); Mon, 15 May 2023 02:25:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239633AbjEOGZc (ORCPT ); Mon, 15 May 2023 02:25:32 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20623.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::623]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EE8526A8; Sun, 14 May 2023 23:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=topic.nl; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+IJUozzBV3ITTHoJunYUHYXDKWhVa9s20GQxi5ii0iE=; b=XijtSBbbKov+S8i3NiMkg5qTGC3qWLM7GyGMBjJB/9rojRwzcraHINXJACrfaRcDvIHc5f7WTw8NBsgCj2PZfIJLeVxJHweWVN+Hq1aOFu2fRCaC2PdJ/LcpfZPKxA7ikICgP4/k2daIETODV3OJUeIqhZ5uiSZPOo1MvuLXDGb4y7DUvmYT0gldniQqEfC6VIow3Se+LspqEx5EaSatjnrUnS/0gCEAf2xo3RWiS/NDtWAe3pclk8LiKtCDIZKsy5yvDP3x4pVg2K6qqvRjqdAoZIC7g98ACufw8+MZCCP59d37UztXbVDr6K8ovh3cjr6nKbU98wkZ41zKKVIdPQ== Received: from DB6PR0202CA0019.eurprd02.prod.outlook.com (2603:10a6:4:29::29) by AM8PR04MB7379.eurprd04.prod.outlook.com (2603:10a6:20b:1c4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Mon, 15 May 2023 06:25:14 +0000 Received: from DB5EUR01FT091.eop-EUR01.prod.protection.outlook.com (2603:10a6:4:29:cafe::ea) by DB6PR0202CA0019.outlook.office365.com (2603:10a6:4:29::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.29 via Frontend Transport; Mon, 15 May 2023 06:25:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 13.93.42.39) smtp.mailfrom=topicproducts.com; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=topic.nl; Received-SPF: Pass (protection.outlook.com: domain of topicproducts.com designates 13.93.42.39 as permitted sender) receiver=protection.outlook.com; client-ip=13.93.42.39; helo=westeu12-emailsignatures-cloud.codetwo.com; pr=C Received: from westeu12-emailsignatures-cloud.codetwo.com (13.93.42.39) by DB5EUR01FT091.mail.protection.outlook.com (10.152.5.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.29 via Frontend Transport; Mon, 15 May 2023 06:25:13 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (104.47.51.177) by westeu12-emailsignatures-cloud.codetwo.com with CodeTwo SMTP Server (TLS12) via SMTP; Mon, 15 May 2023 06:25:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fBaiM/WCXzU7azsk2z7MAsu1ZxtEhQVkRNFFiuqYR14ininV5ZRlcfKGQag2lZ0MXv9h9Vp/4tlOypaCGl1SpZUBL494NvIzWNkG4UaF4dxq4jWmvxizGzZs9GtiL+oBqq+XnkpRZpVyCz+HgxEiQD0js29g2Ysk5u1w3LBKcTVn/24nblF1w3GnAKpqg3bGk49B1YvOCADf6e4OFIodMtL1EphQQyrY/PmRVP70Fd23O3AmSp8f0Lh2b8tBrHNR3DXeRRkPgMAX9H76Vq6MRTXqDC38D3AKwuWi+N4YHC3NGCGaafAQ9cZ+yopSabA9Q4wTqgIL9nnMp4uJjpv/9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OIGSnjgWpwba90XCwWe82ADgDCq40CxnyXT241WntnE=; b=fr3F4EGuPpupWgKrfmJ8OphfsWSbfvY73lpmnlMon3UrKRT/U53LiWlNsq/Va1k8Omr4YCNXpUxJ6iIDLNHsTcHKj2SIwnS1IVAJVIJahNC2Pioqwj+XT4sQak/th5ZKOdyKg70kux3uY4+xYTauyLNr5CbRfF4NEjyB2r7W26v2lArKJSXHpTypnzYmVDSsAUA2/pMyXlRwshkRgY0XA0DYEI+TX9EYVV1QEUEmkgufzEKJTwQMfh/lhlYM7zjv8MNRbNt1P41J28AyeNof3JgkckWhiLvChyVLczhCLXm1K2Xf485smiFVW4KcSRpSSEPwVAcqg5r2+ISrZigIKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=topicproducts.com; dmarc=pass action=none header.from=topic.nl; dkim=pass header.d=topic.nl; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=topic.nl; Received: from DB8PR04MB6523.eurprd04.prod.outlook.com (2603:10a6:10:10f::26) by AM9PR04MB8795.eurprd04.prod.outlook.com (2603:10a6:20b:40a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Mon, 15 May 2023 06:25:09 +0000 Received: from DB8PR04MB6523.eurprd04.prod.outlook.com ([fe80::f4fa:8429:9de2:41c3]) by DB8PR04MB6523.eurprd04.prod.outlook.com ([fe80::f4fa:8429:9de2:41c3%6]) with mapi id 15.20.6387.030; Mon, 15 May 2023 06:25:09 +0000 From: Mike Looijmans To: devicetree@vger.kernel.org, linux-usb@vger.kernel.org CC: Mike Looijmans , Greg Kroah-Hartman , Krzysztof Kozlowski , Rob Herring , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] dt-bindings: usb: Add microchip USB5807 HUB Date: Mon, 15 May 2023 08:25:01 +0200 Message-ID: <20230515062502.29273-1-mike.looijmans@topic.nl> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: AM4PR07CA0005.eurprd07.prod.outlook.com (2603:10a6:205:1::18) To DB8PR04MB6523.eurprd04.prod.outlook.com (2603:10a6:10:10f::26) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB8PR04MB6523:EE_|AM9PR04MB8795:EE_|DB5EUR01FT091:EE_|AM8PR04MB7379:EE_ X-MS-Office365-Filtering-Correlation-Id: 674c377a-9796-4b20-fae4-08db550d249f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: hg0yo2QMBwEJCIzTA1hbyI8WWnVlZPqcDnQwvVWw6YBs3VXcJ2HxMOTu/w9q5jA9/YjKBBJAloMrxY92hiSfqYNb+nd3tY2MlXvirxvafkp54ygrVktofopz5rT9xO/P/BARz6yBaB39IpKXQljbngWKH3hRKFrdJGTi7la7aVX6kgar4OgFojj4KYx/wmXia5WdL9tc7oF175TXGLbyQiOqDoTWw2xhWWyZpuLv0jyGQI3XvYIMoo+3ZgFfhtREhTKbGAa1NC2VeFghv1xeA16Wlgz6GWrZTR7WL/klSs27OlwLE+c4/Vy/+UgQ08b0yp0RRVvDnmqlVk+fqbw1Ys63XeZ1jHsMyKmHEFnw7s1B4Mm6ruZFCmm6pG3Yj61hdSnTDDeoid00Rqce8f14OnzGKC0HlVd6h6WCWjN0ObepoXj/f570a1rx8BDLswaIzNmuNf3MOweZZI1GhSzPsZhlfiJJ7f8LW2pwHsnDm7mK8b2qguRYgqFH+Wpod48c+Li261KMtoTvHlZD0z4I6nM22XtMW+ihRZeuWrO78+VaC3cbysQRlUTTkY9ejKgUzqRw69fxAXfTHHGvVvqC9rXIEd0acbblvExHQbP9PNg= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB8PR04MB6523.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(396003)(136003)(366004)(39830400003)(451199021)(316002)(4326008)(66946007)(2906002)(5660300002)(44832011)(8936002)(8676002)(66476007)(66556008)(41300700001)(42882007)(54906003)(478600001)(2616005)(966005)(52116002)(36756003)(6666004)(6486002)(26005)(6512007)(1076003)(186003)(6506007)(83170400001)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8795 X-CodeTwo-MessageID: 05461389-e3ba-428d-9dd9-8afea7a2ce17.20230515062513@westeu12-emailsignatures-cloud.codetwo.com X-CodeTwoProcessed: true References: <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.f4f6ec47-9e6b-4978-b229-53520227ed28@emailsignatures365.codetwo.com> X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR01FT091.eop-EUR01.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: e18b0fc3-4138-4113-e9e0-08db550d21e7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7+Vp1piS8X/QO/wd22wnVS5Q8d3GnEjSU3RMERHgt7JY3bGQihIqQ8GUJ4X0ibt4FdycbVkNY0JE6Itd6ot6dagbKc/84d/oxucHtal2EHOz4UzBtnA3bd/fBj41VvbVMQROjK17Tlqvrau6thxj8NM2VxLggB5myXjds4njvIIuoJwMf7cDMicCt2Rxn9ZWEOi/WJ1q6byMcakG1Mdlfy/Pr5Vijysl1w4S4Qnux26WRbsuDSfeY7Rk7naFSQHSQtrVsrxjaldRcoh5YQ7OLir76K3dGffeMp4ed3CQZd+MqCiDMo1UNp/HK05B5y7XUUU37B3aOOhaKWxfFft9XTVnbdW56WbPEPCX+IyiifXG8vhnGa8rE9Gu3URIm1oAU5NKmyp0r3PpFVNu72E99NBAbq7XovxQE5W/emZrkq06tIUki6IUoiYT7MNT7rt/50sbf5QXeWQCEFgHCwwmIBU+kCBO1GZv+BZ1lIWkHrBNDpomJr62NRQpYv8vwzu2RMM2f7UfiHydyYQOnX5t0zpXfENWu3RSBTMFkmBfEsB+qdM+YRMOB+IQQ8uCbwvX7B4xw6MwcVo3WmvgLRIcEZAVsPuLVfgkRi8OCHDjLD3GTA0zANyljxl7Zye7hLwWhmNxubPAAshDJtEujUFWdbdo4x+d9HY1XGqlW51LD/8/5G4UTz6V1ChUnMvIJ5PI X-Forefront-Antispam-Report: CIP:13.93.42.39;CTRY:NL;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:westeu12-emailsignatures-cloud.codetwo.com;PTR:westeu12-emailsignatures-cloud.codetwo.com;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(396003)(136003)(39830400003)(451199021)(46966006)(36840700001)(316002)(4326008)(70586007)(70206006)(2906002)(5660300002)(44832011)(8936002)(8676002)(41300700001)(42882007)(54906003)(478600001)(2616005)(966005)(40480700001)(36756003)(6666004)(6486002)(26005)(6512007)(1076003)(186003)(15974865002)(6506007)(47076005)(336012)(36860700001)(7636003)(7596003)(356005)(83170400001)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: topic.nl X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2023 06:25:13.8894 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 674c377a-9796-4b20-fae4-08db550d249f X-MS-Exchange-CrossTenant-Id: 449607a5-3517-482d-8d16-41dd868cbda3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=449607a5-3517-482d-8d16-41dd868cbda3;Ip=[13.93.42.39];Helo=[westeu12-emailsignatures-cloud.codetwo.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT091.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7379 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The USB5807 is a 7-port USB 3.1 hub that can be configured by I2C. This driver resets the chip, optionally allows D+/D- lines to be swapped in the devicetree config, and then sends an ATTACH command to put the device in operational mode. Signed-off-by: Mike Looijmans --- Changes in v2: Rename to microchip,usb5807.yaml Remove reset-gpios description Add maxItems Add vddXX-supply properties .../bindings/usb/microchip,usb5807.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5807.yaml diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5807.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5807.yaml new file mode 100644 index 000000000000..ac5f1a959aae --- /dev/null +++ b/Documentation/devicetree/bindings/usb/microchip,usb5807.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/microchip,usb5807.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip USB 3.1 SuperSpeed Hub Controller + +maintainers: + - Mike Looijmans + +properties: + compatible: + enum: + - microchip,usb5807 + + reg: + maxItems: 1 + + reset-gpios: + maxItems: 1 + + vdd12-supply: + description: core power supply (1.2V) + + vdd33-supply: + description: main power supply (3.3V) + + swap-dx-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + maxItems: 8 + description: + Specifies the ports which will swap the differential-pair (D+/D-), + default is not-swapped. + +additionalProperties: false + +required: + - compatible + - reg + +examples: + - | + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + usb-hub@2d { + compatible = "microchip,usb5807"; + reg = <0x2d>; + reset-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + /* Swapped D+/D- on port 0 */ + swap-dx-lanes = <0>; + }; + }; From patchwork Mon May 15 06:25:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Looijmans X-Patchwork-Id: 13240834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C15E1C7EE2A for ; Mon, 15 May 2023 06:25:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239726AbjEOGZh (ORCPT ); Mon, 15 May 2023 02:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239320AbjEOGZc (ORCPT ); Mon, 15 May 2023 02:25:32 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2071.outbound.protection.outlook.com [40.107.14.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA7E2690; Sun, 14 May 2023 23:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=topic.nl; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6557tR+hHIlapExyQlMWrJH/UKBc/ErpmbvcWFXP7pE=; b=vEpqSxyIpU5Td+/0s0m1dG+KtXiiDgNxiITEG+i+kHElvt2yw5GWBIKVRUyVc3f7lT6Ek4x0qF4FAzYoyuJLqPFwvg8dlJfBRa9G51fRXaAjVV0g2ZG+VEMk+6DFZaCiTaovM49teYwkPreyHMIE5aAcYQv5Jr9hJPap9y1uC8jvlL1oOAXMYLx6Z3l6T3C5gE9dO+5dJqiTO+pNxUV9HnyVrbnulDSdb6MimJDKLw3rPg791TjEAGuBjSdXhKW9G0MjwVLSv/VFmSLmYojYsAk/n5/xsDRNlljRRpBnWEGLTI8ycSxNwPzufcEN09lpCKsLQaVYcPBQ7mzq9zhTQA== Received: from DB3PR06CA0007.eurprd06.prod.outlook.com (2603:10a6:8:1::20) by PAXPR04MB8109.eurprd04.prod.outlook.com (2603:10a6:102:1c2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Mon, 15 May 2023 06:25:15 +0000 Received: from DB5EUR01FT064.eop-EUR01.prod.protection.outlook.com (2603:10a6:8:1:cafe::f1) by DB3PR06CA0007.outlook.office365.com (2603:10a6:8:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30 via Frontend Transport; Mon, 15 May 2023 06:25:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 13.93.42.39) smtp.mailfrom=topicproducts.com; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=topic.nl; Received-SPF: Pass (protection.outlook.com: domain of topicproducts.com designates 13.93.42.39 as permitted sender) receiver=protection.outlook.com; client-ip=13.93.42.39; helo=westeu12-emailsignatures-cloud.codetwo.com; pr=C Received: from westeu12-emailsignatures-cloud.codetwo.com (13.93.42.39) by DB5EUR01FT064.mail.protection.outlook.com (10.152.5.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.25 via Frontend Transport; Mon, 15 May 2023 06:25:14 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (104.47.51.177) by westeu12-emailsignatures-cloud.codetwo.com with CodeTwo SMTP Server (TLS12) via SMTP; Mon, 15 May 2023 06:25:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C0z7jv0fhEmOsjtj75pnKRKJXL1eQ6Iy+CcZFCowu+Ff6yJrz8DfP0z5CIvNSVL9gQlsK2fbZZkOXmVcp77Jmr61AJrcvAq/nkUlW11ONXm7Vyf5LU0ufyrW3DXCviRuedVIxN1hNsfBYobfj2hHuHf6tamgFfGi1YIuMn7Avq5vf6XiBFBeNcXe/jzKDxs7hRhgg9lNy3duUk0+MOO4Y6K8ANdTVbnp8e0lAnS4QY/w28zeHJKJxQebHEJanRbS11m9lX1441h4ySTykHgvRrN1TArrjO40HPCTrwcB1Vtvo4xngWKJuNrbmf8yDy3RCn+3ggNaeGospkUaG3YAmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7GfSDL9NVZfDQCs0UoZLxZaJWDM2jvctnXHOTPUYylc=; b=KMCVncEvNL4z0mtZU9lTWl2VqmmXK6QV4Vl6GO09pmPHjXNslCXMPJ4wQE/VKxT7xRcuMXlJSd7x7qnkGqgof9pIDv46hwl4rWWK1V4XT4MCVXJPFtRDOU9w/xxghBsM2N3OGEnAmCRq/CrH6nHqL9y0KwIZfTRsJwXQpj+UeO+5p/EuxPUJO3iZnNATtD3trsekuDH1rcgdlBeM5R1j2b0rYZkym8705yOfx7dVuP2Bmnn0joAxhGcW3tAmO4REf/+ViBOn3QEEQdqQjeBVr96u5UWndAI8jKNdyWh7mmVrBhig7fIFNCmCPGyfoqQBPrnJR0N1Aa8RU6kAmOTdRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=topicproducts.com; dmarc=pass action=none header.from=topic.nl; dkim=pass header.d=topic.nl; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=topic.nl; Received: from DB8PR04MB6523.eurprd04.prod.outlook.com (2603:10a6:10:10f::26) by AM9PR04MB8795.eurprd04.prod.outlook.com (2603:10a6:20b:40a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Mon, 15 May 2023 06:25:10 +0000 Received: from DB8PR04MB6523.eurprd04.prod.outlook.com ([fe80::f4fa:8429:9de2:41c3]) by DB8PR04MB6523.eurprd04.prod.outlook.com ([fe80::f4fa:8429:9de2:41c3%6]) with mapi id 15.20.6387.030; Mon, 15 May 2023 06:25:10 +0000 From: Mike Looijmans To: devicetree@vger.kernel.org, linux-usb@vger.kernel.org CC: Mike Looijmans , Greg Kroah-Hartman , Jean Delvare , Lukas Bulwahn , Matthias Kaehlcke , Ravi Chandra Sadineni , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] usb: misc: usb5807: Add driver Date: Mon, 15 May 2023 08:25:02 +0200 Message-ID: <20230515062502.29273-2-mike.looijmans@topic.nl> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230515062502.29273-1-mike.looijmans@topic.nl> References: <20230515062502.29273-1-mike.looijmans@topic.nl> <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.10e3aa89-d7f2-4182-9838-42342e94a83d@emailsignatures365.codetwo.com> X-ClientProxiedBy: AM4PR07CA0005.eurprd07.prod.outlook.com (2603:10a6:205:1::18) To DB8PR04MB6523.eurprd04.prod.outlook.com (2603:10a6:10:10f::26) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB8PR04MB6523:EE_|AM9PR04MB8795:EE_|DB5EUR01FT064:EE_|PAXPR04MB8109:EE_ X-MS-Office365-Filtering-Correlation-Id: a13a646d-a02b-4352-f0f0-08db550d2524 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: BeQnt/17MtKYiO0c9ZoD5yki7Yx4NU6DhrT68L9fgaR2tUFLqHoDZNq/4wJSTto3TERodAlD2vueyMeNQI+lRp95HEAwuJZQYhYbZ3+lUROIDfRU7A3E+EdLB0kosfYFPzzb5R/cCvZcEpvyreJQ7wKWI2UqmIuifxql5EZNsURUzuIssBerIpLjSm0TUuyVCsgbYlT6UTpzyauWoCDkwdWTRS9ZmZZLD3dBjKguMy8jsuTW46BwvjZ7+9rb6Nna/2d3zJwGREnwxLDk08QkMclnTWlUByFT5zUf3cDCm9Q8D/ULIU0jBPYE79jeqYQ5tvFpD0gbfJLP/xA2zUUZdCX28pURsUo3xUCrYZ6prLdlmOzgXwPdfeTMO9Lsqe4PE+UBcu3MYlb/WKeB6l7ZzZOcKUXPjzak3fgSKTjrSC6GIrsssPbVuqG8+7oPgRK2DsDIdzTOo3wu9sqg5OzJVXTiZ5o8uoq62lIo284DRyTVjyj8Y+lYmwUsWIFplJUT4c7n7DoYOYmUJlzWzorPSE8eLY/krZqKLg/wMOIv9XYIZuL5+K/qw4WGeLQRmkzsSuRCQr+nQXhWeng8Cy/GT3393tWH3wU3iMaT1BvKdzXN+9owigLsVYOE3DMrzItx X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB8PR04MB6523.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(396003)(136003)(366004)(39830400003)(451199021)(316002)(4326008)(66946007)(2906002)(5660300002)(44832011)(8936002)(8676002)(66476007)(66556008)(41300700001)(42882007)(54906003)(478600001)(2616005)(52116002)(36756003)(6666004)(6486002)(26005)(6512007)(1076003)(186003)(6506007)(83380400001)(83170400001)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8795 X-CodeTwo-MessageID: 6cd021b1-1d54-4f88-b4ad-e5c65cfeaa9c.20230515062513@westeu12-emailsignatures-cloud.codetwo.com X-CodeTwoProcessed: true X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR01FT064.eop-EUR01.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4d299981-9816-43bd-464a-08db550d2247 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZQt18Zx2Q7gYapKgYgOrdPVGIOREES7e3pxajyAeogTLWyYwpoAtZ5P5OEHpFZaBYtXEKhrwU1CfoIRnHaoElbxwNdi7ddbX8vX+f/KT6Q8nxjCX9f8TFMwKgt2w4ISx13/uEG/ftc0XOxjeRg1pFmhHjhKpwW3gD9oXjTne6okWF16KFB46OaNu43MKAb7316YKIfbTbR78x8kr1yIbYufuVPy6MTA+nFPD5Hp6uWjLIwKYeVQEV6BjIWU0LVmKIHTKXzdseueo41obngB7Kas+NfAxjbxRJI8G7ba7GRB+OpEV6d0Bd3gYzm7jUOvQ5uTAziE1k30fbw1FN7bQBhLvSGtsawfY4aOPxT7p1egq8Np5jqe1Rfw/BBFsSCAi4//P7ZVUSPpSKjRsdhWree3N2EwLl9cSZBA4TuYJuFN72UXZ1Oe6nanXSyzTkYUwU8q1IWcpCEB1OnVy00iDUgBxhWe1dhmdUrKaQWlMuKB11tjM6z/lYyWmZn4IGmvdM1qi3/THsQzP0z6V22ui76mTek80IY5YtwzifHkpu1A/DIDW4UxfRvuPXmDYzbifZirCx0u87BbnvECnRG7aOgIeOGaHtviVLX+mlH3YBb1CzHZNXu3jlJ6DFj4KBNBfiCIjKGkzqK2mzgo0S/0/jVkix7835e8NVhjWu5o5FIjf2x03l2kezaNH1SCBD/1AD/8jwqFLq0p63L4UsBIK2g== X-Forefront-Antispam-Report: CIP:13.93.42.39;CTRY:NL;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:westeu12-emailsignatures-cloud.codetwo.com;PTR:westeu12-emailsignatures-cloud.codetwo.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(39830400003)(346002)(396003)(376002)(451199021)(46966006)(36840700001)(83170400001)(54906003)(478600001)(8676002)(8936002)(44832011)(5660300002)(2906002)(15974865002)(36756003)(82310400005)(4326008)(70206006)(70586007)(40480700001)(316002)(7596003)(356005)(7636003)(41300700001)(36860700001)(47076005)(186003)(2616005)(6512007)(6506007)(1076003)(83380400001)(26005)(336012)(42882007)(6486002)(6666004);DIR:OUT;SFP:1101; X-OriginatorOrg: topic.nl X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2023 06:25:14.7139 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a13a646d-a02b-4352-f0f0-08db550d2524 X-MS-Exchange-CrossTenant-Id: 449607a5-3517-482d-8d16-41dd868cbda3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=449607a5-3517-482d-8d16-41dd868cbda3;Ip=[13.93.42.39];Helo=[westeu12-emailsignatures-cloud.codetwo.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT064.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8109 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The USB5807 is a 7-port USB 3.1 hub that can be configured by I2C. This drivers resets the chip, optionally allows D+/D- lines to be swapped in the devicetree config, and then sends an ATTACH command to put the device in operational mode. Signed-off-by: Mike Looijmans --- Changes in v2: Add regulator support for vddXX supplies drivers/usb/misc/Kconfig | 9 ++ drivers/usb/misc/Makefile | 1 + drivers/usb/misc/usb5807.c | 184 +++++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 drivers/usb/misc/usb5807.c diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig index 99b15b77dfd5..6659e917ea26 100644 --- a/drivers/usb/misc/Kconfig +++ b/drivers/usb/misc/Kconfig @@ -251,6 +251,15 @@ config USB_EZUSB_FX2 Say Y here if you need EZUSB device support. (Cypress FX/FX2/FX2LP microcontrollers) +config USB_HUB_USB5807 + tristate "USB5807 Hub Controller Configuration Driver" + depends on I2C + help + This option enables support for configuration via SMBus of the + Microchip USB5807 USB 3.1 Hub Controller. Configuration parameters may + be set in devicetree. + Say Y or M here if you need to configure such a device via SMBus. + config USB_HUB_USB251XB tristate "USB251XB Hub Controller Configuration Driver" depends on I2C diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile index 1992cc284d8a..e827ed251fa5 100644 --- a/drivers/usb/misc/Makefile +++ b/drivers/usb/misc/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_USB_USS720) += uss720.o obj-$(CONFIG_USB_SEVSEG) += usbsevseg.o obj-$(CONFIG_USB_YUREX) += yurex.o obj-$(CONFIG_USB_HUB_USB251XB) += usb251xb.o +obj-$(CONFIG_USB_HUB_USB5807) += usb5807.o obj-$(CONFIG_USB_HSIC_USB3503) += usb3503.o obj-$(CONFIG_USB_HSIC_USB4604) += usb4604.o obj-$(CONFIG_USB_CHAOSKEY) += chaoskey.o diff --git a/drivers/usb/misc/usb5807.c b/drivers/usb/misc/usb5807.c new file mode 100644 index 000000000000..c617f3371fa1 --- /dev/null +++ b/drivers/usb/misc/usb5807.c @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for Microchip USB5807 USB 3.1 Hub + * Configuration via SMBus. + * + * Copyright (c) 2023 Topic Embedded Products + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define USB5807_CMD_ATTACH 0xAA55 +#define USB5807_CMD_CONFIG 0x9937 + +#define USB5807_REG_LANE_SWAP 0x30FA + +#define USB5807_NUM_PORTS 7 + + +static int usb5807_write(struct i2c_client *i2c, void *buf, u8 len) +{ + int ret; + struct i2c_msg msg = { + .addr = i2c->addr, + .flags = 0x0, + .len = len, + .buf = buf, + }; + + ret = i2c_transfer(i2c->adapter, &msg, 1); + return ret < 0 ? ret : 0; +} + +/* + * Send a command sequence, which is an I2C write transaction, with the command + * word in big endian and a terminating "0" byte. + */ +static int usb5807_command(struct i2c_client *i2c, u16 cmd) +{ + u8 buf[3] = {cmd >> 8, cmd & 0xff, 0}; + + return usb5807_write(i2c, buf, sizeof(buf)); +} + +static int usb5807_prepare_reg_u8(struct i2c_client *i2c, u16 reg, u8 value) +{ + u8 buf[] = { + 0x00, + 0x00, /* Memory offset */ + 1 + 4, /* Transaction size */ + 0x00, /* 0 = Register write operation */ + 1, /* Size of register data */ + (reg >> 8) & 0xff, + reg & 0xff, /* Register offset */ + value, /* Register data */ + 0 /* Terminating zero */ + }; + + return usb5807_write(i2c, buf, sizeof(buf)); +} + +/* + * Write an 8-bit register. First we must write the "set register" operation to + * the chip's internal memory at offset 0, then issue a command to execute said + * operation. + */ +static int usb5807_write_reg_u8(struct i2c_client *i2c, u16 reg, u8 value) +{ + int ret; + + ret = usb5807_prepare_reg_u8(i2c, reg, value); + if (ret) + return ret; + + return usb5807_command(i2c, USB5807_CMD_CONFIG); +} + +/* Decode array of port numbers property into bit mask */ +static u8 usb5807_get_ports_field(struct device *dev, const char *prop_name) +{ + struct property *prop; + const __be32 *p; + u32 port; + u8 result = 0; + + of_property_for_each_u32(dev->of_node, prop_name, prop, p, port) { + if (port < USB5807_NUM_PORTS) + result |= BIT(port); + else + dev_warn(dev, "%s: port %u doesn't exist\n", prop_name, + port); + } + return result; +} + +static int usb5807_i2c_probe(struct i2c_client *i2c) +{ + struct gpio_desc *reset_gpio; + int ret; + u8 val; + + /* Reset the chip to bring it into configuration mode */ + reset_gpio = devm_gpiod_get_optional(&i2c->dev, "reset", + GPIOD_OUT_HIGH); + if (IS_ERR(reset_gpio)) { + return dev_err_probe(&i2c->dev, PTR_ERR(reset_gpio), + "Failed to request reset GPIO\n"); + } + + /* Enable power supplies while chip is held in reset */ + ret = devm_regulator_get_enable(&i2c->dev, "vdd12"); + if (ret) + return ret; + + ret = devm_regulator_get_enable(&i2c->dev, "vdd33"); + if (ret) + return ret; + + /* Reset timing: Assert for >= 5 us */ + usleep_range(5, 10); + + /* Lock the bus for >= 1ms while the hub reads the I2C strapping */ + i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT); + + gpiod_set_value_cansleep(reset_gpio, 0); + usleep_range(1000, 2000); + + i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT); + + /* The hub device needs additional time to boot up */ + msleep(20); + + val = usb5807_get_ports_field(&i2c->dev, "swap-dx-lanes"); + if (val) { + ret = usb5807_write_reg_u8(i2c, USB5807_REG_LANE_SWAP, val); + if (ret < 0) + dev_err(&i2c->dev, "Failed writing config: %d\n", ret); + } + + /* + * Send the "Attach" command which makes the device disappear from the + * I2C bus and starts USB enumeration. + */ + ret = usb5807_command(i2c, USB5807_CMD_ATTACH); + if (ret) { + dev_err(&i2c->dev, "Failed sending ATTACH command: %d\n", ret); + return ret; + } + + return 0; +} + +static const struct of_device_id usb5807_of_match[] = { + { .compatible = "microchip,usb5807" }, + { } /* sentinel */ +}; +MODULE_DEVICE_TABLE(of, usb5807_of_match); + +static const struct i2c_device_id usb5807_id[] = { + { "usb5807", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(i2c, usb5807_id); + +static struct i2c_driver usb5807_i2c_driver = { + .driver = { + .name = "usb5807", + .of_match_table = of_match_ptr(usb5807_of_match), + }, + .probe_new = usb5807_i2c_probe, + .id_table = usb5807_id, +}; + +module_i2c_driver(usb5807_i2c_driver); + +MODULE_AUTHOR("Mike Looijmans "); +MODULE_DESCRIPTION("USB5807 USB 3.1 Hub Controller Driver"); +MODULE_LICENSE("GPL");