From patchwork Wed May 22 01:03:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jung Daehwan X-Patchwork-Id: 13670123 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0E17D29E for ; Wed, 22 May 2024 01:04:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716339856; cv=none; b=EewUmhB/46/GW5DekjClLdX1+FhkvnSKvdjoPZfBUgWoBO88mcms37RJ6Sl3N/YHYIRmqlNUuEUmMpz/UfMyyX3219E+RSsZpvHFxw8Qm10sMxAlhBBd3LNXWKYeBmCsSmVnbgnTBaeHE4as0z8xnRyXYvPUzAohBzf50LDqju0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716339856; c=relaxed/simple; bh=OqYU2toc8VhoFRt8nhJ72nYlMy15OQ6sULFO1f7aqe4=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:References; b=n8o8Nwsg1sKcNH+jEWk6Gsm6YDvk65FhacKFWh6ogon9hjdadfvwWfX4JY59Rca307G+HZ5vrsvMZ3I+UoaELHaZQKCKbc7MWcUYnQL/ucEAmqtRvOZK8lOIdAdBLP+Lknq7eZzFT9jsCI/E19gNq1D8bHKv6HwUYt7AOOmcl8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=lapIq5Gk; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="lapIq5Gk" Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20240522010410epoutp03060e622537cd2f93dad05515e875aef1~RqgAwEe0J1276912769epoutp03f for ; Wed, 22 May 2024 01:04:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20240522010410epoutp03060e622537cd2f93dad05515e875aef1~RqgAwEe0J1276912769epoutp03f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1716339850; bh=Uitcad8ZpKbqMNDW2YytBLVtTZ4j7uwwqX9O3MWQJPo=; h=From:To:Cc:Subject:Date:References:From; b=lapIq5GkskK7aRDEkVatV8emSRWbNh4HPuzM77CaA1geDzhCTFC+tjvq2DZ5gA/9m U9IsDp4IYTSpOS9iWF1zS96iVj480Oq/7SJx+3WCXVho75IKTosdXXejZcQe76u6X8 ocuag9zW4zX5ZL3XPILy7k28b838/khdOpmoY/YE= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20240522010410epcas2p11d5550044515a107ecd4ef5392f36bdc~RqgAbdLEf0338303383epcas2p1e; Wed, 22 May 2024 01:04:10 +0000 (GMT) Received: from epsmgec2p1-new.samsung.com (unknown [182.195.36.69]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4VkY3Y64zSz4x9Q9; Wed, 22 May 2024 01:04:09 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmgec2p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 7A.94.19141.9844D466; Wed, 22 May 2024 10:04:09 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20240522010409epcas2p457b2fcb4f423f2500305053f44ae3199~Rqf-d4A7i0068900689epcas2p4s; Wed, 22 May 2024 01:04:09 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240522010409epsmtrp2846a47b1fde03b71481eeb5f30d7a431~Rqf-XLog81573115731epsmtrp2M; Wed, 22 May 2024 01:04:09 +0000 (GMT) X-AuditID: b6c32a4d-869ff70000004ac5-bb-664d44892cd5 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 33.61.08924.9844D466; Wed, 22 May 2024 10:04:09 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [10.229.95.128]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240522010409epsmtip207170fe17fd7525879063e08d597c994~Rqf-JMfKt2481524815epsmtip2G; Wed, 22 May 2024 01:04:09 +0000 (GMT) From: Daehwan Jung To: Mathias Nyman , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org (open list:USB XHCI DRIVER), linux-kernel@vger.kernel.org (open list), Thinh Nguyen , Daehwan Jung Subject: [RFC] usb: host: xhci-mem: Write high first on erst base of secondary interrupter Date: Wed, 22 May 2024 10:03:59 +0900 Message-Id: <1716339839-44022-1-git-send-email-dh10.jung@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHKsWRmVeSWpSXmKPExsWy7bCmqW6ni2+aweM+Q4s7C6YxWTQvXs9m cXnXHDaLRctamS2aN01htVi14AC7A5vH4j0vmTz2z13D7tG3ZRWjx5b9nxk9Pm+SC2CNyrbJ SE1MSS1SSM1Lzk/JzEu3VfIOjneONzUzMNQ1tLQwV1LIS8xNtVVy8QnQdcvMAbpASaEsMacU KBSQWFyspG9nU5RfWpKqkJFfXGKrlFqQklNgXqBXnJhbXJqXrpeXWmJlaGBgZApUmJCdseXx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NvyypGjy37PzN6fN4kF8AaxWWT kpqTWZZapG+XwJWx5fEa9oKnghW/p81gbWD8z9fFyMkhIWAicePPAbYuRi4OIYHdjBKXV2xi h0hISiydewPKFpa433KEFaLoG6PEgl9PgDo4ONgEtCS+L2QEqRERiJNYcXkPC0gNs8BORonb H3awgSSEBaIk/vfcARvEIqAqseXnL7A4r4CrxJzrDxkhFshJ3DzXyTyBkWcBI8MqRsnUguLc 9NxiwwLDvNRyveLE3OLSvHS95PzcTYzg4NHS3MG4fdUHvUOMTByMhxglOJiVRHg3bfFME+JN SaysSi3Kjy8qzUktPsQozcGiJM4r/qI3RUggPbEkNTs1tSC1CCbLxMEp1cDk0h+g3nT/bezf H0/m8Xvd27WiVHp/3G/jmZsqXjedVc9vv50064WJwZlnF2VL5q8WM+PVf7bhg+H25slOJrdb +1wOPnwpFBLPMvFiwEal2eUvTu+8ousSI822r/iQt7Xy5bqN53bqtN/9y6bTt6Ky+iH7spIb TR0MewMmsv8Q5RP9vtJG6twPPd/eReWVCpOnH3wXFGBh/orZ4bYdxzmJvcZ8jy7l9Quu3fdB zt1aTCaWy/7pgfseu/ctVeZWyHNRERdcIiRo80Pp/Y4Xf180/y9Q1lM58OrT6yUc54yVjlt+ WWrMLZv8W2jFZ+l+hg3L7K2MWH1NbhnuvbxHTdV0z6Eob9VdPsFni6bP2pOgxFKckWioxVxU nAgAkSKzKY0CAAA= X-CMS-MailID: 20240522010409epcas2p457b2fcb4f423f2500305053f44ae3199 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240522010409epcas2p457b2fcb4f423f2500305053f44ae3199 References: Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: ERSTBA_HI should be written first on secondary interrupter. That's why secondary interrupter could be set while Host Controller is already running. [Synopsys]- The host controller was design to support ERST setting during the RUN state. But since there is a limitation in controller in supporting separate ERSTBA_HI and ERSTBA_LO programming, It is supported when the ERSTBA is programmed in 64bit, or in 32 bit mode ERSTBA_HI before ERSTBA_LO [Synopsys]- The internal initialization of event ring fetches the "Event Ring Segment Table Entry" based on the indication of ERSTBA_LO written. Signed-off-by: Daehwan Jung --- drivers/usb/host/xhci-mem.c | 5 ++++- drivers/usb/host/xhci.h | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 3100219..36ee704 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2325,7 +2325,10 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir, erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base); erst_base &= ERST_BASE_RSVDP; erst_base |= ir->erst.erst_dma_addr & ~ERST_BASE_RSVDP; - xhci_write_64(xhci, erst_base, &ir->ir_set->erst_base); + if (intr_num == 0) + xhci_write_64(xhci, erst_base, &ir->ir_set->erst_base); + else + xhci_write_64_r(xhci, erst_base, &ir->ir_set->erst_base); /* Set the event ring dequeue address of this interrupter */ xhci_set_hc_event_deq(xhci, ir); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 3041515..7951c0e 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -17,6 +17,7 @@ #include #include #include +#include /* Code sharing between pci-quirks and xhci hcd */ #include "xhci-ext-caps.h" @@ -1747,6 +1748,11 @@ static inline void xhci_write_64(struct xhci_hcd *xhci, { lo_hi_writeq(val, regs); } +static inline void xhci_write_64_r(struct xhci_hcd *xhci, + const u64 val, __le64 __iomem *regs) +{ + hi_lo_writeq(val, regs); +} static inline int xhci_link_trb_quirk(struct xhci_hcd *xhci) {