2017-11-03 10:28:30 +00:00
|
|
|
// SPDX-License-Identifier: GPL-1.0+
|
2011-04-04 04:44:59 +00:00
|
|
|
/*
|
|
|
|
* Renesas USB
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Renesas Solutions Corp.
|
2019-06-25 05:38:46 +00:00
|
|
|
* Copyright (C) 2019 Renesas Electronics Corporation
|
2011-04-04 04:44:59 +00:00
|
|
|
* Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef RENESAS_USB_H
|
|
|
|
#define RENESAS_USB_H
|
2017-12-13 06:46:58 +00:00
|
|
|
#include <linux/notifier.h>
|
2011-04-04 04:44:59 +00:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/usb/ch9.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* module type
|
|
|
|
*
|
|
|
|
* it will be return value from get_id
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
USBHS_HOST = 0,
|
|
|
|
USBHS_GADGET,
|
|
|
|
USBHS_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* callback functions for platform
|
|
|
|
*
|
|
|
|
* These functions are called from driver for platform
|
|
|
|
*/
|
|
|
|
struct renesas_usbhs_platform_callback {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* Hardware init function for platform.
|
|
|
|
* it is called when driver was probed.
|
|
|
|
*/
|
|
|
|
int (*hardware_init)(struct platform_device *pdev);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* Hardware exit function for platform.
|
|
|
|
* it is called when driver was removed
|
|
|
|
*/
|
2013-04-01 01:34:43 +00:00
|
|
|
int (*hardware_exit)(struct platform_device *pdev);
|
2011-04-04 04:44:59 +00:00
|
|
|
|
2011-10-24 02:57:10 +00:00
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* for board specific clock control
|
|
|
|
*/
|
2013-04-01 01:34:43 +00:00
|
|
|
int (*power_ctrl)(struct platform_device *pdev,
|
2011-10-24 02:57:10 +00:00
|
|
|
void __iomem *base, int enable);
|
|
|
|
|
2011-04-04 04:44:59 +00:00
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* Phy reset for platform
|
|
|
|
*/
|
2013-04-01 01:34:43 +00:00
|
|
|
int (*phy_reset)(struct platform_device *pdev);
|
2011-04-04 04:44:59 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* get USB ID function
|
|
|
|
* - USBHS_HOST
|
|
|
|
* - USBHS_GADGET
|
|
|
|
*/
|
|
|
|
int (*get_id)(struct platform_device *pdev);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* get VBUS status function.
|
|
|
|
*/
|
|
|
|
int (*get_vbus)(struct platform_device *pdev);
|
2011-10-11 05:01:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* VBUS control is needed for Host
|
|
|
|
*/
|
|
|
|
int (*set_vbus)(struct platform_device *pdev, int enable);
|
2017-12-13 06:46:58 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
* extcon notifier to set host/peripheral mode.
|
|
|
|
*/
|
|
|
|
int (*notifier)(struct notifier_block *nb, unsigned long event,
|
|
|
|
void *data);
|
2011-04-04 04:44:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* parameters for renesas usbhs
|
|
|
|
*
|
|
|
|
* some register needs USB chip specific parameters.
|
|
|
|
* This struct show it to driver
|
|
|
|
*/
|
2015-11-18 05:34:09 +00:00
|
|
|
|
|
|
|
struct renesas_usbhs_driver_pipe_config {
|
|
|
|
u8 type; /* USB_ENDPOINT_XFER_xxx */
|
|
|
|
u16 bufsize;
|
|
|
|
u8 bufnum;
|
|
|
|
bool double_buf;
|
|
|
|
};
|
|
|
|
#define RENESAS_USBHS_PIPE(_type, _size, _num, _double_buf) { \
|
|
|
|
.type = (_type), \
|
|
|
|
.bufsize = (_size), \
|
|
|
|
.bufnum = (_num), \
|
|
|
|
.double_buf = (_double_buf), \
|
|
|
|
}
|
|
|
|
|
2011-04-04 04:44:59 +00:00
|
|
|
struct renesas_usbhs_driver_param {
|
|
|
|
/*
|
|
|
|
* pipe settings
|
|
|
|
*/
|
2015-11-18 05:34:09 +00:00
|
|
|
struct renesas_usbhs_driver_pipe_config *pipe_configs;
|
|
|
|
int pipe_size; /* pipe_configs array size */
|
2011-04-04 04:44:59 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* for BUSWAIT :: BWAIT
|
2011-10-11 05:01:28 +00:00
|
|
|
* see
|
|
|
|
* renesas_usbhs/common.c :: usbhsc_set_buswait()
|
2011-04-04 04:44:59 +00:00
|
|
|
* */
|
|
|
|
int buswait_bwait;
|
2011-04-28 07:41:14 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* delay time from notify_hotplug callback
|
|
|
|
*/
|
2011-10-24 02:57:02 +00:00
|
|
|
int detection_delay; /* msec */
|
2011-06-06 05:19:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* dma id for dmaengine
|
2012-05-29 06:31:39 +00:00
|
|
|
* The data transfer direction on D0FIFO/D1FIFO should be
|
|
|
|
* fixed for keeping consistency.
|
|
|
|
* So, the platform id settings will be..
|
|
|
|
* .d0_tx_id = xx_TX,
|
|
|
|
* .d1_rx_id = xx_RX,
|
|
|
|
* or
|
|
|
|
* .d1_tx_id = xx_TX,
|
|
|
|
* .d0_rx_id = xx_RX,
|
2011-06-06 05:19:03 +00:00
|
|
|
*/
|
|
|
|
int d0_tx_id;
|
|
|
|
int d0_rx_id;
|
|
|
|
int d1_tx_id;
|
|
|
|
int d1_rx_id;
|
2014-11-10 11:02:47 +00:00
|
|
|
int d2_tx_id;
|
|
|
|
int d2_rx_id;
|
|
|
|
int d3_tx_id;
|
|
|
|
int d3_rx_id;
|
2011-06-06 05:19:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* pio <--> dma border.
|
|
|
|
*/
|
|
|
|
int pio_dma_border; /* default is 64byte */
|
2011-10-11 05:06:12 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*/
|
2015-03-12 06:35:20 +00:00
|
|
|
u32 has_usb_dmac:1; /* for USB-DMAC */
|
2019-05-15 15:20:41 +00:00
|
|
|
u32 runtime_pwctrl:1;
|
2019-05-15 15:20:42 +00:00
|
|
|
u32 has_cnen:1;
|
2019-05-15 15:20:43 +00:00
|
|
|
u32 cfifo_byte_addr:1; /* CFIFO is byte addressable */
|
2015-03-12 06:35:20 +00:00
|
|
|
#define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */
|
2019-06-25 05:38:49 +00:00
|
|
|
u32 multi_clks:1;
|
2019-06-25 05:38:52 +00:00
|
|
|
u32 has_new_pipe_configs:1;
|
2011-04-04 04:44:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* platform information for renesas_usbhs driver.
|
|
|
|
*/
|
|
|
|
struct renesas_usbhs_platform_info {
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* platform set these functions before
|
|
|
|
* call platform_add_devices if needed
|
|
|
|
*/
|
|
|
|
struct renesas_usbhs_platform_callback platform_callback;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* option:
|
|
|
|
*
|
|
|
|
* driver use these param for some register
|
|
|
|
*/
|
|
|
|
struct renesas_usbhs_driver_param driver_param;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* macro for platform
|
|
|
|
*/
|
|
|
|
#define renesas_usbhs_get_info(pdev)\
|
|
|
|
((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data)
|
|
|
|
#endif /* RENESAS_USB_H */
|