From 333c4158645fe8aaacbd644bcdf7bc4c5b93cc26 Mon Sep 17 00:00:00 2001 From: Tim Gover <990920+timg236@users.noreply.github.com> Date: Wed, 15 Jan 2020 11:26:19 +0000 Subject: [PATCH] usb: xhci: Raspberry Pi FW loader for VIA VL805 The VL805 FW may either be loaded from an SPI EEPROM or alternatively loaded directly by the VideoCore firmware. A PCI reset will reset the VL805 XHCI controller on the Raspberry Pi4 requiring the firmware to be reloaded if an SPI EEPROM is not present. Use a VideoCore mailbox to trigger the loading of the VL805 firmware (if necessary) after a PCI reset. Signed-off-by: Tim Gover --- drivers/usb/host/pci-quirks.c | 31 +++++++++++++++++++++- include/soc/bcm2835/raspberrypi-firmware.h | 2 +- 2 files changed, 31 insertions(+), 2 deletions(-) --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -18,7 +18,7 @@ #include #include "pci-quirks.h" #include "xhci-ext-caps.h" - +#include #define UHCI_USBLEGSUP 0xc0 /* legacy support */ #define UHCI_USBCMD 0 /* command register */ @@ -634,6 +634,32 @@ EXPORT_SYMBOL_GPL(usb_amd_pt_check_port) #endif /* CONFIG_PCI_DISABLE_COMMON_QUIRKS */ +/* The VL805 firmware may either be loaded from an EEPROM or by the BIOS into + * memory. If run from memory it must be reloaded after a PCI fundmental reset. + * The Raspberry Pi firmware acts as the BIOS in this case. + */ +static void usb_vl805_init(struct pci_dev *pdev) +{ +#if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) + struct rpi_firmware *fw; + struct { + u32 dev_addr; + } packet; + int ret; + + fw = rpi_firmware_get(NULL); + if (!fw) + return; + + packet.dev_addr = (pdev->bus->number << 20) | + (PCI_SLOT(pdev->devfn) << 15) | (PCI_FUNC(pdev->devfn) << 12); + + dev_dbg(&pdev->dev, "RPI_FIRMWARE_NOTIFY_XHCI_RESET %x", packet.dev_addr); + ret = rpi_firmware_property(fw, RPI_FIRMWARE_NOTIFY_XHCI_RESET, + &packet, sizeof(packet)); +#endif +} + #if IS_ENABLED(CONFIG_USB_UHCI_HCD) /* @@ -1222,6 +1248,9 @@ hc_init: if (pdev->vendor == PCI_VENDOR_ID_INTEL) usb_enable_intel_xhci_ports(pdev); + if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) + usb_vl805_init(pdev); + op_reg_base = base + XHCI_HC_LENGTH(readl(base)); /* Wait for the host controller to be ready before writing any --- a/include/soc/bcm2835/raspberrypi-firmware.h +++ b/include/soc/bcm2835/raspberrypi-firmware.h @@ -95,7 +95,7 @@ enum rpi_firmware_property_tag { RPI_FIRMWARE_SET_PERIPH_REG = 0x00038045, RPI_FIRMWARE_GET_POE_HAT_VAL = 0x00030049, RPI_FIRMWARE_SET_POE_HAT_VAL = 0x00030050, - + RPI_FIRMWARE_NOTIFY_XHCI_RESET = 0x00030058, /* Dispmanx TAGS */ RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, bcm27xx/patches-5.4/950-0146-lan78xx-use-default-alignment-for-rx-buffers.patch'>
blob: 8327e4fc3136285153f2a2ca62f6b842e6be47a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
From c4fb99ee7aac2b979f729d4641d0e22fb5c08cc1 Mon Sep 17 00:00:00 2001
From: P33M <p33m@github.com>
Date: Thu, 2 May 2019 11:53:45 +0100
Subject: [PATCH] lan78xx: use default alignment for rx buffers

The lan78xx uses a 12-byte hardware rx header, so there is no need
to allocate SKBs with NET_IP_ALIGN set. Removes alignment faults
in both dwc_otg and in ipv6 processing.
---
 drivers/net/usb/lan78xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -3239,7 +3239,7 @@ static int rx_submit(struct lan78xx_net
 	size_t size = dev->rx_urb_size;
 	int ret = 0;
 
-	skb = netdev_alloc_skb_ip_align(dev->net, size);
+	skb = netdev_alloc_skb(dev->net, size);
 	if (!skb) {
 		usb_free_urb(urb);
 		return -ENOMEM;