Received: by 10.192.165.148 with SMTP id m20csp389296imm; Fri, 20 Apr 2018 00:32:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+leWpzH2xgvxaRR078xDTY/MKds8PGqpSDWyb7PZfZklwtXOw/4yzsr1zPPTcM2Hq8gCoC X-Received: by 2002:a17:902:1025:: with SMTP id b34-v6mr9187756pla.324.1524209535644; Fri, 20 Apr 2018 00:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524209535; cv=none; d=google.com; s=arc-20160816; b=qsVizow6EXI5VZVmrwzeLkiQCEsCcTt+jX9E5s+54Xn+UIwPseLKsdvGwH8fBtFF4K EnmIz16moHlcNi3XIq6nrImw3tWDwnepnrgdsmEUkSBATlSsbrGkWzOKf9JGHcIKmGf8 bAyie0DjV4xUU6BbIpYWk09KdCzRZRMoT85FckbPcE1nQDzpvRBM4jP6qQU7gIYyfPHD AjVbQw3H6UcMfrPOgIr4ChD3Y/w5ZJ+fU/Nb0RjUoLUbNuyy21PFThR1Yk6iwpWMA3Rm Hpegk0LZDQ3hjDyJsWwNotWANx49gHgSnr39AGvQrBnueMpXYtt+Rm03ET+snuZSKe8G 19kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=CIcA0VnasMs0iRoFTNGjOHGkuvYWBHRihRg3PpfSB5c=; b=p6lrGbBWB2vV/b8VlAThasoPHgWAZnVeHFp3xqY3UMBHrpzy2AMmojO3JSAcUwcX/p idGYvpb4P5+nbY+mf/pAMmdKOj05ZZZZaxMQSa2SLchiN/la+NeYtbf76Ng74PcqABIy 4VsScCpgZPuz/MKhU7h3O/u5MfaoWJ2t1FNNYh7M0oh7xD6VWkwZDKlQSvUjsWmjCuS7 P1c9w4Da7spff6fOuAQXnnFnZlV1+7O0pa9zAHcJ+dUaMtTlvgmLAY51RUP8DkD+ju8R 3jfIaYet7Bm+eqFnILostXC/WO+uubd1iHT298TPJ0N4x5raEcEqwOvq5doM+e9UAL+a 0Hyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axentia.se header.s=selector1 header.b=kdK8j1OI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1-v6si5494261plp.567.2018.04.20.00.32.01; Fri, 20 Apr 2018 00:32:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@axentia.se header.s=selector1 header.b=kdK8j1OI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754018AbeDTHat (ORCPT + 99 others); Fri, 20 Apr 2018 03:30:49 -0400 Received: from mail-db5eur01on0114.outbound.protection.outlook.com ([104.47.2.114]:41356 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753922AbeDTHao (ORCPT ); Fri, 20 Apr 2018 03:30:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CIcA0VnasMs0iRoFTNGjOHGkuvYWBHRihRg3PpfSB5c=; b=kdK8j1OInUvlKqvooxGbpzeDgFHDuOca5yU1SEe0da8t9q7jtiRHaK3jAs1OeF15bdsVns/Mx+BcJLVRd89TmNS2GqWBfLQ+g9a1s4AE00lhxCZDLL391m40ttblT03v4P0ncHfAuiUgBlvUknJWeIvwHgOmduX+S1bL7eY14KA= Received: from [192.168.13.3] (85.226.244.23) by DB6PR0202MB2776.eurprd02.prod.outlook.com (2603:10a6:4:a8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.13; Fri, 20 Apr 2018 07:30:40 +0000 Subject: Re: [PATCH v2] usb: chipidea: Hook into mux framework to toggle usb switch To: Peter Chen , Yossi Mansharoff , Greg Kroah-Hartman , "open list:CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER" , open list Cc: "robh@kernel.org" , "swboyd@chromium.org" , "devicetree@vger.kernel.org" , Stephen Boyd References: <1523973148-2094-1-git-send-email-yossim@codeaurora.org> From: Peter Rosin Organization: Axentia Technologies AB Message-ID: <1fd0df0a-3930-94c8-2973-2c90e0b07530@axentia.se> Date: Fri, 20 Apr 2018 09:30:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [85.226.244.23] X-ClientProxiedBy: DB3PR0202CA0023.eurprd02.prod.outlook.com (2603:10a6:8:1::36) To DB6PR0202MB2776.eurprd02.prod.outlook.com (2603:10a6:4:a8::22) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(7021125)(5600026)(4534165)(7022125)(4603075)(4627221)(201702281549075)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020);SRVR:DB6PR0202MB2776; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0202MB2776;3:4h5rYqbFpqesgHnFDdN1NCsc8S/vBDqW6ZjQMyXCOgOE54MgKSYJ6zzu65hxqqPhxmKHm916wXCHIy30+sw7y54fyZn4LJBheLreh0fVn3ZoODDpYJJUFOa1Z5aJloxbNQ7mY0PiVp3J5dOZIqh2dVnaZtj2UFaKce0bNKFEjMMhMVy1Je9pRfr7pKBt/u774L1PdaEi6pzvX0kCxWM1W8He6ALxfMm+qdN6skl7D4oMpqmZU9jGHG6vMsPgqHey;25:MzaIH0xAuLpG+AqQzNx9LesidrcGB34FwE+d/s5edTp86vS56yfy9SR1VkVT1akGKWAuU+cekiGzb8itWPG7l6yM1ldx7kClTygm6fuZYCUYawkSJReVBIl8M7uKh2mnRA6DQJ2TZ3T8W0UHmP+9SBvgFFEf2VmQ70MpbyJMhNcEtnMBrgBYlyzSgHZyrS/1SzibODTYLdyn8+5/rYNq1gps8Woh+XK6qfmXBRouVqYn7zj0DXm14l0POpCXG7sP36mZWCEzmS57aM7vwJOAF9sU7CDBxbHIcokwhzQjXZcrzVAlWcHfRaDKxfdmNECSdPE5hRThWQc0vmglnsj9vQ==;31:L173A8qJmy2qIFcIEUDfGVpB7+kFUjRxF1HW2sxle4t4krkZBnEB/lQlT+UNGIjZ6I5HupmLfiKVHqHE5r/gsHl0GPz9ciAqhxbyRNnMN23vgqWUvm1SgzsNfjEQWjR+0WhiUfFHTFF2eFiDOnlOoBtqWOvPCyJ6B+1iopdw0uszOg2m62axT22oP0rTctFRMWL85X6n1kz/k21idk/xxv2YDT/k7Nzhm1+qaU57hUE= X-MS-TrafficTypeDiagnostic: DB6PR0202MB2776: Authentication-Results: outbound.protection.outlook.com; spf=skipped (originating message); dkim=none (message not signed) header.d=none; dmarc=none action=none header.from=axentia.se; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231232)(944501391)(52105095)(93006095)(93001095)(10201501046)(3002001)(6041310)(20161123564045)(2016111802025)(20161123560045)(20161123558120)(20161123562045)(6072148)(6043046)(201708071742011);SRVR:DB6PR0202MB2776;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0202MB2776; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0202MB2776;4:nCZKSV+BUaelLL0uIFLRge7Cc5ioez71fUPuBzhbBLhcBxbyGjWEwx4JdK3T7XxKzocEY7xJM4vSNQifgXIOMXC2dzSi7QcG2F/vdVH43clzcxnzUlrkjtScmIfYyz0VvFRtIG94VcDpYMW1aeWmP05dQxurTmNbkXg0y0Jv41j7uw9EkfbITRunxjd8vnVTq9458xluhKSmyaCALDXLpIGNH1K+pBy512jrZ+wwnVWI5Xl+zi8MEnS25WFRvjeTfk0B/2jq7lagshye4U53iQ== X-Forefront-PRVS: 0648FCFFA8 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(366004)(39380400002)(376002)(396003)(52314003)(377424004)(8936002)(11346002)(23676004)(305945005)(74482002)(6246003)(4326008)(77096007)(6666003)(8676002)(186003)(81166006)(16526019)(6486002)(36916002)(65826007)(53546011)(52146003)(229853002)(2486003)(86362001)(386003)(52116002)(26005)(76176011)(5660300001)(31696002)(31686004)(6116002)(47776003)(446003)(3846002)(230700001)(110136005)(8656006)(50466002)(476003)(956004)(117156002)(3260700006)(316002)(2616005)(25786009)(478600001)(36756003)(53936002)(54906003)(7736002)(16576012)(2906002)(66066001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0202MB2776;H:[192.168.13.3];FPR:;SPF:None;LANG:en;MLV:sfv; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjAyMDJNQjI3NzY7MjM6aTAwSExqYW5yUy9sMWtmRTc1N3dDS0xF?= =?utf-8?B?VUFNT0xQSTJhV1Y0TDlSeUE5dHFScUhQamZyaE81VWVnVkk1eWI3U2lPRmFm?= =?utf-8?B?eHZLSUpmQWttQmFPUWkvTUFvTkZKWHlkeTRJWlh5amZkVjd4aHkwUlY1MjdK?= =?utf-8?B?ZVc3UVRLWE56TlRkUWk3aGxwOEJaNU1iOVVIb3hRNDhZQk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JwoHeEfpe X-MS-Office365-Filtering-Correlation-Id: 5d107556-0fb4-4f71-01e9-08d5a6909eb4 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2018 07:30:40.5266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d107556-0fb4-4f71-01e9-08d5a6909eb4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0202MB2776 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-04-20 04:00, Peter Chen wrote: > > >> --- a/drivers/usb/chipidea/Kconfig >> +++ b/drivers/usb/chipidea/Kconfig >> @@ -3,6 +3,8 @@ config USB_CHIPIDEA >> depends on ((USB_EHCI_HCD && USB_GADGET) || (USB_EHCI_HCD >> && !USB_GADGET) || (!USB_EHCI_HCD && USB_GADGET)) && HAS_DMA >> select EXTCON >> select RESET_CONTROLLER >> + select MULTIPLEXER >> + select MUX_GPIO > > The above two configurations are only used at your specific platforms, please add > them at either your platform defconfig or the related hardware driver's Kconfig. "select MUX_GPIO" is indeed questionable and should be somewhere else because this driver will work with any other mux as well. It's simply something else that requires it. If it was the case that MUX_GPIO is indeed required then the whole use of the mux subsystem is questionable and the thing controlled might as well be controlled directly with the GPIO line. The mux subsystem is good when a single mux "controller" is shared between several unrelated drivers utilizing different muxes controlled by that same mux "controller" (think several muxes controlled by the same GPIO line/lines). The mux subsystem is also useful when the driver does not want to handle/know how the specific mux is controlled. That said, it's of course not wrong to use the mux subsystem in cases like this either, but I think it might be much easier and direct to just twiddle the single GPIO line directly here? Or do you expect some future HW variant that will use some other means to control this mux? >> help >> Say Y here if your system has a dual role high speed USB >> controller based on ChipIdea silicon IP. It supports: >> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index >> 33ae87f..8fa0991 100644 >> --- a/drivers/usb/chipidea/core.c >> +++ b/drivers/usb/chipidea/core.c >> @@ -61,6 +61,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "ci.h" >> #include "udc.h" >> @@ -687,6 +688,10 @@ static int ci_get_platdata(struct device *dev, >> if (of_find_property(dev->of_node, "non-zero-ttctrl-ttha", NULL)) >> platdata->flags |= CI_HDRC_SET_NON_ZERO_TTHA; >> >> + platdata->usb_switch = devm_mux_control_get_optional(dev, "usb_switch"); >> + if (IS_ERR(platdata->usb_switch)) >> + return PTR_ERR(platdata->usb_switch); >> + >> ext_id = ERR_PTR(-ENODEV); >> ext_vbus = ERR_PTR(-ENODEV); >> if (of_property_read_bool(dev->of_node, "extcon")) { diff --git >> a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index af45aa32..d9d2d00 >> 100644 >> --- a/drivers/usb/chipidea/host.c >> +++ b/drivers/usb/chipidea/host.c >> @@ -13,6 +13,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "../host/ehci.h" >> >> @@ -161,6 +162,10 @@ static int host_start(struct ci_hdrc *ci) >> if (ci_otg_is_fsm_mode(ci)) { >> otg->host = &hcd->self; >> hcd->self.otg_port = 1; >> + } else { >> + ret = mux_control_select(ci->platdata->usb_switch, 1); >> + if (ret) >> + goto disable_reg; > > What will happen if ci->platdata->usb_switch is NULL? What has not been mentioned in this patch is that it depends on another patch which is not yet upstream. You can google for mux: add mux_control_get_optional() API to get an idea (it's also in linux-next). Anyway, with that patch this is not a problem. >> } >> } >> >> @@ -181,6 +186,8 @@ static void host_stop(struct ci_hdrc *ci) >> struct usb_hcd *hcd = ci->hcd; >> >> if (hcd) { >> + if (!ci_otg_is_fsm_mode(ci)) >> + mux_control_deselect(ci->platdata->usb_switch); > > Ditto. > >> if (ci->platdata->notify_event) >> ci->platdata->notify_event(ci, >> CI_HDRC_CONTROLLER_STOPPED_EVENT); >> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index >> 9852ec5..209d3f6 100644 >> --- a/drivers/usb/chipidea/udc.c >> +++ b/drivers/usb/chipidea/udc.c >> @@ -19,6 +19,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "ci.h" >> #include "udc.h" >> @@ -1965,16 +1966,26 @@ void ci_hdrc_gadget_destroy(struct ci_hdrc *ci) >> >> static int udc_id_switch_for_device(struct ci_hdrc *ci) { >> + int ret = 0; >> + >> if (ci->is_otg) >> /* Clear and enable BSV irq */ >> hw_write_otgsc(ci, OTGSC_BSVIS | OTGSC_BSVIE, >> OTGSC_BSVIS | OTGSC_BSVIE); >> >> - return 0; >> + if (!ci_otg_is_fsm_mode(ci)) >> + ret = mux_control_select(ci->platdata->usb_switch, 0); >> + > > Ditto > >> + if (ci->is_otg && ret) >> + hw_write_otgsc(ci, OTGSC_BSVIE | OTGSC_BSVIS, >> OTGSC_BSVIS); >> + >> + return ret; >> } >> >> static void udc_id_switch_for_host(struct ci_hdrc *ci) { >> + mux_control_deselect(ci->platdata->usb_switch); >> + >> /* >> * host doesn't care B_SESSION_VALID event >> * so clear and disbale BSV irq >> diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index >> 07f9936..9ea55a1 100644 >> --- a/include/linux/usb/chipidea.h >> +++ b/include/linux/usb/chipidea.h >> @@ -10,6 +10,7 @@ >> #include >> >> struct ci_hdrc; >> +struct mux_control; >> >> /** >> * struct ci_hdrc_cable - structure for external connector cable state tracking @@ - >> 76,6 +77,7 @@ struct ci_hdrc_platform_data { >> /* VBUS and ID signal state tracking, using extcon framework */ >> struct ci_hdrc_cable vbus_extcon; >> struct ci_hdrc_cable id_extcon; >> + struct mux_control *usb_switch; >> u32 phy_clkgate_delay_us; > > If CONFIG_USB_CHIPIDEA_HOST is not defined, it may cause build error How is that related? There is a forward declaration above? Cheers, peda