Linux Audio

Check our new training course

Loading...
v4.6
 
  1#ifndef _ISP1760_HCD_H_
  2#define _ISP1760_HCD_H_
  3
  4#include <linux/spinlock.h>
  5
  6struct isp1760_qh;
  7struct isp1760_qtd;
  8struct resource;
  9struct usb_hcd;
 10
 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)
 26#define MAX_PAYLOAD_SIZE BLOCK_3_SIZE
 27#define PAYLOAD_AREA_SIZE 0xf000
 28
 29struct isp1760_slotinfo {
 30	struct isp1760_qh *qh;
 31	struct isp1760_qtd *qtd;
 32	unsigned long timestamp;
 33};
 34
 35/* chip memory management */
 36struct isp1760_memory_chunk {
 37	unsigned int start;
 38	unsigned int size;
 39	unsigned int free;
 40};
 41
 42enum isp1760_queue_head_types {
 43	QH_CONTROL,
 44	QH_BULK,
 45	QH_INTERRUPT,
 46	QH_END
 47};
 48
 49struct isp1760_hcd {
 50#ifdef CONFIG_USB_ISP1760_HCD
 51	struct usb_hcd		*hcd;
 52
 53	u32 hcs_params;
 54	spinlock_t		lock;
 55	struct isp1760_slotinfo	atl_slots[32];
 56	int			atl_done_map;
 57	struct isp1760_slotinfo	int_slots[32];
 58	int			int_done_map;
 59	struct isp1760_memory_chunk memory_pool[BLOCKS];
 60	struct list_head	qh_list[QH_END];
 61
 62	/* periodic schedule support */
 63#define	DEFAULT_I_TDPS		1024
 64	unsigned		periodic_size;
 65	unsigned		i_thresh;
 66	unsigned long		reset_done;
 67	unsigned long		next_statechange;
 68#endif
 69};
 70
 71#ifdef CONFIG_USB_ISP1760_HCD
 72int isp1760_hcd_register(struct isp1760_hcd *priv, void __iomem *regs,
 73			 struct resource *mem, int irq, unsigned long irqflags,
 74			 struct device *dev);
 75void isp1760_hcd_unregister(struct isp1760_hcd *priv);
 76
 77int isp1760_init_kmem_once(void);
 78void isp1760_deinit_kmem_cache(void);
 79#else
 80static inline int isp1760_hcd_register(struct isp1760_hcd *priv,
 81				       void __iomem *regs, struct resource *mem,
 82				       int irq, unsigned long irqflags,
 83				       struct device *dev)
 84{
 85	return 0;
 86}
 87
 88static inline void isp1760_hcd_unregister(struct isp1760_hcd *priv)
 89{
 90}
 91
 92static inline int isp1760_init_kmem_once(void)
 93{
 94	return 0;
 95}
 96
 97static inline void isp1760_deinit_kmem_cache(void)
 98{
 99}
100#endif
101
102#endif /* _ISP1760_HCD_H_ */
v4.17
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef _ISP1760_HCD_H_
  3#define _ISP1760_HCD_H_
  4
  5#include <linux/spinlock.h>
  6
  7struct isp1760_qh;
  8struct isp1760_qtd;
  9struct resource;
 10struct usb_hcd;
 11
 12/*
 13 * 60kb divided in:
 14 * - 32 blocks @ 256  bytes
 15 * - 20 blocks @ 1024 bytes
 16 * -  4 blocks @ 8192 bytes
 17 */
 18
 19#define BLOCK_1_NUM 32
 20#define BLOCK_2_NUM 20
 21#define BLOCK_3_NUM 4
 22
 23#define BLOCK_1_SIZE 256
 24#define BLOCK_2_SIZE 1024
 25#define BLOCK_3_SIZE 8192
 26#define BLOCKS (BLOCK_1_NUM + BLOCK_2_NUM + BLOCK_3_NUM)
 27#define MAX_PAYLOAD_SIZE BLOCK_3_SIZE
 28#define PAYLOAD_AREA_SIZE 0xf000
 29
 30struct isp1760_slotinfo {
 31	struct isp1760_qh *qh;
 32	struct isp1760_qtd *qtd;
 33	unsigned long timestamp;
 34};
 35
 36/* chip memory management */
 37struct isp1760_memory_chunk {
 38	unsigned int start;
 39	unsigned int size;
 40	unsigned int free;
 41};
 42
 43enum isp1760_queue_head_types {
 44	QH_CONTROL,
 45	QH_BULK,
 46	QH_INTERRUPT,
 47	QH_END
 48};
 49
 50struct isp1760_hcd {
 51#ifdef CONFIG_USB_ISP1760_HCD
 52	struct usb_hcd		*hcd;
 53
 54	u32 hcs_params;
 55	spinlock_t		lock;
 56	struct isp1760_slotinfo	atl_slots[32];
 57	int			atl_done_map;
 58	struct isp1760_slotinfo	int_slots[32];
 59	int			int_done_map;
 60	struct isp1760_memory_chunk memory_pool[BLOCKS];
 61	struct list_head	qh_list[QH_END];
 62
 63	/* periodic schedule support */
 64#define	DEFAULT_I_TDPS		1024
 65	unsigned		periodic_size;
 66	unsigned		i_thresh;
 67	unsigned long		reset_done;
 68	unsigned long		next_statechange;
 69#endif
 70};
 71
 72#ifdef CONFIG_USB_ISP1760_HCD
 73int isp1760_hcd_register(struct isp1760_hcd *priv, void __iomem *regs,
 74			 struct resource *mem, int irq, unsigned long irqflags,
 75			 struct device *dev);
 76void isp1760_hcd_unregister(struct isp1760_hcd *priv);
 77
 78int isp1760_init_kmem_once(void);
 79void isp1760_deinit_kmem_cache(void);
 80#else
 81static inline int isp1760_hcd_register(struct isp1760_hcd *priv,
 82				       void __iomem *regs, struct resource *mem,
 83				       int irq, unsigned long irqflags,
 84				       struct device *dev)
 85{
 86	return 0;
 87}
 88
 89static inline void isp1760_hcd_unregister(struct isp1760_hcd *priv)
 90{
 91}
 92
 93static inline int isp1760_init_kmem_once(void)
 94{
 95	return 0;
 96}
 97
 98static inline void isp1760_deinit_kmem_cache(void)
 99{
100}
101#endif
102
103#endif /* _ISP1760_HCD_H_ */