1*cd71b1d5SPaul Burton /* SPDX-License-Identifier: GPL-2.0+ */ 2*cd71b1d5SPaul Burton /* 3*cd71b1d5SPaul Burton * JZ4780 definitions 4*cd71b1d5SPaul Burton * 5*cd71b1d5SPaul Burton * Copyright (c) 2013 Imagination Technologies 6*cd71b1d5SPaul Burton * Author: Paul Burton <paul.burton@imgtec.com> 7*cd71b1d5SPaul Burton */ 8*cd71b1d5SPaul Burton 9*cd71b1d5SPaul Burton #ifndef __JZ4780_H__ 10*cd71b1d5SPaul Burton #define __JZ4780_H__ 11*cd71b1d5SPaul Burton 12*cd71b1d5SPaul Burton /* AHB0 BUS Devices */ 13*cd71b1d5SPaul Burton #define DDRC_BASE 0xb3010000 14*cd71b1d5SPaul Burton 15*cd71b1d5SPaul Burton /* AHB2 BUS Devices */ 16*cd71b1d5SPaul Burton #define NEMC_BASE 0xb3410000 17*cd71b1d5SPaul Burton #define BCH_BASE 0xb34d0000 18*cd71b1d5SPaul Burton 19*cd71b1d5SPaul Burton /* APB BUS Devices */ 20*cd71b1d5SPaul Burton #define CPM_BASE 0xb0000000 21*cd71b1d5SPaul Burton #define TCU_BASE 0xb0002000 22*cd71b1d5SPaul Burton #define WDT_BASE 0xb0002000 23*cd71b1d5SPaul Burton #define GPIO_BASE 0xb0010000 24*cd71b1d5SPaul Burton #define UART0_BASE 0xb0030000 25*cd71b1d5SPaul Burton #define UART1_BASE 0xb0031000 26*cd71b1d5SPaul Burton #define UART2_BASE 0xb0032000 27*cd71b1d5SPaul Burton #define UART3_BASE 0xb0033000 28*cd71b1d5SPaul Burton #define MSC0_BASE 0xb3450000 29*cd71b1d5SPaul Burton #define MSC1_BASE 0xb3460000 30*cd71b1d5SPaul Burton #define MSC2_BASE 0xb3470000 31*cd71b1d5SPaul Burton 32*cd71b1d5SPaul Burton /* 33*cd71b1d5SPaul Burton * GPIO 34*cd71b1d5SPaul Burton */ 35*cd71b1d5SPaul Burton /* n = 0,1,2,3,4,5 */ 36*cd71b1d5SPaul Burton #define GPIO_PXPIN(n) (0x00 + (n) * 0x100) 37*cd71b1d5SPaul Burton #define GPIO_PXINT(n) (0x10 + (n) * 0x100) 38*cd71b1d5SPaul Burton #define GPIO_PXINTS(n) (0x14 + (n) * 0x100) 39*cd71b1d5SPaul Burton #define GPIO_PXINTC(n) (0x18 + (n) * 0x100) 40*cd71b1d5SPaul Burton #define GPIO_PXMASK(n) (0x20 + (n) * 0x100) 41*cd71b1d5SPaul Burton #define GPIO_PXMASKS(n) (0x24 + (n) * 0x100) 42*cd71b1d5SPaul Burton #define GPIO_PXMASKC(n) (0x28 + (n) * 0x100) 43*cd71b1d5SPaul Burton #define GPIO_PXPAT1(n) (0x30 + (n) * 0x100) 44*cd71b1d5SPaul Burton #define GPIO_PXPAT1S(n) (0x34 + (n) * 0x100) 45*cd71b1d5SPaul Burton #define GPIO_PXPAT1C(n) (0x38 + (n) * 0x100) 46*cd71b1d5SPaul Burton #define GPIO_PXPAT0(n) (0x40 + (n) * 0x100) 47*cd71b1d5SPaul Burton #define GPIO_PXPAT0S(n) (0x44 + (n) * 0x100) 48*cd71b1d5SPaul Burton #define GPIO_PXPAT0C(n) (0x48 + (n) * 0x100) 49*cd71b1d5SPaul Burton #define GPIO_PXFLG(n) (0x50 + (n) * 0x100) 50*cd71b1d5SPaul Burton #define GPIO_PXFLGC(n) (0x54 + (n) * 0x100) 51*cd71b1d5SPaul Burton #define GPIO_PXOEN(n) (0x60 + (n) * 0x100) 52*cd71b1d5SPaul Burton #define GPIO_PXOENS(n) (0x64 + (n) * 0x100) 53*cd71b1d5SPaul Burton #define GPIO_PXOENC(n) (0x68 + (n) * 0x100) 54*cd71b1d5SPaul Burton #define GPIO_PXPEN(n) (0x70 + (n) * 0x100) 55*cd71b1d5SPaul Burton #define GPIO_PXPENS(n) (0x74 + (n) * 0x100) 56*cd71b1d5SPaul Burton #define GPIO_PXPENC(n) (0x78 + (n) * 0x100) 57*cd71b1d5SPaul Burton #define GPIO_PXDS(n) (0x80 + (n) * 0x100) 58*cd71b1d5SPaul Burton #define GPIO_PXDSS(n) (0x84 + (n) * 0x100) 59*cd71b1d5SPaul Burton #define GPIO_PXDSC(n) (0x88 + (n) * 0x100) 60*cd71b1d5SPaul Burton 61*cd71b1d5SPaul Burton /* PLL setup */ 62*cd71b1d5SPaul Burton #define JZ4780_SYS_EXTAL 48000000 63*cd71b1d5SPaul Burton #define JZ4780_SYS_MEM_SPEED (CONFIG_SYS_MHZ * 1000000) 64*cd71b1d5SPaul Burton #define JZ4780_SYS_MEM_DIV 3 65*cd71b1d5SPaul Burton #define JZ4780_SYS_AUDIO_SPEED (768 * 1000000) 66*cd71b1d5SPaul Burton 67*cd71b1d5SPaul Burton #define JZ4780_APLL_M 1 68*cd71b1d5SPaul Burton #define JZ4780_APLL_N 1 69*cd71b1d5SPaul Burton #define JZ4780_APLL_OD 1 70*cd71b1d5SPaul Burton 71*cd71b1d5SPaul Burton #define JZ4780_MPLL_M (JZ4780_SYS_MEM_SPEED / JZ4780_SYS_EXTAL * 2) 72*cd71b1d5SPaul Burton #define JZ4780_MPLL_N 2 73*cd71b1d5SPaul Burton #define JZ4780_MPLL_OD 1 74*cd71b1d5SPaul Burton 75*cd71b1d5SPaul Burton #define JZ4780_EPLL_M (JZ4780_SYS_AUDIO_SPEED * 2 / JZ4780_SYS_EXTAL) 76*cd71b1d5SPaul Burton #define JZ4780_EPLL_N 1 77*cd71b1d5SPaul Burton #define JZ4780_EPLL_OD 2 78*cd71b1d5SPaul Burton 79*cd71b1d5SPaul Burton #define JZ4780_VPLL_M ((888 * 1000000) * 2 / JZ4780_SYS_EXTAL) 80*cd71b1d5SPaul Burton #define JZ4780_VPLL_N 1 81*cd71b1d5SPaul Burton #define JZ4780_VPLL_OD 2 82*cd71b1d5SPaul Burton 83*cd71b1d5SPaul Burton #ifndef __ASSEMBLY__ 84*cd71b1d5SPaul Burton 85*cd71b1d5SPaul Burton u32 sdram_size(int bank); 86*cd71b1d5SPaul Burton 87*cd71b1d5SPaul Burton const u32 jz4780_clk_get_efuse_clk(void); 88*cd71b1d5SPaul Burton void jz4780_clk_ungate_ethernet(void); 89*cd71b1d5SPaul Burton void jz4780_clk_ungate_mmc(void); 90*cd71b1d5SPaul Burton void jz4780_clk_ungate_uart(const unsigned int uart); 91*cd71b1d5SPaul Burton 92*cd71b1d5SPaul Burton void jz4780_efuse_read(size_t addr, size_t count, u8 *buf); 93*cd71b1d5SPaul Burton void jz4780_efuse_init(u32 ahb2_rate); 94*cd71b1d5SPaul Burton 95*cd71b1d5SPaul Burton void jz4780_tcu_wdt_start(void); 96*cd71b1d5SPaul Burton 97*cd71b1d5SPaul Burton #ifdef CONFIG_SPL_BUILD 98*cd71b1d5SPaul Burton int jz_mmc_init(void __iomem *base); 99*cd71b1d5SPaul Burton #endif 100*cd71b1d5SPaul Burton 101*cd71b1d5SPaul Burton #endif /* __ASSEMBLY__ */ 102*cd71b1d5SPaul Burton 103*cd71b1d5SPaul Burton #endif /* __JZ4780_H__ */ 104