From patchwork Fri Apr 24 16:50:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylwester Nawrocki X-Patchwork-Id: 1276514 X-Patchwork-Delegate: matthias.bgg@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.a=rsa-sha256 header.s=mail20170921 header.b=heWYd/Ix; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4980Zm4wNSz9sSJ for ; Sat, 25 Apr 2020 02:52:16 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7047C81924; Fri, 24 Apr 2020 18:52:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="heWYd/Ix"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D0C2F81924; Fri, 24 Apr 2020 18:52:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 55424818C7 for ; Fri, 24 Apr 2020 18:51:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=s.nawrocki@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200424165159euoutp0280645a16dd1c46861badfd7df573189e~Iz5euuKgm1989519895euoutp02M for ; Fri, 24 Apr 2020 16:51:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200424165159euoutp0280645a16dd1c46861badfd7df573189e~Iz5euuKgm1989519895euoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1587747119; bh=Ib7ksqi57TteKK8vtV+1TVhUUWgyBqT0ZN4q9NuUw78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=heWYd/IxB8QjIrLrndDDGQ4lbEN38WAsYP585HY5EsbDIc3SEWZp9OP1irW/1DYJ/ KkdqhI6W7A7ZHjRvbQ5RqKXdMGtqOksunYlT/x2OBCeCmdacTGNvD9iEgFJJL/aD3r EI2m22Dvcnac4cKWw2i0AWBkMAFH0eXQqjokNrWc= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200424165158eucas1p1edb8d7ec639cc36599be722a01195c7f~Iz5eQMqnG0438504385eucas1p1E; Fri, 24 Apr 2020 16:51:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 69.FF.60679.E2913AE5; Fri, 24 Apr 2020 17:51:58 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200424165157eucas1p2b0a0eb386fd9304d4cbf1e23248849d9~Iz5dewwsB3259532595eucas1p2O; Fri, 24 Apr 2020 16:51:57 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200424165157eusmtrp14cf77ab5ca721c5f1f51cc8490a53f5e~Iz5deFp9s1224212242eusmtrp1D; Fri, 24 Apr 2020 16:51:57 +0000 (GMT) X-AuditID: cbfec7f4-0e5ff7000001ed07-90-5ea3192eab1c Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2E.3F.08375.D2913AE5; Fri, 24 Apr 2020 17:51:57 +0100 (BST) Received: from AMDC3061.digital.local (unknown [106.120.51.75]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200424165156eusmtip2a64a79e11bd3a28fbbeb5ae27c182675~Iz5cz7ssj1549415494eusmtip2Y; Fri, 24 Apr 2020 16:51:56 +0000 (GMT) From: Sylwester Nawrocki To: u-boot@lists.denx.de, mbrugger@suse.com, marex@denx.de, bmeng.cn@gmail.com Cc: sjg@chromium.org, nsaenzjulienne@suse.de, jh80.chung@samsung.com, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Sylwester Nawrocki , Sergey Temerkhanov Subject: [PATCH v1 02/10] usb: xhci: Use only 32-bit accesses in xhci_writeq/xhci_readq Date: Fri, 24 Apr 2020 18:50:04 +0200 Message-Id: <20200424165012.31915-3-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200424165012.31915-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIA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YtZ7M4/Kad1WLprH3sFt+2bGO0eLu3k92B22N2w0UW j3mzTrB47Jx1l93j7J0djB59W1YxeqzfcpXFY/Pp6gD2KD2bovzSklSFjPziElulaEMLIz1D Sws9IxNLPUNj81grI1MlfTublNSczLLUIn27BL2ML5trC97wV9w89pmpgfEtTxcjJ4eEgInE sk9LmLsYuTiEBJYySkz9c4q9i5EDKCElMb9FCaJGWOLPtS42iJpPjBK/X7UxgiTYBAwleo/2 gdkiAiESL45eYQIpYha4zyixqnE2E0hCWCBcYuOcf2wgNouAqsTLl22sIAt4Bawlpu5PgVgg L7F6wwFmEJtTwEai8ewrFhBbCKhk28znLBMY+RYwMqxiFEktLc5Nzy021CtOzC0uzUvXS87P 3cQIDPVtx35u3sF4aWPwIUYBDkYlHt6II4vihFgTy4orcw8xSnAwK4nwxpQAhXhTEiurUovy 44tKc1KLDzGaAt00kVlKNDkfGId5JfGGpobmFpaG5sbmxmYWSuK8HQIHY4QE0hNLUrNTUwtS i2D6mDg4pRoYvc0k89IWR3y+zzQxRLlEcOXEP4HngxVjf76+dac6dnFSSFq2jfScg/6bZWfu mLHu6duwU3N+N00+6dHg/evkmVXu56UUZvjy7rVeX7hB/8vTmO6XRpx6BWfeVfK1b7uu3jbd Ofa2iKuaaJmR0p25l2ao7KrUKShJW7zi6f1+w5Mvl8hMfXM6UImlOCPRUIu5qDgRAP3RdD6L AgAA X-CMS-MailID: 20200424165157eucas1p2b0a0eb386fd9304d4cbf1e23248849d9 X-Msg-Generator: CA X-RootMTR: 20200424165157eucas1p2b0a0eb386fd9304d4cbf1e23248849d9 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200424165157eucas1p2b0a0eb386fd9304d4cbf1e23248849d9 References: <20200424165012.31915-1-s.nawrocki@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean There might be hardware configurations where 64-bit data accesses to XHCI registers are not supported properly. This patch removes the readq/writeq so always two 32-bit accesses are used to read/write 64-bit XHCI registers, similarly as it is done in Linux kernel. This patch fixes operation of the XHCI controller on RPI4 Broadcom BCM2711 SoC based board, where the VL805 USB XHCI controller is connected to the PCIe Root Complex, which is attached to the system through the SCB bridge. Even though the architecture is 64-bit the PCIe BAR is 32-bit and likely the 64-bit wide register accesses initiated by the CPU are not properly translated to a sequence of 32-bit PCIe accesses. xhci_readq(), for example, always returns same value in upper and lower 32-bits, e.g. 0xabcd1234abcd1234 instead of 0x00000000abcd1234. Cc: Sergey Temerkhanov Signed-off-by: Sylwester Nawrocki Reviewed-by: Bin Meng Reviewed-by: Nicolas Saenz Julienne --- Changes since RFC: - dropped Kconfig option, switched to not using readq/writeq unconditionally. --- include/usb/xhci.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/usb/xhci.h b/include/usb/xhci.h index 6017504..c16106a 100644 --- a/include/usb/xhci.h +++ b/include/usb/xhci.h @@ -1111,28 +1111,20 @@ static inline void xhci_writel(uint32_t volatile *regs, const unsigned int val) */ static inline u64 xhci_readq(__le64 volatile *regs) { -#if BITS_PER_LONG == 64 - return readq(regs); -#else __u32 *ptr = (__u32 *)regs; u64 val_lo = readl(ptr); u64 val_hi = readl(ptr + 1); return val_lo + (val_hi << 32); -#endif } static inline void xhci_writeq(__le64 volatile *regs, const u64 val) { -#if BITS_PER_LONG == 64 - writeq(val, regs); -#else __u32 *ptr = (__u32 *)regs; u32 val_lo = lower_32_bits(val); /* FIXME */ u32 val_hi = upper_32_bits(val); writel(val_lo, ptr); writel(val_hi, ptr + 1); -#endif } int xhci_hcd_init(int index, struct xhci_hccr **ret_hccr,