linux/drivers/usb/musb/musb_dsps.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Texas Instruments DSPS platforms "glue layer"
 *
 * Copyright (C) 2012, by Texas Instruments
 *
 * Based on the am35x "glue layer" code.
 *
 * This file is part of the Inventra Controller Driver for Linux.
 *
 * musb_dsps.c will be a common file for all the TI DSPS platforms
 * such as dm64x, dm36x, dm35x, da8x, am35x and ti81x.
 * For now only ti81x is using this and in future davinci.c, am35x.c
 * da8xx.c would be merged to this file after testing.
 */

#include <linux/io.h>
#include <linux/irq.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
#include <linux/module.h>
#include <linux/usb/usb_phy_generic.h>
#include <linux/platform_data/usb-omap.h>
#include <linux/sizes.h>

#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/usb/of.h>

#include <linux/debugfs.h>

#include "musb_core.h"

static const struct of_device_id musb_dsps_of_match[];

/*
 * DSPS musb wrapper register offset.
 * FIXME: This should be expanded to have all the wrapper registers from TI DSPS
 * musb ips.
 */
struct dsps_musb_wrapper {};

/*
 * register shadow for suspend
 */
struct dsps_context {};

/*
 * DSPS glue structure.
 */
struct dsps_glue {};

static const struct debugfs_reg32 dsps_musb_regs[] =;

static void dsps_mod_timer(struct dsps_glue *glue, int wait_ms)
{}

/*
 * If no vbus irq from the PMIC is configured, we need to poll VBUS status.
 */
static void dsps_mod_timer_optional(struct dsps_glue *glue)
{}

/* USBSS  / USB AM335x */
#define USBSS_IRQ_STATUS
#define USBSS_IRQ_ENABLER
#define USBSS_IRQ_CLEARR

#define USBSS_IRQ_PD_COMP

/*
 * dsps_musb_enable - enable interrupts
 */
static void dsps_musb_enable(struct musb *musb)
{}

/*
 * dsps_musb_disable - disable HDRC and flush interrupts
 */
static void dsps_musb_disable(struct musb *musb)
{}

/* Caller must take musb->lock */
static int dsps_check_status(struct musb *musb, void *unused)
{}

static void otg_timer(struct timer_list *t)
{}

static void dsps_musb_clear_ep_rxintr(struct musb *musb, int epnum)
{}

static irqreturn_t dsps_interrupt(int irq, void *hci)
{}

static int dsps_musb_dbg_init(struct musb *musb, struct dsps_glue *glue)
{}

static int dsps_musb_init(struct musb *musb)
{}

static int dsps_musb_exit(struct musb *musb)
{}

static int dsps_musb_set_mode(struct musb *musb, u8 mode)
{}

static bool dsps_sw_babble_control(struct musb *musb)
{}

static int dsps_musb_recover(struct musb *musb)
{}

/* Similar to am35x, dm81xx support only 32-bit read operation */
static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
{}

#ifdef CONFIG_USB_TI_CPPI41_DMA
static void dsps_dma_controller_callback(struct dma_controller *c)
{
	struct musb *musb = c->musb;
	struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent);
	void __iomem *usbss_base = glue->usbss_base;
	u32 status;

	status = musb_readl(usbss_base, USBSS_IRQ_STATUS);
	if (status & USBSS_IRQ_PD_COMP)
		musb_writel(usbss_base, USBSS_IRQ_STATUS, USBSS_IRQ_PD_COMP);
}

static struct dma_controller *
dsps_dma_controller_create(struct musb *musb, void __iomem *base)
{
	struct dma_controller *controller;
	struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent);
	void __iomem *usbss_base = glue->usbss_base;

	controller = cppi41_dma_controller_create(musb, base);
	if (IS_ERR_OR_NULL(controller))
		return controller;

	musb_writel(usbss_base, USBSS_IRQ_ENABLER, USBSS_IRQ_PD_COMP);
	controller->dma_callback = dsps_dma_controller_callback;

	return controller;
}

#ifdef CONFIG_PM_SLEEP
static void dsps_dma_controller_suspend(struct dsps_glue *glue)
{
	void __iomem *usbss_base = glue->usbss_base;

	musb_writel(usbss_base, USBSS_IRQ_CLEARR, USBSS_IRQ_PD_COMP);
}

static void dsps_dma_controller_resume(struct dsps_glue *glue)
{
	void __iomem *usbss_base = glue->usbss_base;

	musb_writel(usbss_base, USBSS_IRQ_ENABLER, USBSS_IRQ_PD_COMP);
}
#endif
#else /* CONFIG_USB_TI_CPPI41_DMA */
#ifdef CONFIG_PM_SLEEP
static void dsps_dma_controller_suspend(struct dsps_glue *glue) {}
static void dsps_dma_controller_resume(struct dsps_glue *glue) {}
#endif
#endif /* CONFIG_USB_TI_CPPI41_DMA */

static struct musb_platform_ops dsps_ops =;

static u64 musb_dmamask =;

static int get_int_prop(struct device_node *dn, const char *s)
{}

static int dsps_create_musb_pdev(struct dsps_glue *glue,
		struct platform_device *parent)
{}

static irqreturn_t dsps_vbus_threaded_irq(int irq, void *priv)
{}

static int dsps_setup_optional_vbus_irq(struct platform_device *pdev,
					struct dsps_glue *glue)
{}

static int dsps_probe(struct platform_device *pdev)
{}

static void dsps_remove(struct platform_device *pdev)
{}

static const struct dsps_musb_wrapper am33xx_driver_data =;

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

#ifdef CONFIG_PM_SLEEP
static int dsps_suspend(struct device *dev)
{}

static int dsps_resume(struct device *dev)
{}
#endif

static SIMPLE_DEV_PM_OPS(dsps_pm_ops, dsps_suspend, dsps_resume);

static struct platform_driver dsps_usbss_driver =;

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_LICENSE();

module_platform_driver();