Pull ARC udpates from Vineet Gupta: - updates for various platforms - boot log updates for upcoming HS48 family of cores (dual issue) * tag 'arc-4.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARC: [plat-hsdk]: Add reset controller node to manage ethernet reset ARC: [plat-hsdk]: Temporary fix to set CPU frequency to 1GHz ARC: fix allnoconfig build warning ARCv2: boot log: identify HS48 cores (dual issue) ARC: boot log: decontaminate ARCv2 ISA_CONFIG register arc: remove redundant UTS_MACHINE define in arch/arc/Makefile ARC: [plat-eznps] Update platform maintainer as Noam left ARC: [plat-hsdk] use actual clk driver to manage cpu clk ARC: [*defconfig] Reenable soft lock-up detector ARC: [plat-axs10x] sdio: Temporary fix of sdio ciu frequency ARC: [plat-hsdk] sdio: Temporary fix of sdio ciu frequency ARC: [plat-axs103] Add temporary quirk to reset ethernet IP
Unified · Split
| @@ -5259,7 +5259,8 @@ S: Maintained · 5258 unmodified lines | ||
| 5259 | 5259 | F: drivers/iommu/exynos-iommu.c |
| 5260 | 5260 | |
| 5261 | 5261 | EZchip NPS platform support |
| 5262 | −M: Noam Camus <noamc@ezchip.com> | |
| 5262 | +M: Elad Kanfi <eladkan@mellanox.com> | |
| 5263 | +M: Vineet Gupta <vgupta@synopsys.com> | |
| 5263 | 5264 | S: Supported |
| 5264 | 5265 | F: arch/arc/plat-eznps |
| 5265 | 5266 | F: arch/arc/boot/dts/eznps.dts |
| @@ -24,7 +24,7 @@ config ARC · 23 unmodified lines | ||
| 24 | 24 | select GENERIC_SMP_IDLE_THREAD |
| 25 | 25 | select HAVE_ARCH_KGDB |
| 26 | 26 | select HAVE_ARCH_TRACEHOOK |
| 27 | − select HAVE_FUTEX_CMPXCHG | |
| 27 | + select HAVE_FUTEX_CMPXCHG if FUTEX | |
| 28 | 28 | select HAVE_IOREMAP_PROT |
| 29 | 29 | select HAVE_KPROBES |
| 30 | 30 | select HAVE_KRETPROBES |
| @@ -6,8 +6,6 @@ · 5 unmodified lines | ||
| 6 | 6 | # published by the Free Software Foundation. |
| 7 | 7 | # |
| 8 | 8 | |
| 9 | −UTS_MACHINE := arc | |
| 10 | − | |
| 11 | 9 | ifeq ($(CROSS_COMPILE),) |
| 12 | 10 | ifndef CONFIG_CPU_BIG_ENDIAN |
| 13 | 11 | CROSS_COMPILE := arc-linux- |
| @@ -44,7 +44,14 @@ · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | mmcclk: mmcclk { |
| 46 | 46 | compatible = "fixed-clock"; |
| 47 | − clock-frequency = <50000000>; | |
| 47 | + /* | |
| 48 | + * DW sdio controller has external ciu clock divider | |
| 49 | + * controlled via register in SDIO IP. It divides | |
| 50 | + * sdio_ref_clk (which comes from CGU) by 16 for | |
| 51 | + * default. So default mmcclk clock (which comes | |
| 52 | + * to sdk_in) is 25000000 Hz. | |
| 53 | + */ | |
| 54 | + clock-frequency = <25000000>; | |
| 48 | 55 | #clock-cells = <0>; |
| 49 | 56 | }; |
| 50 | 57 | |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | /dts-v1/; |
| 13 | 13 | |
| 14 | 14 | #include <dt-bindings/net/ti-dp83867.h> |
| 15 | +#include <dt-bindings/reset/snps,hsdk-reset.h> | |
| 15 | 16 | |
| 16 | 17 | / { |
| 17 | 18 | model = "snps,hsdk"; |
| @@ -57,10 +58,10 @@ · 39 unmodified lines | ||
| 57 | 58 | }; |
| 58 | 59 | }; |
| 59 | 60 | |
| 60 | − core_clk: core-clk { | |
| 61 | + input_clk: input-clk { | |
| 61 | 62 | #clock-cells = <0>; |
| 62 | 63 | compatible = "fixed-clock"; |
| 63 | − clock-frequency = <500000000>; | |
| 64 | + clock-frequency = <33333333>; | |
| 64 | 65 | }; |
| 65 | 66 | |
| 66 | 67 | cpu_intc: cpu-interrupt-controller { |
| @@ -102,6 +103,19 @@ · 35 unmodified lines | ||
| 102 | 103 | |
| 103 | 104 | ranges = <0x00000000 0xf0000000 0x10000000>; |
| 104 | 105 | |
| 106 | + cgu_rst: reset-controller@8a0 { | |
| 107 | + compatible = "snps,hsdk-reset"; | |
| 108 | + #reset-cells = <1>; | |
| 109 | + reg = <0x8A0 0x4>, <0xFF0 0x4>; | |
| 110 | + }; | |
| 111 | + | |
| 112 | + core_clk: core-clk@0 { | |
| 113 | + compatible = "snps,hsdk-core-pll-clock"; | |
| 114 | + reg = <0x00 0x10>, <0x14B8 0x4>; | |
| 115 | + #clock-cells = <0>; | |
| 116 | + clocks = <&input_clk>; | |
| 117 | + }; | |
| 118 | + | |
| 105 | 119 | serial: serial@5000 { |
| 106 | 120 | compatible = "snps,dw-apb-uart"; |
| 107 | 121 | reg = <0x5000 0x100>; |
| @@ -120,7 +134,17 @@ · 12 unmodified lines | ||
| 120 | 134 | |
| 121 | 135 | mmcclk_ciu: mmcclk-ciu { |
| 122 | 136 | compatible = "fixed-clock"; |
| 123 | − clock-frequency = <100000000>; | |
| 137 | + /* | |
| 138 | + * DW sdio controller has external ciu clock divider | |
| 139 | + * controlled via register in SDIO IP. Due to its | |
| 140 | + * unexpected default value (it should devide by 1 | |
| 141 | + * but it devides by 8) SDIO IP uses wrong clock and | |
| 142 | + * works unstable (see STAR 9001204800) | |
| 143 | + * So add temporary fix and change clock frequency | |
| 144 | + * from 100000000 to 12500000 Hz until we fix dw sdio | |
| 145 | + * driver itself. | |
| 146 | + */ | |
| 147 | + clock-frequency = <12500000>; | |
| 124 | 148 | #clock-cells = <0>; |
| 125 | 149 | }; |
| 126 | 150 | |
| @@ -141,6 +165,8 @@ · 14 unmodified lines | ||
| 141 | 165 | clocks = <&gmacclk>; |
| 142 | 166 | clock-names = "stmmaceth"; |
| 143 | 167 | phy-handle = <&phy0>; |
| 168 | + resets = <&cgu_rst HSDK_ETH_RESET>; | |
| 169 | + reset-names = "stmmaceth"; | |
| 144 | 170 | |
| 145 | 171 | mdio { |
| 146 | 172 | #address-cells = <1>; |
| @@ -105,7 +105,7 @@ CONFIG_NLS_ISO8859_1=y · 104 unmodified lines | ||
| 105 | 105 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 106 | 106 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 107 | 107 | CONFIG_STRIP_ASM_SYMS=y |
| 108 | −CONFIG_LOCKUP_DETECTOR=y | |
| 108 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 109 | 109 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 110 | 110 | # CONFIG_SCHED_DEBUG is not set |
| 111 | 111 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -104,7 +104,7 @@ CONFIG_NLS_ISO8859_1=y · 103 unmodified lines | ||
| 104 | 104 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 105 | 105 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 106 | 106 | CONFIG_STRIP_ASM_SYMS=y |
| 107 | −CONFIG_LOCKUP_DETECTOR=y | |
| 107 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 108 | 108 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 109 | 109 | # CONFIG_SCHED_DEBUG is not set |
| 110 | 110 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -107,7 +107,7 @@ CONFIG_NLS_ISO8859_1=y · 106 unmodified lines | ||
| 107 | 107 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 108 | 108 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 109 | 109 | CONFIG_STRIP_ASM_SYMS=y |
| 110 | −CONFIG_LOCKUP_DETECTOR=y | |
| 110 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 111 | 111 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 112 | 112 | # CONFIG_SCHED_DEBUG is not set |
| 113 | 113 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -84,5 +84,5 @@ CONFIG_TMPFS=y · 83 unmodified lines | ||
| 84 | 84 | CONFIG_NFS_FS=y |
| 85 | 85 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 86 | 86 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 87 | −CONFIG_LOCKUP_DETECTOR=y | |
| 87 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 88 | 88 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -63,6 +63,7 @@ CONFIG_MMC_SDHCI=y · 62 unmodified lines | ||
| 63 | 63 | CONFIG_MMC_SDHCI_PLTFM=y |
| 64 | 64 | CONFIG_MMC_DW=y |
| 65 | 65 | # CONFIG_IOMMU_SUPPORT is not set |
| 66 | +CONFIG_RESET_HSDK=y | |
| 66 | 67 | CONFIG_EXT3_FS=y |
| 67 | 68 | CONFIG_VFAT_FS=y |
| 68 | 69 | CONFIG_TMPFS=y |
| @@ -72,7 +73,7 @@ CONFIG_NLS_ISO8859_1=y · 3 unmodified lines | ||
| 72 | 73 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 73 | 74 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 74 | 75 | CONFIG_STRIP_ASM_SYMS=y |
| 75 | −CONFIG_LOCKUP_DETECTOR=y | |
| 76 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 76 | 77 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 77 | 78 | # CONFIG_SCHED_DEBUG is not set |
| 78 | 79 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -94,7 +94,7 @@ CONFIG_NLS_ISO8859_1=y · 93 unmodified lines | ||
| 94 | 94 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 95 | 95 | CONFIG_STRIP_ASM_SYMS=y |
| 96 | 96 | CONFIG_DEBUG_SHIRQ=y |
| 97 | −CONFIG_LOCKUP_DETECTOR=y | |
| 97 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 98 | 98 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 99 | 99 | # CONFIG_SCHED_DEBUG is not set |
| 100 | 100 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -98,7 +98,7 @@ CONFIG_NLS_ISO8859_1=y · 97 unmodified lines | ||
| 98 | 98 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 99 | 99 | CONFIG_STRIP_ASM_SYMS=y |
| 100 | 100 | CONFIG_DEBUG_SHIRQ=y |
| 101 | −CONFIG_LOCKUP_DETECTOR=y | |
| 101 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 102 | 102 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 103 | 103 | # CONFIG_SCHED_DEBUG is not set |
| 104 | 104 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -98,6 +98,7 @@ · 97 unmodified lines | ||
| 98 | 98 | |
| 99 | 99 | /* Auxiliary registers */ |
| 100 | 100 | #define AUX_IDENTITY 4 |
| 101 | +#define AUX_EXEC_CTRL 8 | |
| 101 | 102 | #define AUX_INTR_VEC_BASE 0x25 |
| 102 | 103 | #define AUX_VOL 0x5e |
| 103 | 104 | |
| @@ -135,12 +136,12 @@ struct bcr_identity { · 31 unmodified lines | ||
| 135 | 136 | #endif |
| 136 | 137 | }; |
| 137 | 138 | |
| 138 | −struct bcr_isa { | |
| 139 | +struct bcr_isa_arcv2 { | |
| 139 | 140 | #ifdef CONFIG_CPU_BIG_ENDIAN |
| 140 | 141 | unsigned int div_rem:4, pad2:4, ldd:1, unalign:1, atomic:1, be:1, |
| 141 | − pad1:11, atomic1:1, ver:8; | |
| 142 | + pad1:12, ver:8; | |
| 142 | 143 | #else |
| 143 | − unsigned int ver:8, atomic1:1, pad1:11, be:1, atomic:1, unalign:1, | |
| 144 | + unsigned int ver:8, pad1:12, be:1, atomic:1, unalign:1, | |
| 144 | 145 | ldd:1, pad2:4, div_rem:4; |
| 145 | 146 | #endif |
| 146 | 147 | }; |
| @@ -263,13 +264,13 @@ struct cpuinfo_arc { · 116 unmodified lines | ||
| 263 | 264 | struct cpuinfo_arc_mmu mmu; |
| 264 | 265 | struct cpuinfo_arc_bpu bpu; |
| 265 | 266 | struct bcr_identity core; |
| 266 | − struct bcr_isa isa; | |
| 267 | + struct bcr_isa_arcv2 isa; | |
| 267 | 268 | const char *details, *name; |
| 268 | 269 | unsigned int vec_base; |
| 269 | 270 | struct cpuinfo_arc_ccm iccm, dccm; |
| 270 | 271 | struct { |
| 271 | 272 | unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2, |
| 272 | − fpu_sp:1, fpu_dp:1, pad2:6, | |
| 273 | + fpu_sp:1, fpu_dp:1, dual_iss_enb:1, dual_iss_exist:1, pad2:4, | |
| 273 | 274 | debug:1, ap:1, smart:1, rtt:1, pad3:4, |
| 274 | 275 | timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; |
| 275 | 276 | } extn; |
| @@ -51,6 +51,7 @@ static const struct id_to_str arc_cpu_rel[] = { · 50 unmodified lines | ||
| 51 | 51 | { 0x51, "R2.0" }, |
| 52 | 52 | { 0x52, "R2.1" }, |
| 53 | 53 | { 0x53, "R3.0" }, |
| 54 | + { 0x54, "R4.0" }, | |
| 54 | 55 | #endif |
| 55 | 56 | { 0x00, NULL } |
| 56 | 57 | }; |
| @@ -62,6 +63,7 @@ static const struct id_to_str arc_cpu_nm[] = { · 5 unmodified lines | ||
| 62 | 63 | #else |
| 63 | 64 | { 0x40, "ARC EM" }, |
| 64 | 65 | { 0x50, "ARC HS38" }, |
| 66 | + { 0x54, "ARC HS48" }, | |
| 65 | 67 | #endif |
| 66 | 68 | { 0x00, "Unknown" } |
| 67 | 69 | }; |
| @@ -119,11 +121,11 @@ static void read_arc_build_cfg_regs(void) · 51 unmodified lines | ||
| 119 | 121 | struct bcr_generic bcr; |
| 120 | 122 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; |
| 121 | 123 | const struct id_to_str *tbl; |
| 124 | + struct bcr_isa_arcv2 isa; | |
| 122 | 125 | |
| 123 | 126 | FIX_PTR(cpu); |
| 124 | 127 | |
| 125 | 128 | READ_BCR(AUX_IDENTITY, cpu->core); |
| 126 | − READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa); | |
| 127 | 129 | |
| 128 | 130 | for (tbl = &arc_cpu_rel[0]; tbl->id != 0; tbl++) { |
| 129 | 131 | if (cpu->core.family == tbl->id) { |
| @@ -133,7 +135,7 @@ static void read_arc_build_cfg_regs(void) · 3 unmodified lines | ||
| 133 | 135 | } |
| 134 | 136 | |
| 135 | 137 | for (tbl = &arc_cpu_nm[0]; tbl->id != 0; tbl++) { |
| 136 | − if ((cpu->core.family & 0xF0) == tbl->id) | |
| 138 | + if ((cpu->core.family & 0xF4) == tbl->id) | |
| 137 | 139 | break; |
| 138 | 140 | } |
| 139 | 141 | cpu->name = tbl->str; |
| @@ -192,6 +194,14 @@ static void read_arc_build_cfg_regs(void) · 52 unmodified lines | ||
| 192 | 194 | cpu->bpu.full = bpu.ft; |
| 193 | 195 | cpu->bpu.num_cache = 256 << bpu.bce; |
| 194 | 196 | cpu->bpu.num_pred = 2048 << bpu.pte; |
| 197 | + | |
| 198 | + if (cpu->core.family >= 0x54) { | |
| 199 | + unsigned int exec_ctrl; | |
| 200 | + | |
| 201 | + READ_BCR(AUX_EXEC_CTRL, exec_ctrl); | |
| 202 | + cpu->extn.dual_iss_exist = 1; | |
| 203 | + cpu->extn.dual_iss_enb = exec_ctrl & 1; | |
| 204 | + } | |
| 195 | 205 | } |
| 196 | 206 | |
| 197 | 207 | READ_BCR(ARC_REG_AP_BCR, bcr); |
| @@ -205,18 +215,25 @@ static void read_arc_build_cfg_regs(void) · 7 unmodified lines | ||
| 205 | 215 | |
| 206 | 216 | cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt; |
| 207 | 217 | |
| 218 | + READ_BCR(ARC_REG_ISA_CFG_BCR, isa); | |
| 219 | + | |
| 208 | 220 | /* some hacks for lack of feature BCR info in old ARC700 cores */ |
| 209 | 221 | if (is_isa_arcompact()) { |
| 210 | − if (!cpu->isa.ver) /* ISA BCR absent, use Kconfig info */ | |
| 222 | + if (!isa.ver) /* ISA BCR absent, use Kconfig info */ | |
| 211 | 223 | cpu->isa.atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC); |
| 212 | − else | |
| 213 | − cpu->isa.atomic = cpu->isa.atomic1; | |
| 224 | + else { | |
| 225 | + /* ARC700_BUILD only has 2 bits of isa info */ | |
| 226 | + struct bcr_generic bcr = *(struct bcr_generic *)&isa; | |
| 227 | + cpu->isa.atomic = bcr.info & 1; | |
| 228 | + } | |
| 214 | 229 | |
| 215 | 230 | cpu->isa.be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN); |
| 216 | 231 | |
| 217 | 232 | /* there's no direct way to distinguish 750 vs. 770 */ |
| 218 | 233 | if (unlikely(cpu->core.family < 0x34 || cpu->mmu.ver < 3)) |
| 219 | 234 | cpu->name = "ARC750"; |
| 235 | + } else { | |
| 236 | + cpu->isa = isa; | |
| 220 | 237 | } |
| 221 | 238 | } |
| 222 | 239 | |
| @@ -232,10 +249,11 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) · 9 unmodified lines | ||
| 232 | 249 | "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n", |
| 233 | 250 | core->family, core->cpu_id, core->chip_id); |
| 234 | 251 | |
| 235 | − n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s\n", | |
| 252 | + n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s%s%s\n", | |
| 236 | 253 | cpu_id, cpu->name, cpu->details, |
| 237 | 254 | is_isa_arcompact() ? "ARCompact" : "ARCv2", |
| 238 | − IS_AVAIL1(cpu->isa.be, "[Big-Endian]")); | |
| 255 | + IS_AVAIL1(cpu->isa.be, "[Big-Endian]"), | |
| 256 | + IS_AVAIL3(cpu->extn.dual_iss_exist, cpu->extn.dual_iss_enb, " Dual-Issue")); | |
| 239 | 257 | |
| 240 | 258 | n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s%s%s\nISA Extn\t: ", |
| 241 | 259 | IS_AVAIL1(cpu->extn.timer0, "Timer0 "), |
| @@ -111,6 +111,13 @@ static void __init axs10x_early_init(void) · 110 unmodified lines | ||
| 111 | 111 | |
| 112 | 112 | axs10x_enable_gpio_intc_wire(); |
| 113 | 113 | |
| 114 | + /* | |
| 115 | + * Reset ethernet IP core. | |
| 116 | + * TODO: get rid of this quirk after axs10x reset driver (or simple | |
| 117 | + * reset driver) will be available in upstream. | |
| 118 | + */ | |
| 119 | + iowrite32((1 << 5), (void __iomem *) CREG_MB_SW_RESET); | |
| 120 | + | |
| 114 | 121 | scnprintf(mb, 32, "MainBoard v%d", mb_rev); |
| 115 | 122 | axs10x_print_board_ver(CREG_MB_VER, mb); |
| 116 | 123 | } |
| @@ -6,4 +6,5 @@ · 5 unmodified lines | ||
| 6 | 6 | # |
| 7 | 7 | |
| 8 | 8 | menuconfig ARC_SOC_HSDK |
| 9 | − bool "ARC HS Development Kit SOC" | |
| 9 | + bool "ARC HS Development Kit SOC" | |
| 10 | + select CLK_HSDK | |
| @@ -38,6 +38,42 @@ static void __init hsdk_init_per_cpu(unsigned int cpu) · 37 unmodified lines | ||
| 38 | 38 | #define CREG_PAE (CREG_BASE + 0x180) |
| 39 | 39 | #define CREG_PAE_UPDATE (CREG_BASE + 0x194) |
| 40 | 40 | |
| 41 | +#define CREG_CORE_IF_CLK_DIV (CREG_BASE + 0x4B8) | |
| 42 | +#define CREG_CORE_IF_CLK_DIV_2 0x1 | |
| 43 | +#define CGU_BASE ARC_PERIPHERAL_BASE | |
| 44 | +#define CGU_PLL_STATUS (ARC_PERIPHERAL_BASE + 0x4) | |
| 45 | +#define CGU_PLL_CTRL (ARC_PERIPHERAL_BASE + 0x0) | |
| 46 | +#define CGU_PLL_STATUS_LOCK BIT(0) | |
| 47 | +#define CGU_PLL_STATUS_ERR BIT(1) | |
| 48 | +#define CGU_PLL_CTRL_1GHZ 0x3A10 | |
| 49 | +#define HSDK_PLL_LOCK_TIMEOUT 500 | |
| 50 | + | |
| 51 | +#define HSDK_PLL_LOCKED() \ | |
| 52 | + !!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_LOCK) | |
| 53 | + | |
| 54 | +#define HSDK_PLL_ERR() \ | |
| 55 | + !!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_ERR) | |
| 56 | + | |
| 57 | +static void __init hsdk_set_cpu_freq_1ghz(void) | |
| 58 | +{ | |
| 59 | + u32 timeout = HSDK_PLL_LOCK_TIMEOUT; | |
| 60 | + | |
| 61 | + /* | |
| 62 | + * As we set cpu clock which exceeds 500MHz, the divider for the interface | |
| 63 | + * clock must be programmed to div-by-2. | |
| 64 | + */ | |
| 65 | + iowrite32(CREG_CORE_IF_CLK_DIV_2, (void __iomem *) CREG_CORE_IF_CLK_DIV); | |
| 66 | + | |
| 67 | + /* Set cpu clock to 1GHz */ | |
| 68 | + iowrite32(CGU_PLL_CTRL_1GHZ, (void __iomem *) CGU_PLL_CTRL); | |
| 69 | + | |
| 70 | + while (!HSDK_PLL_LOCKED() && timeout--) | |
| 71 | + cpu_relax(); | |
| 72 | + | |
| 73 | + if (!HSDK_PLL_LOCKED() || HSDK_PLL_ERR()) | |
| 74 | + pr_err("Failed to setup CPU frequency to 1GHz!"); | |
| 75 | +} | |
| 76 | + | |
| 41 | 77 | static void __init hsdk_init_early(void) |
| 42 | 78 | { |
| 43 | 79 | /* |
| @@ -52,6 +88,12 @@ static void __init hsdk_init_early(void) · 8 unmodified lines | ||
| 52 | 88 | |
| 53 | 89 | /* Really apply settings made above */ |
| 54 | 90 | writel(1, (void __iomem *) CREG_PAE_UPDATE); |
| 91 | + | |
| 92 | + /* | |
| 93 | + * Setup CPU frequency to 1GHz. | |
| 94 | + * TODO: remove it after smart hsdk pll driver will be introduced. | |
| 95 | + */ | |
| 96 | + hsdk_set_cpu_freq_1ghz(); | |
| 55 | 97 | } |
| 56 | 98 | |
| 57 | 99 | static const char *hsdk_compat[] __initconst = { |