6 #include <soc/addressmap.h>
10 #define FU540_BASE_FQY 33330
28 #define PRCI_CORECLK_MASK 1
29 #define PRCI_CORECLK_CORE_PLL 0
30 #define PRCI_CORECLK_HFCLK 1
32 #define PRCI_PLLCFG_LOCK (1u << 31)
33 #define PRCI_PLLCFG_DIVR_SHIFT 0
34 #define PRCI_PLLCFG_DIVF_SHIFT 6
35 #define PRCI_PLLCFG_DIVQ_SHIFT 15
36 #define PRCI_PLLCFG_RANGE_SHIFT 18
37 #define PRCI_PLLCFG_BYPASS_SHIFT 24
38 #define PRCI_PLLCFG_FSE_SHIFT 25
39 #define PRCI_PLLCFG_DIVR_MASK (0x03f << PRCI_PLLCFG_DIVR_SHIFT)
40 #define PRCI_PLLCFG_DIVF_MASK (0x1ff << PRCI_PLLCFG_DIVF_SHIFT)
41 #define PRCI_PLLCFG_DIVQ_MASK (0x007 << PRCI_PLLCFG_DIVQ_SHIFT)
42 #define PRCI_PLLCFG_RANGE_MASK (0x07 << PRCI_PLLCFG_RANGE_SHIFT)
43 #define PRCI_PLLCFG_BYPASS_MASK (0x1 << PRCI_PLLCFG_BYPASS_SHIFT)
44 #define PRCI_PLLCFG_FSE_MASK (0x1 << PRCI_PLLCFG_FSE_SHIFT)
46 #define PRCI_DDRPLLCFG1_MASK (1u << 31)
48 #define PRCI_GEMGXLPPLCFG1_MASK (1u << 31)
50 #define PRCI_CORECLKSEL_CORECLKSEL 1
52 #define PRCI_DEVICESRESET_DDR_CTRL_RST_N(x) (((x) & 0x1) << 0)
53 #define PRCI_DEVICESRESET_DDR_AXI_RST_N(x) (((x) & 0x1) << 1)
54 #define PRCI_DEVICESRESET_DDR_AHB_RST_N(x) (((x) & 0x1) << 2)
55 #define PRCI_DEVICESRESET_DDR_PHY_RST_N(x) (((x) & 0x1) << 3)
56 #define PRCI_DEVICESRESET_GEMGXL_RST_N(x) (((x) & 0x1) << 5)
65 unsigned int bypass:1;
69 static void configure_pll(
u32 *reg,
const struct pll_settings *
s)
100 static const struct pll_settings corepll_settings = {
123 static const struct pll_settings ddrpll_settings = {
132 static const struct pll_settings gemgxlpll_settings = {
141 static void init_coreclk(
void)
154 static void init_pll_ddr(
void)
168 static void init_gemgxlclk(
void)
180 #define FU540_UART_DEVICES 2
181 #define FU540_UART_REG_DIV 0x18
182 #define FU540_UART_DIV_VAL 4
184 #define FU540_SPI_DIV 0x00
185 #define FU540_SPI_DIV_VAL 4
187 static void update_peripheral_clock_dividers(
void)
193 for (
size_t i = 0; i < FU540_UART_DEVICES; i++)
203 update_peripheral_clock_dividers();
220 asm volatile (
"fence");
230 asm volatile (
"fence");
236 for (
int i = 0; i < 256; i++)
237 asm volatile (
"nop");
248 asm volatile (
"fence");
static void write32(void *addr, uint32_t val)
static uint32_t read32(const void *addr)
#define printk(level,...)
#define setbits32(addr, set)
#define clrsetbits32(addr, clear, set)
#define clrbits32(addr, clear)
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
#define PRCI_PLLCFG_RANGE_SHIFT
#define PRCI_PLLCFG_BYPASS_SHIFT
#define PRCI_PLLCFG_RANGE_MASK
#define PRCI_CORECLK_MASK
#define PRCI_DEVICESRESET_DDR_PHY_RST_N(x)
static struct prci_ctlr * prci
#define PRCI_DEVICESRESET_DDR_CTRL_RST_N(x)
#define PRCI_CORECLK_CORE_PLL
int clock_get_coreclk_khz(void)
#define PRCI_PLLCFG_DIVQ_MASK
#define PRCI_DEVICESRESET_DDR_AHB_RST_N(x)
#define PRCI_CORECLK_HFCLK
#define PRCI_DDRPLLCFG1_MASK
#define PRCI_PLLCFG_BYPASS_MASK
#define PRCI_PLLCFG_DIVF_MASK
#define PRCI_PLLCFG_DIVF_SHIFT
#define PRCI_PLLCFG_DIVR_SHIFT
#define PRCI_PLLCFG_FSE_MASK
#define PRCI_GEMGXLPPLCFG1_MASK
#define PRCI_PLLCFG_DIVR_MASK
#define PRCI_DEVICESRESET_GEMGXL_RST_N(x)
#define PRCI_DEVICESRESET_DDR_AXI_RST_N(x)
int clock_get_tlclk_khz(void)
#define PRCI_PLLCFG_DIVQ_SHIFT
#define PRCI_PLLCFG_FSE_SHIFT
#define s(param, src_bits, pmcreg, dst_bits)
#define c(value, pmcreg, dst_bits)