linux/drivers/usb/renesas_usbhs/mod_host.c

// SPDX-License-Identifier: GPL-1.0+
/*
 * Renesas USB driver
 *
 * Copyright (C) 2011 Renesas Solutions Corp.
 * Kuninori Morimoto <[email protected]>
 */
#include <linux/io.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
#include "common.h"

/*
 *** HARDWARE LIMITATION ***
 *
 * 1) renesas_usbhs has a limited number of controllable devices.
 *    it can control only 9 devices in generally.
 *	see DEVADDn / DCPMAXP / PIPEMAXP.
 *
 * 2) renesas_usbhs pipe number is limited.
 *    the pipe will be re-used for each devices.
 *    so, software should control DATA0/1 sequence of each devices.
 */


/*
 *		image of mod_host
 *
 * +--------+
 * | udev 0 | --> it is used when set address
 * +--------+
 *
 * +--------+					pipes are reused for each uep.
 * | udev 1 |-+- [uep 0 (dcp) ] --+		pipe will be switched when
 * +--------+ |			  |		other device requested
 *	      +- [uep 1 (bulk)]	--|---+		   +--------------+
 *	      |			  +--------------> | pipe0 (dcp)  |
 *	      +- [uep 2 (bulk)]	-@    |		   +--------------+
 *				      |		   | pipe1 (isoc) |
 * +--------+			      |		   +--------------+
 * | udev 2 |-+- [uep 0 (dcp) ]	-@    +----------> | pipe2 (bulk) |
 * +--------+ |					   +--------------+
 *	      +- [uep 1 (int) ]	----+	  +------> | pipe3 (bulk) |
 *				    |	  |	   +--------------+
 * +--------+			    +-----|------> | pipe4 (int)  |
 * | udev 3 |-+- [uep 0 (dcp) ]	-@	  |	   +--------------+
 * +--------+ |				  |	   | ....	  |
 *	      +- [uep 1 (bulk)]	-@	  |	   | ....	  |
 *	      |				  |
 *	      +- [uep 2 (bulk)]-----------+
 *
 * @ :	uep requested free pipe, but all have been used.
 *	now it is waiting for free pipe
 */


/*
 *		struct
 */
struct usbhsh_request {};

struct usbhsh_device {};

struct usbhsh_ep {};

#define USBHSH_DEVICE_MAX
#define USBHSH_PORT_MAX
struct usbhsh_hpriv {};


static const char usbhsh_hcd_name[] =;

/*
 *		macro
 */
#define usbhsh_priv_to_hpriv(priv)

#define __usbhsh_for_each_udev(start, pos, h, i)

#define usbhsh_for_each_udev(pos, hpriv, i)

#define usbhsh_for_each_udev_with_dev0(pos, hpriv, i)

#define usbhsh_hcd_to_hpriv(h)
#define usbhsh_hcd_to_dev(h)

#define usbhsh_hpriv_to_priv(h)
#define usbhsh_hpriv_to_dcp(h)
#define usbhsh_hpriv_to_hcd(h)

#define usbhsh_ep_to_uep(u)
#define usbhsh_uep_to_pipe(u)
#define usbhsh_uep_to_udev(u)
#define usbhsh_uep_to_ep(u)

#define usbhsh_urb_to_ureq(u)
#define usbhsh_urb_to_usbv(u)

#define usbhsh_usbv_to_udev(d)

#define usbhsh_udev_to_usbv(h)
#define usbhsh_udev_is_used(h)

#define usbhsh_pipe_to_uep(p)

#define usbhsh_device_parent(d)
#define usbhsh_device_hubport(d)
#define usbhsh_device_number(h, d)
#define usbhsh_device_nth(h, d)
#define usbhsh_device0(h)

#define usbhsh_port_stat_init(h)
#define usbhsh_port_stat_set(h, s)
#define usbhsh_port_stat_clear(h, s)
#define usbhsh_port_stat_get(h)

#define usbhsh_pkt_to_ureq(p)

/*
 *		req alloc/free
 */
static struct usbhsh_request *usbhsh_ureq_alloc(struct usbhsh_hpriv *hpriv,
					       struct urb *urb,
					       gfp_t mem_flags)
{}

static void usbhsh_ureq_free(struct usbhsh_hpriv *hpriv,
			    struct usbhsh_request *ureq)
{}

/*
 *		status
 */
static int usbhsh_is_running(struct usbhsh_hpriv *hpriv)
{}

/*
 *		pipe control
 */
static void usbhsh_endpoint_sequence_save(struct usbhsh_hpriv *hpriv,
					  struct urb *urb,
					  struct usbhs_pkt *pkt)
{}

static struct usbhsh_device *usbhsh_device_get(struct usbhsh_hpriv *hpriv,
					       struct urb *urb);

static int usbhsh_pipe_attach(struct usbhsh_hpriv *hpriv,
			      struct urb *urb)
{}

static void usbhsh_pipe_detach(struct usbhsh_hpriv *hpriv,
			       struct usbhsh_ep *uep)
{}

/*
 *		endpoint control
 */
static int usbhsh_endpoint_attach(struct usbhsh_hpriv *hpriv,
				  struct urb *urb,
				  gfp_t mem_flags)
{}

static void usbhsh_endpoint_detach(struct usbhsh_hpriv *hpriv,
				   struct usb_host_endpoint *ep)
{}

static void usbhsh_endpoint_detach_all(struct usbhsh_hpriv *hpriv,
				       struct usbhsh_device *udev)
{}

/*
 *		device control
 */
static int usbhsh_connected_to_rhdev(struct usb_hcd *hcd,
				     struct usbhsh_device *udev)
{}

static int usbhsh_device_has_endpoint(struct usbhsh_device *udev)
{}

static struct usbhsh_device *usbhsh_device_get(struct usbhsh_hpriv *hpriv,
					       struct urb *urb)
{}

static struct usbhsh_device *usbhsh_device_attach(struct usbhsh_hpriv *hpriv,
						 struct urb *urb)
{}

static void usbhsh_device_detach(struct usbhsh_hpriv *hpriv,
			       struct usbhsh_device *udev)
{}

/*
 *		queue push/pop
 */
static void usbhsh_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt)
{}

static int usbhsh_queue_push(struct usb_hcd *hcd,
			     struct urb *urb,
			     gfp_t mem_flags)
{}

static void usbhsh_queue_force_pop(struct usbhs_priv *priv,
				   struct usbhs_pipe *pipe)
{}

static void usbhsh_queue_force_pop_all(struct usbhs_priv *priv)
{}

/*
 *		DCP setup stage
 */
static int usbhsh_is_request_address(struct urb *urb)
{}

static void usbhsh_setup_stage_packet_push(struct usbhsh_hpriv *hpriv,
					   struct urb *urb,
					   struct usbhs_pipe *pipe)
{}

/*
 *		DCP data stage
 */
static void usbhsh_data_stage_packet_done(struct usbhs_priv *priv,
					  struct usbhs_pkt *pkt)
{}

static int usbhsh_data_stage_packet_push(struct usbhsh_hpriv *hpriv,
					 struct urb *urb,
					 struct usbhs_pipe *pipe,
					 gfp_t mem_flags)

{}

/*
 *		DCP status stage
 */
static int usbhsh_status_stage_packet_push(struct usbhsh_hpriv *hpriv,
					    struct urb *urb,
					    struct usbhs_pipe *pipe,
					    gfp_t mem_flags)
{}

static int usbhsh_dcp_queue_push(struct usb_hcd *hcd,
				 struct urb *urb,
				 gfp_t mflags)
{}

/*
 *		dma map functions
 */
static int usbhsh_dma_map_ctrl(struct device *dma_dev, struct usbhs_pkt *pkt,
			       int map)
{}

/*
 *		for hc_driver
 */
static int usbhsh_host_start(struct usb_hcd *hcd)
{}

static void usbhsh_host_stop(struct usb_hcd *hcd)
{}

static int usbhsh_urb_enqueue(struct usb_hcd *hcd,
			      struct urb *urb,
			      gfp_t mem_flags)
{}

static int usbhsh_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
{}

static void usbhsh_endpoint_disable(struct usb_hcd *hcd,
				    struct usb_host_endpoint *ep)
{}

static int usbhsh_hub_status_data(struct usb_hcd *hcd, char *buf)
{}

static int __usbhsh_hub_hub_feature(struct usbhsh_hpriv *hpriv,
				    u16 typeReq, u16 wValue,
				    u16 wIndex, char *buf, u16 wLength)
{}

static int __usbhsh_hub_port_feature(struct usbhsh_hpriv *hpriv,
				     u16 typeReq, u16 wValue,
				     u16 wIndex, char *buf, u16 wLength)
{}

static int __usbhsh_hub_get_status(struct usbhsh_hpriv *hpriv,
				   u16 typeReq, u16 wValue,
				   u16 wIndex, char *buf, u16 wLength)
{}

static int usbhsh_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
			      u16 wIndex, char *buf, u16 wLength)
{}

static int usbhsh_bus_nop(struct usb_hcd *hcd)
{}

static const struct hc_driver usbhsh_driver =;

/*
 *		interrupt functions
 */
static int usbhsh_irq_attch(struct usbhs_priv *priv,
			    struct usbhs_irq_state *irq_state)
{}

static int usbhsh_irq_dtch(struct usbhs_priv *priv,
			   struct usbhs_irq_state *irq_state)
{}

static int usbhsh_irq_setup_ack(struct usbhs_priv *priv,
				struct usbhs_irq_state *irq_state)
{}

static int usbhsh_irq_setup_err(struct usbhs_priv *priv,
				struct usbhs_irq_state *irq_state)
{}

/*
 *		module start/stop
 */
static void usbhsh_pipe_init_for_host(struct usbhs_priv *priv)
{}

static int usbhsh_start(struct usbhs_priv *priv)
{}

static int usbhsh_stop(struct usbhs_priv *priv)
{}

int usbhs_mod_host_probe(struct usbhs_priv *priv)
{}

int usbhs_mod_host_remove(struct usbhs_priv *priv)
{}