diff options
author | John Crispin <blogic@openwrt.org> | 2015-11-04 05:50:06 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-11-11 02:37:54 -0500 |
commit | 81857db913e9782546d29b52cd3efc80c0145c23 (patch) | |
tree | dc2f0850c96bf7416bcbc2ceb890c60c7c8a3167 /arch/mips/ralink | |
parent | 1b04be20f6e38672d81f2de844488164bca988ca (diff) |
MIPS: ralink: Add support for mt7688
MT7688 is similar tot he MT7628 but has a different wifi radio.
Signed-off-by: John Crispin <blogic@openwrt.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/11439/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ralink')
-rw-r--r-- | arch/mips/ralink/mt7620.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c index 2ea5ff6dc22e..4d1a0339dd54 100644 --- a/arch/mips/ralink/mt7620.c +++ b/arch/mips/ralink/mt7620.c | |||
@@ -40,6 +40,12 @@ | |||
40 | /* is this a MT7620 or a MT7628 */ | 40 | /* is this a MT7620 or a MT7628 */ |
41 | enum mt762x_soc_type mt762x_soc; | 41 | enum mt762x_soc_type mt762x_soc; |
42 | 42 | ||
43 | /* EFUSE bits */ | ||
44 | #define EFUSE_MT7688 0x100000 | ||
45 | |||
46 | /* DRAM type bit */ | ||
47 | #define DRAM_TYPE_MT7628_MASK 0x1 | ||
48 | |||
43 | /* does the board have sdram or ddram */ | 49 | /* does the board have sdram or ddram */ |
44 | static int dram_type; | 50 | static int dram_type; |
45 | 51 | ||
@@ -227,6 +233,12 @@ static struct rt2880_pmx_group mt7628an_pinmux_data[] = { | |||
227 | { 0 } | 233 | { 0 } |
228 | }; | 234 | }; |
229 | 235 | ||
236 | static inline int is_mt76x8(void) | ||
237 | { | ||
238 | return mt762x_soc == MT762X_SOC_MT7628AN || | ||
239 | mt762x_soc == MT762X_SOC_MT7688; | ||
240 | } | ||
241 | |||
230 | static __init u32 | 242 | static __init u32 |
231 | mt7620_calc_rate(u32 ref_rate, u32 mul, u32 div) | 243 | mt7620_calc_rate(u32 ref_rate, u32 mul, u32 div) |
232 | { | 244 | { |
@@ -381,7 +393,7 @@ void __init ralink_clk_init(void) | |||
381 | #define RINT(x) ((x) / 1000000) | 393 | #define RINT(x) ((x) / 1000000) |
382 | #define RFRAC(x) (((x) / 1000) % 1000) | 394 | #define RFRAC(x) (((x) / 1000) % 1000) |
383 | 395 | ||
384 | if (mt762x_soc == MT762X_SOC_MT7628AN) { | 396 | if (is_mt76x8()) { |
385 | if (xtal_rate == MHZ(40)) | 397 | if (xtal_rate == MHZ(40)) |
386 | cpu_rate = MHZ(580); | 398 | cpu_rate = MHZ(580); |
387 | else | 399 | else |
@@ -511,8 +523,15 @@ void prom_soc_init(struct ralink_soc_info *soc_info) | |||
511 | #endif | 523 | #endif |
512 | } | 524 | } |
513 | } else if (n0 == MT7620_CHIP_NAME0 && n1 == MT7628_CHIP_NAME1) { | 525 | } else if (n0 == MT7620_CHIP_NAME0 && n1 == MT7628_CHIP_NAME1) { |
514 | mt762x_soc = MT762X_SOC_MT7628AN; | 526 | u32 efuse = __raw_readl(sysc + SYSC_REG_EFUSE_CFG); |
515 | name = "MT7628AN"; | 527 | |
528 | if (efuse & EFUSE_MT7688) { | ||
529 | mt762x_soc = MT762X_SOC_MT7688; | ||
530 | name = "MT7688"; | ||
531 | } else { | ||
532 | mt762x_soc = MT762X_SOC_MT7628AN; | ||
533 | name = "MT7628AN"; | ||
534 | } | ||
516 | soc_info->compatible = "ralink,mt7628an-soc"; | 535 | soc_info->compatible = "ralink,mt7628an-soc"; |
517 | } else { | 536 | } else { |
518 | panic("mt762x: unknown SoC, n0:%08x n1:%08x\n", n0, n1); | 537 | panic("mt762x: unknown SoC, n0:%08x n1:%08x\n", n0, n1); |
@@ -525,10 +544,14 @@ void prom_soc_init(struct ralink_soc_info *soc_info) | |||
525 | (rev & CHIP_REV_ECO_MASK)); | 544 | (rev & CHIP_REV_ECO_MASK)); |
526 | 545 | ||
527 | cfg0 = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG0); | 546 | cfg0 = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG0); |
528 | dram_type = (cfg0 >> SYSCFG0_DRAM_TYPE_SHIFT) & SYSCFG0_DRAM_TYPE_MASK; | 547 | if (is_mt76x8()) |
548 | dram_type = cfg0 & DRAM_TYPE_MT7628_MASK; | ||
549 | else | ||
550 | dram_type = (cfg0 >> SYSCFG0_DRAM_TYPE_SHIFT) & | ||
551 | SYSCFG0_DRAM_TYPE_MASK; | ||
529 | 552 | ||
530 | soc_info->mem_base = MT7620_DRAM_BASE; | 553 | soc_info->mem_base = MT7620_DRAM_BASE; |
531 | if (mt762x_soc == MT762X_SOC_MT7628AN) | 554 | if (is_mt76x8()) |
532 | mt7628_dram_init(soc_info); | 555 | mt7628_dram_init(soc_info); |
533 | else | 556 | else |
534 | mt7620_dram_init(soc_info); | 557 | mt7620_dram_init(soc_info); |
@@ -541,7 +564,7 @@ void prom_soc_init(struct ralink_soc_info *soc_info) | |||
541 | pr_info("Digital PMU set to %s control\n", | 564 | pr_info("Digital PMU set to %s control\n", |
542 | (pmu1 & DIG_SW_SEL) ? ("sw") : ("hw")); | 565 | (pmu1 & DIG_SW_SEL) ? ("sw") : ("hw")); |
543 | 566 | ||
544 | if (mt762x_soc == MT762X_SOC_MT7628AN) | 567 | if (is_mt76x8()) |
545 | rt2880_pinmux_data = mt7628an_pinmux_data; | 568 | rt2880_pinmux_data = mt7628an_pinmux_data; |
546 | else | 569 | else |
547 | rt2880_pinmux_data = mt7620a_pinmux_data; | 570 | rt2880_pinmux_data = mt7620a_pinmux_data; |