Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-1.0+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Renesas USB driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2011 Renesas Solutions Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #ifndef RENESAS_USB_FIFO_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #define RENESAS_USB_FIFO_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/sh_dma.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <asm/dma.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "pipe.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) struct usbhs_fifo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	u32 port;	/* xFIFO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	u32 sel;	/* xFIFOSEL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	u32 ctr;	/* xFIFOCTR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	struct usbhs_pipe	*pipe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	struct dma_chan		*tx_chan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	struct dma_chan		*rx_chan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	struct sh_dmae_slave	tx_slave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	struct sh_dmae_slave	rx_slave;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define USBHS_MAX_NUM_DFIFO	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) struct usbhs_fifo_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	struct usbhs_fifo cfifo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	struct usbhs_fifo dfifo[USBHS_MAX_NUM_DFIFO];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define usbhsf_get_dnfifo(p, n)	(&((p)->fifo_info.dfifo[n]))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define usbhs_for_each_dfifo(priv, dfifo, i)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	for ((i) = 0;						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	     ((i) < USBHS_MAX_NUM_DFIFO) &&			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		     ((dfifo) = usbhsf_get_dnfifo(priv, (i)));	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) struct usbhs_pkt_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) struct usbhs_pkt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	struct list_head node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	struct usbhs_pipe *pipe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	const struct usbhs_pkt_handle *handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	void (*done)(struct usbhs_priv *priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		     struct usbhs_pkt *pkt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	struct work_struct work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	dma_addr_t dma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	const struct dmaengine_result *dma_result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	void *buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	int length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	int trans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	int actual;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	int zero;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	int sequence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) struct usbhs_pkt_handle {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	int (*prepare)(struct usbhs_pkt *pkt, int *is_done);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	int (*try_run)(struct usbhs_pkt *pkt, int *is_done);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	int (*dma_done)(struct usbhs_pkt *pkt, int *is_done);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * fifo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) int usbhs_fifo_probe(struct usbhs_priv *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) void usbhs_fifo_remove(struct usbhs_priv *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) void usbhs_fifo_init(struct usbhs_priv *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) void usbhs_fifo_quit(struct usbhs_priv *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  * packet info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) extern const struct usbhs_pkt_handle usbhs_fifo_pio_push_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) extern const struct usbhs_pkt_handle usbhs_fifo_pio_pop_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) extern const struct usbhs_pkt_handle usbhs_ctrl_stage_end_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) extern const struct usbhs_pkt_handle usbhs_fifo_dma_push_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) extern const struct usbhs_pkt_handle usbhs_fifo_dma_pop_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) extern const struct usbhs_pkt_handle usbhs_dcp_status_stage_in_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) extern const struct usbhs_pkt_handle usbhs_dcp_status_stage_out_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) extern const struct usbhs_pkt_handle usbhs_dcp_data_stage_in_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) extern const struct usbhs_pkt_handle usbhs_dcp_data_stage_out_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) void usbhs_pkt_init(struct usbhs_pkt *pkt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		    void (*done)(struct usbhs_priv *priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 				 struct usbhs_pkt *pkt),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		    void *buf, int len, int zero, int sequence);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) void usbhs_pkt_start(struct usbhs_pipe *pipe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #endif /* RENESAS_USB_FIFO_H */