qcacmn: Add static window support for UMAC and CE access in 6750
Use static window for accessing UMAC and CE register in qca6750. For UMAC and CE register access, separate static window is mapped. Host accesses these registers using relative offset to window address. Change-Id: I7940336579553f05a11f1379f635689d08508c56 CRs-Fixed: 2617684
This commit is contained in:
@@ -260,28 +260,6 @@ static inline void hal_write32_mb(struct hal_soc *hal_soc, uint32_t offset,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* hal_write_address_32_mb - write a value to a register
|
||||
*
|
||||
*/
|
||||
static inline
|
||||
void hal_write_address_32_mb(struct hal_soc *hal_soc,
|
||||
qdf_iomem_t addr, uint32_t value)
|
||||
{
|
||||
uint32_t offset;
|
||||
qdf_iomem_t new_addr;
|
||||
|
||||
if (!hal_soc->use_register_windowing)
|
||||
return qdf_iowrite32(addr, value);
|
||||
|
||||
offset = addr - hal_soc->dev_base_addr;
|
||||
if (hal_soc->static_window_map) {
|
||||
new_addr = hal_get_window_address(hal_soc, addr);
|
||||
return qdf_iowrite32(new_addr, value);
|
||||
}
|
||||
hal_write32_mb(hal_soc, offset, value);
|
||||
}
|
||||
|
||||
#define hal_write32_mb_confirm(_hal_soc, _offset, _value) \
|
||||
hal_write32_mb(_hal_soc, _offset, _value)
|
||||
#else
|
||||
@@ -290,6 +268,7 @@ static inline void hal_write32_mb(struct hal_soc *hal_soc, uint32_t offset,
|
||||
{
|
||||
int ret;
|
||||
unsigned long flags;
|
||||
qdf_iomem_t new_addr;
|
||||
|
||||
/* Region < BAR + 4K can be directly accessed */
|
||||
if (offset < MAPPED_REF_OFF) {
|
||||
@@ -310,6 +289,11 @@ static inline void hal_write32_mb(struct hal_soc *hal_soc, uint32_t offset,
|
||||
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(hal_soc, offset);
|
||||
@@ -338,6 +322,7 @@ static inline void hal_write32_mb_confirm(struct hal_soc *hal_soc,
|
||||
{
|
||||
int ret;
|
||||
unsigned long flags;
|
||||
qdf_iomem_t new_addr;
|
||||
|
||||
/* Region < BAR + 4K can be directly accessed */
|
||||
if (offset < MAPPED_REF_OFF) {
|
||||
@@ -360,6 +345,14 @@ static inline void hal_write32_mb_confirm(struct hal_soc *hal_soc,
|
||||
qdf_iowrite32(hal_soc->dev_base_addr + offset, value);
|
||||
hal_reg_write_result_check(hal_soc, 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);
|
||||
hal_reg_write_result_check(hal_soc,
|
||||
new_addr - hal_soc->dev_base_addr,
|
||||
value);
|
||||
} else {
|
||||
hal_lock_reg_access(hal_soc, &flags);
|
||||
hal_select_window_confirm(hal_soc, offset);
|
||||
@@ -382,6 +375,7 @@ static inline void hal_write32_mb_confirm(struct hal_soc *hal_soc,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* hal_write_address_32_mb - write a value to a register
|
||||
@@ -399,7 +393,6 @@ void hal_write_address_32_mb(struct hal_soc *hal_soc,
|
||||
offset = addr - hal_soc->dev_base_addr;
|
||||
hal_write32_mb(hal_soc, offset, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DP_HAL_MULTIWINDOW_DIRECT_ACCESS
|
||||
#define hal_srng_write_address_32_mb(_a, _b, _c) qdf_iowrite32(_b, _c)
|
||||
@@ -460,6 +453,7 @@ uint32_t hal_read32_mb(struct hal_soc *hal_soc, uint32_t offset)
|
||||
{
|
||||
uint32_t ret;
|
||||
unsigned long flags;
|
||||
qdf_iomem_t new_addr;
|
||||
|
||||
/* Region < BAR + 4K can be directly accessed */
|
||||
if (offset < MAPPED_REF_OFF)
|
||||
@@ -475,6 +469,11 @@ uint32_t hal_read32_mb(struct hal_soc *hal_soc, uint32_t offset)
|
||||
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(hal_soc, offset);
|
||||
@@ -507,17 +506,11 @@ uint32_t hal_read_address_32_mb(struct hal_soc *soc,
|
||||
{
|
||||
uint32_t offset;
|
||||
uint32_t ret;
|
||||
qdf_iomem_t new_addr;
|
||||
|
||||
if (!soc->use_register_windowing)
|
||||
return qdf_ioread32(addr);
|
||||
|
||||
offset = addr - soc->dev_base_addr;
|
||||
if (soc->static_window_map) {
|
||||
new_addr = hal_get_window_address(soc, addr);
|
||||
return qdf_ioread32(new_addr);
|
||||
}
|
||||
|
||||
ret = hal_read32_mb(soc, offset);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -258,6 +258,7 @@ static void hal_target_based_configure(struct hal_soc *hal)
|
||||
#ifdef QCA_WIFI_QCA6750
|
||||
case TARGET_TYPE_QCA6750:
|
||||
hal->use_register_windowing = true;
|
||||
hal->static_window_map = true;
|
||||
hal_qca6750_attach(hal);
|
||||
break;
|
||||
#endif
|
||||
|
@@ -1278,6 +1278,9 @@ uint16_t hal_rx_get_rx_sequence_6750(uint8_t *buf)
|
||||
return HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info);
|
||||
}
|
||||
|
||||
#define UMAC_WINDOW_REMAP_RANGE 0x14
|
||||
#define CE_WINDOW_REMAP_RANGE 0x37
|
||||
|
||||
/**
|
||||
* hal_get_window_address_6750(): Function to get hp/tp address
|
||||
* @hal_soc: Pointer to hal_soc
|
||||
@@ -1288,7 +1291,33 @@ uint16_t hal_rx_get_rx_sequence_6750(uint8_t *buf)
|
||||
static inline qdf_iomem_t hal_get_window_address_6750(struct hal_soc *hal_soc,
|
||||
qdf_iomem_t addr)
|
||||
{
|
||||
return addr;
|
||||
qdf_iomem_t new_addr;
|
||||
uint32_t offset;
|
||||
uint32_t window;
|
||||
|
||||
offset = addr - hal_soc->dev_base_addr;
|
||||
window = (offset >> WINDOW_SHIFT) & WINDOW_VALUE_MASK;
|
||||
|
||||
/*
|
||||
* If offset lies within UMAC register range, use 2nd window
|
||||
*/
|
||||
if (window == UMAC_WINDOW_REMAP_RANGE) {
|
||||
new_addr = (hal_soc->dev_base_addr + WINDOW_START +
|
||||
(offset & WINDOW_RANGE_MASK));
|
||||
/*
|
||||
* If offset lies within CE register range, use 3rd window
|
||||
*/
|
||||
} else if (window == CE_WINDOW_REMAP_RANGE) {
|
||||
new_addr = (hal_soc->dev_base_addr + (2 * WINDOW_START) +
|
||||
(offset & WINDOW_RANGE_MASK));
|
||||
} else {
|
||||
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
|
||||
"%s: ERROR: Accessing Wrong register\n", __func__);
|
||||
qdf_assert_always(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new_addr;
|
||||
}
|
||||
|
||||
struct hal_hw_txrx_ops qca6750_hal_hw_txrx_ops = {
|
||||
|
Reference in New Issue
Block a user