[PATCH 3/3] Add support for 3680
Eugene Krasnikov
k.eugene.e at gmail.com
Mon Dec 2 03:17:19 EST 2013
> + if (wcn->fw_major == 1 && wcn->fw_minor == 5) {
How about using ">=" instead of "==" just to support future FW releases.
On Fri, Nov 29, 2013 at 2:41 PM, Pontus Fuchs <pontus.fuchs at gmail.com> wrote:
> 3680 has a few registers on other addresses.
>
> Signed-off-by: Pontus Fuchs <pontus.fuchs at gmail.com>
> ---
> dxe.c | 8 +++++++-
> dxe.h | 4 ++--
> main.c | 13 +++++++++++++
> wcn36xx.h | 4 ++++
> 4 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/dxe.c b/dxe.c
> index dd7207d..1f4f044 100644
> --- a/dxe.c
> +++ b/dxe.c
> @@ -672,6 +672,12 @@ int wcn36xx_dxe_tx_frame(struct wcn36xx *wcn,
> return 0;
> }
>
> +#define wcn36xx_dxe_write_register_x(wcn, reg, reg_data) \
> + if (wcn->chip_version == WCN36XX_CHIP_3680) \
> + wcn36xx_dxe_write_register(wcn, reg ## _3680, reg_data); \
> + else \
> + wcn36xx_dxe_write_register(wcn, reg ## _3660, reg_data); \
> +
> int wcn36xx_dxe_init(struct wcn36xx *wcn)
> {
> int reg_data = 0, ret;
> @@ -681,7 +687,7 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn)
>
> /* Setting interrupt path */
> reg_data = WCN36XX_DXE_CCU_INT;
> - wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_REG_CCU_INT, reg_data);
> + wcn36xx_dxe_write_register_x(wcn, WCN36XX_DXE_REG_CCU_INT, reg_data);
>
> /***************************************/
> /* Init descriptors for TX LOW channel */
> diff --git a/dxe.h b/dxe.h
> index 83b4d89..b30167c 100644
> --- a/dxe.h
> +++ b/dxe.h
> @@ -29,11 +29,11 @@ H2H_TEST_RX_TX = DMA2
> */
>
> /* DXE registers */
> -#define WCN36XX_DXE_MEM_BASE 0x03000000
> #define WCN36XX_DXE_MEM_REG 0x202000
>
> #define WCN36XX_DXE_CCU_INT 0xA0011
> -#define WCN36XX_DXE_REG_CCU_INT 0x200b10
> +#define WCN36XX_DXE_REG_CCU_INT_3660 0x200b10
> +#define WCN36XX_DXE_REG_CCU_INT_3680 0x2050dc
>
> /* TODO This must calculated properly but not hardcoded */
> #define WCN36XX_DXE_CTRL_TX_L 0x328a44
> diff --git a/main.c b/main.c
> index e882f18..6d8286d 100644
> --- a/main.c
> +++ b/main.c
> @@ -178,6 +178,17 @@ static inline u8 get_sta_index(struct ieee80211_vif *vif,
> sta_priv->sta_index;
> }
>
> +static void wcn36xx_detect_chip_version(struct wcn36xx *wcn)
> +{
> + if (wcn->fw_major == 1 && wcn->fw_minor == 5) {
> + wcn36xx_info("Chip is 3680\n");
> + wcn->chip_version = WCN36XX_CHIP_3680;
> + } else {
> + wcn36xx_info("Chip is 3660\n");
> + wcn->chip_version = WCN36XX_CHIP_3660;
> + }
> +}
> +
> static int wcn36xx_start(struct ieee80211_hw *hw)
> {
> struct wcn36xx *wcn = hw->priv;
> @@ -224,6 +235,8 @@ static int wcn36xx_start(struct ieee80211_hw *hw)
> goto out_free_smd_buf;
> }
>
> + wcn36xx_detect_chip_version(wcn);
> +
> /* DMA channel initialization */
> ret = wcn36xx_dxe_init(wcn);
> if (ret) {
> diff --git a/wcn36xx.h b/wcn36xx.h
> index 01737fc..6974278 100644
> --- a/wcn36xx.h
> +++ b/wcn36xx.h
> @@ -176,6 +176,7 @@ struct wcn36xx {
> u8 fw_version;
> u8 fw_minor;
> u8 fw_major;
> + u32 chip_version;
>
> /* extra byte for the NULL termination */
> u8 crm_version[WCN36XX_HAL_VERSION_LENGTH + 1];
> @@ -223,6 +224,9 @@ struct wcn36xx {
>
> };
>
> +#define WCN36XX_CHIP_3660 0
> +#define WCN36XX_CHIP_3680 1
> +
> static inline bool wcn36xx_is_fw_version(struct wcn36xx *wcn,
> u8 major,
> u8 minor,
> --
> 1.8.3.2
>
>
> _______________________________________________
> wcn36xx mailing list
> wcn36xx at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/wcn36xx
--
Best regards,
Eugene
More information about the wcn36xx
mailing list