404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.191.156.74: ~ $
// SPDX-License-Identifier: GPL-1.0+
/*
 * Renesas USB
 *
 * Copyright (C) 2011 Renesas Solutions Corp.
 * 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
#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 table for driver
 *
 * These functions are called from platform for driver.
 * Callback function's pointer will be set before
 * renesas_usbhs_platform_callback :: hardware_init was called
 */
struct renesas_usbhs_driver_callback {
	int (*notify_hotplug)(struct platform_device *pdev);
};

/*
 * 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
	 */
	int (*hardware_exit)(struct platform_device *pdev);

	/*
	 * option:
	 *
	 * for board specific clock control
	 */
	int (*power_ctrl)(struct platform_device *pdev,
			   void __iomem *base, int enable);

	/*
	 * option:
	 *
	 * Phy reset for platform
	 */
	int (*phy_reset)(struct platform_device *pdev);

	/*
	 * 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);

	/*
	 * option:
	 *
	 * VBUS control is needed for Host
	 */
	int (*set_vbus)(struct platform_device *pdev, int enable);
};

/*
 * parameters for renesas usbhs
 *
 * some register needs USB chip specific parameters.
 * This struct show it to driver
 */

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),	\
	}

struct renesas_usbhs_driver_param {
	/*
	 * pipe settings
	 */
	struct renesas_usbhs_driver_pipe_config *pipe_configs;
	int pipe_size; /* pipe_configs array size */

	/*
	 * option:
	 *
	 * for BUSWAIT :: BWAIT
	 * see
	 *	renesas_usbhs/common.c :: usbhsc_set_buswait()
	 * */
	int buswait_bwait;

	/*
	 * option:
	 *
	 * delay time from notify_hotplug callback
	 */
	int detection_delay; /* msec */

	/*
	 * option:
	 *
	 * dma id for dmaengine
	 * 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,
	 */
	int d0_tx_id;
	int d0_rx_id;
	int d1_tx_id;
	int d1_rx_id;
	int d2_tx_id;
	int d2_rx_id;
	int d3_tx_id;
	int d3_rx_id;

	/*
	 * option:
	 *
	 * pio <--> dma border.
	 */
	int pio_dma_border; /* default is 64byte */

	uintptr_t type;
	u32 enable_gpio;

	/*
	 * option:
	 */
	u32 has_otg:1; /* for controlling PWEN/EXTLP */
	u32 has_sudmac:1; /* for SUDMAC */
	u32 has_usb_dmac:1; /* for USB-DMAC */
#define USBHS_USB_DMAC_XFER_SIZE	32	/* hardcode the xfer size */
};

#define USBHS_TYPE_RCAR_GEN2		1
#define USBHS_TYPE_RCAR_GEN3		2
#define USBHS_TYPE_RCAR_GEN3_WITH_PLL	3

/*
 * 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;

	/*
	 * driver set these callback functions pointer.
	 * platform can use it on callback functions
	 */
	struct renesas_usbhs_driver_callback	driver_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)

#define renesas_usbhs_call_notify_hotplug(pdev)				\
	({								\
		struct renesas_usbhs_driver_callback *dc;		\
		dc = &(renesas_usbhs_get_info(pdev)->driver_callback);	\
		if (dc && dc->notify_hotplug)				\
			dc->notify_hotplug(pdev);			\
	})
#endif /* RENESAS_USB_H */

Filemanager

Name Type Size Permission Actions
association.h File 4.59 KB 0644
atmel_usba_udc.h File 421 B 0644
audio-v2.h File 13.17 KB 0644
audio.h File 1.23 KB 0644
c67x00.h File 1.82 KB 0644
cdc-wdm.h File 651 B 0644
cdc.h File 1.48 KB 0644
cdc_ncm.h File 5.56 KB 0644
ch9.h File 2.5 KB 0644
chipidea.h File 2.77 KB 0644
composite.h File 25.17 KB 0644
ehci-dbgp.h File 2.05 KB 0644
ehci_def.h File 7.89 KB 0644
ehci_pdriver.h File 2.31 KB 0644
ezusb.h File 286 B 0644
functionfs.h File 151 B 0644
g_hid.h File 1.13 KB 0644
gadget.h File 32.65 KB 0644
gadget_configfs.h File 2.94 KB 0644
gpio_vbus.h File 1.13 KB 0644
hcd.h File 25.93 KB 0644
input.h File 716 B 0644
iowarrior.h File 1.34 KB 0644
irda.h File 3.76 KB 0644
isp116x.h File 1.13 KB 0644
isp1301.h File 2.38 KB 0644
isp1362.h File 1.59 KB 0644
isp1760.h File 633 B 0644
m66592.h File 1.41 KB 0644
musb-ux500.h File 899 B 0644
musb.h File 4.59 KB 0644
net2280.h File 23.55 KB 0644
of.h File 1.46 KB 0644
ohci_pdriver.h File 1.71 KB 0644
otg-fsm.h File 8.61 KB 0644
otg.h File 3.01 KB 0644
pd.h File 8.98 KB 0644
pd_bdo.h File 1011 B 0644
pd_vdo.h File 7.58 KB 0644
phy.h File 9.25 KB 0644
phy_companion.h File 1.17 KB 0644
quirks.h File 2.34 KB 0644
r8a66597.h File 17.65 KB 0644
renesas_usbhs.h File 4.76 KB 0644
rndis_host.h File 5.94 KB 0644
samsung_usb_phy.h File 530 B 0644
serial.h File 17.12 KB 0644
sl811.h File 838 B 0644
storage.h File 2.58 KB 0644
tcpm.h File 6.46 KB 0644
tegra_usb_phy.h File 2.38 KB 0644
tilegx.h File 983 B 0644
typec.h File 7.04 KB 0644
uas.h File 2.07 KB 0644
ulpi.h File 1.99 KB 0644
usb338x.h File 7.63 KB 0644
usb_phy_generic.h File 892 B 0644
usbnet.h File 10.01 KB 0644
wusb-wa.h File 7.5 KB 0644
wusb.h File 9.92 KB 0644
xhci-dbgp.h File 825 B 0644