1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2deae26bfSKyle McMartin #ifndef _ASM_PARISC_PARISC_DEVICE_H_ 3deae26bfSKyle McMartin #define _ASM_PARISC_PARISC_DEVICE_H_ 4deae26bfSKyle McMartin 5deae26bfSKyle McMartin #include <linux/device.h> 6deae26bfSKyle McMartin 7deae26bfSKyle McMartin struct parisc_device { 8deae26bfSKyle McMartin struct resource hpa; /* Hard Physical Address */ 9deae26bfSKyle McMartin struct parisc_device_id id; 10deae26bfSKyle McMartin struct parisc_driver *driver; /* Driver for this device */ 11deae26bfSKyle McMartin char name[80]; /* The hardware description */ 12deae26bfSKyle McMartin int irq; 13deae26bfSKyle McMartin int aux_irq; /* Some devices have a second IRQ */ 14deae26bfSKyle McMartin 15deae26bfSKyle McMartin char hw_path; /* The module number on this bus */ 16deae26bfSKyle McMartin unsigned int num_addrs; /* some devices have additional address ranges. */ 17deae26bfSKyle McMartin unsigned long *addr; /* which will be stored here */ 18deae26bfSKyle McMartin 19deae26bfSKyle McMartin #ifdef CONFIG_64BIT 20deae26bfSKyle McMartin /* parms for pdc_pat_cell_module() call */ 21deae26bfSKyle McMartin unsigned long pcell_loc; /* Physical Cell location */ 22deae26bfSKyle McMartin unsigned long mod_index; /* PAT specific - Misc Module info */ 23deae26bfSKyle McMartin 24deae26bfSKyle McMartin /* generic info returned from pdc_pat_cell_module() */ 25deae26bfSKyle McMartin unsigned long mod_info; /* PAT specific - Misc Module info */ 26deae26bfSKyle McMartin unsigned long pmod_loc; /* physical Module location */ 27dd5e6d6aSThomas Bogendoerfer unsigned long mod0; 28deae26bfSKyle McMartin #endif 29deae26bfSKyle McMartin u64 dma_mask; /* DMA mask for I/O */ 30deae26bfSKyle McMartin struct device dev; 31deae26bfSKyle McMartin }; 32deae26bfSKyle McMartin 33deae26bfSKyle McMartin struct parisc_driver { 34deae26bfSKyle McMartin struct parisc_driver *next; 35deae26bfSKyle McMartin char *name; 36deae26bfSKyle McMartin const struct parisc_device_id *id_table; 37deae26bfSKyle McMartin int (*probe)(struct parisc_device *dev); /* New device discovered */ 38*87875c10SUwe Kleine-König void (*remove)(struct parisc_device *dev); 39deae26bfSKyle McMartin struct device_driver drv; 40deae26bfSKyle McMartin }; 41deae26bfSKyle McMartin 42deae26bfSKyle McMartin 43deae26bfSKyle McMartin #define to_parisc_device(d) container_of(d, struct parisc_device, dev) 44deae26bfSKyle McMartin #define to_parisc_driver(d) container_of(d, struct parisc_driver, drv) 45deae26bfSKyle McMartin #define parisc_parent(d) to_parisc_device(d->dev.parent) 46deae26bfSKyle McMartin parisc_pathname(struct parisc_device * d)4790f67130SKay Sieversstatic inline const char *parisc_pathname(struct parisc_device *d) 48deae26bfSKyle McMartin { 4990f67130SKay Sievers return dev_name(&d->dev); 50deae26bfSKyle McMartin } 51deae26bfSKyle McMartin 52deae26bfSKyle McMartin static inline void parisc_set_drvdata(struct parisc_device * d,void * p)53deae26bfSKyle McMartinparisc_set_drvdata(struct parisc_device *d, void *p) 54deae26bfSKyle McMartin { 55deae26bfSKyle McMartin dev_set_drvdata(&d->dev, p); 56deae26bfSKyle McMartin } 57deae26bfSKyle McMartin 58deae26bfSKyle McMartin static inline void * parisc_get_drvdata(struct parisc_device * d)59deae26bfSKyle McMartinparisc_get_drvdata(struct parisc_device *d) 60deae26bfSKyle McMartin { 61deae26bfSKyle McMartin return dev_get_drvdata(&d->dev); 62deae26bfSKyle McMartin } 63deae26bfSKyle McMartin 64deae26bfSKyle McMartin extern struct bus_type parisc_bus_type; 65deae26bfSKyle McMartin 66dd5e6d6aSThomas Bogendoerfer int iosapic_serial_irq(struct parisc_device *dev); 67dd5e6d6aSThomas Bogendoerfer 68deae26bfSKyle McMartin #endif /*_ASM_PARISC_PARISC_DEVICE_H_*/ 69