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: 145468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2758609vqu; Wed, 27 Sep 2023 09:45:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNAV6ynU7AnDh8k0Ja0PmAF/b9uTzHXGS+0i1ZsWxsDmujbCLVizZRgm80vICV4OLCM+Kh X-Received: by 2002:a17:903:1c1:b0:1c5:bea4:8537 with SMTP id e1-20020a17090301c100b001c5bea48537mr2012360plh.15.1695833136661; Wed, 27 Sep 2023 09:45:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695833136; cv=pass; d=google.com; s=arc-20160816; b=oH1K5GVkVOWtVQKPRM3JLNaDyWk8kviKt3lgAF1pOZtxtGiGgwTj3tAjvG3cI0T7Sq u918NtgM59677wcrjeg+ztOonUKp0ZdKxVEsRpF2+xnkwM5xSd9y/wadADjzjQ5aGsYX L1sWK0xdRATeRo28/4y3g1jdWdeQhDcfZC001qNU4/Io/iSOlvBV0lTNndOZZuowDLxE UYC1GKaM3s40IkyY/AkOqsvLCtI0rKPaIurUWYshGXfD91f1DzfYJsttyVkWd9dysKV9 Xa3GAkuAaOjDQDUK+1aJDhNc59Da1Ye4GqY/kctMEoSLzKgwDR2sJlJ/71TF0ntlPRuV w+aw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ha7N9+kxyJqPvCwXnGMv0DWCxgnCvthjbFMurCUrm2A=; fh=S2Yd6ZWf4PE3UWmHWDKlbLbWMSMC5tewAeJBwAWxIdQ=; b=BH83zjDIb42SSkUIRp2XTSSUniBaaXedMueBO28tMiYGutgykbSSzqC0w9pSuYIzcr DGAftiAm2YgRcul13SMIB2LfhRnM5ZZfU4kIEYY0AHil27CuFFEq3lYh4fpdk8aHJxDr rQ5sm9BK1kK8Eaa5I3VAmEzyVvpK5SAv4Bq+sUwqo66mT94reCysB2MWxhCxEcMRm1qI 56Cmmw5u0gMpcOa4+J3obRXCHemisqpnYpTcIRkDPZmZbIoL6msLwh9w0E8wBCmn2+nF wlkyaX0/HJLyK88DtL6o5seoUoxnwrOJf6WN1UZpD+pfZIzCjbhT+iBb+sB4JBAsuN59 /j0w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nuvoton.onmicrosoft.com header.s=selector2-nuvoton-onmicrosoft-com header.b=qYE6Zm8S; arc=pass (i=1 spf=pass spfdomain=nuvoton.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id q7-20020a170902dac700b001c60c109ce7si10947503plx.295.2023.09.27.09.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 09:45:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@nuvoton.onmicrosoft.com header.s=selector2-nuvoton-onmicrosoft-com header.b=qYE6Zm8S; arc=pass (i=1 spf=pass spfdomain=nuvoton.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6AC9D809692E; Wed, 27 Sep 2023 02:56:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231169AbjI0Jzo (ORCPT + 22 others); Wed, 27 Sep 2023 05:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbjI0Jzc (ORCPT ); Wed, 27 Sep 2023 05:55:32 -0400 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> 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=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 27 Sep 2023 02:56:04 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778209927245597457 X-GMAIL-MSGID: 1778209927245597457 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