From patchwork Wed Sep 27 09:55:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomer Maimon X-Patchwork-Id: 13400573 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1CB6273E7; Wed, 27 Sep 2023 09:55:32 +0000 (UTC) Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01hn2216.outbound.protection.outlook.com [52.100.223.216]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EF9712A; Wed, 27 Sep 2023 02:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J6E7BsBMFw4DZG0yNrc54BUF8r/TZy2nj2IyUxUSy9wuhZX2CmPhKJZe89+wtyFfKav4WzWzyw6Vv6BkV6cOGeKdrAXC+0Ey26zNAk7FtTFCi8pnnCK4VTFsjgx4vmkTl15TRwk7E1G4aotH0dEpdL72+5WCEsbmAD5Yi21ccDt3YRftDDufUBDZSyTX3ZNpWFUFYqMrMTsVatSrp352PM0qOda4pJm+iyXEaqGjPwEFGt6+zFyTwavCmE741wARqG3p5sAhi80Az2TqggH53IZpV4gieBCCFeIMd6rQNnpj3D9EKjQM5dp45oIw4nOY+PJaf5Vc6lKNVHgnJjjeQw== 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=ha7N9+kxyJqPvCwXnGMv0DWCxgnCvthjbFMurCUrm2A=; b=GfD8f/wsmDfblYdZk/oVbQEcfzQDNYmQ/vSIHL5DZ+DJK8aKV6WYwNItkbHdyaSz+UcEDW1PN/Bi3MBtTpTY8F0jeHPD3A7SrquJgItFVxJ4IdR/uhiiNu9lVXLg7Qep0UWcilKuDvJkgAvK8O6UxEryo7eoDxt0wwJ9O8Bi8AIY2bxWp2ItmicYZos0CAvVn06XxN3E9PeftpRIVCyI5P5ZRka3fNKp+YRpLNFDeazBcbwZmWffh5YsyYZd6cVxJHZ84SkP1sYH2wS1WkQObQ/N2l3f6h1kquuT7rD0Yr6tjoJ4GYWsJvqmvspcMadAmUN/IZeS8IgaJnKHu2nUBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 175.98.123.7) smtp.rcpttodomain=gmail.com smtp.mailfrom=nuvoton.com; dmarc=fail (p=none sp=quarantine pct=100) action=none header.from=gmail.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuvoton.onmicrosoft.com; s=selector2-nuvoton-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ha7N9+kxyJqPvCwXnGMv0DWCxgnCvthjbFMurCUrm2A=; b=qYE6Zm8S1/h0X6N5CJV3HGBn7Zvkg7n1MIkvFiN/AjWPX37cpBDsEAcvP4w5bQE1CFwMpMMvisDboMmcZVUdDmZhaCET8/RwzMZpKdqVqH3ieaiK64AoiFmgFUDBhaVPSo8YfZ7KNinWhroN1Vc4wzoLk4RyEKLTrmx+IP9JIwk= Received: from SI2PR02CA0011.apcprd02.prod.outlook.com (2603:1096:4:194::20) by SEYPR03MB6434.apcprd03.prod.outlook.com (2603:1096:101:3e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Wed, 27 Sep 2023 09:55:27 +0000 Received: from SG1PEPF000082E7.apcprd02.prod.outlook.com (2603:1096:4:194:cafe::15) by SI2PR02CA0011.outlook.office365.com (2603:1096:4:194::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.21 via Frontend Transport; Wed, 27 Sep 2023 09:55:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 175.98.123.7) smtp.mailfrom=nuvoton.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=gmail.com; Received-SPF: Pass (protection.outlook.com: domain of nuvoton.com designates 175.98.123.7 as permitted sender) receiver=protection.outlook.com; client-ip=175.98.123.7; helo=NTHCCAS04.nuvoton.com; pr=C Received: from NTHCCAS04.nuvoton.com (175.98.123.7) by SG1PEPF000082E7.mail.protection.outlook.com (10.167.240.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.6838.14 via Frontend Transport; Wed, 27 Sep 2023 09:55:27 +0000 Received: from NTHCCAS02.nuvoton.com (10.1.9.121) by NTHCCAS04.nuvoton.com (10.1.8.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.14; Wed, 27 Sep 2023 17:55:13 +0800 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCCAS02.nuvoton.com (10.1.9.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 27 Sep 2023 17:55:12 +0800 Received: from taln60.nuvoton.co.il (10.191.1.180) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 27 Sep 2023 17:55:12 +0800 Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id AAA5364741; Wed, 27 Sep 2023 12:55:11 +0300 (IDT) From: Tomer Maimon To: , , , , , , , , , , , , CC: , , , , Tomer Maimon Subject: [PATCH v2 1/3] usb: chipidea: add CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS flag Date: Wed, 27 Sep 2023 12:55:07 +0300 Message-ID: <20230927095509.267029-2-tmaimon77@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230927095509.267029-1-tmaimon77@gmail.com> References: <20230927095509.267029-1-tmaimon77@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NotSetDelaration: True X-EOPAttributedMessage: 0 X-MS-Exchange-SkipListedInternetSender: ip=[175.98.123.7];domain=NTHCCAS04.nuvoton.com X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG1PEPF000082E7:EE_|SEYPR03MB6434:EE_ X-MS-Office365-Filtering-Correlation-Id: d21184d0-8e6d-4bab-4ff6-08dbbf3fe096 X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YOxmh0RF/rlgQD+mQ4D3cvbf0iFFnkxQbCUsixTdMOXmrJVqSpD9i2YacOajt/8b9lnlBeWw6EpQU5QAtn4hTEiY6eEpVMjfmCG4LIJ+bzHRXq72Yyu6dFm8/jCzrDKrrLo/WfCI6QOIkZt1I410Xd8p9Hc+UdBQHRIL6ELm9+Z/4nX/MYqWfLyTzAfWe7gRU0wuvegCDqLaLNAvwIz/kvwBUxMukkt6F32FZPQD8MBTZIf/LxZXD0C9U+yE2Z3OJyyVfGoEaSNpwwbbP/jpkZGv3wBrX5sVB2BlDCifl8UqWFLj78lao8KlP+XCzpPcm3dr/wkfE+0+x1tb5Jj7sjBdVaQoCaL1PgINyOLkldu3t0NN40Uevcnl445+MiLBqVGzpcFoA4k6NICflQOxK5FKS++xKp+pGsWpKFNohdjIhd7fy0fLzlHaaOJc3/e0XvrdgKqggSQgUrzYiAyi1Dcp2XZo3NVP5Tnra782ay8QyP+f5LeIAoB0Z/KIAcPSGSuvSw6Wm7jO+9Yf7H5t+C6gCqSzT39sX8dui/JKdWoIVNgThabYVPvlDKcr9A9cM5b+ekNjRrtfV8yganqDGk2CMICeH8wZ+ItTuJ2rVIshcvMpZyY93oe93eyTSJzo2E4NUd9+mTzz/EzUbR/YPw7UYnMeOlCxrW4JS9J8acwWIvKUrCsrGgIQWQGsw/t2EQKs3Q5EDwIsuYUdtQ5hShC+3ouE+HVs/uA8TvAiqmLsDYa68r/71ekVi0jng+4WuIziwsBgMm2jtXKOVTPx+qmmLXIYTdIQ3ICL9UWhhzM02u1+GMZ1jS9OS+tPxZmsFcoqlFRf9uNrsDhk3uK0wGeTw0ZQHfhIS735He3ROYVyHR0QIfKZgOZaZI82Fka8aChar+lPtAUPzOwvB9v+5QWO8R/FzmAguKYmCBrholvoo+qjVgW29A8jYTt3JmBKW9OP4rcnvYw/2iwB/V9KWzUZCqtrulb5O7sqXrF3mKw= X-Forefront-Antispam-Report: CIP:175.98.123.7;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:NTHCCAS04.nuvoton.com;PTR:175-98-123-7.static.tfn.net.tw;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(376002)(136003)(346002)(230922051799003)(61400799006)(5400799018)(186009)(451199024)(82310400011)(48200799006)(36840700001)(46966006)(40470700004)(55446002)(336012)(6266002)(83170400001)(6666004)(82740400003)(2616005)(81166007)(36860700001)(36756003)(83380400001)(921005)(34020700004)(26005)(47076005)(73392003)(1076003)(356005)(478600001)(82202003)(42882007)(70206006)(76482006)(110136005)(42186006)(70586007)(54906003)(2906002)(316002)(40480700001)(40460700003)(4326008)(7416002)(8676002)(5660300002)(8936002)(41300700001)(45356006)(35450700002)(84790400001)(12100799045);DIR:OUT;SFP:1501; X-OriginatorOrg: nuvoton.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2023 09:55:27.3286 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d21184d0-8e6d-4bab-4ff6-08dbbf3fe096 X-MS-Exchange-CrossTenant-Id: a3f24931-d403-4b4a-94f1-7d83ac638e07 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a3f24931-d403-4b4a-94f1-7d83ac638e07;Ip=[175.98.123.7];Helo=[NTHCCAS04.nuvoton.com] X-MS-Exchange-CrossTenant-AuthSource: SG1PEPF000082E7.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR03MB6434 X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Adding CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS flag to modify the vbus_active parameter to active in case the ChipIdea USB IP role is device-only and there is no otgsc register. Signed-off-by: Tomer Maimon Acked-by: Peter Chen --- drivers/usb/chipidea/otg.c | 5 ++++- include/linux/usb/chipidea.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index f5490f2a5b6b..647e98f4e351 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -130,8 +130,11 @@ enum ci_role ci_otg_role(struct ci_hdrc *ci) void ci_handle_vbus_change(struct ci_hdrc *ci) { - if (!ci->is_otg) + if (!ci->is_otg) { + if (ci->platdata->flags & CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS) + usb_gadget_vbus_connect(&ci->gadget); return; + } if (hw_read_otgsc(ci, OTGSC_BSV) && !ci->vbus_active) usb_gadget_vbus_connect(&ci->gadget); diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index 0b4f2d5faa08..5a7f96684ea2 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -64,6 +64,7 @@ struct ci_hdrc_platform_data { #define CI_HDRC_PMQOS BIT(15) #define CI_HDRC_PHY_VBUS_CONTROL BIT(16) #define CI_HDRC_HAS_PORTSC_PEC_MISSED BIT(17) +#define CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS BIT(18) enum usb_dr_mode dr_mode; #define CI_HDRC_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 From patchwork Wed Sep 27 09:55:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomer Maimon X-Patchwork-Id: 13400570 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3F521C6A5; Wed, 27 Sep 2023 09:55:25 +0000 (UTC) Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01hn2205.outbound.protection.outlook.com [52.100.0.205]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B134A192; Wed, 27 Sep 2023 02:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jx/1S+k3sAqeSe+zIg8hoxmP3Ensp2uY59Nv4+/iyBo9nOO4/tbMaBCPcwY+OKQEDtihGg/8h7aXSXFnvFEAWlIUzMsZJmZq11/Jcf928GMPpzYeaPBhcr5RvBja2PmbSDj/1HwO3HmVdz8Mfk/5Rcnc1N59MQtt7vzJSExThCbJeowuu2hprehZL9tjnhl4xrajx4Uq9CuQPPEHAEJo/W8UYmLPx1YtrEihmSeejg6ARX3s3488FktkJAu+yRJvTXK8KiIYpAtuNqwtq7TQtsfkVCJD7r3nBvNoDc5jpm0mGmzcHoHlqxyJz0H2Uy+Z5jIHodrq8c6X/T98+fj6ig== 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=HhbXqOJR79u+/b1TOeqh2Q568aPZn+33VQAaeCzrrDc=; b=b+uBEHisN2dfdzDvIMUGHYDrt0RjtWLsTa0kGGTsZc8Rr3sa70ppZdRAf647LdKa9cPn1/se4I8BfrPcIa3+53lrhB+s1qs7wkU5kMUn0XLOITmx5tgNi+JHJIeZ85M0Tqo5W3Dt9gb1tpnHOyWJY7CFz824XshGvEwtpbKOy46LDgb9/WbSUL1QrDMBNPHr9cb3UYT4Y0G/eBRtRA6VgqoL2qqnn5RBq5aLcyA1A1EZiG9Ot2ysimLT7rRlxybOHhuzzODecmImk4+9WE7R3SOEyLEQEqW1qsXzR8dPIR1sUy6DbayI6a4y4Pq12jcjh0JXJ0z5UKb1Zzaee/Bx/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 211.75.126.7) smtp.rcpttodomain=gmail.com smtp.mailfrom=nuvoton.com; dmarc=fail (p=none sp=quarantine pct=100) action=none header.from=gmail.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuvoton.onmicrosoft.com; s=selector2-nuvoton-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HhbXqOJR79u+/b1TOeqh2Q568aPZn+33VQAaeCzrrDc=; b=jpvxniJfpFXimsLfsfqV99ypiuab344h75LT4ylsrJAjpBPf1NHU7mn1C/xUCfG9pxhDjzrXDuvTBL5qspJDiJ9haSDuLAl6cfaDM3e0fTPfVhfPZ/XTk7kiAHz9eD+/bC2QuOz/aHec9eCtESEhP3Xxq2tvX8ulyUDvc1vvOkQ= Received: from SG2PR02CA0101.apcprd02.prod.outlook.com (2603:1096:4:92::17) by TYZPR03MB6599.apcprd03.prod.outlook.com (2603:1096:400:1fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.24; Wed, 27 Sep 2023 09:55:18 +0000 Received: from SG2PEPF000B66C9.apcprd03.prod.outlook.com (2603:1096:4:92:cafe::44) by SG2PR02CA0101.outlook.office365.com (2603:1096:4:92::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.35 via Frontend Transport; Wed, 27 Sep 2023 09:55:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 211.75.126.7) smtp.mailfrom=nuvoton.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=gmail.com; Received-SPF: Pass (protection.outlook.com: domain of nuvoton.com designates 211.75.126.7 as permitted sender) receiver=protection.outlook.com; client-ip=211.75.126.7; helo=NTHCCAS01.nuvoton.com; pr=C Received: from NTHCCAS01.nuvoton.com (211.75.126.7) by SG2PEPF000B66C9.mail.protection.outlook.com (10.167.240.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Wed, 27 Sep 2023 09:55:18 +0000 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 27 Sep 2023 17:55:13 +0800 Received: from taln60.nuvoton.co.il (10.191.1.180) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 27 Sep 2023 17:55:12 +0800 Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 31D0864742; Wed, 27 Sep 2023 12:55:12 +0300 (IDT) From: Tomer Maimon To: , , , , , , , , , , , , CC: , , , , Tomer Maimon Subject: [PATCH v2 2/3] dt-bindings: usb: ci-hdrc-usb2: add npcm750 and npcm845 compatible Date: Wed, 27 Sep 2023 12:55:08 +0300 Message-ID: <20230927095509.267029-3-tmaimon77@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230927095509.267029-1-tmaimon77@gmail.com> References: <20230927095509.267029-1-tmaimon77@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NotSetDelaration: True X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PEPF000B66C9:EE_|TYZPR03MB6599:EE_ X-MS-Office365-Filtering-Correlation-Id: fe94630f-2eec-400b-662a-08dbbf3fdb18 X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KPKbSaOHBa59HKsAcPDl8arkaDhU7uC1l2yrwOAMaa8j9dJpGtm40kepbTwIfexkNTfdevV9G8jg/09WQvOkcz1CQR/r+JKbpEDojbfVayVT1hFQfYhbFXDwQjPtt3agX5sfIo6wTvS3+B6bs0RQgX+tKwrWl+3EoeyM7NA6EcdCVq3lDhzi9k/dAM5/uwy2wt7FB9keBwtTh6oW/yCdg6sWn+ugAruzOcmIxeYlHbHslBR6AjGGWjZ+IzLn2cUSCSEoS/tRaTUV7YhpzQU/w7TZ4IWBXXaVcwJouCAwjhJ9ccCn0IsJrtnV1nY901Wwz0KBzxIy/SM0B7djW+/lYriGfuaHYWgbo+AtgOV2I/fVEiVUSniN0QrnQggWL9Hhxm1LA7d50lDsg8Xz7K3fbX08IjumETic4IR+2P8guznDKulOg5yZ/96RKWrioIBIQ/XbMtlhTm148GC9xYhdNG+bb2pDZ9YVkgF5mm36ym6xKoR/L80WxqVQJOZqFF2FjaegR3HEh8c5hPYW18KjGfRq09JNCZZtxlwyYcmzjv5NIfP6D1xiLvxMqSPEBCc164OZD8GoQSRh+kEpmgDHFmbXUzyugYaNPkJ84kAVQb1k237Txs06qaiGQX4O84L/Y5sKr2FunMY3+W9liJlnxbRWdGQmY88o3miQOm1+l/PK0mMYCJwypm4nhTyyRNaz2hDcxzDHehNszaepUavD7Yhc7ne3pXtS+YouRO2q1g6EnkJ1hdtbbU7ACrk1wf5AuYRNwxks39+NGBnqLvlvVcyStXQh+rddg4v6a1/ansUTagUR1c6w4afSoGyr6HXxky+GNkn81h2yBL6wBTvSTlFj2cB3SriIDWRWyVu5Dfybs8+O8mgD33PiyBxb/a0mYbhFI9QOjPqCRDqgesdK8Nwg/vgUrHJVmMJ9T6fhoYMsi4b8s9AM6OA04D0OEyfo8DKLgQtK1YQFD9IjUl308kUmqUxHhRYPydP4uwF/Ul0= X-Forefront-Antispam-Report: CIP:211.75.126.7;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:NTHCCAS01.nuvoton.com;PTR:211-75-126-7.hinet-ip.hinet.net;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(82310400011)(5400799018)(451199024)(186009)(48200799006)(61400799006)(36840700001)(40470700004)(46966006)(4744005)(40460700003)(73392003)(6266002)(1076003)(5660300002)(4326008)(54906003)(110136005)(36756003)(82202003)(40480700001)(70206006)(316002)(41300700001)(2906002)(7416002)(8936002)(81166007)(42882007)(70586007)(356005)(26005)(6666004)(83170400001)(76482006)(336012)(42186006)(47076005)(55446002)(478600001)(921005)(34020700004)(2616005)(82740400003)(36860700001)(8676002)(45356006)(35450700002)(84790400001)(12100799045);DIR:OUT;SFP:1501; X-OriginatorOrg: nuvoton.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2023 09:55:18.1461 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe94630f-2eec-400b-662a-08dbbf3fdb18 X-MS-Exchange-CrossTenant-Id: a3f24931-d403-4b4a-94f1-7d83ac638e07 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a3f24931-d403-4b4a-94f1-7d83ac638e07;Ip=[211.75.126.7];Helo=[NTHCCAS01.nuvoton.com] X-MS-Exchange-CrossTenant-AuthSource: SG2PEPF000B66C9.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR03MB6599 X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add a compatible string for Nuvoton BMC NPCM750 and Nuvoton BMC NPCM845. Signed-off-by: Tomer Maimon --- Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml index 1394557517b1..a9e173432002 100644 --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml @@ -16,6 +16,8 @@ properties: - enum: - chipidea,usb2 - lsi,zevio-usb + - nuvoton,npcm750-udc + - nuvoton,npcm845-udc - nvidia,tegra20-ehci - nvidia,tegra20-udc - nvidia,tegra30-ehci @@ -388,6 +390,8 @@ allOf: enum: - chipidea,usb2 - lsi,zevio-usb + - nuvoton,npcm750-udc + - nuvoton,npcm845-udc - nvidia,tegra20-udc - nvidia,tegra30-udc - nvidia,tegra114-udc From patchwork Wed Sep 27 09:55:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomer Maimon X-Patchwork-Id: 13400571 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25AE91401F; Wed, 27 Sep 2023 09:55:26 +0000 (UTC) Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01hn2246.outbound.protection.outlook.com [52.100.223.246]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6D013A; Wed, 27 Sep 2023 02:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mMGxEXVhz16r/2LW+d6g7XBljXbziIqrYpS3lTLis70sVjX5sCtg86CuX6uHwpgfV6j+849QitwKvHOCdcVF2FLB1MavuLRrN8pTMb0HjPbG8rRigvKpGgEapSgQczg6dkAjFt+YkONgXa32dmzrHxV9YIf0Oo+5wMz2glL2vh0rrFSv1QLMYWZaqJFZjz4GJ112HkKKIyRV5COR+8p+U0Zo2IUyH8gMcBvns6PAdIiKCrfW1Q65nbOseh2QK9zDfZqBYpALr5nHSFMReSw2gbiUJ8OSmYSp7tYxlMaCX1l97ome57omTBxy+2yepHu9FV/1O6yRet1gJCNQf7aIvQ== 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=fl1VxRhdRvz/y2QkA9nIu8cIMgWvkU4Lt6YJykCjsSw=; b=jqesLbuyvXlpKsYGjaVJ0vhTiZSARnHKbtfHUvESNWDT9IK9pE73ceXxu5SQWDPw3BipHNaakz9glWjiEFfA+lUhWyRDuGSY64hQLHPQ+9JuUC1ZKmHj54BroCNDtiZxZVuxw87aqAlvbsxFJ9rSX9eteYW19vwT5b9ddXo5EMbzeIIKk4DdZXFBrAWK3enD9bjEikuKWUeUuLTGacBRkMJJEoyb/qjuvJUuCyndzZOrOr4x80TL4OWeJJlAH23lffy5dTGmS2Fzoh3JaSMhVoggB4N+c9tmB4r2WPOeXHtKT/1RUnOFYGtfBUmYAlmBzrfZSUeeZFmRJrFhTeI1iA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 211.75.126.7) smtp.rcpttodomain=gmail.com smtp.mailfrom=nuvoton.com; dmarc=fail (p=none sp=quarantine pct=100) action=none header.from=gmail.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuvoton.onmicrosoft.com; s=selector2-nuvoton-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fl1VxRhdRvz/y2QkA9nIu8cIMgWvkU4Lt6YJykCjsSw=; b=fV0tOQ484KNlMoQDcZVjUC6MY9ENnOSSVGil0uNFlai0c69Q/Gc1FcXD6L0xt+fOeTjI2ueJxAOb4sMdoFug6FSjNtS+U8/V6dbq7G/VYszfvTEnvAkJcxnFnyzTyVVOMaskX6ItHc1nFsgBf3N9oR1AK1utlrLwrcwNQfLn6dw= Received: from SG2PR02CA0107.apcprd02.prod.outlook.com (2603:1096:4:92::23) by SI2PR03MB5579.apcprd03.prod.outlook.com (2603:1096:4:12d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Wed, 27 Sep 2023 09:55:19 +0000 Received: from SG2PEPF000B66C9.apcprd03.prod.outlook.com (2603:1096:4:92:cafe::75) by SG2PR02CA0107.outlook.office365.com (2603:1096:4:92::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.35 via Frontend Transport; Wed, 27 Sep 2023 09:55:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 211.75.126.7) smtp.mailfrom=nuvoton.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=gmail.com; Received-SPF: Pass (protection.outlook.com: domain of nuvoton.com designates 211.75.126.7 as permitted sender) receiver=protection.outlook.com; client-ip=211.75.126.7; helo=NTHCCAS01.nuvoton.com; pr=C Received: from NTHCCAS01.nuvoton.com (211.75.126.7) by SG2PEPF000B66C9.mail.protection.outlook.com (10.167.240.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Wed, 27 Sep 2023 09:55:18 +0000 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 27 Sep 2023 17:55:13 +0800 Received: from taln60.nuvoton.co.il (10.191.1.180) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 27 Sep 2023 17:55:13 +0800 Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 8E17864740; Wed, 27 Sep 2023 12:55:12 +0300 (IDT) From: Tomer Maimon To: , , , , , , , , , , , , CC: , , , , Tomer Maimon Subject: [PATCH v2 3/3] usb: chipidea: Add support for NPCM Date: Wed, 27 Sep 2023 12:55:09 +0300 Message-ID: <20230927095509.267029-4-tmaimon77@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230927095509.267029-1-tmaimon77@gmail.com> References: <20230927095509.267029-1-tmaimon77@gmail.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NotSetDelaration: True X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PEPF000B66C9:EE_|SI2PR03MB5579:EE_ X-MS-Office365-Filtering-Correlation-Id: 485a96b0-d541-4bbe-1282-08dbbf3fdb86 X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uKGEUaE15Vo1B9YV5v3t18EmQBDDumsGxU5XI4RjwxjZc2XCo1TvrVqHb8GJOOyo+gFRexEFiNqvGVwd5yP7V3i9AMvi6SCzcgF+qR3QHQHY9VsvN1hNDxie0d23KGP40D5rW0Gk4VHHv8wc0dn/Lt+1uIpTF/Xf9a9Q5AP3ucrrqV9Nbut9eBRX6k+YNPAk1KkR54rvBTTQOkm/qDIYatPV9amc2dI4LpyFJ7ZgKrSuszOeGjSh+rzqIJcBkOPKujHXgfvMEN9W0z0NKuPuxs7RH1r4OO2DSZjBUEb5DES1gqmXVk+IbsCeV7TKGjVzyu5blxYl/K5A8cQOws4zUj1J4Y2M5BqvmLUEaP+DbGMzNx9udmXYDJ7w6fPGkpId8fJYnbgZ6nDpjywbYsaYgBEjbY2qoOAbWLVwijkAZRgC9f2idNGD90hp2KOaexO9l8jyIM02biyxkmamLCaoGLsYMY88CLxMzYaht3WM/OMClsAzUk5GhW8gjSNvuaoWAftF/H10irkzrbsiN0tue8M86jSQwsT0fUcuIzUprBju+nLxN4GaZXu7u/PpstKW3QBYPQMftl2WuXPndLN8xUDzaLuu32jaBUYF1PLAJRfJ73ek89Yh8VTi3uuBupkhTunAXJs3SzTa1Mn6tGl4xF/7WDtXAYrwOYISJjt5ysNhdaQZCZ9+gCXJu8xloUGOIi5Dz3/glDm39xh3Lh9L75YCpK3yThHo7wm7/x0hZ2h/iMpviIX05iQSk7/uPUUVN3Q4Cjds3kT7EjFJ7k4S3Ww19dvSf2kF2oo6ver3pYroQM1vx5SUkhjSbvqs3XEquUHArWjrBuY4jXcuFDhpfRKc2R462Vhl44R7dovf1RBS5vL5hgxUnJM4eyGSVC20AffU4tbzvUkr+M+ZyQ3aj00EP5jmSa14tRzftmBLbhD5MPzACILEUmXL0cR8W2fcG3YHJ3/x4xeu3x14BB9jcF/Hp7dHmZY/Et1psL9rXV4= X-Forefront-Antispam-Report: CIP:211.75.126.7;CTRY:TW;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:NTHCCAS01.nuvoton.com;PTR:211-75-126-7.hinet-ip.hinet.net;CAT:NONE;SFS:(13230031)(4636009)(396003)(346002)(376002)(39860400002)(136003)(230922051799003)(82310400011)(186009)(451199024)(5400799018)(48200799006)(61400799006)(36840700001)(46966006)(40470700004)(8676002)(6266002)(4326008)(336012)(5660300002)(70206006)(70586007)(8936002)(73392003)(26005)(42882007)(110136005)(83380400001)(82202003)(40460700003)(1076003)(54906003)(2616005)(478600001)(42186006)(7416002)(40480700001)(316002)(55446002)(36860700001)(41300700001)(34020700004)(83170400001)(2906002)(81166007)(82740400003)(921005)(6666004)(47076005)(76482006)(36756003)(356005)(45356006)(35450700002)(84790400001)(12100799045);DIR:OUT;SFP:1501; X-OriginatorOrg: nuvoton.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2023 09:55:18.8648 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 485a96b0-d541-4bbe-1282-08dbbf3fdb86 X-MS-Exchange-CrossTenant-Id: a3f24931-d403-4b4a-94f1-7d83ac638e07 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a3f24931-d403-4b4a-94f1-7d83ac638e07;Ip=[211.75.126.7];Helo=[NTHCCAS01.nuvoton.com] X-MS-Exchange-CrossTenant-AuthSource: SG2PEPF000B66C9.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR03MB5579 X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add Nuvoton NPCM BMC SoCs support to USB ChipIdea driver. NPCM SoC include ChipIdea IP block that used for USB device controller mode. Signed-off-by: Tomer Maimon Acked-by: Peter Chen --- drivers/usb/chipidea/Kconfig | 4 + drivers/usb/chipidea/Makefile | 1 + drivers/usb/chipidea/ci_hdrc_npcm.c | 117 ++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 drivers/usb/chipidea/ci_hdrc_npcm.c diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig index c815824a0b2d..bab45bc62361 100644 --- a/drivers/usb/chipidea/Kconfig +++ b/drivers/usb/chipidea/Kconfig @@ -43,6 +43,10 @@ config USB_CHIPIDEA_MSM tristate "Enable MSM hsusb glue driver" if EXPERT default USB_CHIPIDEA +config USB_CHIPIDEA_NPCM + tristate "Enable NPCM hsusb glue driver" if EXPERT + default USB_CHIPIDEA + config USB_CHIPIDEA_IMX tristate "Enable i.MX USB glue driver" if EXPERT depends on OF diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile index 71afeab97e83..718cb24603dd 100644 --- a/drivers/usb/chipidea/Makefile +++ b/drivers/usb/chipidea/Makefile @@ -13,6 +13,7 @@ ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o obj-$(CONFIG_USB_CHIPIDEA_GENERIC) += ci_hdrc_usb2.o obj-$(CONFIG_USB_CHIPIDEA_MSM) += ci_hdrc_msm.o +obj-$(CONFIG_USB_CHIPIDEA_NPCM) += ci_hdrc_npcm.o obj-$(CONFIG_USB_CHIPIDEA_PCI) += ci_hdrc_pci.o obj-$(CONFIG_USB_CHIPIDEA_IMX) += usbmisc_imx.o ci_hdrc_imx.o obj-$(CONFIG_USB_CHIPIDEA_TEGRA) += ci_hdrc_tegra.o diff --git a/drivers/usb/chipidea/ci_hdrc_npcm.c b/drivers/usb/chipidea/ci_hdrc_npcm.c new file mode 100644 index 000000000000..4169855e7940 --- /dev/null +++ b/drivers/usb/chipidea/ci_hdrc_npcm.c @@ -0,0 +1,117 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2023 Nuvoton Technology corporation. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ci.h" + +struct npcm_udc_data { + struct platform_device *ci; + struct clk *core_clk; + struct ci_hdrc_platform_data pdata; +}; + +static int npcm_udc_notify_event(struct ci_hdrc *ci, unsigned event) +{ + struct device *dev = ci->dev->parent; + + switch (event) { + case CI_HDRC_CONTROLLER_RESET_EVENT: + /* clear all mode bits */ + hw_write(ci, OP_USBMODE, 0xffffffff, 0x0); + break; + default: + dev_dbg(dev, "unknown ci_hdrc event\n"); + break; + } + + return 0; +} + +static int npcm_udc_probe(struct platform_device *pdev) +{ + int ret; + struct npcm_udc_data *ci; + struct platform_device *plat_ci; + struct device *dev = &pdev->dev; + + ci = devm_kzalloc(&pdev->dev, sizeof(*ci), GFP_KERNEL); + if (!ci) + return -ENOMEM; + platform_set_drvdata(pdev, ci); + + ci->core_clk = devm_clk_get_optional(dev, NULL); + if (IS_ERR(ci->core_clk)) + return PTR_ERR(ci->core_clk); + + ret = clk_prepare_enable(ci->core_clk); + if (ret) { + dev_err(dev, "failed to enable the clock: %d\n", ret); + return ret; + } + + ci->pdata.name = dev_name(dev); + ci->pdata.capoffset = DEF_CAPOFFSET; + ci->pdata.flags = CI_HDRC_REQUIRES_ALIGNED_DMA | + CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS; + ci->pdata.phy_mode = USBPHY_INTERFACE_MODE_UTMI; + ci->pdata.notify_event = npcm_udc_notify_event; + + plat_ci = ci_hdrc_add_device(dev, pdev->resource, pdev->num_resources, + &ci->pdata); + if (IS_ERR(plat_ci)) { + ret = PTR_ERR(plat_ci); + dev_err(dev, "failed to register HDRC NPCM device: %d\n", ret); + goto clk_err; + } + + pm_runtime_no_callbacks(dev); + pm_runtime_enable(dev); + + return 0; + +clk_err: + clk_disable_unprepare(ci->core_clk); + return ret; +} + +static int npcm_udc_remove(struct platform_device *pdev) +{ + struct npcm_udc_data *ci = platform_get_drvdata(pdev); + + pm_runtime_disable(&pdev->dev); + ci_hdrc_remove_device(ci->ci); + clk_disable_unprepare(ci->core_clk); + + return 0; +} + +static const struct of_device_id npcm_udc_dt_match[] = { + { .compatible = "nuvoton,npcm750-udc", }, + { .compatible = "nuvoton,npcm845-udc", }, + { } +}; +MODULE_DEVICE_TABLE(of, npcm_udc_dt_match); + +static struct platform_driver npcm_udc_driver = { + .probe = npcm_udc_probe, + .remove = npcm_udc_remove, + .driver = { + .name = "npcm_udc", + .of_match_table = npcm_udc_dt_match, + }, +}; + +module_platform_driver(npcm_udc_driver); + +MODULE_DESCRIPTION("NPCM USB device controller driver"); +MODULE_AUTHOR("Tomer Maimon "); +MODULE_ALIAS("platform:npcm-udc"); +MODULE_LICENSE("GPL v2");