From patchwork Mon May 4 12:45:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylwester Nawrocki X-Patchwork-Id: 1282595 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=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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=pk4tcHnp; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 49G2fd4ptYz9sSc for ; Mon, 4 May 2020 22:46:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 66C4281FC0; Mon, 4 May 2020 14:46:02 +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="pk4tcHnp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2A6A881FC6; Mon, 4 May 2020 14:45:56 +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 2F1DE81FAA for ; Mon, 4 May 2020 14:45:46 +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 20200504124544euoutp025d31f20c622c6f3a38c1f2c5592f6332~L0-VwUKgH1324713247euoutp02_ for ; Mon, 4 May 2020 12:45:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200504124544euoutp025d31f20c622c6f3a38c1f2c5592f6332~L0-VwUKgH1324713247euoutp02_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1588596344; bh=mpc5rYw/U19wNz9z3l9qIGYqOM/GqAOeD9khN0UIZwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pk4tcHnpfaEuz1SgdBpSA98YkqQGhCNH2UgFUUv8Qef9KR8f3ThU6Gpx9mAzpTScc 9sMRfYOY1vIQvMZDZ//q/53ucVs1CDbRFvSKFSVXnAVEg6GeuJjW3iTrlqx04oWdDT vbcs+IW9uyt/cMm7xiRqe9/CCHDGc5Mlx27WjuTM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200504124544eucas1p28fef8af43d8a4ed3b8852f07ff32b5a4~L0-VUVuXH1023610236eucas1p2e; Mon, 4 May 2020 12:45:44 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id F4.A1.60679.87E00BE5; Mon, 4 May 2020 13:45:44 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200504124543eucas1p12dd4bca4b6b65593027c63485c659191~L0-U0C9iL0157301573eucas1p1d; Mon, 4 May 2020 12:45:43 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200504124543eusmtrp159bbc0912f42a5de45c3430ab455f207~L0-Uyw61g1936819368eusmtrp13; Mon, 4 May 2020 12:45:43 +0000 (GMT) X-AuditID: cbfec7f4-0cbff7000001ed07-66-5eb00e784974 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 81.E4.07950.77E00BE5; Mon, 4 May 2020 13:45:43 +0100 (BST) Received: from AMDC3061.digital.local (unknown [106.120.51.75]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200504124543eusmtip2215f8e4b4179359eca5b04c79a63d836~L0-UQaW1y3047630476eusmtip2r; Mon, 4 May 2020 12:45:43 +0000 (GMT) From: Sylwester Nawrocki To: u-boot@lists.denx.de, mbrugger@suse.com, marex@denx.de, bmeng.cn@gmail.com Cc: nsaenzjulienne@suse.de, sjg@chromium.org, jh80.chung@samsung.com, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Sylwester Nawrocki , Sergey Temerkhanov Subject: [PATCH v2 02/10] usb: xhci: Use only 32-bit accesses in xhci_writeq/xhci_readq Date: Mon, 4 May 2020 14:45:15 +0200 Message-Id: <20200504124523.23484-3-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200504124523.23484-1-s.nawrocki@samsung.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YOGM9q8XUnniL G7/aWC3WHrnLbvGmrZHRYsHkJ6wW22YtZ7M4/Kad1WLprH3sFt+2bGO0eLu3k92B22N2w0UW j3mzTrB47Jx1l93j7J0djB59W1YxeqzfcpXFY/Pp6gD2KD2bovzSklSFjPziElulaEMLIz1D Sws9IxNLPUNj81grI1MlfTublNSczLLUIn27BL2MnZMXshZ8Fqj42LGYrYHxIW8XIyeHhICJ xOVNVxlBbCGBpYwSy7endTFyAMWlJOa3KEGUCEv8udbF1sXIBVTyCajkw3xWkASbgKFE79E+ sF4RgRCJF0evMIEUMQvcZ5To6voDViQsEC4xcfVnRpChLAKqEo+69UHCvALWEm1vWpggFshL rN5wgBnE5hSwkXjT9IkF4h5rib0/jrFNYORbwMiwilEktbQ4Nz232EivODG3uDQvXS85P3cT IzDUtx37uWUHY9e74EOMAhyMSjy8G76ujxNiTSwrrsw9xCjBwawkwrujBSjEm5JYWZValB9f VJqTWnyI0RToponMUqLJ+cA4zCuJNzQ1NLewNDQ3Njc2s1AS5+0QOBgjJJCeWJKanZpakFoE 08fEwSnVwLg64R7DoYubNvw+nJjifjw74/5kz7VdzE/WlTvuPaoenHTnuGSqaOXzvxlOTybN 2H4vq03vYWjJyS1RWwJXqDrp5Gclc8bpzDEUaw0MVn7AnH8r6q7w54uGClf1+879d3dev/9g 717e9bpZ6SERVSnzjpcKJgrdnzO72Mb8gOXdjiCWCQIVvkosxRmJhlrMRcWJAKD0RsCLAgAA X-CMS-MailID: 20200504124543eucas1p12dd4bca4b6b65593027c63485c659191 X-Msg-Generator: CA X-RootMTR: 20200504124543eucas1p12dd4bca4b6b65593027c63485c659191 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200504124543eucas1p12dd4bca4b6b65593027c63485c659191 References: <20200504124523.23484-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 v1: - none. 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,