]>
git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/linux/mic_bus.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Intel MIC Platform Software Stack (MPSS)
5 * Copyright(c) 2014 Intel Corporation.
7 * Intel MIC Bus driver.
9 * This implementation is very similar to the virtio bus driver
10 * implementation @ include/linux/virtio.h.
15 * Everything a mbus driver needs to work with any particular mbus
18 #include <linux/interrupt.h>
19 #include <linux/dma-mapping.h>
21 struct mbus_device_id
{
26 #define MBUS_DEV_DMA_HOST 2
27 #define MBUS_DEV_DMA_MIC 3
28 #define MBUS_DEV_ANY_ID 0xffffffff
31 * mbus_device - representation of a device using mbus
32 * @mmio_va: virtual address of mmio space
33 * @hw_ops: the hardware ops supported by this device.
34 * @id: the device type identification (used to match it with a driver).
35 * @dev: underlying device.
36 * be used to communicate with.
37 * @index: unique position on the mbus bus
40 void __iomem
*mmio_va
;
41 struct mbus_hw_ops
*hw_ops
;
42 struct mbus_device_id id
;
48 * mbus_driver - operations for a mbus I/O driver
49 * @driver: underlying device driver (populate name and owner).
50 * @id_table: the ids serviced by this driver.
51 * @probe: the function to call when a device is found. Returns 0 or -errno.
52 * @remove: the function to call when a device is removed.
55 struct device_driver driver
;
56 const struct mbus_device_id
*id_table
;
57 int (*probe
)(struct mbus_device
*dev
);
58 void (*scan
)(struct mbus_device
*dev
);
59 void (*remove
)(struct mbus_device
*dev
);
63 * struct mic_irq - opaque pointer used as cookie
68 * mbus_hw_ops - Hardware operations for accessing a MIC device on the MIC bus.
71 struct mic_irq
* (*request_threaded_irq
)(struct mbus_device
*mbdev
,
72 irq_handler_t handler
,
73 irq_handler_t thread_fn
,
74 const char *name
, void *data
,
76 void (*free_irq
)(struct mbus_device
*mbdev
,
77 struct mic_irq
*cookie
, void *data
);
78 void (*ack_interrupt
)(struct mbus_device
*mbdev
, int num
);
82 mbus_register_device(struct device
*pdev
, int id
, const struct dma_map_ops
*dma_ops
,
83 struct mbus_hw_ops
*hw_ops
, int index
,
84 void __iomem
*mmio_va
);
85 void mbus_unregister_device(struct mbus_device
*mbdev
);
87 int mbus_register_driver(struct mbus_driver
*drv
);
88 void mbus_unregister_driver(struct mbus_driver
*drv
);
90 static inline struct mbus_device
*dev_to_mbus(struct device
*_dev
)
92 return container_of(_dev
, struct mbus_device
, dev
);
95 static inline struct mbus_driver
*drv_to_mbus(struct device_driver
*drv
)
97 return container_of(drv
, struct mbus_driver
, driver
);
100 #endif /* _MIC_BUS_H */