]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/sparc/include/asm/ebus_64.h
sparc: don't use asm/of_device.h
[linux-2.6-omap-h63xx.git] / arch / sparc / include / asm / ebus_64.h
1 /*
2  * ebus.h: PCI to Ebus pseudo driver software state.
3  *
4  * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
5  * Copyright (C) 1999 David S. Miller (davem@redhat.com)
6  */
7
8 #ifndef __SPARC64_EBUS_H
9 #define __SPARC64_EBUS_H
10
11 #include <linux/of_device.h>
12
13 #include <asm/oplib.h>
14 #include <asm/prom.h>
15
16 struct linux_ebus_child {
17         struct linux_ebus_child         *next;
18         struct linux_ebus_device        *parent;
19         struct linux_ebus               *bus;
20         struct device_node              *prom_node;
21         struct resource                  resource[PROMREG_MAX];
22         int                              num_addrs;
23         unsigned int                     irqs[PROMINTR_MAX];
24         int                              num_irqs;
25 };
26
27 struct linux_ebus_device {
28         struct of_device                ofdev;
29         struct linux_ebus_device        *next;
30         struct linux_ebus_child         *children;
31         struct linux_ebus               *bus;
32         struct device_node              *prom_node;
33         struct resource                  resource[PROMREG_MAX];
34         int                              num_addrs;
35         unsigned int                     irqs[PROMINTR_MAX];
36         int                              num_irqs;
37 };
38 #define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
39
40 struct linux_ebus {
41         struct of_device                ofdev;
42         struct linux_ebus               *next;
43         struct linux_ebus_device        *devices;
44         struct pci_dev                  *self;
45         int                              index;
46         int                              is_rio;
47         struct device_node              *prom_node;
48 };
49 #define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
50
51 struct ebus_dma_info {
52         spinlock_t      lock;
53         void __iomem    *regs;
54
55         unsigned int    flags;
56 #define EBUS_DMA_FLAG_USE_EBDMA_HANDLER         0x00000001
57 #define EBUS_DMA_FLAG_TCI_DISABLE               0x00000002
58
59         /* These are only valid is EBUS_DMA_FLAG_USE_EBDMA_HANDLER is
60          * set.
61          */
62         void (*callback)(struct ebus_dma_info *p, int event, void *cookie);
63         void *client_cookie;
64         unsigned int    irq;
65 #define EBUS_DMA_EVENT_ERROR    1
66 #define EBUS_DMA_EVENT_DMA      2
67 #define EBUS_DMA_EVENT_DEVICE   4
68
69         unsigned char   name[64];
70 };
71
72 extern int ebus_dma_register(struct ebus_dma_info *p);
73 extern int ebus_dma_irq_enable(struct ebus_dma_info *p, int on);
74 extern void ebus_dma_unregister(struct ebus_dma_info *p);
75 extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,
76                             size_t len);
77 extern void ebus_dma_prepare(struct ebus_dma_info *p, int write);
78 extern unsigned int ebus_dma_residue(struct ebus_dma_info *p);
79 extern unsigned int ebus_dma_addr(struct ebus_dma_info *p);
80 extern void ebus_dma_enable(struct ebus_dma_info *p, int on);
81
82 extern struct linux_ebus                *ebus_chain;
83
84 extern void ebus_init(void);
85
86 #define for_each_ebus(bus)                                              \
87         for((bus) = ebus_chain; (bus); (bus) = (bus)->next)
88
89 #define for_each_ebusdev(dev, bus)                                      \
90         for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
91
92 #define for_each_edevchild(dev, child)                                  \
93         for((child) = (dev)->children; (child); (child) = (child)->next)
94
95 #endif /* !(__SPARC64_EBUS_H) */