Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp553306rdf; Fri, 3 Nov 2023 08:15:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNxu/+gcZ46Ewq74qurxsMDnTmqhHBU9U0wHcsjwAE+pDIUV6yUn0VTJwoL3XgWr8KOkEC X-Received: by 2002:a05:6358:8a9:b0:168:e6df:4e7a with SMTP id m41-20020a05635808a900b00168e6df4e7amr29463835rwj.4.1699024502204; Fri, 03 Nov 2023 08:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699024502; cv=none; d=google.com; s=arc-20160816; b=HDEBIS6DjyrTTT95cSN7CVhv2GSBy7vIg6hmh+lm2fC46KsPdXau7SLrqqut7OArH9 YsHBS4KC/SiYq53AXGtK+W7nEBwuCvixZSZCtR+7/w1Gt542ZxxV8Afm9JLjW6pXXCP/ c71wHdhqMtX/qUZ1FmVxpuqMetXFlv+YEJOxdAErozhIfFhVHcXuvRRXbXxLdxt9nlgo SmMsXK3e1qJh45HMaNgCk1WTSOf1ejjHwMqU6nSW5CrqevXiZ1QtFogfHkOD2yPK5tKP kZP7cj7/rhWnOmnWwNJIHGmtnmsWqmWsdatc062bo1r+beJEG/x+XT/UAxaiWQsqx1Xi RNbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=JQmtajR/Lo5kWZGagJsWizBqcJuSRUlM8N3Px2Mnlzc=; fh=a3TqZVsk+r13cFyprMms2S3laiIwD6awWl0wlPJxq00=; b=dEeszaBiYI+cTSCOOFPnm5ukdhNXOhrocmPQHp1HE8r1HT9bxEID7W/nn2oL0nwsaq rEEPepvJfXhjN8f/ukNcPjjnxNGygZhlMshHY/L2jMifwFsjFYqZHRnDUiyLwzXWTZI6 KW1k0sOrDKm3mOSI1yu22Er9lz/4hfRQGqLalgaK7gWB/y/WGBHNCkd5cZwdtxTYz/NJ VND6bWSrIXhJ4XNiW+IomZepnjWRiaeeyolU+1J0s1b8r1OTjwTZYeYc7BfQbImsIw5S Uglv0h74G3QEdkq/BrvbVy6JYy3lVsO/dinR6M/0ns5qiwktLqHJBm/tZf/uQHue3DWs 5sIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WLW0DLxh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i70-20020a638749000000b005b5c68e2c92si1572514pge.371.2023.11.03.08.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 08:15:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WLW0DLxh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 09742837B2DE; Fri, 3 Nov 2023 08:15:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231825AbjKCPPA (ORCPT + 99 others); Fri, 3 Nov 2023 11:15:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbjKCPO6 (ORCPT ); Fri, 3 Nov 2023 11:14:58 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EDBC1B2 for ; Fri, 3 Nov 2023 08:14:52 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-32fb1d757f7so867719f8f.0 for ; Fri, 03 Nov 2023 08:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699024491; x=1699629291; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=JQmtajR/Lo5kWZGagJsWizBqcJuSRUlM8N3Px2Mnlzc=; b=WLW0DLxhI6kNo/vp1JLsCwd5z2ctRoiSgmOMUmrtNkjrJS8ksnB6Lnr9KClsKfeR6s zLs+7jabuSJYFFvMJVzKgEF9uj3trz0B868fvE33Ysywxoue0FB5HxzP4RQ5HoAC2tIJ XATbApGnxbjk6HmtsQ58KIvR5Os8kzjii/IiExYsHHaot80spaquxlfVqiOrS/JU9SUb U9VBacCBzWuuGy+0wt5kwf+qeHEkSJomzZUrLXU+dnwkxphzqm7EETBxDC+mVpzxr3hT uZN1pW91Ys5b+etp8ISYEmrCUJCZseUxQbASPULys4blLcC2v3g05tV+OLy+9/FCJBN3 8vCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699024491; x=1699629291; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JQmtajR/Lo5kWZGagJsWizBqcJuSRUlM8N3Px2Mnlzc=; b=m4z79gTa/DbFicp9ECvrVhueZW+q+xJwNapREHk/e75a4IWuy7r4tIr4oh+Tayespt fameojOKcmjWfioG7kaCoqj2TNGobyHuSW29/MN03o4Qzrjb1ix/QZ2OHJGPZFZC6Phl rPGkTOKT6oYGVPmE2uYUeoFApNZOe6hR33UX3Zm23nftHNumYKJh3y1fqjwc/0Y84qDF r3Q6fSFZxrGGD862fCEJe7rr2lfREn/K55vTDD1033P8u8rI+LRsWiM6Xu4xd60kC6Ub //1XrguLt2OvglH/8J+uQs7T0ZT+4y0vPOVl2unTGPM9ZAhQMcfwoVIv5TI8N/TlvoUh zKOQ== X-Gm-Message-State: AOJu0YxW+LMlSfeMJHKGw8iyWZZKUNnsrX+7QXGd42R82qBikLJMGvAb eqQ5Rj8Bk0au9Z7K2Q6l37/VJQ== X-Received: by 2002:a5d:6f1a:0:b0:32d:b2cf:8ccd with SMTP id ay26-20020a5d6f1a000000b0032db2cf8ccdmr27222679wrb.47.1699024490887; Fri, 03 Nov 2023 08:14:50 -0700 (PDT) Received: from [192.168.100.102] ([37.228.218.3]) by smtp.gmail.com with ESMTPSA id k12-20020adff28c000000b0032f99801273sm2065454wro.66.2023.11.03.08.14.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Nov 2023 08:14:50 -0700 (PDT) Message-ID: Date: Fri, 3 Nov 2023 15:14:49 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC 2/8] usb: dwc3: core: Register vendor hooks for dwc3-qcom Content-Language: en-US To: Krishna Kurapati , Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , quic_wcheng@quicinc.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, quic_ppratap@quicinc.com, quic_jackp@quicinc.com References: <20231017131851.8299-1-quic_kriskura@quicinc.com> <20231017131851.8299-3-quic_kriskura@quicinc.com> From: Bryan O'Donoghue In-Reply-To: <20231017131851.8299-3-quic_kriskura@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 08:15:01 -0700 (PDT) On 17/10/2023 14:18, Krishna Kurapati wrote: > Currently on QC targets, the conndone/disconnect events in device mode are > generated by controller when software writes to QSCRATCH registers in qcom > glue layer rather than the vbus line being routed to dwc3 core IP for it > to recognize and generate these events. > > We need to write '1' to UTMI_OTG_VBUS_VALID bit of QSCRATCH_HS_PHY_CTRL > register to generate a connection done event and "0" if we need to > generate a disconnect event during cable removal or mode switch. Exactly > what is done by "dwc3_qcom_vbus_override_enable" call in dwc3-qcom. > > When the disconnect is not generated upon cable removal, the connected > flag of dwc3 is left marked as "true" and it blocks runtime suspend. > > The goal of these vendor hooks is to let the mode change and cable removal > notifications from core reach the glue layers so that glue can take > necessary action. > > Before flattening the device tree, glue driver is not sure when the core > probe was completed as core probe can be deferred. In this case, glue is > not sure when to register vendor hooks. So mandate enabling runtime only > for flattened device node platforms so that glue can know when to register > vendor hooks. > > The following are the requirements aimed in this implementation: > > 1. When enum in device mode, Glue/core must stay active. > > 2. When cable is connected but UDC is not written yet, then glue/core > must be suspended. > > 3. Upon removing cable in device mode, the disconnect event must be > generated and unblock runtime suspend for dwc3 core. > > Signed-off-by: Krishna Kurapati What happens to this code if you static int count; 1. sleep in dwc3_probe for 10 milliseconds 2. return -EPROBE_DEFER 3. if count++ < 5 goto 1 i.e. if we simulate say waiting on a PHY driver to probe in dwc3_probe() and what happens if we introduce a 100 millsecond sleep into dwc3_qcom_probe() - and run a fake disconnect event from dwc3_qcom_probe_core() directly ? In other words if make it that dwc3_probe() completes and struct dwc3_glue_ops->notify_cable_disconnect() fires prior to dwc3_qcom_probe_core() completing ? i.e. I don't immediately see how you've solved the probe() completion race condition here. --- bod