linux/drivers/usb/host/xhci-rcar.c

// SPDX-License-Identifier: GPL-2.0
/*
 * xHCI host controller driver for R-Car SoCs
 *
 * Copyright (C) 2014 Renesas Electronics Corporation
 */

#include <linux/firmware.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/usb/phy.h>

#include "xhci.h"
#include "xhci-plat.h"
#include "xhci-rzv2m.h"

#define XHCI_RCAR_FIRMWARE_NAME_V1
#define XHCI_RCAR_FIRMWARE_NAME_V3

/*
* - The V3 firmware is for all R-Car Gen3
* - The V2 firmware is possible to use on R-Car Gen2. However, the V2 causes
*   performance degradation. So, this driver continues to use the V1 if R-Car
*   Gen2.
* - The V1 firmware is impossible to use on R-Car Gen3.
*/
MODULE_FIRMWARE();
MODULE_FIRMWARE();

/*** Register Offset ***/
#define RCAR_USB3_AXH_STA
#define RCAR_USB3_INT_ENA
#define RCAR_USB3_DL_CTRL
#define RCAR_USB3_FW_DATA0

#define RCAR_USB3_LCLK
#define RCAR_USB3_CONF1
#define RCAR_USB3_CONF2
#define RCAR_USB3_CONF3
#define RCAR_USB3_RX_POL
#define RCAR_USB3_TX_POL

/*** Register Settings ***/
/* AXI Host Control Status */
#define RCAR_USB3_AXH_STA_B3_PLL_ACTIVE
#define RCAR_USB3_AXH_STA_B2_PLL_ACTIVE
#define RCAR_USB3_AXH_STA_PLL_ACTIVE_MASK

/* Interrupt Enable */
#define RCAR_USB3_INT_XHC_ENA
#define RCAR_USB3_INT_PME_ENA
#define RCAR_USB3_INT_HSE_ENA
#define RCAR_USB3_INT_ENA_VAL

/* FW Download Control & Status */
#define RCAR_USB3_DL_CTRL_ENABLE
#define RCAR_USB3_DL_CTRL_FW_SUCCESS
#define RCAR_USB3_DL_CTRL_FW_SET_DATA0

/* LCLK Select */
#define RCAR_USB3_LCLK_ENA_VAL

/* USB3.0 Configuration */
#define RCAR_USB3_CONF1_VAL
#define RCAR_USB3_CONF2_VAL
#define RCAR_USB3_CONF3_VAL

/* USB3.0 Polarity */
#define RCAR_USB3_RX_POL_VAL
#define RCAR_USB3_TX_POL_VAL

static void xhci_rcar_start_gen2(struct usb_hcd *hcd)
{}

static int xhci_rcar_is_gen2(struct device *dev)
{}

static void xhci_rcar_start(struct usb_hcd *hcd)
{}

static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
{}

static bool xhci_rcar_wait_for_pll_active(struct usb_hcd *hcd)
{}

/* This function needs to initialize a "phy" of usb before */
static int xhci_rcar_init_quirk(struct usb_hcd *hcd)
{}

static int xhci_rcar_resume_quirk(struct usb_hcd *hcd)
{}

/*
 * On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set
 * to 1. However, these SoCs don't support 64-bit address memory
 * pointers. So, this driver clears the AC64 bit of xhci->hcc_params
 * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in
 * xhci_gen_setup() by using the XHCI_NO_64BIT_SUPPORT quirk.
 *
 * And, since the firmware/internal CPU control the USBSTS.STS_HALT
 * and the process speed is down when the roothub port enters U3,
 * long delay for the handshake of STS_HALT is neeed in xhci_suspend()
 * by using the XHCI_SLOW_SUSPEND quirk.
 */
#define SET_XHCI_PLAT_PRIV_FOR_RCAR(firmware)

static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 =;

static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 =;

static const struct xhci_plat_priv xhci_plat_renesas_rzv2m =;

static const struct of_device_id usb_xhci_of_match[] =;
MODULE_DEVICE_TABLE(of, usb_xhci_of_match);

static int xhci_renesas_probe(struct platform_device *pdev)
{}

static struct platform_driver usb_xhci_renesas_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();