1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) 2013 - 2025 Intel Corporation 4 */ 5 6 #ifndef IPU7_BUS_H 7 #define IPU7_BUS_H 8 9 #include <linux/auxiliary_bus.h> 10 #include <linux/container_of.h> 11 #include <linux/device.h> 12 #include <linux/irqreturn.h> 13 #include <linux/list.h> 14 #include <linux/scatterlist.h> 15 #include <linux/types.h> 16 17 #include "abi/ipu7_fw_boot_abi.h" 18 19 #include "ipu7-syscom.h" 20 21 struct pci_dev; 22 struct ipu_buttress_ctrl; 23 struct ipu7_mmu; 24 struct ipu7_device; 25 26 enum ipu7_subsys { 27 IPU_IS = 0, 28 IPU_PS = 1, 29 IPU_SUBSYS_NUM = 2, 30 }; 31 32 struct ipu7_bus_device { 33 struct auxiliary_device auxdev; 34 const struct auxiliary_driver *auxdrv; 35 const struct ipu7_auxdrv_data *auxdrv_data; 36 struct list_head list; 37 enum ipu7_subsys subsys; 38 void *pdata; 39 struct ipu7_mmu *mmu; 40 struct ipu7_device *isp; 41 const struct ipu_buttress_ctrl *ctrl; 42 u64 dma_mask; 43 struct sg_table fw_sgt; 44 u32 fw_entry; 45 struct ipu7_syscom_context *syscom; 46 struct ia_gofo_boot_config *boot_config; 47 dma_addr_t boot_config_dma_addr; 48 u32 boot_config_size; 49 }; 50 51 struct ipu7_auxdrv_data { 52 irqreturn_t (*isr)(struct ipu7_bus_device *adev); 53 irqreturn_t (*isr_threaded)(struct ipu7_bus_device *adev); 54 bool wake_isr_thread; 55 }; 56 57 #define to_ipu7_bus_device(_dev) \ 58 container_of(to_auxiliary_dev(_dev), struct ipu7_bus_device, auxdev) 59 #define auxdev_to_adev(_auxdev) \ 60 container_of(_auxdev, struct ipu7_bus_device, auxdev) 61 #define ipu7_bus_get_drvdata(adev) dev_get_drvdata(&(adev)->auxdev.dev) 62 63 struct ipu7_bus_device * 64 ipu7_bus_initialize_device(struct pci_dev *pdev, struct device *parent, 65 void *pdata, const struct ipu_buttress_ctrl *ctrl, 66 const char *name); 67 int ipu7_bus_add_device(struct ipu7_bus_device *adev); 68 void ipu7_bus_del_devices(struct pci_dev *pdev); 69 #endif 70