diff options
author | Stuart Menefy <stuart.menefy@st.com> | 2009-08-24 05:27:33 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-08-24 05:27:33 -0400 |
commit | 6000fc4d6f3e55ad52cce8d76317187fe01af2aa (patch) | |
tree | bc86a1f13465a791b7e77f7663280bcb23fdd378 /drivers/sh/intc.c | |
parent | bd4fb4d4c1e4a5a2ffbf57a83817a749df1339dd (diff) |
sh: Fixes some write posting issues in the interrupt handling for SH
It is possible for the CPU to re-enable it's interrupt block bit
before the write to the interrupt controller has actually masked out
the external interupt at the controller. We get around this by
reading back from the interrupt controller which will ensure the
write has happened.
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/sh/intc.c')
-rw-r--r-- | drivers/sh/intc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/sh/intc.c b/drivers/sh/intc.c index 3dd231a643b5..4b1ca9d28353 100644 --- a/drivers/sh/intc.c +++ b/drivers/sh/intc.c | |||
@@ -77,7 +77,7 @@ static unsigned long ack_handle[NR_IRQS]; | |||
77 | static inline struct intc_desc_int *get_intc_desc(unsigned int irq) | 77 | static inline struct intc_desc_int *get_intc_desc(unsigned int irq) |
78 | { | 78 | { |
79 | struct irq_chip *chip = get_irq_chip(irq); | 79 | struct irq_chip *chip = get_irq_chip(irq); |
80 | return (void *)((char *)chip - offsetof(struct intc_desc_int, chip)); | 80 | return container_of(chip, struct intc_desc_int, chip); |
81 | } | 81 | } |
82 | 82 | ||
83 | static inline unsigned int set_field(unsigned int value, | 83 | static inline unsigned int set_field(unsigned int value, |
@@ -95,16 +95,19 @@ static inline unsigned int set_field(unsigned int value, | |||
95 | static void write_8(unsigned long addr, unsigned long h, unsigned long data) | 95 | static void write_8(unsigned long addr, unsigned long h, unsigned long data) |
96 | { | 96 | { |
97 | __raw_writeb(set_field(0, data, h), addr); | 97 | __raw_writeb(set_field(0, data, h), addr); |
98 | (void)__raw_readb(addr); /* Defeat write posting */ | ||
98 | } | 99 | } |
99 | 100 | ||
100 | static void write_16(unsigned long addr, unsigned long h, unsigned long data) | 101 | static void write_16(unsigned long addr, unsigned long h, unsigned long data) |
101 | { | 102 | { |
102 | __raw_writew(set_field(0, data, h), addr); | 103 | __raw_writew(set_field(0, data, h), addr); |
104 | (void)__raw_readw(addr); /* Defeat write posting */ | ||
103 | } | 105 | } |
104 | 106 | ||
105 | static void write_32(unsigned long addr, unsigned long h, unsigned long data) | 107 | static void write_32(unsigned long addr, unsigned long h, unsigned long data) |
106 | { | 108 | { |
107 | __raw_writel(set_field(0, data, h), addr); | 109 | __raw_writel(set_field(0, data, h), addr); |
110 | (void)__raw_readl(addr); /* Defeat write posting */ | ||
108 | } | 111 | } |
109 | 112 | ||
110 | static void modify_8(unsigned long addr, unsigned long h, unsigned long data) | 113 | static void modify_8(unsigned long addr, unsigned long h, unsigned long data) |
@@ -112,6 +115,7 @@ static void modify_8(unsigned long addr, unsigned long h, unsigned long data) | |||
112 | unsigned long flags; | 115 | unsigned long flags; |
113 | local_irq_save(flags); | 116 | local_irq_save(flags); |
114 | __raw_writeb(set_field(__raw_readb(addr), data, h), addr); | 117 | __raw_writeb(set_field(__raw_readb(addr), data, h), addr); |
118 | (void)__raw_readb(addr); /* Defeat write posting */ | ||
115 | local_irq_restore(flags); | 119 | local_irq_restore(flags); |
116 | } | 120 | } |
117 | 121 | ||
@@ -120,6 +124,7 @@ static void modify_16(unsigned long addr, unsigned long h, unsigned long data) | |||
120 | unsigned long flags; | 124 | unsigned long flags; |
121 | local_irq_save(flags); | 125 | local_irq_save(flags); |
122 | __raw_writew(set_field(__raw_readw(addr), data, h), addr); | 126 | __raw_writew(set_field(__raw_readw(addr), data, h), addr); |
127 | (void)__raw_readw(addr); /* Defeat write posting */ | ||
123 | local_irq_restore(flags); | 128 | local_irq_restore(flags); |
124 | } | 129 | } |
125 | 130 | ||
@@ -128,6 +133,7 @@ static void modify_32(unsigned long addr, unsigned long h, unsigned long data) | |||
128 | unsigned long flags; | 133 | unsigned long flags; |
129 | local_irq_save(flags); | 134 | local_irq_save(flags); |
130 | __raw_writel(set_field(__raw_readl(addr), data, h), addr); | 135 | __raw_writel(set_field(__raw_readl(addr), data, h), addr); |
136 | (void)__raw_readl(addr); /* Defeat write posting */ | ||
131 | local_irq_restore(flags); | 137 | local_irq_restore(flags); |
132 | } | 138 | } |
133 | 139 | ||