ubootRaspberryPi4_64bit: rebase patch series

This commit is contained in:
Bernardo Meurer 2022-04-26 17:12:52 -07:00
parent cff95d1193
commit 77bb75d6a2
No known key found for this signature in database
GPG Key ID: F4C0D53B8D14C246
10 changed files with 32 additions and 143 deletions

View File

@ -425,16 +425,14 @@ in {
CONFIG_USB_XHCI_BRCM=y
'';
extraPatches = [
./rpi-cm4/0002-usb-xhci-reset-endpoint-on-USB-stall.patch
./rpi-cm4/0003-rpi-add-NVMe-to-boot-order.patch
./rpi-cm4/0004-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch
./rpi-cm4/0005-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch
./rpi-cm4/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch
./rpi-cm4/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch
./rpi-cm4/0003-nvme-improve-readability-of-nvme_setup_prps.patch
./rpi-cm4/0004-nvme-Use-pointer-for-CPU-addressed-buffers.patch
./rpi-cm4/0005-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch
./rpi-cm4/0001-rpi-add-NVMe-to-boot-order.patch
./rpi-cm4/0002-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch
./rpi-cm4/0003-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch
./rpi-cm4/0004-drivers-bcm283x-don-t-explicitly-disable-init.patch
./rpi-cm4/0005-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch
./rpi-cm4/0006-nvme-improve-readability-of-nvme_setup_prps.patch
./rpi-cm4/0007-nvme-Use-pointer-for-CPU-addressed-buffers.patch
./rpi-cm4/0008-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch
];
};

View File

@ -1,10 +1,7 @@
From ae45864457182fcaa67911e1e3d8db242dff3646 Mon Sep 17 00:00:00 2001
Message-Id: <ae45864457182fcaa67911e1e3d8db242dff3646.1645627172.git.stefan@agner.ch>
In-Reply-To: <24b77460dbfa2497ceb7a1611bf28b6eb88a1d74.1645627172.git.stefan@agner.ch>
References: <24b77460dbfa2497ceb7a1611bf28b6eb88a1d74.1645627172.git.stefan@agner.ch>
From d39555653d3d67cc2e5873180a48fc1582cbb534 Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Tue, 29 Dec 2020 23:34:52 +0100
Subject: [PATCH 3/5] rpi: add NVMe to boot order
Subject: [PATCH 1/8] rpi: add NVMe to boot order
The Compute Module 4 I/O Board can support a NVMe. Add NVMe to the boot
order.
@ -40,5 +37,5 @@ index 4c5c1ac31f..e24c94c7d2 100644
BOOT_TARGET_PXE(func) \
BOOT_TARGET_DHCP(func)
--
2.35.1
2.35.3

View File

@ -1,10 +1,7 @@
From 3a13ff4eb509e8e80a52ae45c9a5573e745803c3 Mon Sep 17 00:00:00 2001
Message-Id: <3a13ff4eb509e8e80a52ae45c9a5573e745803c3.1645627172.git.stefan@agner.ch>
In-Reply-To: <24b77460dbfa2497ceb7a1611bf28b6eb88a1d74.1645627172.git.stefan@agner.ch>
References: <24b77460dbfa2497ceb7a1611bf28b6eb88a1d74.1645627172.git.stefan@agner.ch>
From 88e6bbedcc9c95db7de9a537a617520c60e4e86d Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 23 Sep 2021 23:43:31 +0200
Subject: [PATCH 4/5] Revert "nvme: Correct the prps per page calculation
Subject: [PATCH 2/8] Revert "nvme: Correct the prps per page calculation
method"
This reverts commit 859b33c948945f7904f60a2c12a3792d356d51ad.
@ -40,5 +37,5 @@ index 3c529a2fce..3bda491e12 100644
length -= (page_size - offset);
--
2.35.1
2.35.3

View File

@ -1,87 +0,0 @@
From c942eb452c1c31fe6259178b6e9fea5456d7fb9c Mon Sep 17 00:00:00 2001
Message-Id: <c942eb452c1c31fe6259178b6e9fea5456d7fb9c.1645627172.git.stefan@agner.ch>
In-Reply-To: <24b77460dbfa2497ceb7a1611bf28b6eb88a1d74.1645627172.git.stefan@agner.ch>
References: <24b77460dbfa2497ceb7a1611bf28b6eb88a1d74.1645627172.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Mon, 27 Sep 2021 12:28:04 +0200
Subject: [PATCH 2/5] usb: xhci: reset endpoint on USB stall
There are devices which cause a USB stall when trying to read strings.
Specifically Arduino Mega R3 stalls when trying to read the product
string.
The stall currently remains unhandled, and subsequent retries submit new
transfers on a stopped endpoint which ultimately cause a crash in
abort_td():
WARN halted endpoint, queueing URB anyway.
XHCI control transfer timed out, aborting...
Unexpected XHCI event TRB, skipping... (3affe040 00000000 13000000 02008401)
BUG at drivers/usb/host/xhci-ring.c:505/abort_td()!
BUG!
resetting ...
Linux seems to be able to recover from the stall by issuing a
TRB_RESET_EP command.
Introduce reset_ep() which issues a TRB_RESET_EP followed by setting the
transfer ring dequeue pointer via TRB_SET_DEQ. This allows to properly
recover from a USB stall error and continue communicating with the USB
device.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
drivers/usb/host/xhci-ring.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 35bd5cd29e..430823cb9d 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -481,6 +481,33 @@ union xhci_trb *xhci_wait_for_event(struct xhci_ctrl *ctrl, trb_type expected)
BUG();
}
+/*
+ * Issue reset endpoint command for an endpoint. This is required to recover
+ * a halted endpoint (e.g. due to a stall error).
+ */
+static void reset_ep(struct usb_device *udev, int ep_index)
+{
+ struct xhci_ctrl *ctrl = xhci_get_ctrl(udev);
+ struct xhci_ring *ring = ctrl->devs[udev->slot_id]->eps[ep_index].ring;
+ union xhci_trb *event;
+ u32 field;
+
+ printf("Resetting EP...\n");
+ xhci_queue_command(ctrl, NULL, udev->slot_id, ep_index, TRB_RESET_EP);
+ event = xhci_wait_for_event(ctrl, TRB_COMPLETION);
+ field = le32_to_cpu(event->trans_event.flags);
+ BUG_ON(TRB_TO_SLOT_ID(field) != udev->slot_id);
+ xhci_acknowledge_event(ctrl);
+
+ xhci_queue_command(ctrl, (void *)((uintptr_t)ring->enqueue |
+ ring->cycle_state), udev->slot_id, ep_index, TRB_SET_DEQ);
+ event = xhci_wait_for_event(ctrl, TRB_COMPLETION);
+ BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
+ != udev->slot_id || GET_COMP_CODE(le32_to_cpu(
+ event->event_cmd.status)) != COMP_SUCCESS);
+ xhci_acknowledge_event(ctrl);
+}
+
/*
* Stops transfer processing for an endpoint and throws away all unprocessed
* TRBs by setting the xHC's dequeue pointer to our enqueue pointer. The next
@@ -928,6 +955,10 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe,
record_transfer_result(udev, event, length);
xhci_acknowledge_event(ctrl);
+ if (udev->status == USB_ST_STALLED) {
+ reset_ep(udev, ep_index);
+ return -EPIPE;
+ }
/* Invalidate buffer to make it available to usb-core */
if (length > 0)
--
2.35.1

View File

@ -1,10 +1,7 @@
From b00922ee48987ef91f0ca2aa3a66ad22c6c83d57 Mon Sep 17 00:00:00 2001
Message-Id: <b00922ee48987ef91f0ca2aa3a66ad22c6c83d57.1645627172.git.stefan@agner.ch>
In-Reply-To: <24b77460dbfa2497ceb7a1611bf28b6eb88a1d74.1645627172.git.stefan@agner.ch>
References: <24b77460dbfa2497ceb7a1611bf28b6eb88a1d74.1645627172.git.stefan@agner.ch>
From bcc994f717e3835c66e5ff85d78f314a427312fa Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 7 Oct 2021 12:02:39 +0200
Subject: [PATCH 5/5] usb: xhci-brcm: Make driver compatible with downstream
Subject: [PATCH 3/8] usb: xhci-brcm: Make driver compatible with downstream
device tree
The downstream device tree uses just "generic-xhci" as compatible
@ -29,5 +26,5 @@ index fe17924028..0c6938187b 100644
};
--
2.35.1
2.35.3

View File

@ -1,8 +1,7 @@
From 78704bc154d695ee16fdf8396f4d60b740190014 Mon Sep 17 00:00:00 2001
Message-Id: <78704bc154d695ee16fdf8396f4d60b740190014.1650924333.git.stefan@agner.ch>
From dcb1d1594345d89733559ed2ce19f5cfcf352512 Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 14 Apr 2022 12:15:26 +0200
Subject: [PATCH 1/5] drivers: bcm283x: don't explicitly disable init
Subject: [PATCH 4/8] drivers: bcm283x: don't explicitly disable init
It seems that the reason why init doesn't succeed is the lack of clock
support in U-Boot. Setting the default clock of 48MHz for the PL011
@ -50,5 +49,5 @@ index e24c94c7d2..98ba4dc052 100644
/* GPIO */
#define CONFIG_BCM2835_GPIO
--
2.36.0
2.35.3

View File

@ -1,10 +1,7 @@
From c2447aa922068cebd9bbaac45acae3d853abf687 Mon Sep 17 00:00:00 2001
Message-Id: <c2447aa922068cebd9bbaac45acae3d853abf687.1650924333.git.stefan@agner.ch>
In-Reply-To: <78704bc154d695ee16fdf8396f4d60b740190014.1650924333.git.stefan@agner.ch>
References: <78704bc154d695ee16fdf8396f4d60b740190014.1650924333.git.stefan@agner.ch>
From f014611eb8b2ff2b46c9065ee354ca872a019273 Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 14 Apr 2022 12:18:41 +0200
Subject: [PATCH 2/5] drivers: bcm283x: allow to spawn any PL011 UART
Subject: [PATCH 5/8] drivers: bcm283x: allow to spawn any PL011 UART
The current code checks pinmux for the first PL011 only. Raspberry Pi 4
has multiple PL011 UARTs. This code prevents probing of other UARTs in
@ -64,5 +61,5 @@ index 182274036c..98628e1ca4 100644
* Read the ofdata here rather than in an of_to_plat() method
* since we need the soc simple-bus to be probed so that the 'ranges'
--
2.36.0
2.35.3

View File

@ -1,10 +1,7 @@
From 78924e9cf8c4af0baafcb2e7224bf04ad65276de Mon Sep 17 00:00:00 2001
Message-Id: <78924e9cf8c4af0baafcb2e7224bf04ad65276de.1650924333.git.stefan@agner.ch>
In-Reply-To: <78704bc154d695ee16fdf8396f4d60b740190014.1650924333.git.stefan@agner.ch>
References: <78704bc154d695ee16fdf8396f4d60b740190014.1650924333.git.stefan@agner.ch>
From 313fb277fae1c8687e93772663e37108363e9e7d Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 23 Sep 2021 23:52:44 +0200
Subject: [PATCH 3/5] nvme: improve readability of nvme_setup_prps()
Subject: [PATCH 6/8] nvme: improve readability of nvme_setup_prps()
Improve readability by introducing consts, reuse consts where
appropriate and adding variables with discriptive name.
@ -47,5 +44,5 @@ index 3bda491e12..1601651449 100644
prp_pool += page_size;
}
--
2.36.0
2.35.3

View File

@ -1,10 +1,7 @@
From e040d976ecbdd8071bbcb73d78e17ababa88c51f Mon Sep 17 00:00:00 2001
Message-Id: <e040d976ecbdd8071bbcb73d78e17ababa88c51f.1650924333.git.stefan@agner.ch>
In-Reply-To: <78704bc154d695ee16fdf8396f4d60b740190014.1650924333.git.stefan@agner.ch>
References: <78704bc154d695ee16fdf8396f4d60b740190014.1650924333.git.stefan@agner.ch>
From fa2fff362077ed6939659b9d5a42ae38cb2c9e24 Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 23 Sep 2021 23:58:35 +0200
Subject: [PATCH 4/5] nvme: Use pointer for CPU addressed buffers
Subject: [PATCH 7/8] nvme: Use pointer for CPU addressed buffers
Pass buffers which use CPU addressing as void pointers. This aligns with
DMA APIs which use void pointers as argument. It will avoid unnecessary
@ -259,5 +256,5 @@ index 2cdf8ce320..8ff823cd81 100644
/**
* nvme_scan_namespace - scan all namespaces attached to NVMe controllers
--
2.36.0
2.35.3

View File

@ -1,10 +1,7 @@
From c4736c35141e519d15430660e17c274e142e886d Mon Sep 17 00:00:00 2001
Message-Id: <c4736c35141e519d15430660e17c274e142e886d.1650924333.git.stefan@agner.ch>
In-Reply-To: <78704bc154d695ee16fdf8396f4d60b740190014.1650924333.git.stefan@agner.ch>
References: <78704bc154d695ee16fdf8396f4d60b740190014.1650924333.git.stefan@agner.ch>
From e3c3029de7f7e60e9f0aedd99a8eaf76ed7214ea Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Fri, 24 Sep 2021 00:27:39 +0200
Subject: [PATCH 5/5] nvme: translate virtual addresses into the bus's address
Subject: [PATCH 8/8] nvme: translate virtual addresses into the bus's address
space
So far we've been content with passing physical/CPU addresses when
@ -194,5 +191,5 @@ index c6aae4da5d..31e6899bca 100644
+
#endif /* __DRIVER_NVME_H__ */
--
2.36.0
2.35.3