/*1* This file is subject to the terms and conditions of the GNU General Public2* License. See the file "COPYING" in the main directory of this archive3* for more details.4*5* Copyright (C) 2014 Imagination Technologies Ltd.6*/7#ifndef __ASM_CDMM_H8#define __ASM_CDMM_H910#include <linux/device.h>11#include <linux/mod_devicetable.h>1213/**14* struct mips_cdmm_device - Represents a single device on a CDMM bus.15* @dev: Driver model device object.16* @cpu: CPU which can access this device.17* @res: MMIO resource.18* @type: Device type identifier.19* @rev: Device revision number.20*/21struct mips_cdmm_device {22struct device dev;23unsigned int cpu;24struct resource res;25unsigned int type;26unsigned int rev;27};2829/**30* struct mips_cdmm_driver - Represents a driver for a CDMM device.31* @drv: Driver model driver object.32* @probe Callback for probing newly discovered devices.33* @remove: Callback to remove the device.34* @shutdown: Callback on system shutdown.35* @cpu_down: Callback when the parent CPU is going down.36* Any CPU pinned threads/timers should be disabled.37* @cpu_up: Callback when the parent CPU is coming back up again.38* CPU pinned threads/timers can be restarted.39* @id_table: Table for CDMM IDs to match against.40*/41struct mips_cdmm_driver {42struct device_driver drv;43int (*probe)(struct mips_cdmm_device *);44int (*remove)(struct mips_cdmm_device *);45void (*shutdown)(struct mips_cdmm_device *);46int (*cpu_down)(struct mips_cdmm_device *);47int (*cpu_up)(struct mips_cdmm_device *);48const struct mips_cdmm_device_id *id_table;49};5051/**52* mips_cdmm_phys_base() - Choose a physical base address for CDMM region.53*54* Picking a suitable physical address at which to map the CDMM region is55* platform specific, so this function can be defined by platform code to56* pick a suitable value if none is configured by the bootloader.57*58* This address must be 32kB aligned, and the region occupies a maximum of 32kB59* of physical address space which must not be used for anything else.60*61* Returns: Physical base address for CDMM region, or 0 on failure.62*/63phys_addr_t mips_cdmm_phys_base(void);6465extern const struct bus_type mips_cdmm_bustype;66void __iomem *mips_cdmm_early_probe(unsigned int dev_type);6768#define to_mips_cdmm_device(d) container_of(d, struct mips_cdmm_device, dev)6970#define mips_cdmm_get_drvdata(d) dev_get_drvdata(&d->dev)71#define mips_cdmm_set_drvdata(d, p) dev_set_drvdata(&d->dev, p)7273int mips_cdmm_driver_register(struct mips_cdmm_driver *);74void mips_cdmm_driver_unregister(struct mips_cdmm_driver *);7576/*77* module_mips_cdmm_driver() - Helper macro for drivers that don't do78* anything special in module init/exit. This eliminates a lot of79* boilerplate. Each module may only use this macro once, and80* calling it replaces module_init() and module_exit()81*/82#define module_mips_cdmm_driver(__mips_cdmm_driver) \83module_driver(__mips_cdmm_driver, mips_cdmm_driver_register, \84mips_cdmm_driver_unregister)8586/*87* builtin_mips_cdmm_driver() - Helper macro for drivers that don't do anything88* special in init and have no exit. This eliminates some boilerplate. Each89* driver may only use this macro once, and calling it replaces device_initcall90* (or in some cases, the legacy __initcall). This is meant to be a direct91* parallel of module_mips_cdmm_driver() above but without the __exit stuff that92* is not used for builtin cases.93*/94#define builtin_mips_cdmm_driver(__mips_cdmm_driver) \95builtin_driver(__mips_cdmm_driver, mips_cdmm_driver_register)9697/* drivers/tty/mips_ejtag_fdc.c */9899#ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON100int setup_early_fdc_console(void);101#else102static inline int setup_early_fdc_console(void)103{104return -ENODEV;105}106#endif107108#endif /* __ASM_CDMM_H */109110111