Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp725960ybj; Tue, 5 May 2020 06:48:56 -0700 (PDT) X-Google-Smtp-Source: APiQypIFTW12vbQiWtfQPb8HEotcIof8YpjCibuupgrWONm/y5j+Pu/B47GagnG+v8wEGAwhEZT6 X-Received: by 2002:a05:6402:698:: with SMTP id f24mr2612805edy.260.1588686535852; Tue, 05 May 2020 06:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588686535; cv=none; d=google.com; s=arc-20160816; b=ER0QaZUoGFPIrEp3DsHsk0j9517cQc8swJdRT/+q1OGbJUg9djaWIAdqrgOMnE0Iw3 CIiUecnCegSJw1DII0DWfwC8zKq6nR1fgT8OYdbaosse8M1s7V/oQDIscHx1T76sZ9w6 sydSATUwBtSKuLMDWtSukcQTX0ZhP4QgRdQHmftA/TVP2u3WY0yODcXg7hv5rl/oRXHO 9eaYBhQImBLOGy1TftAQJY3MNBCYoPSbud0951UvpxNIpE0weRMeuDIcH0YYnRR9Z4hE 9bnEfup3Tzn+fsYlZf0ajAW8DeIkkSKpBnbRoshvfUrKlx2W8o/Ys7aMCYIFQ571djAG zNOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=ppl7JJURwjC719PlOnXqL5fRwoCEx3/YXgZJ0bywnSw=; b=yT5kv259YSEvQX0wlJLSwBq+pybxaySNeiF2s0mZCv73ZhR1MZrSk2wU2i/XcmsHjr Nyq+OXmNMp7pbyQNzVrA3wpXTrnxVEd4eXLFT+t28drdz5HVP7vIUMBZIJwPnbd0EDeZ N/Y5vId6xwFYB1ZGbnRjr62VQLs0i1e4iMY8UkedTvzUtEkcJ753AyPi6TXYFMYx3QFL VJZezHU77TISkGmn6JJxqRdd9zwroj3/3RHnZXRUPh8rYujpu6h4y7m2XbHAgcFfE41p MQnrhEytlBsU9BY6jCSjzapRFOUELnN3wly/eVrPCzmv3QX9KaJM6AtqItZ8f0KMVsc5 w2+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si1106714ejw.89.2020.05.05.06.48.30; Tue, 05 May 2020 06:48:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729122AbgEENrE (ORCPT + 99 others); Tue, 5 May 2020 09:47:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:58614 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728965AbgEENrE (ORCPT ); Tue, 5 May 2020 09:47:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 72CD5ABB2; Tue, 5 May 2020 13:47:04 +0000 (UTC) Message-ID: <073b80ef4285a02729f5b06872474202d4ff2e3e.camel@suse.de> Subject: Re: [PATCH v2 2/2] usb: xhci: Load Raspberry Pi 4 VL805's firmware From: Nicolas Saenz Julienne To: Matthias Brugger , 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 Date: Tue, 05 May 2020 15:47:00 +0200 In-Reply-To: <38448831-9f22-f887-e938-065fed195414@suse.com> References: <20200430130433.11248-1-nsaenzjulienne@suse.de> <20200430130433.11248-3-nsaenzjulienne@suse.de> <0958ece3-feda-65c0-b0e2-893e2dfeb508@suse.com> <38448831-9f22-f887-e938-065fed195414@suse.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-gTb7tVCY4YQZBYQw8Qwq" User-Agent: Evolution 3.36.2 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-gTb7tVCY4YQZBYQw8Qwq Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2020-05-05 at 15:39 +0200, Matthias Brugger wrote: >=20 > On 05/05/2020 14:53, Nicolas Saenz Julienne wrote: > > Hi Matthias, > >=20 > > On Tue, 2020-05-05 at 14:15 +0200, Matthias Brugger wrote: > > > On 30/04/2020 15:04, Nicolas Saenz Julienne wrote: > > > > When needed, RPi4's co-processor (called VideoCore) has to be instr= ucted > > > > to load VL805's firmware (the chip providing xHCI support). VideoCo= re's > > > > firmware expects the board's PCIe bus to be already configured in o= rder > > > > for it to load the xHCI chip firmware. So we have to make sure this > > > > happens in between the PCIe configuration and xHCI startup. > > > >=20 > > > > Introduce a callback in xhci_pci_probe() to run this platform speci= fic > > > > routine. > > > >=20 > > > > Signed-off-by: Nicolas Saenz Julienne > > > >=20 > > > > --- > > > >=20 > > > > Changes since v1: > > > > - Create callback > > > >=20 > > > > board/raspberrypi/rpi/rpi.c | 12 ++++++++++++ > > > > drivers/usb/host/xhci-pci.c | 6 ++++++ > > > > include/usb/xhci.h | 3 +++ > > > > 3 files changed, 21 insertions(+) > > > >=20 > > > > diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rp= i.c > > > > index e367ba3092..8aa78d1f48 100644 > > > > --- a/board/raspberrypi/rpi/rpi.c > > > > +++ b/board/raspberrypi/rpi/rpi.c > > > > @@ -14,6 +14,7 @@ > > > > #include > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -494,3 +495,14 @@ int ft_board_setup(void *blob, bd_t *bd) > > > > =20 > > > > return 0; > > > > } > > > > + > > > > +#ifdef CONFIG_BCM2711 > > >=20 > > > This won't work with rpi_arm64_defconfig. > > > Can't we just evaluate at runtime if we need to do anything in > > > xhci_pci_fixup. > >=20 > > I can't see why, who is going to call xhci_pci_probe() in RPi3? > >=20 >=20 > If you do make rpi_arm64_defconfig and inspect the .config, you will see = that > CONFIG_BCM2711 is not defined, so this code won't be called on RPi4. Oh! Understood. Well, given that only xhci_pci_probe() is called if we're running on RPi4, = I think I can disregard those defines altogether. I'll double-check that. Regards, Nicolas > Regards, > Matthias >=20 > > Regards, > > Nicolas > >=20 > > > I wonder if the newer RPi4 have also a newer revision ID (see > > > get_board_rev). > > > If > > > so we could add another bool to struct rpi_model which will indicate = us if > > > we > > > need to notify VideoCore about vl805's firmware. > > >=20 > > > > +void xhci_pci_fixup(struct udevice *dev) > > > > +{ > > > > + int ret; > > > > + > > > > + ret =3D bcm2711_notify_vl805_reset(); > > > > + if (ret) > > > > + printf("RPI: Failed to notify VideoCore about vl805's > > > > firmware\n"); > > > > +} > > > > +#endif > > > > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pc= i.c > > > > index c1f60da541..1285dde1ef 100644 > > > > --- a/drivers/usb/host/xhci-pci.c > > > > +++ b/drivers/usb/host/xhci-pci.c > > > > @@ -11,6 +11,10 @@ > > > > #include > > > > #include > > > > =20 > > > > +__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; > > > > =20 > > > > + xhci_pci_fixup(dev); > > > > + > > > > xhci_pci_init(dev, &hccr, &hcor); > > > > =20 > > > > 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_ > > > > =20 > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -1281,4 +1282,6 @@ extern struct dm_usb_ops xhci_usb_ops; > > > > =20 > > > > struct xhci_ctrl *xhci_get_ctrl(struct usb_device *udev); > > > > =20 > > > > +extern void xhci_pci_fixup(struct udevice *dev); > > > > + > > > > #endif /* HOST_XHCI_H_ */ > > > >=20 --=-gTb7tVCY4YQZBYQw8Qwq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl6xblQACgkQlfZmHno8 x/7l+Af/SDoBVKw5HdpLkFov8Q6yNB39S5R4rQ9T8R5xCY8mTMqyTUBfukTrv4Hs yRw5KSV4YgH/eNOBiy80CR/MnB4/nSwK1z+Luszqj7c6RCSYzRo0cUVCOhm9FBBg Be8EdlrL3zjdLEx369R7Tgo7U0pQCwfs3d4CNS/BGSLC6rKPVcmw3otsqWoS8Jqm Sf3z1PSAv+4FbIoRIyU3Us9i7rCGL/y6yQtvryfeAcXswwWS6QkUcAdwcDa62ft6 OevVpIJY6FFNVHH3FD+q1nE7Hd06pn4XGrCzdE1BGof+hNtaWGmaSp8rHaTbkIE+ vcojpVpRnWt3/5ljveGjZo8nRPNBGw== =EafC -----END PGP SIGNATURE----- --=-gTb7tVCY4YQZBYQw8Qwq--