summaryrefslogtreecommitdiffstats
path: root/arch/mips/ralink
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-11-04 05:50:08 -0500
committerRalf Baechle <ralf@linux-mips.org>2015-11-11 02:37:59 -0500
commitb361bd762e7724e660a44955ae4840aa984e3871 (patch)
tree586047e7f0f3fcb708ab4cee4b531d60a97123e7 /arch/mips/ralink
parent418d29c8706170c6801998e48341181b274a47a8 (diff)
MIPS: ralink: Fix usb issue during frequency scaling
If the USB HCD is running and the cpu is scaled too low, then the USB stops working. Increase the idle speed of the core to fix this if the kernel is built with USB support. The "magic" values are taken from the Ralink SDK Kernel. Signed-off-by: John Crispin <blogic@openwrt.org> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/11441/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ralink')
-rw-r--r--arch/mips/ralink/mt7620.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c
index f3a4a08f2e71..55ddf09d8676 100644
--- a/arch/mips/ralink/mt7620.c
+++ b/arch/mips/ralink/mt7620.c
@@ -37,6 +37,12 @@
37#define PMU1_CFG 0x8C 37#define PMU1_CFG 0x8C
38#define DIG_SW_SEL BIT(25) 38#define DIG_SW_SEL BIT(25)
39 39
40/* clock scaling */
41#define CLKCFG_FDIV_MASK 0x1f00
42#define CLKCFG_FDIV_USB_VAL 0x0300
43#define CLKCFG_FFRAC_MASK 0x001f
44#define CLKCFG_FFRAC_USB_VAL 0x0003
45
40/* EFUSE bits */ 46/* EFUSE bits */
41#define EFUSE_MT7688 0x100000 47#define EFUSE_MT7688 0x100000
42 48
@@ -432,6 +438,20 @@ void __init ralink_clk_init(void)
432 ralink_clk_add("10000b00.spi", sys_rate); 438 ralink_clk_add("10000b00.spi", sys_rate);
433 ralink_clk_add("10000c00.uartlite", periph_rate); 439 ralink_clk_add("10000c00.uartlite", periph_rate);
434 ralink_clk_add("10180000.wmac", xtal_rate); 440 ralink_clk_add("10180000.wmac", xtal_rate);
441
442 if (IS_ENABLED(CONFIG_USB) && is_mt76x8()) {
443 /*
444 * When the CPU goes into sleep mode, the BUS clock will be
445 * too low for USB to function properly. Adjust the busses
446 * fractional divider to fix this
447 */
448 u32 val = rt_sysc_r32(SYSC_REG_CPU_SYS_CLKCFG);
449
450 val &= ~(CLKCFG_FDIV_MASK | CLKCFG_FFRAC_MASK);
451 val |= CLKCFG_FDIV_USB_VAL | CLKCFG_FFRAC_USB_VAL;
452
453 rt_sysc_w32(val, SYSC_REG_CPU_SYS_CLKCFG);
454 }
435} 455}
436 456
437void __init ralink_of_remap(void) 457void __init ralink_of_remap(void)