linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: mbrugger@suse.com, u-boot@lists.denx.de, bmeng.cn@gmail.com,
	marex@denx.de, linux-kernel@vger.kernel.org
Cc: sjg@chromium.org, m.szyprowski@samsung.com,
	s.nawrocki@samsung.com, mark.kettenis@xs4all.nl,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Subject: [PATCH v3 2/2] usb: xhci: Load Raspberry Pi 4 VL805's firmware
Date: Tue,  5 May 2020 18:26:07 +0200	[thread overview]
Message-ID: <20200505162607.334-3-nsaenzjulienne@suse.de> (raw)
In-Reply-To: <20200505162607.334-1-nsaenzjulienne@suse.de>

When needed, RPi4's co-processor (called VideoCore) has to be instructed
to load VL805's firmware (the chip providing xHCI support). VideCore's
firmware expects the board's PCIe bus to be already configured in order
for it to load the xHCI chip firmware. So we have to make sure this
happens in between the PCIe configuration and xHCI startup.

Introduce a callback in xhci_pci_probe() to run this platform specific
routine.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

---

Changes since v2:
 - Get rid of #ifdef CONFIG_BCM2711
 - Get rid of redundant error message

Changes since v1:
 - Create callback

 board/raspberrypi/rpi/rpi.c | 6 ++++++
 drivers/usb/host/xhci-pci.c | 6 ++++++
 include/usb/xhci.h          | 3 +++
 3 files changed, 15 insertions(+)

diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index e367ba3092..dcaf45fbf2 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -14,6 +14,7 @@
 #include <lcd.h>
 #include <memalign.h>
 #include <mmc.h>
+#include <usb/xhci.h>
 #include <asm/gpio.h>
 #include <asm/arch/mbox.h>
 #include <asm/arch/msg.h>
@@ -494,3 +495,8 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 	return 0;
 }
+
+void xhci_pci_fixup(struct udevice *dev)
+{
+	bcm2711_notify_vl805_reset();
+}
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index c1f60da541..1285dde1ef 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -11,6 +11,10 @@
 #include <usb.h>
 #include <usb/xhci.h>
 
+__weak void xhci_pci_fixup(struct udevice *dev)
+{
+}
+
 static void xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr,
 			  struct xhci_hcor **ret_hcor)
 {
@@ -40,6 +44,8 @@ static int xhci_pci_probe(struct udevice *dev)
 	struct xhci_hccr *hccr;
 	struct xhci_hcor *hcor;
 
+	xhci_pci_fixup(dev);
+
 	xhci_pci_init(dev, &hccr, &hcor);
 
 	return xhci_register(dev, hccr, hcor);
diff --git a/include/usb/xhci.h b/include/usb/xhci.h
index c16106a2fc..57feed7603 100644
--- a/include/usb/xhci.h
+++ b/include/usb/xhci.h
@@ -16,6 +16,7 @@
 #ifndef HOST_XHCI_H_
 #define HOST_XHCI_H_
 
+#include <usb.h>
 #include <asm/types.h>
 #include <asm/cache.h>
 #include <asm/io.h>
@@ -1281,4 +1282,6 @@ extern struct dm_usb_ops xhci_usb_ops;
 
 struct xhci_ctrl *xhci_get_ctrl(struct usb_device *udev);
 
+extern void xhci_pci_fixup(struct udevice *dev);
+
 #endif /* HOST_XHCI_H_ */
-- 
2.26.2


  parent reply	other threads:[~2020-05-05 16:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 16:26 [PATCH v3 0/2] usb: xhci: Load Raspberry Pi 4 VL805's firmware Nicolas Saenz Julienne
2020-05-05 16:26 ` [PATCH v3 1/2] arm: rpi: Add function to trigger VL805's firmware load Nicolas Saenz Julienne
2020-05-06  5:33   ` Bin Meng
2020-05-06  8:31     ` Nicolas Saenz Julienne
2020-05-05 16:26 ` Nicolas Saenz Julienne [this message]
2020-05-13 12:56 ` [PATCH v3 0/2] usb: xhci: Load Raspberry Pi 4 VL805's firmware Nicolas Saenz Julienne
2020-06-01 10:47 ` Nicolas Saenz Julienne
2020-06-01 10:53   ` Marek Vasut
2020-06-01 11:09     ` Nicolas Saenz Julienne
2020-06-01 11:12       ` Marek Vasut
2020-06-01 14:41         ` Nicolas Saenz Julienne
2020-06-01 15:27           ` Marek Vasut
2020-06-04 11:18             ` Nicolas Saenz Julienne
2020-06-04 11:52               ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200505162607.334-3-nsaenzjulienne@suse.de \
    --to=nsaenzjulienne@suse.de \
    --cc=bmeng.cn@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=marex@denx.de \
    --cc=mark.kettenis@xs4all.nl \
    --cc=mbrugger@suse.com \
    --cc=s.nawrocki@samsung.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).