linux/drivers/usb/c67x00/c67x00.h

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * c67x00.h: Cypress C67X00 USB register and field definitions
 *
 * Copyright (C) 2006-2008 Barco N.V.
 *    Derived from the Cypress cy7c67200/300 ezusb linux driver and
 *    based on multiple host controller drivers inside the linux kernel.
 */

#ifndef _USB_C67X00_H
#define _USB_C67X00_H

#include <linux/spinlock.h>
#include <linux/platform_device.h>
#include <linux/completion.h>
#include <linux/mutex.h>

/* ---------------------------------------------------------------------
 * Cypress C67x00 register definitions
 */

/* Hardware Revision Register */
#define HW_REV_REG

/* General USB registers */
/* ===================== */

/* USB Control Register */
#define USB_CTL_REG(x)

#define LOW_SPEED_PORT(x)
#define HOST_MODE
#define PORT_RES_EN(x)
#define SOF_EOP_EN(x)

/* USB status register - Notice it has different content in hcd/udc mode */
#define USB_STAT_REG(x)

#define EP0_IRQ_FLG
#define EP1_IRQ_FLG
#define EP2_IRQ_FLG
#define EP3_IRQ_FLG
#define EP4_IRQ_FLG
#define EP5_IRQ_FLG
#define EP6_IRQ_FLG
#define EP7_IRQ_FLG
#define RESET_IRQ_FLG
#define SOF_EOP_IRQ_FLG
#define ID_IRQ_FLG
#define VBUS_IRQ_FLG

/* USB Host only registers */
/* ======================= */

/* Host n Control Register */
#define HOST_CTL_REG(x)

#define PREAMBLE_EN
#define SEQ_SEL
#define ISO_EN
#define ARM_EN

/* Host n Interrupt Enable Register */
#define HOST_IRQ_EN_REG(x)

#define SOF_EOP_IRQ_EN
#define SOF_EOP_TMOUT_IRQ_EN
#define ID_IRQ_EN
#define VBUS_IRQ_EN
#define DONE_IRQ_EN

/* USB status register */
#define HOST_STAT_MASK
#define PORT_CONNECT_CHANGE(x)
#define PORT_SE0_STATUS(x)

/* Host Frame Register */
#define HOST_FRAME_REG(x)

#define HOST_FRAME_MASK

/* USB Peripheral only registers */
/* ============================= */

/* Device n Port Sel reg */
#define DEVICE_N_PORT_SEL(x)

/* Device n Interrupt Enable Register */
#define DEVICE_N_IRQ_EN_REG(x)

#define DEVICE_N_ENDPOINT_N_CTL_REG(dev, ep)
#define DEVICE_N_ENDPOINT_N_STAT_REG(dev, ep)

#define DEVICE_N_ADDRESS(dev)

/* HPI registers */
/* ============= */

/* HPI Status register */
#define SOFEOP_FLG(x)
#define SIEMSG_FLG(x)
#define RESET_FLG(x)
#define DONE_FLG(x)
#define RESUME_FLG(x)
#define MBX_OUT_FLG
#define MBX_IN_FLG
#define ID_FLG
#define VBUS_FLG

/* Interrupt routing register */
#define HPI_IRQ_ROUTING_REG

#define HPI_SWAP_ENABLE(x)
#define RESET_TO_HPI_ENABLE(x)
#define DONE_TO_HPI_ENABLE(x)
#define RESUME_TO_HPI_ENABLE(x)
#define SOFEOP_TO_HPI_EN(x)
#define SOFEOP_TO_CPU_EN(x)
#define ID_TO_HPI_ENABLE
#define VBUS_TO_HPI_ENABLE

/* SIE msg registers */
#define SIEMSG_REG(x)

#define HUSB_TDListDone

#define SUSB_EP0_MSG
#define SUSB_EP1_MSG
#define SUSB_EP2_MSG
#define SUSB_EP3_MSG
#define SUSB_EP4_MSG
#define SUSB_EP5_MSG
#define SUSB_EP6_MSG
#define SUSB_EP7_MSG
#define SUSB_RST_MSG
#define SUSB_SOF_MSG
#define SUSB_CFG_MSG
#define SUSB_SUS_MSG
#define SUSB_ID_MSG
#define SUSB_VBUS_MSG

/* BIOS interrupt routines */

#define SUSBx_RECEIVE_INT(x)
#define SUSBx_SEND_INT(x)

#define SUSBx_DEV_DESC_VEC(x)
#define SUSBx_CONF_DESC_VEC(x)
#define SUSBx_STRING_DESC_VEC(x)

#define CY_HCD_BUF_ADDR
#define SIE_TD_SIZE
#define SIE_TD_BUF_SIZE

#define SIE_TD_OFFSET(host)
#define SIE_BUF_OFFSET(host)

/* Base address of HCD + 2 x TD_SIZE + 2 x TD_BUF_SIZE */
#define CY_UDC_REQ_HEADER_BASE
/* 8- byte request headers for IN/OUT transfers */
#define CY_UDC_REQ_HEADER_SIZE

#define CY_UDC_REQ_HEADER_ADDR(ep_num)
#define CY_UDC_DESC_BASE_ADDRESS

#define CY_UDC_BIOS_REPLACE_BASE
#define CY_UDC_REQ_BUFFER_BASE
#define CY_UDC_REQ_BUFFER_SIZE
#define CY_UDC_REQ_BUFFER_ADDR(ep_num)

/* ---------------------------------------------------------------------
 * Driver data structures
 */

struct c67x00_device;

/**
 * struct c67x00_sie - Common data associated with a SIE
 * @lock: lock to protect this struct and the associated chip registers
 * @private_data: subdriver dependent data
 * @irq: subdriver dependent irq handler, set NULL when not used
 * @dev: link to common driver structure
 * @sie_num: SIE number on chip, starting from 0
 * @mode: SIE mode (host/peripheral/otg/not used)
 */
struct c67x00_sie {};

#define sie_dev(s)

/**
 * struct c67x00_lcp
 */
struct c67x00_lcp {};

/*
 * struct c67x00_hpi
 */
struct c67x00_hpi {};

#define C67X00_SIES
#define C67X00_PORTS

/**
 * struct c67x00_device - Common data associated with a c67x00 instance
 * @hpi: hpi addresses
 * @sie: array of sie's on this chip
 * @pdev: platform device of instance
 * @pdata: configuration provided by the platform
 */
struct c67x00_device {};

/* ---------------------------------------------------------------------
 * Low level interface functions
 */

/* Host Port Interface (HPI) functions */
u16 c67x00_ll_hpi_status(struct c67x00_device *dev);
void c67x00_ll_hpi_reg_init(struct c67x00_device *dev);
void c67x00_ll_hpi_enable_sofeop(struct c67x00_sie *sie);
void c67x00_ll_hpi_disable_sofeop(struct c67x00_sie *sie);

/* General functions */
u16 c67x00_ll_fetch_siemsg(struct c67x00_device *dev, int sie_num);
u16 c67x00_ll_get_usb_ctl(struct c67x00_sie *sie);
void c67x00_ll_usb_clear_status(struct c67x00_sie *sie, u16 bits);
u16 c67x00_ll_usb_get_status(struct c67x00_sie *sie);
void c67x00_ll_write_mem_le16(struct c67x00_device *dev, u16 addr,
			      void *data, int len);
void c67x00_ll_read_mem_le16(struct c67x00_device *dev, u16 addr,
			     void *data, int len);

/* Host specific functions */
void c67x00_ll_set_husb_eot(struct c67x00_device *dev, u16 value);
void c67x00_ll_husb_reset(struct c67x00_sie *sie, int port);
void c67x00_ll_husb_set_current_td(struct c67x00_sie *sie, u16 addr);
u16 c67x00_ll_husb_get_current_td(struct c67x00_sie *sie);
u16 c67x00_ll_husb_get_frame(struct c67x00_sie *sie);
void c67x00_ll_husb_init_host_port(struct c67x00_sie *sie);
void c67x00_ll_husb_reset_port(struct c67x00_sie *sie, int port);

/* Called by c67x00_irq to handle lcp interrupts */
void c67x00_ll_irq(struct c67x00_device *dev, u16 int_status);

/* Setup and teardown */
void c67x00_ll_init(struct c67x00_device *dev);
void c67x00_ll_release(struct c67x00_device *dev);
int c67x00_ll_reset(struct c67x00_device *dev);

#endif				/* _USB_C67X00_H */