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