From 830542f0d1c38caec68eeec9cf23aadd6445452d Mon Sep 17 00:00:00 2001 From: Sravan Kumar Kairam Date: Wed, 10 Jul 2019 12:09:55 +0530 Subject: [PATCH] qcacmn: Fix wrong register window access In register select window if the register offset falls in the last stored register window in driver, register window remap is not done. There is a case if platform driver accesses the hardware registers and remaps the register window, then driver wont be aware of this and have the wrong cached register window. So when driver tries to write or read it selects the wrong register window and accesses wrong register address. So fix this by always doing the register window remap. Change-Id: Ic38cc8cc3d9d82a3534f5ea356027db324c9fe13 CRs-Fixed: 2477771 --- hal/wifi3.0/hal_api.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hal/wifi3.0/hal_api.h b/hal/wifi3.0/hal_api.h index b373f345d9..6b22a4a15c 100644 --- a/hal/wifi3.0/hal_api.h +++ b/hal/wifi3.0/hal_api.h @@ -90,6 +90,16 @@ static inline int hal_force_wake_release(struct hal_soc *soc) } #endif +#ifdef PCIE_REG_WINDOW_LOCAL_NO_CACHE +static inline void hal_select_window(struct hal_soc *hal_soc, uint32_t offset) +{ + uint32_t window = (offset >> WINDOW_SHIFT) & WINDOW_VALUE_MASK; + + qdf_iowrite32(hal_soc->dev_base_addr + WINDOW_REG_ADDRESS, + WINDOW_ENABLE_BIT | window); + hal_soc->register_window = window; +} +#else static inline void hal_select_window(struct hal_soc *hal_soc, uint32_t offset) { uint32_t window = (offset >> WINDOW_SHIFT) & WINDOW_VALUE_MASK; @@ -99,6 +109,7 @@ static inline void hal_select_window(struct hal_soc *hal_soc, uint32_t offset) hal_soc->register_window = window; } } +#endif /** * note1: WINDOW_RANGE_MASK = (1 << WINDOW_SHIFT) -1