dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / usb / c67x00 / c67x00-hcd.h
blob3b181d4c7a03827c571c71d367efa6840db376dd
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * c67x00-hcd.h: Cypress C67X00 USB HCD
5 * Copyright (C) 2006-2008 Barco N.V.
6 * Derived from the Cypress cy7c67200/300 ezusb linux driver and
7 * based on multiple host controller drivers inside the linux kernel.
8 */
10 #ifndef _USB_C67X00_HCD_H
11 #define _USB_C67X00_HCD_H
13 #include <linux/kernel.h>
14 #include <linux/spinlock.h>
15 #include <linux/list.h>
16 #include <linux/usb.h>
17 #include <linux/usb/hcd.h>
18 #include "c67x00.h"
21 * The following parameters depend on the CPU speed, bus speed, ...
22 * These can be tuned for specific use cases, e.g. if isochronous transfers
23 * are very important, bandwidth can be sacrificed to guarantee that the
24 * 1ms deadline will be met.
25 * If bulk transfers are important, the MAX_FRAME_BW can be increased,
26 * but some (or many) isochronous deadlines might not be met.
28 * The values are specified in bittime.
32 * The current implementation switches between _STD (default) and _ISO (when
33 * isochronous transfers are scheduled), in order to optimize the throughput
34 * in normal circumstances, but also provide good isochronous behaviour.
36 * Bandwidth is described in bit time so with a 12MHz USB clock and 1ms
37 * frames; there are 12000 bit times per frame.
40 #define TOTAL_FRAME_BW 12000
41 #define DEFAULT_EOT 2250
43 #define MAX_FRAME_BW_STD (TOTAL_FRAME_BW - DEFAULT_EOT)
44 #define MAX_FRAME_BW_ISO 2400
47 * Periodic transfers may only use 90% of the full frame, but as
48 * we currently don't even use 90% of the full frame, we may
49 * use the full usable time for periodic transfers.
51 #define MAX_PERIODIC_BW(full_bw) full_bw
53 /* -------------------------------------------------------------------------- */
55 struct c67x00_hcd {
56 spinlock_t lock;
57 struct c67x00_sie *sie;
58 unsigned int low_speed_ports; /* bitmask of low speed ports */
59 unsigned int urb_count;
60 unsigned int urb_iso_count;
62 struct list_head list[4]; /* iso, int, ctrl, bulk */
63 #if PIPE_BULK != 3
64 #error "Sanity check failed, this code presumes PIPE_... to range from 0 to 3"
65 #endif
67 /* USB bandwidth allocated to td_list */
68 int bandwidth_allocated;
69 /* USB bandwidth allocated for isoc/int transfer */
70 int periodic_bw_allocated;
71 struct list_head td_list;
72 int max_frame_bw;
74 u16 td_base_addr;
75 u16 buf_base_addr;
76 u16 next_td_addr;
77 u16 next_buf_addr;
79 struct tasklet_struct tasklet;
81 struct completion endpoint_disable;
83 u16 current_frame;
84 u16 last_frame;
87 static inline struct c67x00_hcd *hcd_to_c67x00_hcd(struct usb_hcd *hcd)
89 return (struct c67x00_hcd *)(hcd->hcd_priv);
92 static inline struct usb_hcd *c67x00_hcd_to_hcd(struct c67x00_hcd *c67x00)
94 return container_of((void *)c67x00, struct usb_hcd, hcd_priv);
97 /* ---------------------------------------------------------------------
98 * Functions used by c67x00-drv
101 int c67x00_hcd_probe(struct c67x00_sie *sie);
102 void c67x00_hcd_remove(struct c67x00_sie *sie);
104 /* ---------------------------------------------------------------------
105 * Transfer Descriptor scheduling functions
107 int c67x00_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags);
108 int c67x00_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status);
109 void c67x00_endpoint_disable(struct usb_hcd *hcd,
110 struct usb_host_endpoint *ep);
112 void c67x00_hcd_msg_received(struct c67x00_sie *sie, u16 msg);
113 void c67x00_sched_kick(struct c67x00_hcd *c67x00);
114 int c67x00_sched_start_scheduler(struct c67x00_hcd *c67x00);
115 void c67x00_sched_stop_scheduler(struct c67x00_hcd *c67x00);
117 #define c67x00_hcd_dev(x) (c67x00_hcd_to_hcd(x)->self.controller)
119 #endif /* _USB_C67X00_HCD_H */