static void wil_target_reset(struct wil6210_priv *wil)
{
+ int delay = 100;
+ u32 baud_rate;
+ u32 rev_id;
+
wil_dbg_misc(wil, "Resetting...\n");
+ /* register read */
+#define R(a) ioread32(wil->csr + HOSTADDR(a))
/* register write */
#define W(a, v) iowrite32(v, wil->csr + HOSTADDR(a))
/* register set = read, OR, write */
#define S(a, v) iowrite32(ioread32(wil->csr + HOSTADDR(a)) | v, \
wil->csr + HOSTADDR(a))
+ wil->hw_version = R(RGF_FW_REV_ID);
+ rev_id = wil->hw_version & 0xff;
/* hpal_perst_from_pad_src_n_mask */
S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(6));
/* car_perst_rst_src_n_mask */
W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0);
W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000001);
- W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080);
+ if (rev_id == 1) {
+ W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080);
+ } else {
+ W(RGF_LOS_COUNTER_CTL, BIT(6) | BIT(8));
+ W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000);
+ }
W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0);
+ /* wait until device ready. Use baud rate */
+ do {
+ msleep(1);
+ baud_rate = R(RGF_USER_SERIAL_BAUD_RATE);
+ if (delay-- < 0) {
+ wil_err(wil, "Reset not completed\n");
+ return;
+ }
+ } while (baud_rate != 0x15e);
+
+ if (rev_id == 2)
+ W(RGF_LOS_COUNTER_CTL, BIT(8));
+
wil_dbg_misc(wil, "Reset completed\n");
+#undef R
#undef W
#undef S
}
} __packed;
/* registers - FW addresses */
+#define RGF_FW_REV_ID (0x880a8c) /* chip revision */
+#define RGF_USER_SERIAL_BAUD_RATE (0x880050)
+#define RGF_LOS_COUNTER_CTL (0x882dc4)
#define RGF_USER_USER_SCRATCH_PAD (0x8802bc)
#define RGF_USER_USER_ICR (0x880b4c) /* struct RGF_ICR */
#define BIT_USER_USER_ICR_SW_INT_2 BIT(18)
void __iomem *csr;
ulong status;
u32 fw_version;
+ u32 hw_version;
u8 n_mids; /* number of additional MIDs as reported by FW */
/* profile */
u32 monitor_flags;