diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2007-09-17 02:05:01 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-10-02 23:25:27 -0400 |
commit | 0411a5e233db0f5196cff46a34bff15c005bbe6a (patch) | |
tree | ac714b4f93776386833862f1009ac41fcfb67d5d /arch/powerpc/sysdev | |
parent | 0b94a1eeeeb3542d046b928ca01fcd4bf0ea7587 (diff) |
[POWERPC] Update mpic to use dcr_host_t.base
Now that dcr_host_t contains the base address, we can use that in the mpic
code, rather than storing it separately.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/mpic.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 22600fd23958..893e65439e85 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -156,8 +156,7 @@ static inline u32 _mpic_read(enum mpic_reg_type type, | |||
156 | switch(type) { | 156 | switch(type) { |
157 | #ifdef CONFIG_PPC_DCR | 157 | #ifdef CONFIG_PPC_DCR |
158 | case mpic_access_dcr: | 158 | case mpic_access_dcr: |
159 | return dcr_read(rb->dhost, | 159 | return dcr_read(rb->dhost, rb->dhost.base + reg); |
160 | rb->dbase + reg + rb->doff); | ||
161 | #endif | 160 | #endif |
162 | case mpic_access_mmio_be: | 161 | case mpic_access_mmio_be: |
163 | return in_be32(rb->base + (reg >> 2)); | 162 | return in_be32(rb->base + (reg >> 2)); |
@@ -174,8 +173,7 @@ static inline void _mpic_write(enum mpic_reg_type type, | |||
174 | switch(type) { | 173 | switch(type) { |
175 | #ifdef CONFIG_PPC_DCR | 174 | #ifdef CONFIG_PPC_DCR |
176 | case mpic_access_dcr: | 175 | case mpic_access_dcr: |
177 | return dcr_write(rb->dhost, | 176 | return dcr_write(rb->dhost, rb->dhost.base + reg, value); |
178 | rb->dbase + reg + rb->doff, value); | ||
179 | #endif | 177 | #endif |
180 | case mpic_access_mmio_be: | 178 | case mpic_access_mmio_be: |
181 | return out_be32(rb->base + (reg >> 2), value); | 179 | return out_be32(rb->base + (reg >> 2), value); |
@@ -279,9 +277,11 @@ static void _mpic_map_mmio(struct mpic *mpic, unsigned long phys_addr, | |||
279 | static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb, | 277 | static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb, |
280 | unsigned int offset, unsigned int size) | 278 | unsigned int offset, unsigned int size) |
281 | { | 279 | { |
282 | rb->dbase = mpic->dcr_base; | 280 | const u32 *dbasep; |
283 | rb->doff = offset; | 281 | |
284 | rb->dhost = dcr_map(mpic->irqhost->of_node, rb->dbase + rb->doff, size); | 282 | dbasep = of_get_property(mpic->irqhost->of_node, "dcr-reg", NULL); |
283 | |||
284 | rb->dhost = dcr_map(mpic->irqhost->of_node, *dbasep + offset, size); | ||
285 | BUG_ON(!DCR_MAP_OK(rb->dhost)); | 285 | BUG_ON(!DCR_MAP_OK(rb->dhost)); |
286 | } | 286 | } |
287 | 287 | ||
@@ -1075,20 +1075,14 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1075 | BUG_ON(paddr == 0 && node == NULL); | 1075 | BUG_ON(paddr == 0 && node == NULL); |
1076 | 1076 | ||
1077 | /* If no physical address passed in, check if it's dcr based */ | 1077 | /* If no physical address passed in, check if it's dcr based */ |
1078 | if (paddr == 0 && of_get_property(node, "dcr-reg", NULL) != NULL) | 1078 | if (paddr == 0 && of_get_property(node, "dcr-reg", NULL) != NULL) { |
1079 | mpic->flags |= MPIC_USES_DCR; | ||
1080 | |||
1081 | #ifdef CONFIG_PPC_DCR | 1079 | #ifdef CONFIG_PPC_DCR |
1082 | if (mpic->flags & MPIC_USES_DCR) { | 1080 | mpic->flags |= MPIC_USES_DCR; |
1083 | const u32 *dbasep; | ||
1084 | dbasep = of_get_property(node, "dcr-reg", NULL); | ||
1085 | BUG_ON(dbasep == NULL); | ||
1086 | mpic->dcr_base = *dbasep; | ||
1087 | mpic->reg_type = mpic_access_dcr; | 1081 | mpic->reg_type = mpic_access_dcr; |
1088 | } | ||
1089 | #else | 1082 | #else |
1090 | BUG_ON (mpic->flags & MPIC_USES_DCR); | 1083 | BUG(); |
1091 | #endif /* CONFIG_PPC_DCR */ | 1084 | #endif /* CONFIG_PPC_DCR */ |
1085 | } | ||
1092 | 1086 | ||
1093 | /* If the MPIC is not DCR based, and no physical address was passed | 1087 | /* If the MPIC is not DCR based, and no physical address was passed |
1094 | * in, try to obtain one | 1088 | * in, try to obtain one |