blob: df7ea3684b7794bb5ac0cf49decf864aa9dc991c [file] [log] [blame]
Sebastian Siewiordb11e472008-04-24 00:37:04 +02001#ifndef _ISP1760_HCD_H_
2#define _ISP1760_HCD_H_
3
Laurent Pincharte19c99e2015-01-21 00:55:56 +02004#include <linux/spinlock.h>
Laurent Pinchart10c73f02015-01-21 00:55:45 +02005
Laurent Pincharte19c99e2015-01-21 00:55:56 +02006struct isp1760_qh;
7struct isp1760_qtd;
8struct resource;
9struct usb_hcd;
Sebastian Siewiordb11e472008-04-24 00:37:04 +020010
11/*
12 * 60kb divided in:
13 * - 32 blocks @ 256 bytes
14 * - 20 blocks @ 1024 bytes
15 * - 4 blocks @ 8192 bytes
16 */
17
18#define BLOCK_1_NUM 32
19#define BLOCK_2_NUM 20
20#define BLOCK_3_NUM 4
21
22#define BLOCK_1_SIZE 256
23#define BLOCK_2_SIZE 1024
24#define BLOCK_3_SIZE 8192
25#define BLOCKS (BLOCK_1_NUM + BLOCK_2_NUM + BLOCK_3_NUM)
Arvid Brodina041d8e2011-02-26 22:04:40 +010026#define MAX_PAYLOAD_SIZE BLOCK_3_SIZE
27#define PAYLOAD_AREA_SIZE 0xf000
Sebastian Siewiordb11e472008-04-24 00:37:04 +020028
Laurent Pincharte19c99e2015-01-21 00:55:56 +020029struct isp1760_slotinfo {
30 struct isp1760_qh *qh;
31 struct isp1760_qtd *qtd;
32 unsigned long timestamp;
33};
Sebastian Siewiordb11e472008-04-24 00:37:04 +020034
Laurent Pincharte19c99e2015-01-21 00:55:56 +020035/* chip memory management */
36struct isp1760_memory_chunk {
37 unsigned int start;
38 unsigned int size;
39 unsigned int free;
40};
Sebastian Siewiordb11e472008-04-24 00:37:04 +020041
Laurent Pincharte19c99e2015-01-21 00:55:56 +020042enum isp1760_queue_head_types {
43 QH_CONTROL,
44 QH_BULK,
45 QH_INTERRUPT,
46 QH_END
47};
48
49struct isp1760_hcd {
50 struct usb_hcd *hcd;
51
52 u32 hcs_params;
53 spinlock_t lock;
54 struct isp1760_slotinfo atl_slots[32];
55 int atl_done_map;
56 struct isp1760_slotinfo int_slots[32];
57 int int_done_map;
58 struct isp1760_memory_chunk memory_pool[BLOCKS];
59 struct list_head qh_list[QH_END];
60
61 /* periodic schedule support */
62#define DEFAULT_I_TDPS 1024
63 unsigned periodic_size;
64 unsigned i_thresh;
65 unsigned long reset_done;
66 unsigned long next_statechange;
Laurent Pincharte19c99e2015-01-21 00:55:56 +020067};
68
Laurent Pinchart4b1a5772015-01-21 00:55:57 +020069int isp1760_hcd_register(struct isp1760_hcd *priv, void __iomem *regs,
70 struct resource *mem, int irq, unsigned long irqflags,
Laurent Pinchart51714462015-01-21 00:55:59 +020071 struct device *dev);
Laurent Pinchart4b1a5772015-01-21 00:55:57 +020072void isp1760_hcd_unregister(struct isp1760_hcd *priv);
Laurent Pincharte19c99e2015-01-21 00:55:56 +020073
74int isp1760_init_kmem_once(void);
75void isp1760_deinit_kmem_cache(void);
Sebastian Siewiordb11e472008-04-24 00:37:04 +020076
Arvid Brodin71a9f9d2011-04-26 21:48:30 +020077#endif /* _ISP1760_HCD_H_ */