diff options
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/main.c | 36 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/reg.h | 15 |
2 files changed, 49 insertions, 2 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c index 9fa692d11025..ae85ae46c61b 100644 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ b/drivers/net/wireless/ti/wl18xx/main.c | |||
@@ -594,8 +594,8 @@ static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = { | |||
594 | .mem3 = { .start = 0x00000000, .size = 0x00000000 }, | 594 | .mem3 = { .start = 0x00000000, .size = 0x00000000 }, |
595 | }, | 595 | }, |
596 | [PART_PHY_INIT] = { | 596 | [PART_PHY_INIT] = { |
597 | .mem = { .start = 0x80926000, | 597 | .mem = { .start = WL18XX_PHY_INIT_MEM_ADDR, |
598 | .size = sizeof(struct wl18xx_mac_and_phy_params) }, | 598 | .size = WL18XX_PHY_INIT_MEM_SIZE }, |
599 | .reg = { .start = 0x00000000, .size = 0x00000000 }, | 599 | .reg = { .start = 0x00000000, .size = 0x00000000 }, |
600 | .mem2 = { .start = 0x00000000, .size = 0x00000000 }, | 600 | .mem2 = { .start = 0x00000000, .size = 0x00000000 }, |
601 | .mem3 = { .start = 0x00000000, .size = 0x00000000 }, | 601 | .mem3 = { .start = 0x00000000, .size = 0x00000000 }, |
@@ -799,6 +799,9 @@ static int wl18xx_pre_upload(struct wl1271 *wl) | |||
799 | u32 tmp; | 799 | u32 tmp; |
800 | int ret; | 800 | int ret; |
801 | 801 | ||
802 | BUILD_BUG_ON(sizeof(struct wl18xx_mac_and_phy_params) > | ||
803 | WL18XX_PHY_INIT_MEM_SIZE); | ||
804 | |||
802 | ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); | 805 | ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); |
803 | if (ret < 0) | 806 | if (ret < 0) |
804 | goto out; | 807 | goto out; |
@@ -815,6 +818,35 @@ static int wl18xx_pre_upload(struct wl1271 *wl) | |||
815 | wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); | 818 | wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); |
816 | 819 | ||
817 | ret = wlcore_read32(wl, WL18XX_SCR_PAD2, &tmp); | 820 | ret = wlcore_read32(wl, WL18XX_SCR_PAD2, &tmp); |
821 | if (ret < 0) | ||
822 | goto out; | ||
823 | |||
824 | /* | ||
825 | * Workaround for FDSP code RAM corruption (needed for PG2.1 | ||
826 | * and newer; for older chips it's a NOP). Change FDSP clock | ||
827 | * settings so that it's muxed to the ATGP clock instead of | ||
828 | * its own clock. | ||
829 | */ | ||
830 | |||
831 | ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); | ||
832 | if (ret < 0) | ||
833 | goto out; | ||
834 | |||
835 | /* disable FDSP clock */ | ||
836 | ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, | ||
837 | MEM_FDSP_CLK_120_DISABLE); | ||
838 | if (ret < 0) | ||
839 | goto out; | ||
840 | |||
841 | /* set ATPG clock toward FDSP Code RAM rather than its own clock */ | ||
842 | ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, | ||
843 | MEM_FDSP_CODERAM_FUNC_CLK_SEL); | ||
844 | if (ret < 0) | ||
845 | goto out; | ||
846 | |||
847 | /* re-enable FDSP clock */ | ||
848 | ret = wlcore_write32(wl, WL18XX_PHY_FPGA_SPARE_1, | ||
849 | MEM_FDSP_CLK_120_ENABLE); | ||
818 | 850 | ||
819 | out: | 851 | out: |
820 | return ret; | 852 | return ret; |
diff --git a/drivers/net/wireless/ti/wl18xx/reg.h b/drivers/net/wireless/ti/wl18xx/reg.h index 6306e04cd258..05dd8bad2746 100644 --- a/drivers/net/wireless/ti/wl18xx/reg.h +++ b/drivers/net/wireless/ti/wl18xx/reg.h | |||
@@ -38,6 +38,9 @@ | |||
38 | #define WL18XX_REG_BOOT_PART_SIZE 0x00014578 | 38 | #define WL18XX_REG_BOOT_PART_SIZE 0x00014578 |
39 | 39 | ||
40 | #define WL18XX_PHY_INIT_MEM_ADDR 0x80926000 | 40 | #define WL18XX_PHY_INIT_MEM_ADDR 0x80926000 |
41 | #define WL18XX_PHY_END_MEM_ADDR 0x8093CA44 | ||
42 | #define WL18XX_PHY_INIT_MEM_SIZE \ | ||
43 | (WL18XX_PHY_END_MEM_ADDR - WL18XX_PHY_INIT_MEM_ADDR) | ||
41 | 44 | ||
42 | #define WL18XX_SDIO_WSPI_BASE (WL18XX_REGISTERS_BASE) | 45 | #define WL18XX_SDIO_WSPI_BASE (WL18XX_REGISTERS_BASE) |
43 | #define WL18XX_REG_CONFIG_BASE (WL18XX_REGISTERS_BASE + 0x02000) | 46 | #define WL18XX_REG_CONFIG_BASE (WL18XX_REGISTERS_BASE + 0x02000) |
@@ -217,4 +220,16 @@ static const char * const rdl_names[] = { | |||
217 | [RDL_4_SP] = "1897 MIMO", | 220 | [RDL_4_SP] = "1897 MIMO", |
218 | }; | 221 | }; |
219 | 222 | ||
223 | /* FPGA_SPARE_1 register - used to change the PHY ATPG clock at boot time */ | ||
224 | #define WL18XX_PHY_FPGA_SPARE_1 0x8093CA40 | ||
225 | |||
226 | /* command to disable FDSP clock */ | ||
227 | #define MEM_FDSP_CLK_120_DISABLE 0x80000000 | ||
228 | |||
229 | /* command to set ATPG clock toward FDSP Code RAM rather than its own clock */ | ||
230 | #define MEM_FDSP_CODERAM_FUNC_CLK_SEL 0xC0000000 | ||
231 | |||
232 | /* command to re-enable FDSP clock */ | ||
233 | #define MEM_FDSP_CLK_120_ENABLE 0x40000000 | ||
234 | |||
220 | #endif /* __REG_H__ */ | 235 | #endif /* __REG_H__ */ |