From patchwork Mon May 25 11:39:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylwester Nawrocki X-Patchwork-Id: 1297303 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=loc+e1OU; 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 49VwBx1V0jz9sRW for ; Mon, 25 May 2020 21:40:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5FAE081817; Mon, 25 May 2020 13:40:38 +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="loc+e1OU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3C62D81C62; Mon, 25 May 2020 13:40:20 +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 mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9358281817 for ; Mon, 25 May 2020 13:40: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=s.nawrocki@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200525114013euoutp0115ae857833a1637f9a6d51404a7e4170~SQpIAf9Un1437514375euoutp01O for ; Mon, 25 May 2020 11:40:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200525114013euoutp0115ae857833a1637f9a6d51404a7e4170~SQpIAf9Un1437514375euoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1590406813; bh=mpc5rYw/U19wNz9z3l9qIGYqOM/GqAOeD9khN0UIZwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=loc+e1OUDokwyF8lGbCKWZl6ukjgDyGe/LCTnW5YuWJ1jO2TIc5Qky2urUDlLZjUh h7XQf4h0eyuZ608PL+GmU47xMwABAKNgt6xhnjvylmia6wWEJEw1nYisDaaPrbaf2g 4jG867y288gNqZazsgWRR3xZl7LUpPOZa22YajfE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200525114012eucas1p121c073d5a115a5bea0341e90bf80ff25~SQpHumLUA1614016140eucas1p1m; Mon, 25 May 2020 11:40:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 98.94.61286.C9EABCE5; Mon, 25 May 2020 12:40:12 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200525114012eucas1p2fe3523a8d33e6670f8c2877bd4799aca~SQpHbBkG42414324143eucas1p2V; Mon, 25 May 2020 11:40:12 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200525114012eusmtrp20042c368d9a3123db07f9937ddf3a1df~SQpHZbqAa2713827138eusmtrp2E; Mon, 25 May 2020 11:40:12 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-dc-5ecbae9c7ece Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 66.47.07950.C9EABCE5; Mon, 25 May 2020 12:40:12 +0100 (BST) Received: from AMDC3061.digital.local (unknown [106.120.51.75]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200525114012eusmtip1b52942bd6a7c9b986571a1baa2dde427~SQpG45Sgj2560425604eusmtip1l; Mon, 25 May 2020 11:40:12 +0000 (GMT) From: Sylwester Nawrocki To: u-boot@lists.denx.de, mbrugger@suse.com Cc: marex@denx.de, bmeng.cn@gmail.com, james.quinlan@broadcom.com, sjg@chromium.org, nsaenzjulienne@suse.de, jh80.chung@samsung.com, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Sylwester Nawrocki , Sergey Temerkhanov Subject: [PATCH v4 2/9] usb: xhci: Use only 32-bit accesses in xhci_writeq/xhci_readq Date: Mon, 25 May 2020 13:39:52 +0200 Message-Id: <20200525113959.11886-3-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200525113959.11886-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIKsWRmVeSWpSXmKPEx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m7WczeLwm3ZWi6Wz9rFbfNuyjdHi7d5Odgce j1n3z7J5zG64yOIxb9YJFo+ds+6ye5y9s4PRo2/LKkaP9VuusnhsPl0dwBGlZ1OUX1qSqpCR X1xiqxRtaGGkZ2hpoWdkYqlnaGwea2VkqqRvZ5OSmpNZllqkb5egl7Fz8kLWgs8CFR87FrM1 MD7k7WLk5JAQMJFY9HwXG4gtJLCUUeLa09AuRg6guJTE/BYliBJhiT/XuoBKuIBKPjFKtMw5 zwKSYBMwlOg92scIYosI6Eo09qxjASliFljCJHFh4RNWkISwQKhE38HZTCBDWQRUJW4+9AIx eQWsJb5+MoGYLy+xesMBZhCbU8BG4tTBe8wQ51hLzJz1jHECI98CRoZVjCKppcW56bnFRnrF ibnFpXnpesn5uZsYgcG/7djPLTsYu94FH2IU4GBU4uG1WHM6Tog1say4MvcQowQHs5IIb5s7 UIg3JbGyKrUoP76oNCe1+BCjKdBJE5mlRJPzgZGZVxJvaGpobmFpaG5sbmxmoSTO2yFwMEZI ID2xJDU7NbUgtQimj4mDU6qBUa8ku3r+vPDpvt9Pb7Xm09zJ82Lx9pA5H6vYbr5bYLTZava5 noatK8/raVSd/b8r+6yXwZnEIA/XKPefcy4y6xfkpCUcy9xybQlToPrdMo5M8x4HznjF/Ale 6V/yE6dvbHm1KXZmvnpZT5JceMe5FRqzrnyf6n90mdHy/xNdTHW4Z9RfC24UUWIpzkg01GIu Kk4EAGn7l4+UAgAA X-CMS-MailID: 20200525114012eucas1p2fe3523a8d33e6670f8c2877bd4799aca X-Msg-Generator: CA X-RootMTR: 20200525114012eucas1p2fe3523a8d33e6670f8c2877bd4799aca X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200525114012eucas1p2fe3523a8d33e6670f8c2877bd4799aca References: <20200525113959.11886-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,