Re: [PATCH v2 6/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver
On Sat, Aug 30, 2014 at 2:15 PM, Greg Kroah-Hartman wrote: > On Mon, Aug 18, 2014 at 10:08:22AM -0700, Andrew Bresticker wrote: >> Add support for the on-chip xHCI host controller present on Tegra SoCs. >> >> The driver is currently very basic: it loads the controller with its >> firmware, starts the controller, and is able to service messages sent >> by the controller's firmware. The hardware supports device mode as >> well as lower-power operating modes, but support for these is not yet >> implemented here. > > So you are saying the device doesn't really work? Can it handle USB > transactions properly? Huh? It's just as functional as any other xHCI platform host. Perhaps I should have been more clear about "lower-power operating modes": this refers to the runtime powergating of the controller's SuperSpeed and host-controller logic and has nothing to do with USB link/hub/device power management. > I have a jetson board here, is this the controller for that hardware? > Can I test this series on that platform, or is it for something else? Yup, that's the platform I primarily used for testing this series. >> +static const struct tegra_xhci_soc_config tegra124_soc_config = { >> + .firmware_file = "nvidia/tegra124/xusb.bin", >> +}; >> +MODULE_FIRMWARE("nvidia/tegra124/xusb.bin"); > > Has this file been submitted to the linux-firmware tree? It has been posted, see https://patchwork.ozlabs.org/patch/384013/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 6/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver
On Sat, Aug 30, 2014 at 2:15 PM, Greg Kroah-Hartman gre...@linuxfoundation.org wrote: On Mon, Aug 18, 2014 at 10:08:22AM -0700, Andrew Bresticker wrote: Add support for the on-chip xHCI host controller present on Tegra SoCs. The driver is currently very basic: it loads the controller with its firmware, starts the controller, and is able to service messages sent by the controller's firmware. The hardware supports device mode as well as lower-power operating modes, but support for these is not yet implemented here. So you are saying the device doesn't really work? Can it handle USB transactions properly? Huh? It's just as functional as any other xHCI platform host. Perhaps I should have been more clear about lower-power operating modes: this refers to the runtime powergating of the controller's SuperSpeed and host-controller logic and has nothing to do with USB link/hub/device power management. I have a jetson board here, is this the controller for that hardware? Can I test this series on that platform, or is it for something else? Yup, that's the platform I primarily used for testing this series. +static const struct tegra_xhci_soc_config tegra124_soc_config = { + .firmware_file = nvidia/tegra124/xusb.bin, +}; +MODULE_FIRMWARE(nvidia/tegra124/xusb.bin); Has this file been submitted to the linux-firmware tree? It has been posted, see https://patchwork.ozlabs.org/patch/384013/ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 6/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver
On Mon, Aug 18, 2014 at 10:08:22AM -0700, Andrew Bresticker wrote: > Add support for the on-chip xHCI host controller present on Tegra SoCs. > > The driver is currently very basic: it loads the controller with its > firmware, starts the controller, and is able to service messages sent > by the controller's firmware. The hardware supports device mode as > well as lower-power operating modes, but support for these is not yet > implemented here. So you are saying the device doesn't really work? Can it handle USB transactions properly? I have a jetson board here, is this the controller for that hardware? Can I test this series on that platform, or is it for something else? > +static const struct tegra_xhci_soc_config tegra124_soc_config = { > + .firmware_file = "nvidia/tegra124/xusb.bin", > +}; > +MODULE_FIRMWARE("nvidia/tegra124/xusb.bin"); Has this file been submitted to the linux-firmware tree? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 6/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver
On Mon, Aug 18, 2014 at 10:08:22AM -0700, Andrew Bresticker wrote: Add support for the on-chip xHCI host controller present on Tegra SoCs. The driver is currently very basic: it loads the controller with its firmware, starts the controller, and is able to service messages sent by the controller's firmware. The hardware supports device mode as well as lower-power operating modes, but support for these is not yet implemented here. So you are saying the device doesn't really work? Can it handle USB transactions properly? I have a jetson board here, is this the controller for that hardware? Can I test this series on that platform, or is it for something else? +static const struct tegra_xhci_soc_config tegra124_soc_config = { + .firmware_file = nvidia/tegra124/xusb.bin, +}; +MODULE_FIRMWARE(nvidia/tegra124/xusb.bin); Has this file been submitted to the linux-firmware tree? thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 6/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver
On 08/18/2014 11:08 AM, Andrew Bresticker wrote: Add support for the on-chip xHCI host controller present on Tegra SoCs. The driver is currently very basic: it loads the controller with its firmware, starts the controller, and is able to service messages sent by the controller's firmware. The hardware supports device mode as well as lower-power operating modes, but support for these is not yet implemented here. Just one minor comment below. I'd like an ack from a USB maintainer so that this patch can be taken through the Tegra tree along with the rest of the series, which has various dependencies. +MODULE_ALIAS("platform:xhci-tegra"); I don't think that's needed; MODULE_DEVICE_TABLE(of, tegra_xhci_of_match) should be enough upstream. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 6/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver
On 08/18/2014 11:08 AM, Andrew Bresticker wrote: Add support for the on-chip xHCI host controller present on Tegra SoCs. The driver is currently very basic: it loads the controller with its firmware, starts the controller, and is able to service messages sent by the controller's firmware. The hardware supports device mode as well as lower-power operating modes, but support for these is not yet implemented here. Just one minor comment below. I'd like an ack from a USB maintainer so that this patch can be taken through the Tegra tree along with the rest of the series, which has various dependencies. +MODULE_ALIAS(platform:xhci-tegra); I don't think that's needed; MODULE_DEVICE_TABLE(of, tegra_xhci_of_match) should be enough upstream. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 6/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver
Add support for the on-chip xHCI host controller present on Tegra SoCs. The driver is currently very basic: it loads the controller with its firmware, starts the controller, and is able to service messages sent by the controller's firmware. The hardware supports device mode as well as lower-power operating modes, but support for these is not yet implemented here. Based on work by: Ajay Gupta Bharath Yadav Signed-off-by: Andrew Bresticker --- Changes from v1: - Updated to use common mailbox API. - Fixed up so that the driver can be built and used as a module. - Incorporated review feedback from Stephen. - Misc. cleanups. --- drivers/usb/host/Kconfig | 9 + drivers/usb/host/Makefile | 1 + drivers/usb/host/xhci-tegra.c | 893 ++ 3 files changed, 903 insertions(+) create mode 100644 drivers/usb/host/xhci-tegra.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index f5a5831..1fffbed 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -50,6 +50,15 @@ config USB_XHCI_RCAR Say 'Y' to enable the support for the xHCI host controller found in Renesas R-Car ARM SoCs. +config USB_XHCI_TEGRA + tristate "NVIDIA Tegra XHCI support" + depends on ARCH_TEGRA + select MAILBOX + select FW_LOADER + ---help--- + Say 'Y' to enable the support for the xHCI host controller + found in NVIDIA Tegra124 and later SoCs. + endif # USB_XHCI_HCD config USB_EHCI_HCD diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 702d9b7..0a30e26 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_PCI) += pci-quirks.o obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o +obj-$(CONFIG_USB_XHCI_TEGRA) += xhci-tegra.o obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c new file mode 100644 index 000..515aa49 --- /dev/null +++ b/drivers/usb/host/xhci-tegra.c @@ -0,0 +1,893 @@ +/* + * NVIDIA Tegra xHCI host controller driver + * + * Copyright (C) 2014 NVIDIA Corporation + * Copyright (C) 2014 Google, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "xhci.h" + +#define TEGRA_XHCI_SS_CLK_HIGH_SPEED 12000 +#define TEGRA_XHCI_SS_CLK_LOW_SPEED 1200 + +/* FPCI CFG registers */ +#define XUSB_CFG_1 0x004 +#define XUSB_IO_SPACE_EN BIT(0) +#define XUSB_MEM_SPACE_EN BIT(1) +#define XUSB_BUS_MASTER_ENBIT(2) +#define XUSB_CFG_4 0x010 +#define XUSB_BASE_ADDR_SHIFT 15 +#define XUSB_BASE_ADDR_MASK 0x1 +#define XUSB_CFG_ARU_C11_CSBRANGE 0x41c +#define XUSB_CFG_CSB_BASE_ADDR 0x800 + +/* IPFS registers */ +#define IPFS_XUSB_HOST_CONFIGURATION_0 0x180 +#define IPFS_EN_FPCI BIT(0) +#define IPFS_XUSB_HOST_INTR_MASK_0 0x188 +#define IPFS_IP_INT_MASK BIT(16) +#define IPFS_XUSB_HOST_CLKGATE_HYSTERESIS_00x1bc + +#define CSB_PAGE_SELECT_MASK 0x7f +#define CSB_PAGE_SELECT_SHIFT 9 +#define CSB_PAGE_OFFSET_MASK 0x1ff +#define CSB_PAGE_SELECT(addr) ((addr) >> (CSB_PAGE_SELECT_SHIFT) &\ +CSB_PAGE_SELECT_MASK) +#define CSB_PAGE_OFFSET(addr) ((addr) & CSB_PAGE_OFFSET_MASK) + +/* Falcon CSB registers */ +#define XUSB_FALC_CPUCTL 0x100 +#define CPUCTL_STARTCPU BIT(1) +#define CPUCTL_STATE_HALTED BIT(4) +#define XUSB_FALC_BOOTVEC 0x104 +#define XUSB_FALC_DMACTL 0x10c +#define XUSB_FALC_IMFILLRNG1 0x154 +#define IMFILLRNG1_TAG_MASK 0x +#define IMFILLRNG1_TAG_LO_SHIFT 0 +#define IMFILLRNG1_TAG_HI_SHIFT 16 +#define XUSB_FALC_IMFILLCTL0x158 + +/* MP CSB registers */ +#define XUSB_CSB_MP_ILOAD_ATTR 0x101a00 +#define XUSB_CSB_MP_ILOAD_BASE_LO 0x101a04 +#define XUSB_CSB_MP_ILOAD_BASE_HI 0x101a08 +#define XUSB_CSB_MP_L2IMEMOP_SIZE 0x101a10 +#define L2IMEMOP_SIZE_SRC_OFFSET_SHIFT8 +#define L2IMEMOP_SIZE_SRC_OFFSET_MASK 0x3ff +#define L2IMEMOP_SIZE_SRC_COUNT_SHIFT 24
[PATCH v2 6/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver
Add support for the on-chip xHCI host controller present on Tegra SoCs. The driver is currently very basic: it loads the controller with its firmware, starts the controller, and is able to service messages sent by the controller's firmware. The hardware supports device mode as well as lower-power operating modes, but support for these is not yet implemented here. Based on work by: Ajay Gupta aj...@nvidia.com Bharath Yadav bya...@nvidia.com Signed-off-by: Andrew Bresticker abres...@chromium.org --- Changes from v1: - Updated to use common mailbox API. - Fixed up so that the driver can be built and used as a module. - Incorporated review feedback from Stephen. - Misc. cleanups. --- drivers/usb/host/Kconfig | 9 + drivers/usb/host/Makefile | 1 + drivers/usb/host/xhci-tegra.c | 893 ++ 3 files changed, 903 insertions(+) create mode 100644 drivers/usb/host/xhci-tegra.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index f5a5831..1fffbed 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -50,6 +50,15 @@ config USB_XHCI_RCAR Say 'Y' to enable the support for the xHCI host controller found in Renesas R-Car ARM SoCs. +config USB_XHCI_TEGRA + tristate NVIDIA Tegra XHCI support + depends on ARCH_TEGRA + select MAILBOX + select FW_LOADER + ---help--- + Say 'Y' to enable the support for the xHCI host controller + found in NVIDIA Tegra124 and later SoCs. + endif # USB_XHCI_HCD config USB_EHCI_HCD diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 702d9b7..0a30e26 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_PCI) += pci-quirks.o obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o +obj-$(CONFIG_USB_XHCI_TEGRA) += xhci-tegra.o obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c new file mode 100644 index 000..515aa49 --- /dev/null +++ b/drivers/usb/host/xhci-tegra.c @@ -0,0 +1,893 @@ +/* + * NVIDIA Tegra xHCI host controller driver + * + * Copyright (C) 2014 NVIDIA Corporation + * Copyright (C) 2014 Google, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + */ + +#include linux/clk.h +#include linux/delay.h +#include linux/dma-mapping.h +#include linux/firmware.h +#include linux/interrupt.h +#include linux/kernel.h +#include linux/mailbox_client.h +#include linux/module.h +#include linux/of_device.h +#include linux/phy/phy.h +#include linux/platform_device.h +#include linux/pm.h +#include linux/regulator/consumer.h +#include linux/reset.h +#include linux/slab.h +#include linux/workqueue.h + +#include soc/tegra/xusb.h + +#include xhci.h + +#define TEGRA_XHCI_SS_CLK_HIGH_SPEED 12000 +#define TEGRA_XHCI_SS_CLK_LOW_SPEED 1200 + +/* FPCI CFG registers */ +#define XUSB_CFG_1 0x004 +#define XUSB_IO_SPACE_EN BIT(0) +#define XUSB_MEM_SPACE_EN BIT(1) +#define XUSB_BUS_MASTER_ENBIT(2) +#define XUSB_CFG_4 0x010 +#define XUSB_BASE_ADDR_SHIFT 15 +#define XUSB_BASE_ADDR_MASK 0x1 +#define XUSB_CFG_ARU_C11_CSBRANGE 0x41c +#define XUSB_CFG_CSB_BASE_ADDR 0x800 + +/* IPFS registers */ +#define IPFS_XUSB_HOST_CONFIGURATION_0 0x180 +#define IPFS_EN_FPCI BIT(0) +#define IPFS_XUSB_HOST_INTR_MASK_0 0x188 +#define IPFS_IP_INT_MASK BIT(16) +#define IPFS_XUSB_HOST_CLKGATE_HYSTERESIS_00x1bc + +#define CSB_PAGE_SELECT_MASK 0x7f +#define CSB_PAGE_SELECT_SHIFT 9 +#define CSB_PAGE_OFFSET_MASK 0x1ff +#define CSB_PAGE_SELECT(addr) ((addr) (CSB_PAGE_SELECT_SHIFT) \ +CSB_PAGE_SELECT_MASK) +#define CSB_PAGE_OFFSET(addr) ((addr) CSB_PAGE_OFFSET_MASK) + +/* Falcon CSB registers */ +#define XUSB_FALC_CPUCTL 0x100 +#define CPUCTL_STARTCPU BIT(1) +#define CPUCTL_STATE_HALTED BIT(4) +#define XUSB_FALC_BOOTVEC 0x104 +#define XUSB_FALC_DMACTL 0x10c +#define XUSB_FALC_IMFILLRNG1 0x154 +#define IMFILLRNG1_TAG_MASK 0x +#define IMFILLRNG1_TAG_LO_SHIFT 0 +#define IMFILLRNG1_TAG_HI_SHIFT 16 +#define XUSB_FALC_IMFILLCTL0x158 + +/* MP CSB registers */ +#define XUSB_CSB_MP_ILOAD_ATTR 0x101a00 +#define