root/include/linux/mic_bus.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. dev_to_mbus
  2. drv_to_mbus

   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * Intel MIC Platform Software Stack (MPSS)
   4  *
   5  * Copyright(c) 2014 Intel Corporation.
   6  *
   7  * Intel MIC Bus driver.
   8  *
   9  * This implementation is very similar to the the virtio bus driver
  10  * implementation @ include/linux/virtio.h.
  11  */
  12 #ifndef _MIC_BUS_H_
  13 #define _MIC_BUS_H_
  14 /*
  15  * Everything a mbus driver needs to work with any particular mbus
  16  * implementation.
  17  */
  18 #include <linux/interrupt.h>
  19 #include <linux/dma-mapping.h>
  20 
  21 struct mbus_device_id {
  22         __u32 device;
  23         __u32 vendor;
  24 };
  25 
  26 #define MBUS_DEV_DMA_HOST 2
  27 #define MBUS_DEV_DMA_MIC 3
  28 #define MBUS_DEV_ANY_ID 0xffffffff
  29 
  30 /**
  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
  38  */
  39 struct mbus_device {
  40         void __iomem *mmio_va;
  41         struct mbus_hw_ops *hw_ops;
  42         struct mbus_device_id id;
  43         struct device dev;
  44         int index;
  45 };
  46 
  47 /**
  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.
  53  */
  54 struct mbus_driver {
  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);
  60 };
  61 
  62 /**
  63  * struct mic_irq - opaque pointer used as cookie
  64  */
  65 struct mic_irq;
  66 
  67 /**
  68  * mbus_hw_ops - Hardware operations for accessing a MIC device on the MIC bus.
  69  */
  70 struct mbus_hw_ops {
  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,
  75                                                 int intr_src);
  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);
  79 };
  80 
  81 struct mbus_device *
  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);
  86 
  87 int mbus_register_driver(struct mbus_driver *drv);
  88 void mbus_unregister_driver(struct mbus_driver *drv);
  89 
  90 static inline struct mbus_device *dev_to_mbus(struct device *_dev)
  91 {
  92         return container_of(_dev, struct mbus_device, dev);
  93 }
  94 
  95 static inline struct mbus_driver *drv_to_mbus(struct device_driver *drv)
  96 {
  97         return container_of(drv, struct mbus_driver, driver);
  98 }
  99 
 100 #endif /* _MIC_BUS_H */

/* [<][>][^][v][top][bottom][index][help] */