From: Christian Lamparter Date: Wed, 29 Jun 2011 21:45:38 +0000 (+0200) Subject: carl9170 firmware: fixup const volatile register access X-Git-Tag: 1.9.4~10 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=774528bd28331a1f3dd26ed8976f03cf224dfd4e;p=carl9170fw.git carl9170 firmware: fixup const volatile register access Due to heavy usage of all sorts of different optimitations option, the compiler tries to optimize repeated reads of const type * away if they are not marked as volatile. Unfortunately, this breaks the code in several places, as it causes infinite loops while waiting for hardware to update BUSY registers. Signed-off-by: Christian Lamparter --- diff --git a/carlfw/include/io.h b/carlfw/include/io.h index f594a3f..1186af6 100644 --- a/carlfw/include/io.h +++ b/carlfw/include/io.h @@ -31,14 +31,14 @@ static inline __inline uint16_t readw(const volatile void *addr) return *(const volatile uint16_t *) addr; } -static inline __inline void *readp(const volatile void *addr) +static inline __inline volatile void *readp(const volatile void *addr) { - return *(void **) addr; + return *(volatile void **) addr; } static inline __inline uint32_t readl(const volatile void *addr) { - return (uint32_t) (const unsigned int *) readp(addr); + return *(const volatile unsigned int *) addr; } static inline __inline void writeb(volatile void *addr, const volatile uint8_t val) @@ -119,10 +119,10 @@ static inline __inline void incl(const volatile uint32_t addr) static inline __inline uint32_t get(const volatile uint32_t addr) { - return readl((const volatile void *) addr); + return readl((volatile void *) addr); } -static inline __inline void *getp(const volatile uint32_t addr) +static inline __inline volatile void *getp(const volatile uint32_t addr) { return readp((const volatile void *) addr); } diff --git a/carlfw/include/wl.h b/carlfw/include/wl.h index 7152de0..9064dcb 100644 --- a/carlfw/include/wl.h +++ b/carlfw/include/wl.h @@ -42,17 +42,17 @@ static inline __inline void set_wlan_txq_dma_curr_addr(const unsigned int q, con set(AR9170_MAC_REG_DMA_TXQ_CURR_ADDR + (q << 3), v); } -static inline __inline struct dma_desc *get_wlan_txq_dma_addr(const unsigned int q) +static inline __inline volatile struct dma_desc *get_wlan_txq_dma_addr(const unsigned int q) { return getp(AR9170_MAC_REG_DMA_TXQ_ADDR + (q << 3)); } -static inline __inline struct dma_desc *get_wlan_txq_addr(const unsigned int q) +static inline __inline volatile struct dma_desc *get_wlan_txq_addr(const unsigned int q) { return getp(AR9170_MAC_REG_DMA_TXQ_CURR_ADDR + (q << 3)); } -static inline __inline struct dma_desc *get_wlan_txq_last_addr(const unsigned int q) +static inline __inline volatile struct dma_desc *get_wlan_txq_last_addr(const unsigned int q) { return getp(AR9170_MAC_REG_DMA_TXQ_LAST_ADDR + (q << 2)); } diff --git a/carlfw/src/wlan.c b/carlfw/src/wlan.c index 6c73b48..bc9ddc1 100644 --- a/carlfw/src/wlan.c +++ b/carlfw/src/wlan.c @@ -1223,7 +1223,7 @@ static void wlan_check_hang(void) } /* fetch the current DMA queue position */ - desc = get_wlan_txq_addr(i); + desc = (struct dma_desc *)get_wlan_txq_addr(i); /* Stuck frame detection */ if (unlikely(DESC_PAYLOAD(desc) == fw.wlan.last_super[i])) {