diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-06-25 06:44:44 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-06-25 06:44:44 -0400 |
commit | 76a9f26c9e40e9c0ed5dc8f0cedd74e733f0088d (patch) | |
tree | 8e2db4ba9263e92d264ef469c7dac28078f63874 /include/asm-sparc | |
parent | 9bf2aa129a107a0e9e2a5318d35aca731ae7e666 (diff) | |
parent | dfd8317d3340f03bc06eba6b58f0ec0861da4a13 (diff) |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Diffstat (limited to 'include/asm-sparc')
-rw-r--r-- | include/asm-sparc/ebus.h | 17 | ||||
-rw-r--r-- | include/asm-sparc/of_device.h | 63 | ||||
-rw-r--r-- | include/asm-sparc/pbm.h | 3 | ||||
-rw-r--r-- | include/asm-sparc/prom.h | 98 | ||||
-rw-r--r-- | include/asm-sparc/sbus.h | 28 |
5 files changed, 192 insertions, 17 deletions
diff --git a/include/asm-sparc/ebus.h b/include/asm-sparc/ebus.h index 2d6a997c5b0c..54652887c127 100644 --- a/include/asm-sparc/ebus.h +++ b/include/asm-sparc/ebus.h | |||
@@ -13,13 +13,14 @@ | |||
13 | #include <linux/ioport.h> | 13 | #include <linux/ioport.h> |
14 | #endif | 14 | #endif |
15 | #include <asm/oplib.h> | 15 | #include <asm/oplib.h> |
16 | #include <asm/prom.h> | ||
17 | #include <asm/of_device.h> | ||
16 | 18 | ||
17 | struct linux_ebus_child { | 19 | struct linux_ebus_child { |
18 | struct linux_ebus_child *next; | 20 | struct linux_ebus_child *next; |
19 | struct linux_ebus_device *parent; | 21 | struct linux_ebus_device *parent; |
20 | struct linux_ebus *bus; | 22 | struct linux_ebus *bus; |
21 | int prom_node; | 23 | struct device_node *prom_node; |
22 | char prom_name[64]; | ||
23 | struct resource resource[PROMREG_MAX]; | 24 | struct resource resource[PROMREG_MAX]; |
24 | int num_addrs; | 25 | int num_addrs; |
25 | unsigned int irqs[PROMINTR_MAX]; | 26 | unsigned int irqs[PROMINTR_MAX]; |
@@ -27,27 +28,27 @@ struct linux_ebus_child { | |||
27 | }; | 28 | }; |
28 | 29 | ||
29 | struct linux_ebus_device { | 30 | struct linux_ebus_device { |
31 | struct of_device ofdev; | ||
30 | struct linux_ebus_device *next; | 32 | struct linux_ebus_device *next; |
31 | struct linux_ebus_child *children; | 33 | struct linux_ebus_child *children; |
32 | struct linux_ebus *bus; | 34 | struct linux_ebus *bus; |
33 | int prom_node; | 35 | struct device_node *prom_node; |
34 | char prom_name[64]; | ||
35 | struct resource resource[PROMREG_MAX]; | 36 | struct resource resource[PROMREG_MAX]; |
36 | int num_addrs; | 37 | int num_addrs; |
37 | unsigned int irqs[PROMINTR_MAX]; | 38 | unsigned int irqs[PROMINTR_MAX]; |
38 | int num_irqs; | 39 | int num_irqs; |
39 | }; | 40 | }; |
41 | #define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev) | ||
40 | 42 | ||
41 | struct linux_ebus { | 43 | struct linux_ebus { |
44 | struct of_device ofdev; | ||
42 | struct linux_ebus *next; | 45 | struct linux_ebus *next; |
43 | struct linux_ebus_device *devices; | 46 | struct linux_ebus_device *devices; |
44 | struct linux_pbm_info *parent; | 47 | struct linux_pbm_info *parent; |
45 | struct pci_dev *self; | 48 | struct pci_dev *self; |
46 | int prom_node; | 49 | struct device_node *prom_node; |
47 | char prom_name[64]; | ||
48 | struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX]; | ||
49 | int num_ebus_ranges; | ||
50 | }; | 50 | }; |
51 | #define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev) | ||
51 | 52 | ||
52 | struct linux_ebus_dma { | 53 | struct linux_ebus_dma { |
53 | unsigned int dcsr; | 54 | unsigned int dcsr; |
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h new file mode 100644 index 000000000000..4816d102f918 --- /dev/null +++ b/include/asm-sparc/of_device.h | |||
@@ -0,0 +1,63 @@ | |||
1 | #ifndef _ASM_SPARC_OF_DEVICE_H | ||
2 | #define _ASM_SPARC_OF_DEVICE_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | #include <linux/device.h> | ||
6 | #include <linux/mod_devicetable.h> | ||
7 | #include <asm/prom.h> | ||
8 | |||
9 | extern struct bus_type ebus_bus_type; | ||
10 | extern struct bus_type sbus_bus_type; | ||
11 | |||
12 | /* | ||
13 | * The of_device is a kind of "base class" that is a superset of | ||
14 | * struct device for use by devices attached to an OF node and | ||
15 | * probed using OF properties. | ||
16 | */ | ||
17 | struct of_device | ||
18 | { | ||
19 | struct device_node *node; /* OF device node */ | ||
20 | struct device dev; /* Generic device interface */ | ||
21 | }; | ||
22 | #define to_of_device(d) container_of(d, struct of_device, dev) | ||
23 | |||
24 | extern const struct of_device_id *of_match_device( | ||
25 | const struct of_device_id *matches, const struct of_device *dev); | ||
26 | |||
27 | extern struct of_device *of_dev_get(struct of_device *dev); | ||
28 | extern void of_dev_put(struct of_device *dev); | ||
29 | |||
30 | /* | ||
31 | * An of_platform_driver driver is attached to a basic of_device on | ||
32 | * the ISA, EBUS, and SBUS busses on sparc64. | ||
33 | */ | ||
34 | struct of_platform_driver | ||
35 | { | ||
36 | char *name; | ||
37 | struct of_device_id *match_table; | ||
38 | struct module *owner; | ||
39 | |||
40 | int (*probe)(struct of_device* dev, const struct of_device_id *match); | ||
41 | int (*remove)(struct of_device* dev); | ||
42 | |||
43 | int (*suspend)(struct of_device* dev, pm_message_t state); | ||
44 | int (*resume)(struct of_device* dev); | ||
45 | int (*shutdown)(struct of_device* dev); | ||
46 | |||
47 | struct device_driver driver; | ||
48 | }; | ||
49 | #define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver) | ||
50 | |||
51 | extern int of_register_driver(struct of_platform_driver *drv, | ||
52 | struct bus_type *bus); | ||
53 | extern void of_unregister_driver(struct of_platform_driver *drv); | ||
54 | extern int of_device_register(struct of_device *ofdev); | ||
55 | extern void of_device_unregister(struct of_device *ofdev); | ||
56 | extern struct of_device *of_platform_device_create(struct device_node *np, | ||
57 | const char *bus_id, | ||
58 | struct device *parent, | ||
59 | struct bus_type *bus); | ||
60 | extern void of_release_dev(struct device *dev); | ||
61 | |||
62 | #endif /* __KERNEL__ */ | ||
63 | #endif /* _ASM_SPARC_OF_DEVICE_H */ | ||
diff --git a/include/asm-sparc/pbm.h b/include/asm-sparc/pbm.h index 0aba3a82c2eb..fedd9c6e875c 100644 --- a/include/asm-sparc/pbm.h +++ b/include/asm-sparc/pbm.h | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
24 | #include <asm/oplib.h> | 24 | #include <asm/oplib.h> |
25 | #include <asm/prom.h> | ||
25 | 26 | ||
26 | struct linux_pbm_info { | 27 | struct linux_pbm_info { |
27 | int prom_node; | 28 | int prom_node; |
@@ -40,7 +41,7 @@ struct linux_pbm_info { | |||
40 | */ | 41 | */ |
41 | struct pcidev_cookie { | 42 | struct pcidev_cookie { |
42 | struct linux_pbm_info *pbm; | 43 | struct linux_pbm_info *pbm; |
43 | int prom_node; | 44 | struct device_node *prom_node; |
44 | }; | 45 | }; |
45 | 46 | ||
46 | #endif /* !(__SPARC_PBM_H) */ | 47 | #endif /* !(__SPARC_PBM_H) */ |
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h new file mode 100644 index 000000000000..c5e3d26eabd3 --- /dev/null +++ b/include/asm-sparc/prom.h | |||
@@ -0,0 +1,98 @@ | |||
1 | #ifndef _SPARC_PROM_H | ||
2 | #define _SPARC_PROM_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | |||
6 | /* | ||
7 | * Definitions for talking to the Open Firmware PROM on | ||
8 | * Power Macintosh computers. | ||
9 | * | ||
10 | * Copyright (C) 1996-2005 Paul Mackerras. | ||
11 | * | ||
12 | * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. | ||
13 | * Updates for SPARC32 by David S. Miller | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version | ||
18 | * 2 of the License, or (at your option) any later version. | ||
19 | */ | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | #include <linux/proc_fs.h> | ||
23 | #include <asm/atomic.h> | ||
24 | |||
25 | typedef u32 phandle; | ||
26 | typedef u32 ihandle; | ||
27 | |||
28 | struct interrupt_info { | ||
29 | int line; | ||
30 | int sense; /* +ve/-ve logic, edge or level, etc. */ | ||
31 | }; | ||
32 | |||
33 | struct property { | ||
34 | char *name; | ||
35 | int length; | ||
36 | void *value; | ||
37 | struct property *next; | ||
38 | }; | ||
39 | |||
40 | struct device_node { | ||
41 | char *name; | ||
42 | char *type; | ||
43 | phandle node; | ||
44 | phandle linux_phandle; | ||
45 | int n_intrs; | ||
46 | struct interrupt_info *intrs; | ||
47 | char *path_component_name; | ||
48 | char *full_name; | ||
49 | |||
50 | struct property *properties; | ||
51 | struct property *deadprops; /* removed properties */ | ||
52 | struct device_node *parent; | ||
53 | struct device_node *child; | ||
54 | struct device_node *sibling; | ||
55 | struct device_node *next; /* next device of same type */ | ||
56 | struct device_node *allnext; /* next in list of all nodes */ | ||
57 | struct proc_dir_entry *pde; /* this node's proc directory */ | ||
58 | struct kref kref; | ||
59 | unsigned long _flags; | ||
60 | void *data; | ||
61 | }; | ||
62 | |||
63 | static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de) | ||
64 | { | ||
65 | dn->pde = de; | ||
66 | } | ||
67 | |||
68 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
69 | const char *name); | ||
70 | #define for_each_node_by_name(dn, name) \ | ||
71 | for (dn = of_find_node_by_name(NULL, name); dn; \ | ||
72 | dn = of_find_node_by_name(dn, name)) | ||
73 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
74 | const char *type); | ||
75 | #define for_each_node_by_type(dn, type) \ | ||
76 | for (dn = of_find_node_by_type(NULL, type); dn; \ | ||
77 | dn = of_find_node_by_type(dn, type)) | ||
78 | extern struct device_node *of_find_compatible_node(struct device_node *from, | ||
79 | const char *type, const char *compat); | ||
80 | extern struct device_node *of_find_node_by_path(const char *path); | ||
81 | extern struct device_node *of_find_node_by_phandle(phandle handle); | ||
82 | extern struct device_node *of_get_parent(const struct device_node *node); | ||
83 | extern struct device_node *of_get_next_child(const struct device_node *node, | ||
84 | struct device_node *prev); | ||
85 | extern struct property *of_find_property(struct device_node *np, | ||
86 | const char *name, | ||
87 | int *lenp); | ||
88 | extern int of_device_is_compatible(struct device_node *device, const char *); | ||
89 | extern void *of_get_property(struct device_node *node, const char *name, | ||
90 | int *lenp); | ||
91 | extern int of_getintprop_default(struct device_node *np, | ||
92 | const char *name, | ||
93 | int def); | ||
94 | |||
95 | extern void prom_build_devicetree(void); | ||
96 | |||
97 | #endif /* __KERNEL__ */ | ||
98 | #endif /* _SPARC_PROM_H */ | ||
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h index a13cddcecec5..d036e4419d79 100644 --- a/include/asm-sparc/sbus.h +++ b/include/asm-sparc/sbus.h | |||
@@ -11,7 +11,8 @@ | |||
11 | #include <linux/ioport.h> | 11 | #include <linux/ioport.h> |
12 | 12 | ||
13 | #include <asm/oplib.h> | 13 | #include <asm/oplib.h> |
14 | /* #include <asm/iommu.h> */ /* Unused since we use opaque iommu (|io-unit) */ | 14 | #include <asm/prom.h> |
15 | #include <asm/of_device.h> | ||
15 | #include <asm/scatterlist.h> | 16 | #include <asm/scatterlist.h> |
16 | 17 | ||
17 | /* We scan which devices are on the SBus using the PROM node device | 18 | /* We scan which devices are on the SBus using the PROM node device |
@@ -42,18 +43,19 @@ struct sbus_bus; | |||
42 | 43 | ||
43 | /* Linux SBUS device tables */ | 44 | /* Linux SBUS device tables */ |
44 | struct sbus_dev { | 45 | struct sbus_dev { |
45 | struct sbus_bus *bus; /* Back ptr to sbus */ | 46 | struct of_device ofdev; |
46 | struct sbus_dev *next; /* next device on this SBus or null */ | 47 | struct sbus_bus *bus; |
47 | struct sbus_dev *child; /* For ledma and espdma on sun4m */ | 48 | struct sbus_dev *next; |
48 | struct sbus_dev *parent; /* Parent device if not toplevel */ | 49 | struct sbus_dev *child; |
49 | int prom_node; /* PROM device tree node for this device */ | 50 | struct sbus_dev *parent; |
50 | char prom_name[64]; /* PROM device name */ | 51 | int prom_node; |
52 | char prom_name[64]; | ||
51 | int slot; | 53 | int slot; |
52 | 54 | ||
53 | struct resource resource[PROMREG_MAX]; | 55 | struct resource resource[PROMREG_MAX]; |
54 | 56 | ||
55 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; | 57 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; |
56 | int num_registers, ranges_applied; | 58 | int num_registers; |
57 | 59 | ||
58 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; | 60 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; |
59 | int num_device_ranges; | 61 | int num_device_ranges; |
@@ -61,9 +63,11 @@ struct sbus_dev { | |||
61 | unsigned int irqs[4]; | 63 | unsigned int irqs[4]; |
62 | int num_irqs; | 64 | int num_irqs; |
63 | }; | 65 | }; |
66 | #define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev) | ||
64 | 67 | ||
65 | /* This struct describes the SBus(s) found on this machine. */ | 68 | /* This struct describes the SBus(s) found on this machine. */ |
66 | struct sbus_bus { | 69 | struct sbus_bus { |
70 | struct of_device ofdev; | ||
67 | void *iommu; /* Opaque IOMMU cookie */ | 71 | void *iommu; /* Opaque IOMMU cookie */ |
68 | struct sbus_dev *devices; /* Link to devices on this SBus */ | 72 | struct sbus_dev *devices; /* Link to devices on this SBus */ |
69 | struct sbus_bus *next; /* next SBus, if more than one SBus */ | 73 | struct sbus_bus *next; /* next SBus, if more than one SBus */ |
@@ -77,6 +81,7 @@ struct sbus_bus { | |||
77 | int devid; | 81 | int devid; |
78 | int board; | 82 | int board; |
79 | }; | 83 | }; |
84 | #define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev) | ||
80 | 85 | ||
81 | extern struct sbus_bus *sbus_root; | 86 | extern struct sbus_bus *sbus_root; |
82 | 87 | ||
@@ -102,6 +107,7 @@ sbus_is_slave(struct sbus_dev *dev) | |||
102 | #define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */ | 107 | #define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */ |
103 | #define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */ | 108 | #define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */ |
104 | extern void sbus_set_sbus64(struct sbus_dev *, int); | 109 | extern void sbus_set_sbus64(struct sbus_dev *, int); |
110 | extern void sbus_fill_device_irq(struct sbus_dev *); | ||
105 | 111 | ||
106 | /* These yield IOMMU mappings in consistent mode. */ | 112 | /* These yield IOMMU mappings in consistent mode. */ |
107 | extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); | 113 | extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); |
@@ -139,4 +145,10 @@ extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, | |||
139 | BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int) | 145 | BTFIXUPDEF_CALL(unsigned int, sbint_to_irq, struct sbus_dev *sdev, unsigned int) |
140 | #define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint) | 146 | #define sbint_to_irq(sdev, sbint) BTFIXUP_CALL(sbint_to_irq)(sdev, sbint) |
141 | 147 | ||
148 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); | ||
149 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); | ||
150 | extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *); | ||
151 | extern int sbus_arch_preinit(void); | ||
152 | extern void sbus_arch_postinit(void); | ||
153 | |||
142 | #endif /* !(_SPARC_SBUS_H) */ | 154 | #endif /* !(_SPARC_SBUS_H) */ |