18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com> 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Loongson 1 Clock Register Definitions. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef __ASM_MACH_LOONGSON32_REGS_CLK_H 98c2ecf20Sopenharmony_ci#define __ASM_MACH_LOONGSON32_REGS_CLK_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#define LS1X_CLK_REG(x) \ 128c2ecf20Sopenharmony_ci ((void __iomem *)KSEG1ADDR(LS1X_CLK_BASE + (x))) 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define LS1X_CLK_PLL_FREQ LS1X_CLK_REG(0x0) 158c2ecf20Sopenharmony_ci#define LS1X_CLK_PLL_DIV LS1X_CLK_REG(0x4) 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#if defined(CONFIG_LOONGSON1_LS1B) 188c2ecf20Sopenharmony_ci/* Clock PLL Divisor Register Bits */ 198c2ecf20Sopenharmony_ci#define DIV_DC_EN BIT(31) 208c2ecf20Sopenharmony_ci#define DIV_DC_RST BIT(30) 218c2ecf20Sopenharmony_ci#define DIV_CPU_EN BIT(25) 228c2ecf20Sopenharmony_ci#define DIV_CPU_RST BIT(24) 238c2ecf20Sopenharmony_ci#define DIV_DDR_EN BIT(19) 248c2ecf20Sopenharmony_ci#define DIV_DDR_RST BIT(18) 258c2ecf20Sopenharmony_ci#define RST_DC_EN BIT(5) 268c2ecf20Sopenharmony_ci#define RST_DC BIT(4) 278c2ecf20Sopenharmony_ci#define RST_DDR_EN BIT(3) 288c2ecf20Sopenharmony_ci#define RST_DDR BIT(2) 298c2ecf20Sopenharmony_ci#define RST_CPU_EN BIT(1) 308c2ecf20Sopenharmony_ci#define RST_CPU BIT(0) 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define DIV_DC_SHIFT 26 338c2ecf20Sopenharmony_ci#define DIV_CPU_SHIFT 20 348c2ecf20Sopenharmony_ci#define DIV_DDR_SHIFT 14 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define DIV_DC_WIDTH 4 378c2ecf20Sopenharmony_ci#define DIV_CPU_WIDTH 4 388c2ecf20Sopenharmony_ci#define DIV_DDR_WIDTH 4 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define BYPASS_DC_SHIFT 12 418c2ecf20Sopenharmony_ci#define BYPASS_DDR_SHIFT 10 428c2ecf20Sopenharmony_ci#define BYPASS_CPU_SHIFT 8 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define BYPASS_DC_WIDTH 1 458c2ecf20Sopenharmony_ci#define BYPASS_DDR_WIDTH 1 468c2ecf20Sopenharmony_ci#define BYPASS_CPU_WIDTH 1 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#elif defined(CONFIG_LOONGSON1_LS1C) 498c2ecf20Sopenharmony_ci/* PLL/SDRAM Frequency configuration register Bits */ 508c2ecf20Sopenharmony_ci#define PLL_VALID BIT(31) 518c2ecf20Sopenharmony_ci#define FRAC_N GENMASK(23, 16) 528c2ecf20Sopenharmony_ci#define RST_TIME GENMASK(3, 2) 538c2ecf20Sopenharmony_ci#define SDRAM_DIV GENMASK(1, 0) 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci/* CPU/CAMERA/DC Frequency configuration register Bits */ 568c2ecf20Sopenharmony_ci#define DIV_DC_EN BIT(31) 578c2ecf20Sopenharmony_ci#define DIV_DC GENMASK(30, 24) 588c2ecf20Sopenharmony_ci#define DIV_CAM_EN BIT(23) 598c2ecf20Sopenharmony_ci#define DIV_CAM GENMASK(22, 16) 608c2ecf20Sopenharmony_ci#define DIV_CPU_EN BIT(15) 618c2ecf20Sopenharmony_ci#define DIV_CPU GENMASK(14, 8) 628c2ecf20Sopenharmony_ci#define DIV_DC_SEL_EN BIT(5) 638c2ecf20Sopenharmony_ci#define DIV_DC_SEL BIT(4) 648c2ecf20Sopenharmony_ci#define DIV_CAM_SEL_EN BIT(3) 658c2ecf20Sopenharmony_ci#define DIV_CAM_SEL BIT(2) 668c2ecf20Sopenharmony_ci#define DIV_CPU_SEL_EN BIT(1) 678c2ecf20Sopenharmony_ci#define DIV_CPU_SEL BIT(0) 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define DIV_DC_SHIFT 24 708c2ecf20Sopenharmony_ci#define DIV_CAM_SHIFT 16 718c2ecf20Sopenharmony_ci#define DIV_CPU_SHIFT 8 728c2ecf20Sopenharmony_ci#define DIV_DDR_SHIFT 0 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define DIV_DC_WIDTH 7 758c2ecf20Sopenharmony_ci#define DIV_CAM_WIDTH 7 768c2ecf20Sopenharmony_ci#define DIV_CPU_WIDTH 7 778c2ecf20Sopenharmony_ci#define DIV_DDR_WIDTH 2 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#endif 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#endif /* __ASM_MACH_LOONGSON32_REGS_CLK_H */ 82