qcacmn: add APIs to access CMEM

Adding write/read APIs for accessing the CMEM.

Currently in QCA6750, UMAC and CE windows are statically mapped,
a new static window for CMEM is added for CMEM transactions.

Change-Id: Ie10b33a6f468c6e4db314ea85856414962ef29e3
CRs-Fixed: 2771193
This commit is contained in:
Manikanta Pubbisetty
2020-09-04 18:39:47 +05:30
committed by snandini
parent 2db8a92735
commit 1a4e3a96c7
3 changed files with 86 additions and 15 deletions

View File

@@ -261,6 +261,8 @@ static inline void hal_write32_mb(struct hal_soc *hal_soc, uint32_t offset,
#define hal_write32_mb_confirm(_hal_soc, _offset, _value) \
hal_write32_mb(_hal_soc, _offset, _value)
#define hal_write32_mb_cmem(_hal_soc, _offset, _value)
#else
static inline void hal_write32_mb(struct hal_soc *hal_soc, uint32_t offset,
uint32_t value)
@@ -386,6 +388,35 @@ static inline void hal_write32_mb_confirm(struct hal_soc *hal_soc,
}
}
}
static inline void hal_write32_mb_cmem(struct hal_soc *hal_soc, uint32_t offset,
uint32_t value)
{
unsigned long flags;
qdf_iomem_t new_addr;
if (!TARGET_ACCESS_ALLOWED(HIF_GET_SOFTC(
hal_soc->hif_handle))) {
hal_err_rl("%s: target access is not allowed", __func__);
return;
}
if (!hal_soc->use_register_windowing ||
offset < MAX_UNWINDOWED_ADDRESS) {
qdf_iowrite32(hal_soc->dev_base_addr + offset, value);
} else if (hal_soc->static_window_map) {
new_addr = hal_get_window_address(
hal_soc,
hal_soc->dev_base_addr + offset);
qdf_iowrite32(new_addr, value);
} else {
hal_lock_reg_access(hal_soc, &flags);
hal_select_window_confirm(hal_soc, offset);
qdf_iowrite32(hal_soc->dev_base_addr + WINDOW_START +
(offset & WINDOW_RANGE_MASK), value);
hal_unlock_reg_access(hal_soc, &flags);
}
}
#endif
/**
@@ -481,6 +512,8 @@ static inline uint32_t hal_read32_mb(struct hal_soc *hal_soc, uint32_t offset)
return ret;
}
#define hal_read32_mb_cmem(_hal_soc, _offset)
#else
static
uint32_t hal_read32_mb(struct hal_soc *hal_soc, uint32_t offset)
@@ -531,6 +564,37 @@ uint32_t hal_read32_mb(struct hal_soc *hal_soc, uint32_t offset)
return ret;
}
static inline
uint32_t hal_read32_mb_cmem(struct hal_soc *hal_soc, uint32_t offset)
{
uint32_t ret;
unsigned long flags;
qdf_iomem_t new_addr;
if (!TARGET_ACCESS_ALLOWED(HIF_GET_SOFTC(
hal_soc->hif_handle))) {
hal_err_rl("%s: target access is not allowed", __func__);
return 0;
}
if (!hal_soc->use_register_windowing ||
offset < MAX_UNWINDOWED_ADDRESS) {
ret = qdf_ioread32(hal_soc->dev_base_addr + offset);
} else if (hal_soc->static_window_map) {
new_addr = hal_get_window_address(
hal_soc,
hal_soc->dev_base_addr + offset);
ret = qdf_ioread32(new_addr);
} else {
hal_lock_reg_access(hal_soc, &flags);
hal_select_window_confirm(hal_soc, offset);
ret = qdf_ioread32(hal_soc->dev_base_addr + WINDOW_START +
(offset & WINDOW_RANGE_MASK));
hal_unlock_reg_access(hal_soc, &flags);
}
return ret;
}
#endif
/* Max times allowed for register writing retry */