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
6 * Copyright (C) 2014 Imagination Technologies Ltd.
11 #include <linux/device.h>
12 #include <linux/mod_devicetable.h>
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
{
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
;
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);
103 static inline int setup_early_fdc_console(void)
109 #endif /* __ASM_CDMM_H */