drm/panthor: Don't add write fences to the shared BOs
[drm/drm-misc.git] / arch / mips / include / asm / cdmm.h
blob81fa99084178e7215691306dad9287cfb6e6c40c
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
6 * Copyright (C) 2014 Imagination Technologies Ltd.
7 */
8 #ifndef __ASM_CDMM_H
9 #define __ASM_CDMM_H
11 #include <linux/device.h>
12 #include <linux/mod_devicetable.h>
14 /**
15 * struct mips_cdmm_device - Represents a single device on a CDMM bus.
16 * @dev: Driver model device object.
17 * @cpu: CPU which can access this device.
18 * @res: MMIO resource.
19 * @type: Device type identifier.
20 * @rev: Device revision number.
22 struct mips_cdmm_device {
23 struct device dev;
24 unsigned int cpu;
25 struct resource res;
26 unsigned int type;
27 unsigned int rev;
30 /**
31 * struct mips_cdmm_driver - Represents a driver for a CDMM device.
32 * @drv: Driver model driver object.
33 * @probe Callback for probing newly discovered devices.
34 * @remove: Callback to remove the device.
35 * @shutdown: Callback on system shutdown.
36 * @cpu_down: Callback when the parent CPU is going down.
37 * Any CPU pinned threads/timers should be disabled.
38 * @cpu_up: Callback when the parent CPU is coming back up again.
39 * CPU pinned threads/timers can be restarted.
40 * @id_table: Table for CDMM IDs to match against.
42 struct mips_cdmm_driver {
43 struct device_driver drv;
44 int (*probe)(struct mips_cdmm_device *);
45 int (*remove)(struct mips_cdmm_device *);
46 void (*shutdown)(struct mips_cdmm_device *);
47 int (*cpu_down)(struct mips_cdmm_device *);
48 int (*cpu_up)(struct mips_cdmm_device *);
49 const struct mips_cdmm_device_id *id_table;
52 /**
53 * mips_cdmm_phys_base() - Choose a physical base address for CDMM region.
55 * Picking a suitable physical address at which to map the CDMM region is
56 * platform specific, so this function can be defined by platform code to
57 * pick a suitable value if none is configured by the bootloader.
59 * This address must be 32kB aligned, and the region occupies a maximum of 32kB
60 * of physical address space which must not be used for anything else.
62 * Returns: Physical base address for CDMM region, or 0 on failure.
64 phys_addr_t mips_cdmm_phys_base(void);
66 extern const struct bus_type mips_cdmm_bustype;
67 void __iomem *mips_cdmm_early_probe(unsigned int dev_type);
69 #define to_mips_cdmm_device(d) container_of(d, struct mips_cdmm_device, dev)
71 #define mips_cdmm_get_drvdata(d) dev_get_drvdata(&d->dev)
72 #define mips_cdmm_set_drvdata(d, p) dev_set_drvdata(&d->dev, p)
74 int mips_cdmm_driver_register(struct mips_cdmm_driver *);
75 void mips_cdmm_driver_unregister(struct mips_cdmm_driver *);
78 * module_mips_cdmm_driver() - Helper macro for drivers that don't do
79 * anything special in module init/exit. This eliminates a lot of
80 * boilerplate. Each module may only use this macro once, and
81 * calling it replaces module_init() and module_exit()
83 #define module_mips_cdmm_driver(__mips_cdmm_driver) \
84 module_driver(__mips_cdmm_driver, mips_cdmm_driver_register, \
85 mips_cdmm_driver_unregister)
88 * builtin_mips_cdmm_driver() - Helper macro for drivers that don't do anything
89 * special in init and have no exit. This eliminates some boilerplate. Each
90 * driver may only use this macro once, and calling it replaces device_initcall
91 * (or in some cases, the legacy __initcall). This is meant to be a direct
92 * parallel of module_mips_cdmm_driver() above but without the __exit stuff that
93 * is not used for builtin cases.
95 #define builtin_mips_cdmm_driver(__mips_cdmm_driver) \
96 builtin_driver(__mips_cdmm_driver, mips_cdmm_driver_register)
98 /* drivers/tty/mips_ejtag_fdc.c */
100 #ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON
101 int setup_early_fdc_console(void);
102 #else
103 static inline int setup_early_fdc_console(void)
105 return -ENODEV;
107 #endif
109 #endif /* __ASM_CDMM_H */