Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3397817imu; Wed, 7 Nov 2018 09:42:07 -0800 (PST) X-Google-Smtp-Source: AJdET5d/xpq/jyVLkIHMgcKDS7787Bhj+Rmvr4qqTVhPWD5AGVyYB0lZs0a2F+j+EO+su5GxS7GX X-Received: by 2002:a62:5cc4:: with SMTP id q187-v6mr1091603pfb.47.1541612527200; Wed, 07 Nov 2018 09:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541612527; cv=none; d=google.com; s=arc-20160816; b=aEKcC6NAow9/m3u84+56TaIDRXg9t1VShZjIvdCaAg4K5fpZmi0OYWXq38AxkNtlQm 3IZizsfG+nL4g2BxTNBOiSEz87cZrPJhOw2hVOYzusb3al2+r+PWim+lfIjVXuVKOWfm qBruWQLtUTOldzwoiJTokn9pk4U9NQGqpm3+6t4FSPyi4fpch4DZsIHFtIhmSNoYee/S vgUFLPcR1yoGb3RZ3YO2anqP1MV1LONaY+AsAvH+A8RghnnDngf/eIydmoPPLiDoVqI8 +QUUZ6sQxtfDQauXd8nm82fbZEDvET3wbryeCnB4EAicT5RjhzxKcaiZQnI8dz4aJLQY uoiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ARzXNn6/nICGZMs9oHPbSoGfh7bmfrp8eFyC7A9bq9E=; b=yrsPMDxFB5uTgs9KZHuKG1exPcD1qCsn9otvnvCAJOhPa2/el8whUR6pwAuEOVr/Rs Z9e7uuWmAHctn6SQG613gbR2uEpMiPWY6zQDGY9df7G8+lEhR5EJB8qjz5Pn5AybIUEG V9KZ+KEhXoWMVzVmHj2yQCPCCWKDhvb97BVeVc/d/KuhQeBnc7cnKOzN1hJiNSXJ2VNb PSwdbtGUMsmmsPuygkRaHbZ+NfT8HzL3azf0eW8+vm3TXETxKe3bM9bSe+K/dUf8hhQu YqPkAPROhaXk7mORNaIhqDe2dwnaQ6mDILsrBFznd8UkI/bO6ihX6aOHN3g8mhGJadkP /j5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=MEGQr8XW; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v69si1125098pgd.284.2018.11.07.09.41.51; Wed, 07 Nov 2018 09:42:07 -0800 (PST) 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=@broadcom.com header.s=google header.b=MEGQr8XW; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731556AbeKHDMT (ORCPT + 99 others); Wed, 7 Nov 2018 22:12:19 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45025 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728063AbeKHDMT (ORCPT ); Wed, 7 Nov 2018 22:12:19 -0500 Received: by mail-pg1-f193.google.com with SMTP id w3-v6so7599055pgs.11 for ; Wed, 07 Nov 2018 09:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ARzXNn6/nICGZMs9oHPbSoGfh7bmfrp8eFyC7A9bq9E=; b=MEGQr8XWCGnZg8U0cSEazxWWxye/6kO8iLBhw4u4pbWhxKtyE+Po81WD0LOmYWWDWS whIOsASxtov3Iz34yO5SkQFvNL7cMo6xyDQ98VfKgOG6lmwBqgfPEU+JW+IrawNjhd+T Q8sZJocEA6/yFR/dra0KhHn4u3BxMRLheiEEM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ARzXNn6/nICGZMs9oHPbSoGfh7bmfrp8eFyC7A9bq9E=; b=cWqMsgNhVDqg7N3E3ZXbVC55UQxu5zrdOeUlFg3nPG/B0Z2doTLMmgUdqQ7XoFA4T0 Em8vlwvdMYF9Edd0c7TIvdP9iYQJ1OLBpc/fmdzjqTfFK72Cz2RH2Cgq9oe9wWDsCFxi bo00nSSUMdjlEp4LUycdoiitFtM0bdxbwdOgCOJN9u6Jd+zyEyk1BBl2HLJSL7VrvlK7 YYqbKEcJg4h/T98ospJlENSM6S+4O22lwu9IJOhRnpwjh0FCM6nZE/RWx942jFq5Fnuc kO1lq/Vak6EZJGNugC4D5QbT4u4VhPLcvT9WYQ1cvd9TZWhNqkeyLv8z2x5P+QsNKxvP S/Cw== X-Gm-Message-State: AGRZ1gI/SP/dtG0Y3UFP3e9TYVyEmpjAU7eA/uzQcBTTFNsyiT92KNtW u4RwUmWjW0f++aftnmVMSvTN X-Received: by 2002:a62:8c93:: with SMTP id m141-v6mr1071534pfd.239.1541612453573; Wed, 07 Nov 2018 09:40:53 -0800 (PST) Received: from [10.28.17.185] ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id 11-v6sm1430583pfr.55.2018.11.07.09.40.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 09:40:52 -0800 (PST) Subject: Re: [PATCH V3 4/6] usb: ohci-platform: Add support for Broadcom STB SoC's To: Florian Fainelli , Alan Stern Cc: Al Cooper , linux-kernel@vger.kernel.org, Alban Bedel , Alex Elder , Andrew Morton , Arnd Bergmann , Avi Fishman , bcm-kernel-feedback-list@broadcom.com, Bjorn Andersson , Chunfeng Yun , "David S. Miller" , devicetree@vger.kernel.org, Dmitry Osipenko , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Hans de Goede , James Hogan , Jianguo Sun , Johan Hovold , Kees Cook , linux-usb@vger.kernel.org, Lu Baolu , Mark Rutland , Martin Blumenstingl , Mathias Nyman , Mathias Nyman , Mauro Carvalho Chehab , Rishabh Bhatnagar , Rob Herring , Roger Quadros References: <16a80878-58f7-1584-058e-0e0e49da61cb@gmail.com> From: Al Cooper Message-ID: <45134862-4b72-be72-533c-942c2bf70400@broadcom.com> Date: Wed, 7 Nov 2018 12:40:57 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <16a80878-58f7-1584-058e-0e0e49da61cb@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/7/18 12:29 PM, Florian Fainelli wrote: > On 11/7/18 8:27 AM, Alan Stern wrote: >> On Wed, 7 Nov 2018, Al Cooper wrote: >> >>> On 11/7/18 10:23 AM, Alan Stern wrote: >>>> On Tue, 6 Nov 2018, Florian Fainelli wrote: >>>> >>>>> On 11/6/18 1:40 PM, Al Cooper wrote: >>>>>> On 11/6/18 11:08 AM, Alan Stern wrote: >>>>>>> On Mon, 5 Nov 2018, Al Cooper wrote: >>>>>>> >>>>>>>> Add support for Broadcom STB SoC's to the ohci platform driver. >>>>>>>> >>>>>>>> Signed-off-by: Al Cooper >>>>>>>> --- >>>>>>> >>>>>>>> @@ -177,6 +189,8 @@ static int ohci_platform_probe(struct >>>>>>>> platform_device *dev) >>>>>>>>           ohci->flags |= OHCI_QUIRK_FRAME_NO; >>>>>>>>       if (pdata->num_ports) >>>>>>>>           ohci->num_ports = pdata->num_ports; >>>>>>>> +    if (pdata->suspend_without_phy_exit) >>>>>>>> +        hcd->suspend_without_phy_exit = 1; >>>>>>> >>>>>>> Sorry if I missed this in the earlier discussions...  Is there any >>>>>>> possibility of adding a DT binding that could express this requirement, >>>>>>> instead of putting it in the platform data? >>>>>>> >>>>>>> Alan Stern >>>>>>> >>>>>> >>>>>> Alan, >>>>>> >>>>>> That was my original approach but internal review suggested that I use >>>>>> pdata instead. Below is my original patch for: >>>>> >>>>> And the reason for that suggestion was really because it was percevied >>>>> as encoding a driver behavior as a Device Tree property as opposed to >>>>> describing something that was inherently and strictly a hardware >>>>> behavior (therefore suitable for Device Tree). >>>> >>>> Right. The best way to approach this problem is to identify and >>>> characterize the hardware behavior which makes this override necessary. >>>> Then _that_ can be added to DT, since it will be a property of the >>>> hardware rather than of the driver. >>>> >>>>>> Add the ability to skip calling the PHY's exit routine on suspend >>>>>> and the PHY's init routine on resume. This is to handle a USB PHY >>>>>> that should have it's power_off function called on suspend but cannot >>>>>> have it's exit function called because on exit it will disable the >>>>>> PHY to the point where register accesses to the Host Controllers >>>>>> using the PHY will be disabled and the host drivers will crash. >>>> >>>> What's special about this PHY? Why does the exit function mess the PHY >>>> up? Or to put it another way, why doesn't the exit function mess up >>>> other PHYs in the same way? >>>> >>>> For that matter, can we change the code so that suspend doesn't call >>>> the exit function for _any_ PHY? Will just calling the power_off >>>> function be good enough? If not, then why not? >>>> >>>> Alan Stern >>>> >>> >>> In our USB hardware the USB PHY supplies a clock for the EHCI/OHCI and >>> XHCI host controllers and if the PHY is totally shut down the EHCI, OHCI >>> and XHCI registers will cause an exception if accessed and cause the >>> EHCI, OHCI and XHCI drivers to crash. There is always talk of fixing >>> this in the hardware by adding an aux clock that will takeover when the >>> PHY clock is shut down, but this hasn't happened yet. It seems like >>> "exit on suspend" still makes sense on systems that don't have this >>> problem (additional power savings?) so removing the exit on suspend for >>> all systems is not a good idea. >> >> Then in theory you should be able to add a Device Tree property which >> says that the PHY provides a clock for the USB host controller. That >> is strictly a property of the hardware; it has nothing to do with the >> driver. Therefore it is appropriate for DT. > > The very compatible string that is being allocated/defined for this > controller carries that information already, that is, if you probe a > "brcm,bcm7445-ohci" compatible then that means the controller has a > dependency on the PHY to supply its clock. > > Adding a property vs. keying on the compatible string makes sense if you > know there is at least a second consumer of that property (unless we > make it a broadcom specific property, in which case, it really is > redundant with the compatible string). > > Anyway, my grudge with that property was the name chosen initially, > which included an action to be performed by an implementation as opposed > to something purely descriptive. E.g: 'phy-supplies-clock' might be okay. > >> >> Wouldn't this solve your issue? > > It would not change much except that there is no need to much with > ohci-platform.c anymore, but ultimately that property needs to be read > by ohci-hcd.c and acted on, which would likely lead to the same amount > of changes as those present in patch #2 currently. > We also need this functionality in the EHCI and XHCI drivers and it's not the ohci-hcd.c module that needs to know, it's the core/phy.c module called from core/hcd.c. Al