From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35BCAC43334 for ; Tue, 28 Jun 2022 08:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To:From:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oKZ864BeMLrBp7CIz7yXdqmIhgj9zovXB0nyFxCyUQQ=; b=wSuF9KjzwT0M7f WyqHbZhWdJqQ7ydSyAr2NjzEVVD2czc9iKh7a311UFf+4AGtDGBHSOUMFFXuZ1qh0Xq0lp3kTbsmI uO5B4LYZptdK0WwgOIXstg2soHcic5t1AHwH7j1coKwQAJ3q7qlq4EgBXCOkpdY4i4s2290so4eq4 KKCFZD8hY5kQ9rk1WIOWVc1rpCNwoOohudMOPCx32MNexnXvIbUGg0g46mKwRiXdXRtm7KClJ1aXC G9xHZyyttXda2i3QTFDiGzcvvMepr1wWbLUj0SuBSV8Q4ylsChnqpsNoVsADU1GSfHtehd0/orB2I jGyd5f8i7tzekq2wtnxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o66M4-005Aoj-Sa; Tue, 28 Jun 2022 08:13:53 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o66M0-005AlL-GR for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 08:13:50 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220628081339euoutp02052da08860212ccf68c5b3c81cdb3f6a~8uq33OLl01649216492euoutp02A for ; Tue, 28 Jun 2022 08:13:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220628081339euoutp02052da08860212ccf68c5b3c81cdb3f6a~8uq33OLl01649216492euoutp02A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1656404019; bh=PlenMJZIMvg+yssHUrSEVcbqZWVVKLRTR1oE2sU1L04=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=Py+/elLgFTA2wSamoJesR+rrkmPmTvRETEiMcvj0e3vUPESm20QsjGfTYXbKnF2Gz hFoh6SMTipAjlQVjpBfWxL0Ztyw8gPkdvYrZzJyQ1OGVyX75OEMiVOL/njbXhVx77y hgqT5sC4c2xXnsb9reCD3vA0vZRosmV+9yaiIiXQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220628081338eucas1p19f6fd8f2771cae90fe7aec67c6ed1c63~8uq3fsx3o2201622016eucas1p1z; Tue, 28 Jun 2022 08:13:38 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id EA.C8.09664.238BAB26; Tue, 28 Jun 2022 09:13:38 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220628081338eucas1p1e0aab18d1d8c7aa0601399cf9a1cab34~8uq3B2KWe0414204142eucas1p1n; Tue, 28 Jun 2022 08:13:38 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220628081338eusmtrp1ca67fa56b51049c663aedf1a86730c29~8uq3BCtqU3120431204eusmtrp1O; Tue, 28 Jun 2022 08:13:38 +0000 (GMT) X-AuditID: cbfec7f2-d97ff700000025c0-00-62bab83200e8 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 29.99.09038.238BAB26; Tue, 28 Jun 2022 09:13:38 +0100 (BST) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220628081337eusmtip2613a19042f2ffebe257e68a03b14106d~8uq2f07Rm0756207562eusmtip2r; Tue, 28 Jun 2022 08:13:37 +0000 (GMT) Message-ID: Date: Tue, 28 Jun 2022 10:13:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: pci-exynos.c phy_init() usage Content-Language: en-US To: Krzysztof Kozlowski , Bjorn Helgaas , Jaehoon Chung , Jingoo Han Cc: =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Alim Akhtar , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org From: Marek Szyprowski In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA01SeUxScRzfjwfvPdiwF2r+kmaJy61cmkf1tspuR9eWrta5EvENXR4EauVq uWIdZOZVIh3qdMuw0qmoOLEyjXkRyzIsxQ7soFF5VjYt8Fn53+f3Ob7XfjjCK2d54rEJSZQs QRQnQDnMmsc/jUuC6uqjlvYbQ8jXN2tQ0tZxFyXN42dZZOlIPkbqP2sxMi39F4usfNfNIjtv GlBS9aSRsZYt1Kn7MGGl5gIq7O1uQIXWZ3kMYVXJKWFGtQYIhyu9dmD7OKuiqbjYFEoWEBrJ ienK1zKkE67Hfl/8yEoDRYQSsHFIhMCskh6g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nfziYlNSezLLVI3y5BL+PyzK1MBX+FK/53v2BtYFwo0MXIySEhYCLR/3k/cxcjF4eQ wFJGiUlrn7JAJGQkTk5rYIWwhSX+XOtigyh6zyix4O1ENpAEr4CdRO/JX4wgNouAqsSHFU8Z IeKCEidnPgEbJCqQLNG85RATiC0soCVx79oGZhCbWUBc4taT+UwgQ0UEVjNKvNp9lAXEYRY4 zijxcN4Fdoh1C5gklm+5AzaWTcBQouttF9hqTqDV6y9vZ4cYZSbRtbWLEcKWl9j+dg7zBEah WUgumYVk4ywkLbOQtCxgZFnFKJJaWpybnltspFecmFtcmpeul5yfu4kRGKHbjv3csoNx5auP eocYmTgYDzFKcDArifAuPLMzSYg3JbGyKrUoP76oNCe1+BCjKTA4JjJLiSbnA1NEXkm8oZmB qaGJmaWBqaWZsZI4r2dBR6KQQHpiSWp2ampBahFMHxMHp1QDU/nmsrkeN9wuG9UJqOUseye8 7clGBpZdm63mfym8fGXZyfXr+pZnfj9sJrwlxHZmUkmF665Tly584pS49XHOqWe1d2bFGfFf OqDJvq5sWee2aT03XH98u7CL01FxzkfF7ufTJoektiitfu/14/wZnnd6hc68Dn9azrO2bpI0 P2rWPSMsafuEdTxt/BO99m0OD8iTL3q/tnRu5KXG91srRWu9D35jKCuKeTdts81FltdnP1bG h5ruFegRq9L983jShfXLu8/KrDjzM9lVuu5Z/hFHdSWtvAL+k7PDKuR9zz08JyPvIZ1tdV2G VfflaUVrHdYI7SzbpqUZJkuO52zmeSc6xTvq3rpDnRcqlbhUdymxFGckGmoxFxUnAgBg6KeN WQMAAA== X-CMS-MailID: 20220628081338eucas1p1e0aab18d1d8c7aa0601399cf9a1cab34 X-Msg-Generator: CA X-RootMTR: 20220624180806eucas1p16a18d9598c0a08770b428cd58916b65d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220624180806eucas1p16a18d9598c0a08770b428cd58916b65d References: <20220624173541.GA1543581@bhelgaas> <591f696f-b55c-d267-7fcb-74f7fd4a6900@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_011349_018938_2F105AE9 X-CRM114-Status: GOOD ( 22.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Krzysztof, On 27.06.2022 12:47, Krzysztof Kozlowski wrote: > On 27/06/2022 12:30, Marek Szyprowski wrote: >> On 24.06.2022 20:07, Krzysztof Kozlowski wrote: >>> On 24/06/2022 19:35, Bjorn Helgaas wrote: >>>> In exynos_pcie_host_init() [1], we call: >>>> >>>> phy_reset(ep->phy); >>>> phy_power_on(ep->phy); >>>> phy_init(ep->phy); >>>> >>>> The phy_init() function comment [2] says it must be called before >>>> phy_power_on(). Is exynos doing this backwards? >>> Looks like. I don't have Exynos hardware with a PCI, so cannot >>> test/fix/verify. >>> >>> Luckily for Exynos ;-) it's not alone in this pattern: >>> drivers/net/ethernet/marvell/sky2.c >>> drivers/usb/dwc2/platform.c >> I've checked that on the real hardware. Swapping the order of >> phy_power_on and phy_init breaks driver operation. >> >> However pci-exynos is the only driver that uses the phy-exynos-pcie, so >> we can simply swap the content of the init and power_on in the phy >> driver to adjust the code to the right order. power_on/init and >> exit/power_off are also called one after the other in pci-exynos, >> without any activity between them, so we can also simply move all >> operation to one pair of the callback, like power_on/off. >> >> Krzysztof, which solution would you prefer? > I think the real problem is that the Exynos PCIe phy init > (exynos5433_pcie_phy_init) performs parts of power on procedure, so the > code is mixed. Probably also the phy init could not happen earlier due > to gated clocks (ungated in exynos5433_pcie_phy_power_on). > > I would prefer to clean it up while ordering init+power_on, so figure > out more or less correct procedure. > > You can also look at Artpec-8 PHY - it seems using correct order > (init+reset): > https://lore.kernel.org/all/20220614011616epcms2p7dcaa67c53b7df5802dd7a697e2d472d7@epcms2p7/ I've played a bit with those register writes in exynos_pcie_phy and frankly speaking the currenly used (power_on + init) is the only sequence that works properly. I'm leaning to move everything to phy_init/exit. I really don't see how to split it into init + power_on callbacks. While touching this - I would also remove the phy_reset() call in the exynos-pcie driver. It is a left over from the old, obsoleted exynos5440 pcie code, not implemented in the current phy driver, also only a few drivers use or implement it. IMHO it doesn't make sense to keep such dead code. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel