On Tue, Mar 24, 2015 at 10:45:41PM -0500, Rob Herring wrote:
On Tue, Mar 24, 2015 at 10:25 PM, Leo Yan leo.yan@linaro.org wrote:
Add memory barrier for mmio write and read operations, so that it will be much stable for initialization.
Are you sure you don't have the MMU mapping incorrect? These should not be needed with proper mappings.
All register regions are mapped as device type: Device-nGnRE; This mapping type is weaker than strong order.
In the code, there have many registers accessing need set different controller's registers to finish one operation; if there have several outstanding transaction to different endpoints, then if we don't add the DSB() b/t them, it's easily introduce the timing issue.
Looking at the other patches, I would guess you have some ordering problem between SRAM writes and register writes. I'm just guessing as I have no clue what exactly is not stable. You should put barriers where needed rather than wholesale barrier in every register access.
This issue has been reported before. So i committed one patch to add dsb()/isb() after pll's initialization, but it's still fragile when i do the testing w/t system reset.
Actually i have tried add more barriers into init flow, but it's no luck until i apply this patch; that also stands i'm not familiar w/t this SoC. :)
Anyway, i will try to review the init flow again and add more barriers as i can.
Rob
Signed-off-by: Leo Yan leo.yan@linaro.org
include/lib/mmio.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/include/lib/mmio.h b/include/lib/mmio.h index cb37a1c..e43cd93 100644 --- a/include/lib/mmio.h +++ b/include/lib/mmio.h @@ -31,36 +31,52 @@ #ifndef __MMIO_H__ #define __MMIO_H__
+#include <arch_helpers.h> #include <stdint.h>
static inline void mmio_write_8(uintptr_t addr, uint8_t value) {
dsb(); *(volatile uint8_t*)addr = value;
}
static inline uint8_t mmio_read_8(uintptr_t addr) {
return *(volatile uint8_t*)addr;
uint8_t val;
val = *(volatile uint8_t*)addr;
dsb();
return val;
}
static inline void mmio_write_32(uintptr_t addr, uint32_t value) {
dsb(); *(volatile uint32_t*)addr = value;
}
static inline uint32_t mmio_read_32(uintptr_t addr) {
return *(volatile uint32_t*)addr;
uint32_t val;
val = *(volatile uint32_t*)addr;
dsb();
return val;
}
static inline void mmio_write_64(uintptr_t addr, uint64_t value) {
dsb(); *(volatile uint64_t*)addr = value;
}
static inline uint64_t mmio_read_64(uintptr_t addr) {
return *(volatile uint64_t*)addr;
uint64_t val;
val = *(volatile uint64_t*)addr;
dsb();
return val;
}
#endif /* __MMIO_H__ */
1.9.1
Dev mailing list Dev@lists.96boards.org https://lists.96boards.org/mailman/listinfo/dev