From patchwork Tue Apr 21 16:50:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylwester Nawrocki X-Patchwork-Id: 1274443 X-Patchwork-Delegate: marek.vasut@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=TdaEIEQw; 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 4969qL0CtWz9sSK for ; Wed, 22 Apr 2020 03:41:49 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0B3E7811EC; Tue, 21 Apr 2020 19:40:47 +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="TdaEIEQw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BB38A81BC1; Tue, 21 Apr 2020 18:51:28 +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 38EFA81737 for ; Tue, 21 Apr 2020 18:51:25 +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 20200421165124euoutp021fb4b724898c009874780933c7d14680~H49IAvOSY2231422314euoutp02e for ; Tue, 21 Apr 2020 16:51:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200421165124euoutp021fb4b724898c009874780933c7d14680~H49IAvOSY2231422314euoutp02e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1587487884; bh=K5kn614EGEGq9XoRGx08RBxVoAnisE7ZdTKndMJbDRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TdaEIEQw+FnhAJ4fnk4tmLrXmueW2he//FahOikgAeJ6M+OUzadWhD3z2FaQlXB+o eLYh80t9Zmtxjnb8VqEE1Keye1xwPlQilyQlxddEuU4CRUtb1bSTay6Q1TUzHOSaIj HvCnkkprHeRHnhrs7cj1RJfUYImrhaBUSxNNZCGE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200421165124eucas1p2c8640007863ed087707c8d010be6be09~H49HqVo__0783407834eucas1p2_; Tue, 21 Apr 2020 16:51:24 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 57.5D.61286.C842F9E5; Tue, 21 Apr 2020 17:51:24 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200421165124eucas1p161d4049c0e136fc74ae2b00c2a1b3883~H49HV1Vh41763717637eucas1p1o; Tue, 21 Apr 2020 16:51:24 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200421165124eusmtrp2db8fc0e5d79f82c5cc88dc94100c80ec~H49HVJgfe3266732667eusmtrp2Z; Tue, 21 Apr 2020 16:51:24 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-79-5e9f248c9bc0 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 19.3B.07950.B842F9E5; Tue, 21 Apr 2020 17:51:23 +0100 (BST) Received: from AMDC3061.digital.local (unknown [106.120.51.75]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200421165123eusmtip15bd7207cfa303d93b849089978670beb~H49GwZGUR0901309013eusmtip1C; Tue, 21 Apr 2020 16:51:23 +0000 (GMT) From: Sylwester Nawrocki To: u-boot@lists.denx.de, mbrugger@suse.com, marex@denx.de, bmeng.cn@gmail.com Cc: agraf@suse.de, sjg@chrmium.org, jh80.chung@samsung.com, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, Sylwester Nawrocki Subject: [RFC PATCH 6/9] usb: xhci: Allow accessing 64-bit registers with DWORD accesses only Date: Tue, 21 Apr 2020 18:50:56 +0200 Message-Id: <20200421165059.19394-7-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200421165059.19394-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCKsWRmVeSWpSXmKPExsWy7djPc7o9KvPjDFY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XXaPs3d2MHr0bVnF6LF+y1UWj82nqwPYo/RsivJLS1IVMvKLS2yVog0tjPQMLS30jEws 9QyNzWOtjEyV9O1sUlJzMstSi/TtEvQy1tx9yVzQIFTxZdEu5gbGu3xdjJwcEgImEpO+LmDq YuTiEBJYyihx8udKxi5GDqCElMT8FiWIGmGJP9e62CBqPjFKfOxoZgJJsAkYSvQe7WMEsUUE QiReHL0CNogZZNCfhjesIAlhgViJGXMWsYPYLAKqEhM71oA18wpYS1xdPo0dYoO8xOoNB5hB bE4BG4m732ewgNhCQDUNl5awTGDkW8DIsIpRJLW0ODc9t9hIrzgxt7g0L10vOT93EyMwyLcd +7llB2PXu+BDjAIcjEo8vDfOz4sTYk0sK67MPcQowcGsJMK74SFQiDclsbIqtSg/vqg0J7X4 EKMp0FETmaVEk/OBEZhXEm9oamhuYWlobmxubGahJM7bIXAwRkggPbEkNTs1tSC1CKaPiYNT qoExbeNShg0BsVpXNX2+ynqZ6E7NXSE7VcnncfFtX/399bscXzZ29OomzhFKnuj8rz715Ruj Dfa+8s+n7hDYcHyawgFVruDoGTumeS/WeHOltsT4QDWHrfWL65mbVjLm/99wxqyee9+3r8fY 3h36XGPv8K1gQVD7jm/XPqUe2OMxsVg3m+mz4/cjSizFGYmGWsxFxYkAsqsjeYgCAAA= X-CMS-MailID: 20200421165124eucas1p161d4049c0e136fc74ae2b00c2a1b3883 X-Msg-Generator: CA X-RootMTR: 20200421165124eucas1p161d4049c0e136fc74ae2b00c2a1b3883 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200421165124eucas1p161d4049c0e136fc74ae2b00c2a1b3883 References: <20200421165059.19394-1-s.nawrocki@samsung.com> X-Mailman-Approved-At: Tue, 21 Apr 2020 19:40:20 +0200 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 This patch adds a Kconfig option which allows accessing 64-bit xHCI IO registers only with 2 double word accesses rather than using a single quad word access. There might be HW configurations where single quad word access doesn't work, even though the CPU is 64-bit. That seems to be the case on rpi4 board with Broadcom BCM2711 SoC, where the VL805 USB xHCI hub is connected to the PCIe controller behind the SCB bridge. Signed-off-by: Sylwester Nawrocki --- So far I couldn't come up with anything better to make the xHCI host controller working on the rpi4 board. For some reason dereferencing a 64-bit pointer to access 64-bit registers doesn't work there, might be a limitation of the PCIe bridge behind the SCB. In Linux always 2 double word accesses are used. --- drivers/usb/host/Kconfig | 7 +++++++ include/usb/xhci.h | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 0987ff2..3990b8a 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -15,6 +15,13 @@ config USB_XHCI_HCD if USB_XHCI_HCD +config XHCI_64BIT_DWORD_ACCESS_ONLY + bool "Access xHCI 64-bit registers with double word accesses only" + help + Choose this option if your hardware does not support quad word accesses + for registers with 64-bit address pointers. + If unsure, say Y. + config USB_XHCI_DWC3 bool "DesignWare USB3 DRD Core Support" help diff --git a/include/usb/xhci.h b/include/usb/xhci.h index 6017504..459e76b 100644 --- a/include/usb/xhci.h +++ b/include/usb/xhci.h @@ -1111,7 +1111,7 @@ 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 +#if BITS_PER_LONG == 64 && !defined(CONFIG_XHCI_64BIT_DWORD_ACCESS_ONLY) return readq(regs); #else __u32 *ptr = (__u32 *)regs; @@ -1123,7 +1123,7 @@ static inline u64 xhci_readq(__le64 volatile *regs) static inline void xhci_writeq(__le64 volatile *regs, const u64 val) { -#if BITS_PER_LONG == 64 +#if BITS_PER_LONG == 64 && !defined(CONFIG_XHCI_64BIT_DWORD_ACCESS_ONLY) writeq(val, regs); #else __u32 *ptr = (__u32 *)regs;