diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index fcfc864f6f..22b694a11d 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -50,6 +50,12 @@ config TARGET_QCA956X select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 +config TARGET_QCA955X + bool "Support QCA955X" + select SUPPORTS_BIG_ENDIAN + select SUPPORTS_CPU_MIPS32_R1 + select SUPPORTS_CPU_MIPS32_R2 + config TARGET_PB1X00 bool "Support pb1x00" select SUPPORTS_LITTLE_ENDIAN @@ -66,6 +72,7 @@ source "board/micronas/vct/Kconfig" source "board/pb1x00/Kconfig" source "board/qemu-mips/Kconfig" source "board/qca/mips32/qca956x/Kconfig" +source "board/qca/mips32/qca955x/Kconfig" if MIPS diff --git a/board/qca/mips32/common/athrs17_lpbk.c b/board/qca/mips32/common/athrs17_lpbk.c new file mode 100644 index 0000000000..8067514abe --- /dev/null +++ b/board/qca/mips32/common/athrs17_lpbk.c @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +//#include +//#include +//#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "ath_phy.h" +#include "athrs17_phy.h" + +uint32_t athrs17_reg_read(uint32_t reg_addr); +void athrs17_reg_write(uint32_t reg_addr, uint32_t reg_val); + +#ifdef ATH_RGMII_CAL + +# define ATHR_PHY_MAX 1 + +void s17_reg_rmw(unsigned int reg_addr, unsigned int reg_val) +{ + + reg_val |= athrs17_reg_read(reg_addr); + athrs17_reg_write(reg_addr,reg_val); +} + +void init_s17(void) +{ + int phyUnit = 0; + int phyBase = 0; + int phyAddr = 0; + unsigned int rddata; + + athrs17_reg_write(0x624 , 0x003f3f3f); + athrs17_reg_write(0x10 , 0x40000000); + athrs17_reg_write(0x4 , 0x07500000); + athrs17_reg_write(0xc , 0x01000000); + athrs17_reg_write(0x7c , 0x000000fe); // 1gbps + //athrs17_reg_write(0x7c , 0x0000007d); // 100 mbps + //athrs17_reg_write(0x7c , 0x0000007c); // 10 mbps + + for (phyUnit= 0; phyUnit <= ATHR_PHY_MAX; phyUnit++) + { + phyBase = 0; + phyAddr = phyUnit; + // To enable loopback on a phy + // rddata = s17_phy_read(phyAddr, 0x0); + // s17_phy_write(phyAddr, 0x0, (rddata | (1 << 14))); + /* For 100M waveform */ + phy_reg_write(0, phyAddr, 0x1d, 0x18); + phy_reg_write(0, phyAddr, 0x1e, 0x02ea); + /* Turn On Gigabit Clock */ + phy_reg_write(0, phyAddr, 0x1d, 0x3d); + phy_reg_write(0, phyAddr, 0x1e, 0x48a0); + + } + + /* Enable flow control */ + s17_reg_rmw(0x80,0x30); + s17_reg_rmw(0x84,0x30); + s17_reg_rmw(0x88,0x30); + s17_reg_rmw(0x8c,0x30); + s17_reg_rmw(0x90,0x30); +} + +void vlan_config(void) +{ + athrs17_reg_write(S17_P0LOOKUP_CTRL_REG, 0x0014001e); + athrs17_reg_write(S17_P0VLAN_CTRL0_REG, 0x10001); + + athrs17_reg_write(S17_P1LOOKUP_CTRL_REG, 0x0014001d); + athrs17_reg_write(S17_P1VLAN_CTRL0_REG, 0x10001); + + athrs17_reg_write(S17_P2LOOKUP_CTRL_REG, 0x0014001b); + athrs17_reg_write(S17_P2VLAN_CTRL0_REG, 0x10001); + + athrs17_reg_write(S17_P3LOOKUP_CTRL_REG, 0x00140017); + athrs17_reg_write(S17_P3VLAN_CTRL0_REG, 0x10001); + + athrs17_reg_write(S17_P4LOOKUP_CTRL_REG, 0x0014000f); + athrs17_reg_write(S17_P4VLAN_CTRL0_REG, 0x10001); + + athrs17_reg_write(S17_P5LOOKUP_CTRL_REG, 0x00140040); + athrs17_reg_write(S17_P5VLAN_CTRL0_REG, 0x20001); + + athrs17_reg_write(S17_P6LOOKUP_CTRL_REG, 0x00140020); + athrs17_reg_write(S17_P6VLAN_CTRL0_REG, 0x20001); + +} + +void init_s17_lpbk(void) +{ + int phyUnit = 0; + int phyBase = 0; + int phyAddr = 0; + unsigned int rddata; + +#ifdef ATH_S17_MAC0_SGMII + athrs17_reg_write(0x4 , 0x080080); + athrs17_reg_write(0xc , 0x07600000); + athrs17_reg_write(0x94 , 0x000000fe); // 1gbps + athrs17_reg_write(0x624 , 0x007f7f7f); + printf ("Vlan config...\n"); + vlan_config(); +#else + athrs17_reg_write(0x624 , 0x003f3f3f); + athrs17_reg_write(0x4 , 0x07500000); + athrs17_reg_write(0xc , 0x01000000); +#endif + athrs17_reg_write(0x10 , 0x4000000); + athrs17_reg_write(0x7c , 0x000000fe); // 1gbps + //athrs17_reg_write(0x7c , 0x0000007d); // 100 mbps + //athrs17_reg_write(0x7c , 0x0000007c); // 10 mbps + + phyBase = 0; +#ifdef ATH_S17_MAC0_SGMII + phyAddr = 4; +#else + phyAddr = 0; +#endif + // To enable loopback on single phy + phy_reg_write(0, phyAddr, 0x0, 0xc140); + for(rddata=0; rddata<1000; rddata++); + phy_reg_write(0, phyAddr, 0x0, 0x4140); + for(rddata=0; rddata<1000; rddata++); + rddata = phy_reg_read(0, phyAddr, 0x0); +#ifdef DEBUG + printf("s17 phy0 register value 0x%08x\n", rddata); +#endif + +#ifndef CONFIG_MACH_QCA955x + // power down other phys +#ifdef ATH_S17_MAC0_SGMII + phy_reg_write(0, 0x0, 0x0, 0x8800); +#else + phy_reg_write(0, 0x4, 0x0, 0x8800); +#endif + phy_reg_write(0, 0x1, 0x0, 0x8800); + phy_reg_write(0, 0x2, 0x0, 0x8800); + phy_reg_write(0, 0x3, 0x0, 0x8800); +#endif + /* For 100M waveform */ + phy_reg_write(0, phyAddr, 0x1d, 0x18); + phy_reg_write(0, phyAddr, 0x1e, 0x02ea); + /* Turn On Gigabit Clock */ + phy_reg_write(0, phyAddr, 0x1d, 0x3d); + phy_reg_write(0, phyAddr, 0x1e, 0x48a0); + + /* Enable flow control */ + s17_reg_rmw(0x80,0x30); + s17_reg_rmw(0x84,0x30); + s17_reg_rmw(0x88,0x30); + s17_reg_rmw(0x8c,0x30); + s17_reg_rmw(0x90,0x30); +} + +#endif /* #ifdef RGMII_CAL */ diff --git a/board/qca/mips32/qca955x/955x.S b/board/qca/mips32/qca955x/955x.S new file mode 100644 index 0000000000..9cec835efc --- /dev/null +++ b/board/qca/mips32/qca955x/955x.S @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include + +/* + * Helper macros. + * These Clobber t7, t8 and t9 + */ +#define reg_write(_reg, _val) \ + li t7, KSEG1ADDR(_reg); \ + li t8, _val; \ + sw t8, 0(t7); + +#define reg_rmw_set(_reg, _mask, _val) \ + li t7, KSEG1ADDR(_reg); \ + lw t8, 0(t7); \ + li t9, ~(_mask); \ + and t8, t8, t9; \ + li t9, _val; \ + or t8, t8, t9; \ + sw t8, 0(t7) + +#define cpu_pll_set(_mask, _val) \ + reg_rmw_set(CPU_PLL_CONFIG_ADDRESS, _mask, _val) + +#define ddr_pll_set(_mask, _val) \ + reg_rmw_set(DDR_PLL_CONFIG_ADDRESS, _mask, _val) + +#define cpu_ddr_control_set(_mask, _val) \ + reg_rmw_set(CPU_DDR_CLOCK_CONTROL_ADDRESS, _mask, _val) + + +/****************************************************************************** + * first level initialization: + * + * 0) If clock cntrl reset switch is already set, we're recovering from + * "divider reset"; goto 3. + * 1) Setup divide ratios. + * 2) Reset. + * 3) Setup pll's, wait for lock. + * + *****************************************************************************/ + +.globl lowlevel_init + .type lowlevel_init, @function + .text + .align 4 + +lowlevel_init: + +#if !defined(CONFIG_ATH_EMULATION) +#if !defined(CONFIG_ATH_NAND_BR) + + reg_write(BB_DPLL2_ADDRESS, BB_DPLL2_KI_SET(4) | \ + BB_DPLL2_KD_SET(0x60) | \ + BB_DPLL2_PLL_PWD_SET(1) | \ + BB_DPLL2_DELTA_SET(0x1e)); + reg_write(PCIe_DPLL2_ADDRESS, PCIe_DPLL2_KI_SET(4) | \ + PCIe_DPLL2_KD_SET(0x60) | \ + PCIe_DPLL2_PLL_PWD_SET(1) | \ + PCIe_DPLL2_DELTA_SET(0x1e)); + reg_write(DDR_DPLL2_ADDRESS, DDR_DPLL2_KI_SET(4) | \ + DDR_DPLL2_KD_SET(0x60) | \ + DDR_DPLL2_PLL_PWD_SET(1) | \ + DDR_DPLL2_DELTA_SET(0x1e)); + reg_write(CPU_DPLL2_ADDRESS, CPU_DPLL2_KI_SET(4) | \ + CPU_DPLL2_KD_SET(0x60) | \ + CPU_DPLL2_PLL_PWD_SET(1) | \ + CPU_DPLL2_DELTA_SET(0x1e)); + + li t5, CPU_PLL_CONFIG_NINT_VAL + li t6, DDR_PLL_CONFIG_NINT_VAL + li t4, CPU_PLL_DITHER_VAL + li t3, DDR_PLL_DITHER_VAL + + li t7, PLL_CONFIG_VAL_F + lw t8, 0(t7) + li t7, PLL_MAGIC + beq t7, t8, read_from_flash + nop + j pll_bypass_set + nop +read_from_flash: + li t7, PLL_CONFIG_VAL_F + 4 + lw t5, 0(t7) + lw t4, 4(t7) + lw t6, 8(t7) + lw t3, 12(t7) + + +pll_bypass_set: + cpu_ddr_control_set (CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_MASK, CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_SET(1)); + cpu_ddr_control_set (CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_MASK, CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_SET(1)); + cpu_ddr_control_set (CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_MASK, CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_SET(1)); + +init_cpu_pll: + li t7, KSEG1ADDR(CPU_PLL_CONFIG_ADDRESS); + li t8, (CPU_PLL_CONFIG_PLLPWD_SET(1) | \ + CPU_PLL_CONFIG_REF_DIV_VAL | \ + CPU_PLL_CONFIG_RANGE_VAL | \ + CPU_PLL_CONFIG_OUT_DIV_VAL1); + or t8, t8, t5 + sw t8, 0(t7); + +init_ddr_pll: + li t7, KSEG1ADDR(DDR_PLL_CONFIG_ADDRESS); + li t8, (DDR_PLL_CONFIG_PLLPWD_SET(1) | \ + DDR_PLL_CONFIG_REF_DIV_VAL | \ + DDR_PLL_CONFIG_RANGE_VAL | \ + DDR_PLL_CONFIG_OUT_DIV_VAL1); + or t8, t8, t6 + sw t8, 0(t7); + +init_ahb_pll: + reg_write(CPU_DDR_CLOCK_CONTROL_ADDRESS, + CPU_DDR_CLOCK_CONTROL_AHB_DIV_VAL | + AHB_CLK_FROM_DDR | + CPU_AND_DDR_CLK_FROM_DDR | + CPU_AND_DDR_CLK_FROM_CPU | + CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV | + CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV | + CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_SET(1) | + CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_SET(1) | + CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_SET(1)); + +pll_pwd_unset: + cpu_pll_set(CPU_PLL_CONFIG_PLLPWD_MASK, CPU_PLL_CONFIG_PLLPWD_SET(0)); + ddr_pll_set(DDR_PLL_CONFIG_PLLPWD_MASK, DDR_PLL_CONFIG_PLLPWD_SET(0)); + +outdiv_unset: + cpu_pll_set(CPU_PLL_CONFIG_OUTDIV_MASK, CPU_PLL_CONFIG_OUT_DIV_VAL2); + ddr_pll_set(DDR_PLL_CONFIG_OUTDIV_MASK, DDR_PLL_CONFIG_OUT_DIV_VAL2); + +pll_bypass_unset: + cpu_ddr_control_set(CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_MASK, CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_SET(0)); + cpu_ddr_control_set(CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_MASK, CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_SET(0)); + cpu_ddr_control_set(CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_MASK, CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_SET(0)); + +ddr_pll_dither_unset: + li t7, KSEG1ADDR(DDR_PLL_DITHER_ADDRESS); + sw t3, 0(t7); + +cpu_pll_dither_unset: + li t7, KSEG1ADDR(CPU_PLL_DITHER_ADDRESS); + sw t4, 0(t7); + +#endif /* !defined(CONFIG_ATH_NAND_BR) */ +#endif /* !defined(CONFIG_ATH_EMULATION) */ + jr ra + nop diff --git a/board/qca/mips32/qca955x/Kconfig b/board/qca/mips32/qca955x/Kconfig new file mode 100644 index 0000000000..06850e7aa9 --- /dev/null +++ b/board/qca/mips32/qca955x/Kconfig @@ -0,0 +1,15 @@ +if TARGET_QCA955X + +config SYS_CPU + default "qca955x" + +config SYS_BOARD + default "mips32/qca955x" + +config SYS_VENDOR + default "qca" + +config SYS_CONFIG_NAME + default "qca955x" + +endif diff --git a/board/qca/mips32/qca955x/Makefile b/board/qca/mips32/qca955x/Makefile new file mode 100644 index 0000000000..be91a53553 --- /dev/null +++ b/board/qca/mips32/qca955x/Makefile @@ -0,0 +1,42 @@ +BOARD=board955x +COMPRESSED_UBOOT=0 +ETH_CONFIG=_s17 + +obj-y = \ + $(BOARD).o \ + flash.o \ + extra.o \ + init-955x.o \ + ../common/ath_serial.o \ + ../common/ath_pci.o \ + ../common/qca-mach-common.o \ + ../common/athrs17_lpbk.o \ + rgmii-cal-955x.o \ + qca-eth-955x.o + +ifeq ($(ATH_DUAL_FLASH),1) +OBJS += ../common/ath_nand.o ../../../drivers/nand/nand_ids.o +endif + +ifndef BOOT_FROM_NAND +obj-y += ../common/ath_flash.o +endif + +ifeq ($(ATH_RGMII_CAL),1) +obj-y += rgmii-cal-955x.o +obj-y += ../common/athrs17_lpbk.o +endif + +ifeq ($(ETH_CONFIG2), _s17) +OBJS += ../common/athrs17_phy.o +endif + +ifeq ($(ETH_CONFIG), _s17) +obj-y += ../common/athrs17_phy.o +endif + +ifeq ($(ETH_CONFIG), _s27) +OBJS += ../common/athr_s27_phy.o +endif + +obj-y += 955x.o tap-955x.o diff --git a/board/qca/mips32/qca955x/board955x.c b/board/qca/mips32/qca955x/board955x.c new file mode 100644 index 0000000000..9ee127415a --- /dev/null +++ b/board/qca/mips32/qca955x/board955x.c @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +extern int ath_ddr_initial_config(uint32_t refresh); +extern int ath_ddr_find_size(void); + +#ifdef COMPRESSED_UBOOT +# define prmsg(...) +# define args char *s +# define board_str(a) do { \ + char ver[] = "0"; \ + strcpy(s, a " - Scorpion 1."); \ + ver[0] += ath_reg_rd(RST_REVISION_ID_ADDRESS) \ + & 0xf; \ + strcat(s, ver); \ +} while (0) +#else +# define prmsg printf +# define args void +# define board_str(a) \ + printf(a " - Scorpion 1.%d", ath_reg_rd \ + (RST_REVISION_ID_ADDRESS) & 0xf) +#endif + +void +ath_usb1_initial_config(void) +{ +#define unset(a) (~(a)) + + ath_reg_wr_nf(SWITCH_CLOCK_SPARE_ADDRESS, + ath_reg_rd(SWITCH_CLOCK_SPARE_ADDRESS) | + SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_SET(5)); + udelay(1000); + + ath_reg_rmw_set(RST_RESET_ADDRESS, + RST_RESET_USB_PHY_SUSPEND_OVERRIDE_SET(1)); + udelay(1000); + ath_reg_rmw_clear(RST_RESET_ADDRESS, RST_RESET_USB_PHY_RESET_SET(1)); + udelay(1000); + ath_reg_rmw_clear(RST_RESET_ADDRESS, RST_RESET_USB_PHY_ARESET_SET(1)); + udelay(1000); + ath_reg_rmw_clear(RST_RESET_ADDRESS, RST_RESET_USB_HOST_RESET_SET(1)); + udelay(1000); + + ath_reg_rmw_clear(RST_RESET_ADDRESS, RST_RESET_USB_PHY_PLL_PWD_EXT_SET(1)); + udelay(10); + + ath_reg_rmw_set(RST_RESET2_ADDRESS, RST_RESET2_USB1_EXT_PWR_SEQ_SET(1)); + udelay(10); +} + +void +ath_usb2_initial_config(void) +{ + if (is_drqfn()) { + return; + } + + ath_reg_rmw_set(RST_RESET2_ADDRESS, RST_RESET2_USB2_MODE_SET(1)); + udelay(10); + ath_reg_rmw_set(RST_RESET2_ADDRESS, + RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_SET(1)); + udelay(1000); + ath_reg_rmw_clear(RST_RESET2_ADDRESS, RST_RESET2_USB_PHY2_RESET_SET(1)); + udelay(1000); + ath_reg_rmw_clear(RST_RESET2_ADDRESS, RST_RESET2_USB_PHY2_ARESET_SET(1)); + udelay(1000); + ath_reg_rmw_clear(RST_RESET2_ADDRESS, RST_RESET2_USB_HOST2_RESET_SET(1)); + udelay(1000); + + ath_reg_rmw_clear(RST_RESET2_ADDRESS, RST_RESET2_USB_PHY2_PLL_PWD_EXT_SET(1)); + udelay(10); + + ath_reg_rmw_set(RST_RESET2_ADDRESS, RST_RESET2_USB2_EXT_PWR_SEQ_SET(1)); + udelay(10); +} + + +void ath_gpio_config(void) +{ + /* disable the CLK_OBS on GPIO_4 and set GPIO4 as input */ + ath_reg_rmw_clear(GPIO_OE_ADDRESS, (1 << 4)); + ath_reg_rmw_clear(GPIO_OUT_FUNCTION1_ADDRESS, GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_MASK); + ath_reg_rmw_set(GPIO_OUT_FUNCTION1_ADDRESS, GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_SET(0x80)); + ath_reg_rmw_set(GPIO_OE_ADDRESS, (1 << 4)); + /* Set GPIO 13 as input for LED functionality to be OFF during bootup */ + ath_reg_rmw_set(GPIO_OE_ADDRESS, (1 << 13)); + /* Turn off JUMPST_LED and 5Gz LED during bootup */ + ath_reg_rmw_set(GPIO_OE_ADDRESS, (1 << 15)); + ath_reg_rmw_set(GPIO_OE_ADDRESS, (1 << 12)); +} + +int +ath_mem_config(void) +{ + unsigned int type, reg32, *tap; + extern uint32_t *ath_ddr_tap_cal(void); + +#if !defined(CONFIG_ATH_EMULATION) + +#if !defined(CONFIG_ATH_NAND_BR) + type = ath_ddr_initial_config(CFG_DDR_REFRESH_VAL); + + tap = ath_ddr_tap_cal(); + prmsg("tap = 0x%p\n", tap); + + tap = (uint32_t *)0xbd007f10; + prmsg("Tap (low, high) = (0x%x, 0x%x)\n", tap[0], tap[1]); + + tap = (uint32_t *)TAP_CONTROL_0_ADDRESS; + prmsg("Tap values = (0x%x, 0x%x, 0x%x, 0x%x)\n", + tap[0], tap[2], tap[2], tap[3]); + + /* Take WMAC out of reset */ + reg32 = ath_reg_rd(RST_RESET_ADDRESS); + reg32 = reg32 & ~RST_RESET_RTC_RESET_SET(1); + ath_reg_wr_nf(RST_RESET_ADDRESS, reg32); +#endif + + ath_usb1_initial_config(); + ath_usb2_initial_config(); + + ath_gpio_config(); +#endif /* !defined(CONFIG_ATH_EMULATION) */ + + return ath_ddr_find_size(); +} + +phys_size_t initdram(int board_type) +{ + return (ath_mem_config()); +} + +int checkboard(args) +{ + board_str(CONFIG_BOARD_NAME); + return 0; +} diff --git a/board/qca/mips32/qca955x/extra.c b/board/qca/mips32/qca955x/extra.c new file mode 100644 index 0000000000..850c139206 --- /dev/null +++ b/board/qca/mips32/qca955x/extra.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_ATH_NAND_BR +#include +#endif + +#ifdef CONFIG_ATH_NAND_BR +void * +ath_get_nand_cal_data(void) +{ + extern unsigned long long ath_nand_get_cal_offset(const char *ba); + + ulong off,size; + int ret; + static u_char nand_cal_data[256 * 1024]; + nand_info_t *nand; + + /* + * caldata partition is of 128k + * + */ + nand = &nand_info[nand_curr_device]; + size = nand->erasesize; + + /* + * Get the Offset of Caldata partition + */ + off = ath_nand_get_cal_offset(getenv("bootargs")); + if(off == ATH_CAL_OFF_INVAL) { + printf("Invalid CAL offset \n"); + return 1; + } + + /* + * Get the values from flash, and program into the MAC address + * registers + */ + ret = nand_read(nand, (loff_t)off, &size, nand_cal_data); + printf(" %d bytes %s: %s\n", size, + "read", ret ? "ERROR" : "OK"); + if(ret != 0 ) { + return NULL; + } + + return nand_cal_data; +} +#endif + +void ath_set_tuning_caps(void) +{ + typedef struct { + u_int8_t pad[0x28], + params_for_tuning_caps[2], + featureEnable; + } __attribute__((__packed__)) ar9300_eeprom_t; + + ar9300_eeprom_t *eep; + uint32_t val; + +#ifdef CONFIG_ATH_NAND_BR + eep = (ar9300_eeprom_t *)ath_get_nand_cal_data(); +#else + eep = (ar9300_eeprom_t *)WLANCAL; +#endif /* CONFIG_ATH_NAND_BR */ + + val = XTAL_TCXODET_SET(0x0) | + XTAL_XTAL_DRVSTR_SET(0x3) | + XTAL_XTAL_CAPINDAC_SET(0x45) | + XTAL_XTAL_CAPOUTDAC_SET(0x45) | + XTAL_XTAL_SHORTXIN_SET(0x0) | + XTAL_XTAL_LOCALBIAS_SET(0x1) | + XTAL_XTAL_PWDCLKD_SET(0x0) | + XTAL_XTAL_BIAS2X_SET(0x0) | + XTAL_XTAL_LBIAS2X_SET(0x0) | + XTAL_XTAL_ATBVREG_SET(0x0) | + XTAL_XTAL_OSCON_SET(0x1) | + XTAL_XTAL_PWDCLKIN_SET(0x0) | + XTAL_LOCAL_XTAL_SET(0x1) | + XTAL_PWD_SWREGCLK_SET(0x0) | + XTAL_SWREGCLK_EDGE_SEL_SET(0x0) | + XTAL_SPARE_SET(0xf); + + /* checking feature enable bit 6 and caldata is valid */ + if ((eep) && (eep->featureEnable & 0x40) && (eep->pad[0x0] != 0xff)) { + val &= ~(XTAL_XTAL_CAPINDAC_MASK | XTAL_XTAL_CAPOUTDAC_MASK); + val |= XTAL_XTAL_CAPINDAC_SET(eep->params_for_tuning_caps[0]) | + XTAL_XTAL_CAPOUTDAC_SET(eep->params_for_tuning_caps[0]); + + } + + ath_reg_wr(XTAL_ADDRESS, val); + +#define __str(x) # x +#define str(x) __str(x) + + printf("Setting " str(XTAL_ADDRESS) " to 0x%x\n", val); + return; +} + +#ifdef CONFIG_LAST_STAGE_INIT +int last_stage_init(void) +{ + ath_set_tuning_caps(); + return 0; +} +#endif diff --git a/board/qca/mips32/qca955x/flash.c b/board/qca/mips32/qca955x/flash.c new file mode 100644 index 0000000000..291a785a22 --- /dev/null +++ b/board/qca/mips32/qca955x/flash.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include + +#ifndef CONFIG_ATH_NAND_BR +/* + * sets up flash_info and returns size of FLASH (bytes) + */ +unsigned long +flash_get_geom (flash_info_t *flash_info) +{ + int i; + + /* XXX this is hardcoded until we figure out how to read flash id */ + + flash_info->flash_id = FLASH_M25P64; + flash_info->size = CFG_FLASH_SIZE; /* bytes */ + flash_info->sector_count = flash_info->size / CFG_FLASH_SECTOR_SIZE; + + for (i = 0; i < flash_info->sector_count; i++) { + flash_info->start[i] = CFG_FLASH_BASE + + (i * CFG_FLASH_SECTOR_SIZE); + flash_info->protect[i] = 0; + } + + printf ("flash size %dMB, sector count = %d\n", + FLASH_SIZE, flash_info->sector_count); + + return (flash_info->size); +} +#endif /* CONFIG_ATH_NAND_BR */ diff --git a/board/qca/mips32/qca955x/init-955x.c b/board/qca/mips32/qca955x/init-955x.c new file mode 100644 index 0000000000..d218a324c0 --- /dev/null +++ b/board/qca/mips32/qca955x/init-955x.c @@ -0,0 +1,476 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include + +#define ATH_MAX_DDR_SIZE (256 * 1024 * 1024) +#define ATH_DDR_SIZE_INCR (4 * 1024 * 1024) + +int +ath_ddr_find_size(void) +{ + uint8_t *p = (uint8_t *)KSEG1, pat = 0x77; + int i; + +#define max_i (ATH_MAX_DDR_SIZE / ATH_DDR_SIZE_INCR) + + *p = pat; + + /* + * DDR wraps around. Write a pattern to 0x0000_0000. Write an + * address pattern at 4M, 8M, 16M etc. and check when + * 0x0000_0000 gets overwritten. + */ + for(i = 1; (i < max_i); i++) { + *(p + i * ATH_DDR_SIZE_INCR) = (uint8_t)(i); + if (*p != pat) { + break; + } + } + + return ((i < max_i) ? (i * ATH_DDR_SIZE_INCR) : ATH_MAX_DDR_SIZE); +} + +inline int +ath_ram_type(uint32_t bs) +{ + if (RST_BOOTSTRAP_DDR_SELECT_GET(bs)) { + return ATH_MEM_DDR1; + } else { + return ATH_MEM_DDR2; + } +} + +#define CFG_DDR2_SCORPION_CAS_LATENCY 4 + +#ifdef CONFIG_TB614 +# define DDR_CONFIG2_SWAP_A26_A27_VAL (0x1) +#else +# define DDR_CONFIG2_SWAP_A26_A27_VAL (0x0) +#endif + +#if CFG_DDR2_SCORPION_CAS_LATENCY == 4 +#define CFG_DDR2_CONFIG_VAL DDR_CONFIG_CAS_LATENCY_MSB_SET(0x1) | \ + DDR_CONFIG_OPEN_PAGE_SET(0x1) | \ + DDR_CONFIG_CAS_LATENCY_SET(0x1) | \ + DDR_CONFIG_TMRD_SET(0xf) | \ + DDR_CONFIG_TRFC_SET(0x15) | \ + DDR_CONFIG_TRRD_SET(0x7) | \ + DDR_CONFIG_TRP_SET(0x9) | \ + DDR_CONFIG_TRCD_SET(0x9) | \ + DDR_CONFIG_TRAS_SET(0x1b) + +#define CFG_DDR2_CONFIG2_VAL DDR_CONFIG2_HALF_WIDTH_LOW_SET(0x1) | \ + DDR_CONFIG2_SWAP_A26_A27_SET(DDR_CONFIG2_SWAP_A26_A27_VAL) | \ + DDR_CONFIG2_GATE_OPEN_LATENCY_SET(0x8) | \ + DDR_CONFIG2_TWTR_SET(0x15) | \ + DDR_CONFIG2_TRTP_SET(0x9) | \ + DDR_CONFIG2_TRTW_SET(0xe) | \ + DDR_CONFIG2_TWR_SET(0x1) | \ + DDR_CONFIG2_CKE_SET(0x1) | \ + DDR_CONFIG2_CNTL_OE_EN_SET(0x1) | \ + DDR_CONFIG2_BURST_LENGTH_SET(0x8) + +#define CFG_DDR2_CONFIG3_VAL 0x0000000a +#define CFG_DDR2_EXT_MODE_VAL 0x402 +#define CFG_DDR2_MODE_VAL_INIT 0x143 +#define CFG_DDR2_MODE_VAL 0x43 +#define CFG_DDR2_TAP_VAL 0x10 +#define CFG_DDR2_EN_TWL_VAL 0x0000167d +#define CFG_DDR2_RD_DATA_THIS_CYCLE_VAL_16 0xffff +#define CFG_DDR2_RD_DATA_THIS_CYCLE_VAL_32 0xff + +#elif CFG_DDR2_SCORPION_CAS_LATENCY == 5 + +#define CFG_DDR2_CONFIG_VAL DDR_CONFIG_CAS_LATENCY_MSB_SET(0x1) | \ + DDR_CONFIG_OPEN_PAGE_SET(0x1) | \ + DDR_CONFIG_CAS_LATENCY_SET(0x4) | \ + DDR_CONFIG_TMRD_SET(0xf) | \ + DDR_CONFIG_TRFC_SET(0x15) | \ + DDR_CONFIG_TRRD_SET(0x7) | \ + DDR_CONFIG_TRP_SET(0x9) | \ + DDR_CONFIG_TRCD_SET(0x9) | \ + DDR_CONFIG_TRAS_SET(0x1b) + +#define CFG_DDR2_CONFIG2_VAL DDR_CONFIG2_HALF_WIDTH_LOW_SET(0x1) | \ + DDR_CONFIG2_SWAP_A26_A27_SET(DDR_CONFIG2_SWAP_A26_A27_VAL) | \ + DDR_CONFIG2_GATE_OPEN_LATENCY_SET(0xb) | \ + DDR_CONFIG2_TWTR_SET(0x15) | \ + DDR_CONFIG2_TRTP_SET(0x9) | \ + DDR_CONFIG2_TRTW_SET(0xe) | \ + DDR_CONFIG2_TWR_SET(0x1) | \ + DDR_CONFIG2_CKE_SET(0x1) | \ + DDR_CONFIG2_CNTL_OE_EN_SET(0x1) | \ + DDR_CONFIG2_BURST_LENGTH_SET(0x8) + +#define CFG_DDR2_CONFIG3_VAL 0x0000000a +#define CFG_DDR2_EXT_MODE_VAL 0x402 +#define CFG_DDR2_MODE_VAL_INIT 0x153 +#define CFG_DDR2_MODE_VAL 0x53 +#define CFG_DDR2_TAP_VAL 0x10 +#define CFG_DDR2_EN_TWL_VAL 0x00001e7d +#define CFG_DDR2_RD_DATA_THIS_CYCLE_VAL_16 0xffff +#define CFG_DDR2_RD_DATA_THIS_CYCLE_VAL_32 0xff +#endif + +#define CFG_DDR1_CONFIG_VAL DDR_CONFIG_OPEN_PAGE_SET(0x1) | \ + DDR_CONFIG_CAS_LATENCY_SET(0x7) | \ + DDR_CONFIG_TMRD_SET(0x5) | \ + DDR_CONFIG_TRFC_SET(0x7) | \ + DDR_CONFIG_TRRD_SET(0x4) | \ + DDR_CONFIG_TRP_SET(0x6) | \ + DDR_CONFIG_TRCD_SET(0x6) | \ + DDR_CONFIG_TRAS_SET(0x10) + +#define CFG_DDR1_CONFIG2_VAL DDR_CONFIG2_HALF_WIDTH_LOW_SET(0x1) | \ + DDR_CONFIG2_GATE_OPEN_LATENCY_SET(0x6) | \ + DDR_CONFIG2_TWTR_SET(0xe) | \ + DDR_CONFIG2_TRTP_SET(0x8) | \ + DDR_CONFIG2_TRTW_SET(0xe) | \ + DDR_CONFIG2_TWR_SET(0xd) | \ + DDR_CONFIG2_CKE_SET(0x1) | \ + DDR_CONFIG2_CNTL_OE_EN_SET(0x1) | \ + DDR_CONFIG2_BURST_LENGTH_SET(0x8) +#define CFG_DDR1_CONFIG3_VAL 0x0 +#define CFG_DDR1_EXT_MODE_VAL 0x0 +#define CFG_DDR1_MODE_VAL_INIT 0x133 +#define CFG_DDR1_MODE_VAL 0x33 +#define CFG_DDR1_RD_DATA_THIS_CYCLE_VAL_16 0xffff +#define CFG_DDR1_RD_DATA_THIS_CYCLE_VAL_32 0xff +#define CFG_DDR1_TAP_VAL 0x20 + +#define CFG_DDR_CTL_CONFIG DDR_CTL_CONFIG_SRAM_TSEL_SET(0x1) | \ + DDR_CTL_CONFIG_GE0_SRAM_SYNC_SET(0x1) | \ + DDR_CTL_CONFIG_GE1_SRAM_SYNC_SET(0x1) | \ + DDR_CTL_CONFIG_USB_SRAM_SYNC_SET(0x1) | \ + DDR_CTL_CONFIG_PCIE_SRAM_SYNC_SET(0x1) | \ + DDR_CTL_CONFIG_WMAC_SRAM_SYNC_SET(0x1) | \ + DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_SET(0x1) | \ + DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_SET(0x1) + +int /* ram type */ +ath_ddr_initial_config(uint32_t refresh) +{ +#if !defined(CONFIG_ATH_NAND_BR) && !defined(CONFIG_ATH_EMULATION) + int ddr_config, ddr_config2, ddr_config3, ext_mod, mod_val, + mod_val_init, cycle_val, tap_val, type, ctl_config; + uint32_t *pll = (unsigned *)PLL_CONFIG_VAL_F; + uint32_t bootstrap; + + prmsg("\nsri\n"); + prmsg("Scorpion 1.%d\n", ath_reg_rd(RST_REVISION_ID_ADDRESS) & 0xf); + + bootstrap = ath_reg_rd(RST_BOOTSTRAP_ADDRESS); + + switch(type = ath_ram_type(bootstrap)) { + case ATH_MEM_DDR2: + ddr_config = CFG_DDR2_CONFIG_VAL; + ddr_config2 = CFG_DDR2_CONFIG2_VAL; + ddr_config3 = CFG_DDR2_CONFIG3_VAL; + ext_mod = CFG_DDR2_EXT_MODE_VAL; + mod_val_init = CFG_DDR2_MODE_VAL_INIT; + mod_val = CFG_DDR2_MODE_VAL; + tap_val = CFG_DDR2_TAP_VAL; + + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x10); + udelay(10); + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x20); + udelay(10); + prmsg("%s(%d): (", __func__, __LINE__); + + if (RST_BOOTSTRAP_DDR_WIDTH_GET(bootstrap)) { + prmsg("32"); + ctl_config = CFG_DDR_CTL_CONFIG | + DDR_CTL_CONFIG_PAD_DDR2_SEL_SET(0x1); + + cycle_val = CFG_DDR2_RD_DATA_THIS_CYCLE_VAL_32; + } else { + prmsg("16"); + ctl_config = CFG_DDR_CTL_CONFIG | + DDR_CTL_CONFIG_PAD_DDR2_SEL_SET(0x1) | + DDR_CTL_CONFIG_HALF_WIDTH_SET(0x1); + + cycle_val = CFG_DDR2_RD_DATA_THIS_CYCLE_VAL_16; + } + + ctl_config |= CPU_DDR_SYNC_MODE; + + ath_reg_wr_nf(DDR_CTL_CONFIG_ADDRESS, ctl_config); + + prmsg("bit) ddr2 init\n"); + udelay(10); + break; + case ATH_MEM_DDR1: + ddr_config = CFG_DDR1_CONFIG_VAL; + ddr_config2 = CFG_DDR1_CONFIG2_VAL; + ddr_config3 = CFG_DDR1_CONFIG3_VAL; + ext_mod = CFG_DDR1_EXT_MODE_VAL; + mod_val_init = CFG_DDR1_MODE_VAL_INIT; + mod_val = CFG_DDR1_MODE_VAL; + tap_val = CFG_DDR1_TAP_VAL; + + prmsg("%s(%d): (", __func__, __LINE__); + if (RST_BOOTSTRAP_DDR_WIDTH_GET(bootstrap)) { + prmsg("32"); + ctl_config = CFG_DDR_CTL_CONFIG; + cycle_val = CFG_DDR1_RD_DATA_THIS_CYCLE_VAL_32; + } else { + prmsg("16"); + cycle_val = CFG_DDR1_RD_DATA_THIS_CYCLE_VAL_16; + ctl_config = 0; + } + + ctl_config |= CPU_DDR_SYNC_MODE; + + ath_reg_wr_nf(DDR_CTL_CONFIG_ADDRESS, ctl_config); + udelay(10); + prmsg("bit) ddr1 init\n"); + + break; + } +#if 0 + if (*pll == PLL_MAGIC) { + uint32_t cas = pll[5]; + if (cas == 3 || cas == 4) { + cas = (cas * 2) + 2; + ddr_config &= ~(DDR_CONFIG_CAS_LATENCY_MSB_MASK | + DDR_CONFIG_CAS_LATENCY_MASK); + ddr_config |= DDR_CONFIG_CAS_LATENCY_SET(cas & 0x7) | + DDR_CONFIG_CAS_LATENCY_MSB_SET((cas >> 3) & 1); + + cas = pll[5]; + + ddr_config2 &= ~DDR_CONFIG2_GATE_OPEN_LATENCY_MASK; + ddr_config2 |= DDR_CONFIG2_GATE_OPEN_LATENCY_SET((2 * cas) + 1); + + if (type == ATH_MEM_DDR2) { + uint32_t tmp; + tmp = ath_reg_rd(DDR2_CONFIG_ADDRESS); + tmp &= ~DDR2_CONFIG_DDR2_TWL_MASK; + tmp |= DDR2_CONFIG_DDR2_TWL_SET(cas == 3 ? 3 : 5); + ath_reg_wr_nf(DDR2_CONFIG_ADDRESS, tmp); + } + + mod_val = (cas == 3 ? 0x33 : 0x43); + mod_val_init = 0x100 | mod_val; + } + } +#endif + + ath_reg_wr_nf(DDR_RD_DATA_THIS_CYCLE_ADDRESS, cycle_val); + udelay(100); + ath_reg_wr_nf(DDR_BURST_ADDRESS, 0x74444444); + udelay(100); + ath_reg_wr_nf(DDR_BURST2_ADDRESS, 0x44444444); + udelay(100); + ath_reg_wr_nf(DDR_AHB_MASTER_TIMEOUT_MAX_ADDRESS, 0xfffff); + udelay(100); + ath_reg_wr_nf(DDR_CONFIG_ADDRESS, ddr_config); + udelay(100); + ath_reg_wr_nf(DDR_CONFIG2_ADDRESS, ddr_config2); + udelay(100); + ath_reg_wr(DDR_CONFIG_3_ADDRESS, ddr_config3); + udelay(100); + + if (type == ATH_MEM_DDR2) { + ath_reg_wr_nf(DDR2_CONFIG_ADDRESS, CFG_DDR2_EN_TWL_VAL); + udelay(100); + } + + ath_reg_wr_nf(DDR_CONFIG2_ADDRESS, ddr_config2 | 0x80); // CKE Enable + udelay(100); + + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x8); // Precharge + udelay(10); + + if (type == ATH_MEM_DDR2) { + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x10); // EMR2 + udelay(10); + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x20); // EMR3 + udelay(10); + } + + if (type == ATH_MEM_DDR1 || type == ATH_MEM_DDR2) { + ath_reg_wr_nf(DDR_EXTENDED_MODE_REGISTER_ADDRESS, CFG_DDR2_EXT_MODE_VAL); // EMR DLL enable, Reduced Driver Impedance control, Differential DQS disabled + udelay(100); + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x2); // EMR write + udelay(10); + } + + ath_reg_wr_nf(DDR_MODE_REGISTER_ADDRESS, mod_val_init); + udelay(1000); + + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x1); // MR Write + udelay(10); + + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x8); // Precharge + udelay(10); + + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x4); // Auto Refresh + udelay(10); + + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x4); // Auto Refresh + udelay(10); + + // Issue MRS to remove DLL out-of-reset + ath_reg_wr_nf(DDR_MODE_REGISTER_ADDRESS, mod_val); + udelay(100); + + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x1); // MR write + udelay(100); + + if (type == ATH_MEM_DDR2) { + ath_reg_wr_nf(DDR_EXTENDED_MODE_REGISTER_ADDRESS, 0x782); + udelay(100); + + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x2); // EMR write + udelay(100); + + ath_reg_wr_nf(DDR_EXTENDED_MODE_REGISTER_ADDRESS, CFG_DDR2_EXT_MODE_VAL); + udelay(100); + + ath_reg_wr_nf(DDR_CONTROL_ADDRESS, 0x2); // EMR write + udelay(100); + } + + ath_reg_wr_nf(DDR_REFRESH_ADDRESS, refresh); + udelay(100); + + ath_reg_wr(TAP_CONTROL_0_ADDRESS, tap_val); + ath_reg_wr(TAP_CONTROL_1_ADDRESS, tap_val); + + if (RST_BOOTSTRAP_DDR_WIDTH_GET(bootstrap)) { + ath_reg_wr (TAP_CONTROL_2_ADDRESS, tap_val); + ath_reg_wr (TAP_CONTROL_3_ADDRESS, tap_val); + } + + if (type == ATH_MEM_DDR2) { + ath_reg_wr(PMU1_ADDRESS, 0x633c8176); + // Set DDR2 Voltage to 1.8 volts + ath_reg_wr(PMU2_ADDRESS, PMU2_LDO_TUNE_SET(3) | + PMU2_PGM_SET(0x1)); + } + + /* + * Based on SGMII validation for stucks, packet errors were observed and it was + * mostly due to noise pickup on SGMII lines. Switching regulator register is to + * be programmed with proper setting to avoid such stucks. + */ + ath_reg_rmw_clear(PMU1_ADDRESS, (7<<1)); + ath_reg_rmw_set(PMU1_ADDRESS, (1<<3)); + + ath_sys_frequency(); + + return type; +#else // !nand flash and !emulation + return 0; +#endif +} + +int +ath_uart_freq(void) +{ + if (ath_reg_rd(RST_BOOTSTRAP_ADDRESS) & RST_BOOTSTRAP_REF_CLK_MASK) { + return 40 * 1000 * 1000; + } else { + return 25 * 1000 * 1000; + } +} + +void ath_sys_frequency() +{ +#if !defined(CONFIG_ATH_EMULATION) + uint32_t pll, out_div, ref_div, nint, frac, clk_ctrl; +#endif + uint32_t ref = ath_uart_freq(); + uint32_t ath_cpu_freq = 0, ath_ddr_freq = 0, ath_ahb_freq = 0; + + if (ath_cpu_freq) + goto done; + +#ifdef CONFIG_ATH_EMULATION + ath_cpu_freq = 80000000; + ath_ddr_freq = 80000000; + ath_ahb_freq = 40000000; +#else + prmsg("%s: ", __func__); + + clk_ctrl = ath_reg_rd(ATH_DDR_CLK_CTRL); + +#if 0 + pll = ath_reg_rd(CPU_DPLL2_ADDRESS); + if (CPU_DPLL2_LOCAL_PLL_GET(pll)) { + out_div = CPU_DPLL2_OUTDIV_GET(pll); + + pll = ath_reg_rd(CPU_DPLL_ADDRESS); + nint = CPU_DPLL_NINT_GET(pll); + frac = CPU_DPLL_NFRAC_GET(pll); + ref_div = CPU_DPLL_REFDIV_GET(pll); + pll = ref >> 18; + frac = frac * pll / ref_div; + prmsg("cpu srif "); + } else { +#endif + pll = ath_reg_rd(ATH_PLL_CONFIG); + out_div = CPU_PLL_CONFIG_OUTDIV_GET(pll); + ref_div = CPU_PLL_CONFIG_REFDIV_GET(pll); + nint = CPU_PLL_CONFIG_NINT_GET(pll); + frac = CPU_PLL_CONFIG_NFRAC_GET(pll); + pll = ref >> 6; + frac = frac * pll / ref_div; +// } + ath_cpu_freq = (((nint * (ref / ref_div)) + frac) >> out_div) / + (CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_GET(clk_ctrl) + 1); + +#if 0 + pll = ath_reg_rd(DDR_DPLL2_ADDRESS); + if (DDR_DPLL2_LOCAL_PLL_GET(pll)) { + out_div = DDR_DPLL2_OUTDIV_GET(pll); + + pll = ath_reg_rd(DDR_DPLL_ADDRESS); + nint = DDR_DPLL_NINT_GET(pll); + frac = DDR_DPLL_NFRAC_GET(pll); + ref_div = DDR_DPLL_REFDIV_GET(pll); + pll = ref >> 18; + frac = frac * pll / ref_div; + prmsg("ddr srif "); + } else { +#endif + pll = ath_reg_rd(ATH_DDR_PLL_CONFIG); + out_div = DDR_PLL_CONFIG_OUTDIV_GET(pll); + ref_div = DDR_PLL_CONFIG_REFDIV_GET(pll); + nint = DDR_PLL_CONFIG_NINT_GET(pll); + frac = DDR_PLL_CONFIG_NFRAC_GET(pll); + pll = ref >> 10; + frac = frac * pll / ref_div; +// } + ath_ddr_freq = (((nint * (ref / ref_div)) + frac) >> out_div) / + (CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_GET(clk_ctrl) + 1); + + if (CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_GET(clk_ctrl)) { + ath_ahb_freq = ath_ddr_freq / + (CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_GET(clk_ctrl) + 1); + } else { + ath_ahb_freq = ath_cpu_freq / + (CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_GET(clk_ctrl) + 1); + } +#endif +done: + prmsg("cpu %u ddr %u ahb %u\n", + ath_cpu_freq / 1000000, + ath_ddr_freq / 1000000, + ath_ahb_freq / 1000000); +} diff --git a/board/qca/mips32/qca955x/qca-eth-955x.c b/board/qca/mips32/qca955x/qca-eth-955x.c new file mode 100644 index 0000000000..3d91d28239 --- /dev/null +++ b/board/qca/mips32/qca955x/qca-eth-955x.c @@ -0,0 +1,1004 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_ATH_NAND_BR +#include +#endif + +#include +#include "qca-eth-955x.h" +#include "qca-eth-955x_phy.h" +#define SGMII_LINK_WAR_MAX_TRY 10 + +#if (CONFIG_COMMANDS & CFG_CMD_MII) +#include +#endif +#define ath_gmac_unit2mac(_unit) ath_gmac_macs[(_unit)] +#define ath_gmac_name2mac(name) is_drqfn() ? ath_gmac_unit2mac(1):strcmp(name,"eth0") ? ath_gmac_unit2mac(1) : ath_gmac_unit2mac(0) + +int ath_gmac_miiphy_read(char *devname, uint32_t phaddr, uint8_t reg, uint16_t *data); +int ath_gmac_miiphy_write(char *devname, uint32_t phaddr, uint8_t reg, uint16_t data); + +#ifndef CFG_ATH_GMAC_NMACS +#define CFG_ATH_GMAC_NMACS 1 +#endif /* CFG_ATH_GMAC_NMACS */ + +ath_gmac_mac_t *ath_gmac_macs[CFG_ATH_GMAC_NMACS]; + + +#ifdef CONFIG_VIR_PHY +extern int athr_vir_phy_setup(int unit); +extern int athr_vir_phy_is_up(int unit); +extern int athr_vir_phy_is_fdx(int unit); +extern int athr_vir_phy_speed(int unit); +extern void athr_vir_reg_init(void); +#endif + +#ifdef CONFIG_ATHRS17_PHY +extern void athrs17_reg_init(void); +extern void athrs17_reg_init_wan(void); +#endif + + +#ifdef CONFIG_ATHR_8033_PHY +extern int athrs_ar8033_reg_init(void *arg); +extern int athrs_ar8033_phy_setup(void *arg); +extern int athrs_ar8033_phy_is_fdx(int ethUnit); +extern int athrs_ar8033_phy_is_link_alive(int phyUnit); +extern int athrs_ar8033_phy_is_up(int ethUnit); +extern int athrs_ar8033_phy_speed(int ethUnit,int phyUnit); +#endif + +#ifdef CONFIG_ATH_NAND_BR + +#define ATH_ETH_MAC_READ_SIZE 4096 +extern unsigned long long +ath_nand_get_cal_offset(const char *ba); +#endif + +static int +ath_gmac_send(struct eth_device *dev, volatile void *packet, int length) +{ + int i; + + ath_gmac_mac_t *mac = (ath_gmac_mac_t *)dev->priv; + + ath_gmac_desc_t *f = mac->fifo_tx[mac->next_tx]; + + f->pkt_size = length; + f->res1 = 0; + f->pkt_start_addr = virt_to_phys(packet); + + ath_gmac_tx_give_to_dma(f); + flush_cache((u32) packet, length); + ath_gmac_reg_wr(mac, ATH_DMA_TX_DESC, virt_to_phys(f)); + ath_gmac_reg_wr(mac, ATH_DMA_TX_CTRL, ATH_TXE); + + for (i = 0; i < MAX_WAIT; i++) { + udelay(10); + if (!ath_gmac_tx_owned_by_dma(f)) + break; + } + if (i == MAX_WAIT) + printf("Tx Timed out\n"); + + f->pkt_start_addr = 0; + f->pkt_size = 0; + + if (++mac->next_tx >= NO_OF_TX_FIFOS) + mac->next_tx = 0; + + return (0); +} + +static int ath_gmac_recv(struct eth_device *dev) +{ + int length; + ath_gmac_desc_t *f; + ath_gmac_mac_t *mac; + volatile int dmaed_pkt=0; + int count = 0; + + mac = (ath_gmac_mac_t *)dev->priv; + + for (;;) { + f = mac->fifo_rx[mac->next_rx]; + if (ath_gmac_rx_owned_by_dma(f)) { + /* check if the current Descriptor is_empty is 1,But the DMAed count is not-zero + then move to desciprot where the packet is available */ + dmaed_pkt = (ath_gmac_reg_rd(mac, 0x194) >> 16); + if (!dmaed_pkt) { + break ; + } else { + if (f->is_empty == 1) { + while ( count < NO_OF_RX_FIFOS ) { + if (++mac->next_rx >= NO_OF_RX_FIFOS) { + mac->next_rx = 0; + } + f = mac->fifo_rx[mac->next_rx]; + /* + * Break on valid data in the desc by checking + * empty bit. + */ + if (!f->is_empty){ + count = 0; + break; + } + count++; + } + } + } + } + + length = f->pkt_size; + + net_process_received_packet(net_rx_packets[mac->next_rx] , length - 4); + flush_cache((u32) net_rx_packets[mac->next_rx] , PKTSIZE_ALIGN); + + ath_gmac_reg_wr(mac,0x194,1); + ath_gmac_rx_give_to_dma(f); + + if (++mac->next_rx >= NO_OF_RX_FIFOS) + mac->next_rx = 0; + } + + if (!(ath_gmac_reg_rd(mac, ATH_DMA_RX_CTRL))) { + ath_gmac_reg_wr(mac, ATH_DMA_RX_DESC, virt_to_phys(f)); + ath_gmac_reg_wr(mac, ATH_DMA_RX_CTRL, 1); + } + + return (0); +} + +void ath_gmac_mii_setup(ath_gmac_mac_t *mac) +{ + u32 mgmt_cfg_val; + + ath_reg_wr(SWITCH_CLOCK_SPARE_ADDRESS, 0x520); + + if ((is_s17() && mac->mac_unit == 0) || is_drqfn()) { + printf("Scorpion ----> S17 PHY *\n"); + mgmt_cfg_val = 7; +#ifndef ATH_RGMII_CAL + ath_reg_wr(ATH_ETH_CFG, ETH_CFG_ETH_RXDV_DELAY_SET(3) | + ETH_CFG_ETH_RXD_DELAY_SET(3)| + ETH_CFG_RGMII_GE0_SET(1)); + + ath_reg_wr(ETH_XMII_ADDRESS, ETH_XMII_TX_INVERT_SET(1) | + ETH_XMII_RX_DELAY_SET(2) | + ETH_XMII_TX_DELAY_SET(1) | + ETH_XMII_GIGE_SET(1)); +#else + rgmii_cal_alg() +#endif + udelay(1000); + ath_gmac_reg_wr(mac, ATH_MAC_MII_MGMT_CFG, mgmt_cfg_val | (1 << 31)); + ath_gmac_reg_wr(mac, ATH_MAC_MII_MGMT_CFG, mgmt_cfg_val); + return; + } + + if (is_ar8033 () && mac->mac_unit == 1) { + printf("Scorpion ---->8033 PHY*\n"); + mgmt_cfg_val = 7; + ath_gmac_reg_wr(mac, ATH_MAC_MII_MGMT_CFG, mgmt_cfg_val | (1 << 31)); + ath_gmac_reg_wr(mac, ATH_MAC_MII_MGMT_CFG, mgmt_cfg_val); + return; + + + } + if (is_vir_phy()) { + printf("Scorpion ---->VIR PHY*\n"); + + ath_reg_wr(ATH_ETH_CFG, ETH_CFG_ETH_RXDV_DELAY_SET(3) | + ETH_CFG_ETH_RXD_DELAY_SET(3)| + ETH_CFG_RGMII_GE0_SET(1)); + ath_reg_wr(ETH_XMII_ADDRESS, ETH_XMII_TX_INVERT_SET(1) | + ETH_XMII_RX_DELAY_SET(2) | + ETH_XMII_TX_DELAY_SET(1) | + ETH_XMII_GIGE_SET(1)); + udelay(1000); + ath_gmac_reg_wr(mac, ATH_MAC_MII_MGMT_CFG, mgmt_cfg_val | (1 << 31)); + ath_gmac_reg_wr(mac, ATH_MAC_MII_MGMT_CFG, mgmt_cfg_val); + + return; + } +} + +void +athrs_sgmii_res_cal(void) +{ + unsigned int read_data, read_data_otp, otp_value, otp_per_val, rbias_per; + unsigned int read_data_spi; + unsigned int *address_spi = (unsigned int *)0xbffffffc; + unsigned int rbias_pos_or_neg, res_cal_val; + unsigned int sgmii_pos, sgmii_res_cal_value; + unsigned int reversed_sgmii_value, use_value; + + ath_reg_wr(OTP_INTF2_ADDRESS, 0x7d); + ath_reg_wr(OTP_LDO_CONTROL_ADDRESS, 0x0); + + while (ath_reg_rd(OTP_LDO_STATUS_ADDRESS) & OTP_LDO_STATUS_POWER_ON_MASK); + + read_data = ath_reg_rd(OTP_MEM_0_ADDRESS + 4); + + while (!(ath_reg_rd(OTP_STATUS0_ADDRESS) & OTP_STATUS0_EFUSE_READ_DATA_VALID_MASK)); + + read_data_otp = ath_reg_rd(OTP_STATUS1_ADDRESS); + + if (read_data_otp & 0x1fff) { + read_data = read_data_otp; + } else { + read_data_spi = *(address_spi); + if ((read_data_spi & 0xffff0000) == 0x5ca10000) { + read_data = read_data_spi; + } else { + read_data = read_data_otp; + } + } + + if (read_data & 0x00001000) { + otp_value = (read_data & 0xfc0) >> 6; + } else { + otp_value = read_data & 0x3f; + } + + if (otp_value > 31) { + otp_per_val = 63 - otp_value; + rbias_pos_or_neg = 1; + } else { + otp_per_val = otp_value; + rbias_pos_or_neg = 0; + } + + rbias_per = otp_per_val * 15; + + if (rbias_pos_or_neg == 1) { + res_cal_val = (rbias_per + 34) / 21; + sgmii_pos = 1; + } else { + if (rbias_per > 34) { + res_cal_val = (rbias_per - 34) / 21; + sgmii_pos = 0; + } else { + res_cal_val = (34 - rbias_per) / 21; + sgmii_pos = 1; + } + } + + if (sgmii_pos == 1) { + sgmii_res_cal_value = 8 + res_cal_val; + } else { + sgmii_res_cal_value = 8 - res_cal_val; + } + + reversed_sgmii_value = 0; + use_value = 0x8; + reversed_sgmii_value = reversed_sgmii_value | ((sgmii_res_cal_value & use_value) >> 3); + use_value = 0x4; + reversed_sgmii_value = reversed_sgmii_value | ((sgmii_res_cal_value & use_value) >> 1); + use_value = 0x2; + reversed_sgmii_value = reversed_sgmii_value | ((sgmii_res_cal_value & use_value) << 1); + use_value = 0x1; + reversed_sgmii_value = reversed_sgmii_value | ((sgmii_res_cal_value & use_value) << 3); + + reversed_sgmii_value &= 0xf; + + printf("%s: cal value = 0x%x\n", __func__, reversed_sgmii_value); + + // To Check the locking of the SGMII PLL + + read_data = (ath_reg_rd(SGMII_SERDES_ADDRESS) & + ~SGMII_SERDES_RES_CALIBRATION_MASK) | + SGMII_SERDES_RES_CALIBRATION_SET(reversed_sgmii_value); + + ath_reg_wr(SGMII_SERDES_ADDRESS, read_data); + + + ath_reg_wr(ETH_SGMII_SERDES_ADDRESS, + ETH_SGMII_SERDES_EN_LOCK_DETECT_MASK | + ETH_SGMII_SERDES_PLL_REFCLK_SEL_MASK | + ETH_SGMII_SERDES_EN_PLL_MASK); + + ath_reg_rmw_set(SGMII_SERDES_ADDRESS, + SGMII_SERDES_CDR_BW_SET(3) | + SGMII_SERDES_TX_DR_CTRL_SET(1) | + SGMII_SERDES_PLL_BW_SET(1) | + SGMII_SERDES_EN_SIGNAL_DETECT_SET(1) | + SGMII_SERDES_FIBER_SDO_SET(1) | + SGMII_SERDES_VCO_REG_SET(3)); + + ath_reg_rmw_clear(RST_RESET_ADDRESS, RST_RESET_ETH_SGMII_ARESET_MASK); + udelay(25); + ath_reg_rmw_clear(RST_RESET_ADDRESS, RST_RESET_ETH_SGMII_RESET_MASK); + + while (!(ath_reg_rd(SGMII_SERDES_ADDRESS) & SGMII_SERDES_LOCK_DETECT_STATUS_MASK)); +} + + +static void athr_gmac_sgmii_setup() +{ + int status = 0, count = 0; + +#ifdef ATH_SGMII_FORCED_MODE + ath_reg_wr(MR_AN_CONTROL_ADDRESS, MR_AN_CONTROL_SPEED_SEL1_SET(1) | + MR_AN_CONTROL_PHY_RESET_SET(1) | + MR_AN_CONTROL_DUPLEX_MODE_SET(1)); + udelay(10); + + ath_reg_wr(SGMII_CONFIG_ADDRESS, SGMII_CONFIG_MODE_CTRL_SET(2) | + SGMII_CONFIG_FORCE_SPEED_SET(1) | + SGMII_CONFIG_SPEED_SET(2)); + + printf ("SGMII in forced mode\n"); +#else + + ath_reg_wr(SGMII_CONFIG_ADDRESS, SGMII_CONFIG_MODE_CTRL_SET(2)); + + ath_reg_wr(MR_AN_CONTROL_ADDRESS, MR_AN_CONTROL_AN_ENABLE_SET(1) + |MR_AN_CONTROL_PHY_RESET_SET(1)); + + ath_reg_wr(MR_AN_CONTROL_ADDRESS, MR_AN_CONTROL_AN_ENABLE_SET(1)); +#endif +/* + * SGMII reset sequence suggested by systems team. + */ + + ath_reg_wr(SGMII_RESET_ADDRESS, SGMII_RESET_RX_CLK_N_RESET); + + ath_reg_wr(SGMII_RESET_ADDRESS, SGMII_RESET_HW_RX_125M_N_SET(1)); + + ath_reg_wr(SGMII_RESET_ADDRESS, SGMII_RESET_HW_RX_125M_N_SET(1) + |SGMII_RESET_RX_125M_N_SET(1)); + + ath_reg_wr(SGMII_RESET_ADDRESS, SGMII_RESET_HW_RX_125M_N_SET(1) + |SGMII_RESET_TX_125M_N_SET(1) + |SGMII_RESET_RX_125M_N_SET(1)); + + ath_reg_wr(SGMII_RESET_ADDRESS, SGMII_RESET_HW_RX_125M_N_SET(1) + |SGMII_RESET_TX_125M_N_SET(1) + |SGMII_RESET_RX_125M_N_SET(1) + |SGMII_RESET_RX_CLK_N_SET(1)); + + ath_reg_wr(SGMII_RESET_ADDRESS, SGMII_RESET_HW_RX_125M_N_SET(1) + |SGMII_RESET_TX_125M_N_SET(1) + |SGMII_RESET_RX_125M_N_SET(1) + |SGMII_RESET_RX_CLK_N_SET(1) + |SGMII_RESET_TX_CLK_N_SET(1)); + + ath_reg_rmw_clear(MR_AN_CONTROL_ADDRESS, MR_AN_CONTROL_PHY_RESET_SET(1)); + /* + * WAR::Across resets SGMII link status goes to weird + * state. + * if 0xb8070058 (SGMII_DEBUG register) reads other then 0x1f or 0x10 + * for sure we are in bad state. + * Issue a PHY reset in MR_AN_CONTROL_ADDRESS to keep going. + */ + status = (ath_reg_rd(SGMII_DEBUG_ADDRESS) & 0xff); + while (!(status == 0xf || status == 0x10)) { + + ath_reg_rmw_set(MR_AN_CONTROL_ADDRESS, MR_AN_CONTROL_PHY_RESET_SET(1)); + udelay(100); + ath_reg_rmw_clear(MR_AN_CONTROL_ADDRESS, MR_AN_CONTROL_PHY_RESET_SET(1)); + if (count++ == SGMII_LINK_WAR_MAX_TRY) { + printf ("Max resets limit reached exiting...\n"); + break; + } + status = (ath_reg_rd(SGMII_DEBUG_ADDRESS) & 0xff); + } + + printf("%s SGMII done\n",__func__); + +} + +static void ath_gmac_hw_start(ath_gmac_mac_t *mac) +{ + + +#ifndef ATH_RGMII_CAL /* Moved after mii_setup since these registers are touched in RGMII cal code */ + if(mac->mac_unit) + { + ath_gmac_reg_rmw_set(mac, ATH_MAC_CFG2, (ATH_MAC_CFG2_PAD_CRC_EN | + ATH_MAC_CFG2_LEN_CHECK | ATH_MAC_CFG2_IF_1000)); + } else { + + + ath_gmac_reg_rmw_set(mac, ATH_MAC_CFG2, (ATH_MAC_CFG2_PAD_CRC_EN | + ATH_MAC_CFG2_LEN_CHECK | ATH_MAC_CFG2_IF_10_100)); + } + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_0, 0x1f00); +#endif + + +#ifdef ATH_RGMII_CAL + if(mac->mac_unit) + { + ath_gmac_reg_rmw_set(mac, ATH_MAC_CFG2, (ATH_MAC_CFG2_PAD_CRC_EN | + ATH_MAC_CFG2_LEN_CHECK | ATH_MAC_CFG2_IF_1000)); + } else { + + + ath_gmac_reg_rmw_set(mac, ATH_MAC_CFG2, (ATH_MAC_CFG2_PAD_CRC_EN | + ATH_MAC_CFG2_LEN_CHECK | ATH_MAC_CFG2_IF_10_100)); + } + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_0, 0x1f00); +#endif + + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_1, 0x10ffff); + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_2, 0xAAA0555); + + ath_gmac_reg_rmw_set(mac, ATH_MAC_FIFO_CFG_4, 0x3ffff); + /* + * Setting Drop CRC Errors, Pause Frames,Length Error frames + * and Multi/Broad cast frames. + */ + + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_5, 0x7eccf); + + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_3, 0x1f00140); + + printf(": cfg1 %#x cfg2 %#x\n", ath_gmac_reg_rd(mac, ATH_MAC_CFG1), + ath_gmac_reg_rd(mac, ATH_MAC_CFG2)); + + +} + +static int ath_gmac_check_link(ath_gmac_mac_t *mac) +{ + int link, duplex, speed; + + ath_gmac_phy_link(mac->mac_unit, &link); + ath_gmac_phy_duplex(mac->mac_unit, &duplex); + ath_gmac_phy_speed(mac->mac_unit, &speed); + + mac->link = link; + + if(!mac->link) { + printf("%s link down\n",mac->dev->name); + return 0; + } + + switch (speed) + { + case _1000BASET: + ath_gmac_set_mac_if(mac, 1); + ath_gmac_reg_rmw_set(mac, ATH_MAC_FIFO_CFG_5, (1 << 19)); + + if (is_ar8033() && mac->mac_unit == 1) { + ath_reg_wr(ETH_SGMII_ADDRESS, ETH_SGMII_GIGE_SET(1) | + ETH_SGMII_CLK_SEL_SET(1)); + } + + break; + + case _100BASET: + ath_gmac_set_mac_if(mac, 0); + ath_gmac_set_mac_speed(mac, 1); + ath_gmac_reg_rmw_clear(mac, ATH_MAC_FIFO_CFG_5, (1 << 19)); + + if (is_ar8033() && mac->mac_unit == 1) { + ath_reg_wr(ETH_SGMII_ADDRESS, ETH_SGMII_PHASE0_COUNT_SET(1) | + ETH_SGMII_PHASE1_COUNT_SET(1)); + } + + break; + + case _10BASET: + ath_gmac_set_mac_if(mac, 0); + ath_gmac_set_mac_speed(mac, 0); + ath_gmac_reg_rmw_clear(mac, ATH_MAC_FIFO_CFG_5, (1 << 19)); + + if (is_ar8033() && mac->mac_unit == 1) { + ath_reg_wr(ETH_SGMII_ADDRESS, ETH_SGMII_PHASE0_COUNT_SET(19) | + ETH_SGMII_PHASE1_COUNT_SET(19)); + } + + break; + + default: + printf("Invalid speed detected\n"); + return 0; + } + + if (mac->link && (duplex == mac->duplex) && (speed == mac->speed)) { + printf("Returnig without set up\n"); + return 1; + } + + mac->duplex = duplex; + mac->speed = speed; + + printf("dup %d speed %d\n", duplex, speed); + + ath_gmac_set_mac_duplex(mac,duplex); + + return 1; +} + +/* + * For every command we re-setup the ring and start with clean h/w rx state + */ +static int ath_gmac_clean_rx(struct eth_device *dev, bd_t * bd) +{ + + int i; + ath_gmac_desc_t *fr; + ath_gmac_mac_t *mac = (ath_gmac_mac_t*)dev->priv; + + if (!ath_gmac_check_link(mac)) { + printf("Link not found\n"); + return -1; + } + + mac->next_rx = 0; + + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_0, 0x1f00); + ath_gmac_reg_wr(mac, ATH_MAC_CFG1, (ATH_MAC_CFG1_RX_EN | ATH_MAC_CFG1_TX_EN)); + + for (i = 0; i < NO_OF_RX_FIFOS; i++) { + fr = mac->fifo_rx[i]; + fr->pkt_start_addr = virt_to_phys(net_rx_packets[i]); + flush_cache((u32) net_rx_packets[i], PKTSIZE_ALIGN); + ath_gmac_rx_give_to_dma(fr); + } + + ath_gmac_reg_wr(mac, ATH_DMA_RX_DESC, virt_to_phys(mac->fifo_rx[0])); + ath_gmac_reg_wr(mac, ATH_DMA_RX_CTRL, ATH_RXE); /* rx start */ + udelay(1000 * 1000); + + + return 1; + +} + +static int ath_gmac_alloc_fifo(int ndesc, ath_gmac_desc_t ** fifo) +{ + int i; + u32 size; + uchar *p = NULL; + + size = sizeof(ath_gmac_desc_t) * ndesc; + size += CONFIG_SYS_CACHELINE_SIZE - 1; + + if ((p = malloc(size)) == NULL) { + printf("Cant allocate fifos\n"); + return -1; + } + + p = (uchar *) (((u32) p + CONFIG_SYS_CACHELINE_SIZE - 1) & + ~(CONFIG_SYS_CACHELINE_SIZE - 1)); + p = UNCACHED_SDRAM(p); + + for (i = 0; i < ndesc; i++) + fifo[i] = (ath_gmac_desc_t *) p + i; + + return 0; +} + +static int ath_gmac_setup_fifos(ath_gmac_mac_t *mac) +{ + int i; + + if (ath_gmac_alloc_fifo(NO_OF_TX_FIFOS, mac->fifo_tx)) + return 1; + + for (i = 0; i < NO_OF_TX_FIFOS; i++) { + mac->fifo_tx[i]->next_desc = (i == NO_OF_TX_FIFOS - 1) ? + virt_to_phys(mac->fifo_tx[0]) : virt_to_phys(mac->fifo_tx[i + 1]); + ath_gmac_tx_own(mac->fifo_tx[i]); + } + + if (ath_gmac_alloc_fifo(NO_OF_RX_FIFOS, mac->fifo_rx)) + return 1; + + for (i = 0; i < NO_OF_RX_FIFOS; i++) { + mac->fifo_rx[i]->next_desc = (i == NO_OF_RX_FIFOS - 1) ? + virt_to_phys(mac->fifo_rx[0]) : virt_to_phys(mac->fifo_rx[i + 1]); + } + + return (1); +} + +static void ath_gmac_halt(struct eth_device *dev) +{ + ath_gmac_mac_t *mac = (ath_gmac_mac_t *)dev->priv; + ath_gmac_reg_rmw_clear(mac, ATH_MAC_CFG1,(ATH_MAC_CFG1_RX_EN | ATH_MAC_CFG1_TX_EN)); + ath_gmac_reg_wr(mac,ATH_MAC_FIFO_CFG_0,0x1f1f); + ath_gmac_reg_wr(mac,ATH_DMA_RX_CTRL, 0); + while (ath_gmac_reg_rd(mac, ATH_DMA_RX_CTRL)); +} + +#ifdef CONFIG_ATH_NAND_BR + +unsigned char * +ath_eth_mac_addr(unsigned char *sectorBuff) +{ + ulong off, size; + nand_info_t *nand; + unsigned char ret; + + /* + * caldata partition is of 128k + */ + nand = &nand_info[nand_curr_device]; + size = ATH_ETH_MAC_READ_SIZE; /* To read 4k setting size as 4k */ + + /* + * Get the Offset of Caldata partition + */ + off = ath_nand_get_cal_offset(getenv("bootargs")); + if(off == ATH_CAL_OFF_INVAL) { + printf("Invalid CAL offset \n"); + return NULL; + } + /* + * Get the values from flash, and program into the MAC address + * registers + */ + ret = nand_read(nand, (loff_t)off, &size, (u_char *)sectorBuff); + printf(" %d bytes %s: %s\n", size, + "read", ret ? "ERROR" : "OK"); + if(ret != 0 ) { + return NULL; + } + + return sectorBuff; +} + +#else /* CONFIG_ATH_NAND_BR */ + +unsigned char * +ath_gmac_mac_addr_loc(void) +{ + extern flash_info_t flash_info[]; + +#ifdef BOARDCAL + /* + ** BOARDCAL environmental variable has the address of the cal sector + */ + + return ((unsigned char *)BOARDCAL); + +#else + /* MAC address is store in the 2nd 4k of last sector */ + return ((unsigned char *) + (KSEG1ADDR(ATH_SPI_BASE) + (4 * 1024) + + flash_info[0].size - (64 * 1024) /* sector_size */ )); +#endif +} + +#endif /* CONFIG_ATH_NAND_BR */ + +static void ath_gmac_get_ethaddr(struct eth_device *dev) +{ + unsigned char *eeprom; + unsigned char *mac = dev->enetaddr; +#ifndef CONFIG_ATH_EMULATION + +#ifdef CONFIG_ATH_NAND_BR + unsigned char sectorBuff[ATH_ETH_MAC_READ_SIZE]; + + eeprom = ath_eth_mac_addr(sectorBuff); + if(eeprom == NULL) { + /* mac address will be set to default mac address */ + mac[0] = 0xff; + } + else { +#else /* CONFIG_ATH_NAND_BR */ + eeprom = ath_gmac_mac_addr_loc(); +#endif /* CONFIG_ATH_NAND_BR */ + + if (strcmp(dev->name, "eth0") == 0) { + memcpy(mac, eeprom, 6); + } else if (strcmp(dev->name, "eth1") == 0) { + eeprom += 6; + memcpy(mac, eeprom, 6); + } else { + printf("%s: unknown ethernet device %s\n", __func__, dev->name); + return; + } +#ifdef CONFIG_ATH_NAND_BR + } +#endif /* CONFIG_ATH_NAND_BR */ + /* Use fixed address if the above address is invalid */ + if (mac[0] != 0x00 || (mac[0] == 0xff && mac[5] == 0xff)) +#else + if (1) +#endif + { + mac[0] = 0x00; + mac[1] = 0x03; + mac[2] = 0x7f; + mac[3] = 0x09; + mac[4] = 0x0b; + mac[5] = 0xad; + printf("No valid address in Flash. Using fixed address\n"); + } else { + printf("Fetching MAC Address from 0x%p\n", __func__, eeprom); + } +} + +void +athr_mgmt_init(void) +{ + +#ifdef CONFIG_MGMT_INIT + uint32_t rddata; + + rddata = ath_reg_rd(GPIO_IN_ENABLE3_ADDRESS)& + ~GPIO_IN_ENABLE3_MII_GE1_MDI_MASK; + rddata |= GPIO_IN_ENABLE3_MII_GE1_MDI_SET(19); + ath_reg_wr(GPIO_IN_ENABLE3_ADDRESS, rddata); + + ath_reg_rmw_clear(GPIO_OE_ADDRESS, (1 << 19)); + + ath_reg_rmw_clear(GPIO_OE_ADDRESS, (1 << 17)); + + + rddata = ath_reg_rd(GPIO_OUT_FUNCTION4_ADDRESS) & + ~ (GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK | + GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK); + + rddata |= GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_SET(0x20) | + GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_SET(0x21); + + ath_reg_wr(GPIO_OUT_FUNCTION4_ADDRESS, rddata); +#endif + printf ("%s ::done\n",__func__); +} + + +int ath_gmac_enet_initialize(bd_t * bis) +{ + struct eth_device *dev[CFG_ATH_GMAC_NMACS]; + u32 mask, mac_h, mac_l; + int i; + + printf("%s...\n", __func__); + + athrs_sgmii_res_cal(); + + for (i = 0;i < CFG_ATH_GMAC_NMACS;i++) { + + if ((dev[i] = (struct eth_device *) malloc(sizeof (struct eth_device))) == NULL) { + puts("malloc failed\n"); + return 0; + } + + if ((ath_gmac_macs[i] = (ath_gmac_mac_t *) malloc(sizeof (ath_gmac_mac_t))) == NULL) { + puts("malloc failed\n"); + return 0; + } + + memset(ath_gmac_macs[i], 0, sizeof(ath_gmac_mac_t)); + memset(dev[i], 0, sizeof(struct eth_device)); + + sprintf(dev[i]->name, "eth%d", i); + ath_gmac_get_ethaddr(dev[i]); + + ath_gmac_macs[i]->mac_unit = i; + ath_gmac_macs[i]->mac_base = i ? ATH_GE1_BASE : ATH_GE0_BASE ; + ath_gmac_macs[i]->dev = dev[i]; + + dev[i]->iobase = 0; + dev[i]->init = ath_gmac_clean_rx; + dev[i]->halt = ath_gmac_halt; + dev[i]->send = ath_gmac_send; + dev[i]->recv = ath_gmac_recv; + dev[i]->priv = (void *)ath_gmac_macs[i]; + } + +#if !defined(CONFIG_ATH_NAND_BR) + ath_reg_rmw_set(RST_RESET_ADDRESS, RST_RESET_ETH_SGMII_ARESET_SET(1)); + udelay(1000 * 100); + ath_reg_rmw_clear(RST_RESET_ADDRESS, RST_RESET_ETH_SGMII_ARESET_SET(1)); + udelay(100); +#endif + ath_reg_rmw_set(RST_RESET_ADDRESS, RST_RESET_ETH_SGMII_RESET_SET(1) | RST_RESET_EXTERNAL_RESET_SET(1)); + udelay(1000 * 100); + ath_reg_rmw_clear(RST_RESET_ADDRESS, RST_RESET_ETH_SGMII_RESET_SET(1) | RST_RESET_EXTERNAL_RESET_SET(1)); + udelay(1000 * 100); + + for (i = 0;i < CFG_ATH_GMAC_NMACS;i++) { + + ath_gmac_reg_rmw_set(ath_gmac_macs[i], ATH_MAC_CFG1, ATH_MAC_CFG1_SOFT_RST + | ATH_MAC_CFG1_RX_RST | ATH_MAC_CFG1_TX_RST); + + if(!i) { + mask = (ATH_RESET_GE0_MAC | ATH_RESET_GE1_MAC); + + mask = mask | ATH_RESET_GE0_MDIO | ATH_RESET_GE1_MDIO; + + printf("%s: reset mask:%x \n", __func__, mask); + + ath_reg_rmw_set(RST_RESET_ADDRESS, mask); + udelay(1000 * 100); + + ath_reg_rmw_clear(RST_RESET_ADDRESS, mask); + udelay(1000 * 100); + + udelay(10 * 1000); + } +#if defined(CONFIG_MGMT_INIT) && defined (CONFIG_ATHR_SWITCH_ONLY_MODE) || defined ATH_MDC_GPIO + if (!i) + athr_mgmt_init(); + + if (ath_gmac_macs[i]->mac_unit == 0) + continue; +#endif + eth_register(dev[i]); +#if(CONFIG_COMMANDS & CFG_CMD_MII) + miiphy_register(dev[i]->name, ath_gmac_miiphy_read, ath_gmac_miiphy_write); +#endif + ath_gmac_mii_setup(ath_gmac_macs[i]); + + /* if using header for register configuration, we have to */ + /* configure s26 register after frame transmission is enabled */ + + if (ath_gmac_macs[i]->mac_unit == 0) { /* WAN Phy */ +#ifdef CONFIG_ATHRS17_PHY + athrs17_reg_init(); +#endif + +#ifdef CONFIG_VIR_PHY + printf("VIRPhy reg init \n"); + athr_vir_reg_init(); +#endif + + } else { +#ifdef CONFIG_ATHR_8033_PHY + printf("AR8033 PHY init \n"); + athrs_ar8033_reg_init(NULL); + +#endif + +#if defined(CONFIG_MGMT_INIT) && defined (CONFIG_ATHR_SWITCH_ONLY_MODE) + athrs17_reg_init(); +#elif defined (CONFIG_ATHRS17_PHY) && !defined(CFG_DUAL_PHY_SUPPORT) + athrs17_reg_init_wan(); +#endif + } +#ifdef CONFIG_ATHRS_GMAC_SGMII + /* + * MAC unit 1 or drqfn package call sgmii setup. + */ + if (i == 1 || is_drqfn()) + athr_gmac_sgmii_setup(); +#endif + ath_gmac_hw_start(ath_gmac_macs[i]); + ath_gmac_setup_fifos(ath_gmac_macs[i]); + + + + udelay(100 * 1000); + + { + unsigned char *mac = dev[i]->enetaddr; + + printf("%s: %02x:%02x:%02x:%02x:%02x:%02x\n", dev[i]->name, + mac[0] & 0xff, mac[1] & 0xff, mac[2] & 0xff, + mac[3] & 0xff, mac[4] & 0xff, mac[5] & 0xff); + } + mac_l = (dev[i]->enetaddr[4] << 8) | (dev[i]->enetaddr[5]); + mac_h = (dev[i]->enetaddr[0] << 24) | (dev[i]->enetaddr[1] << 16) | + (dev[i]->enetaddr[2] << 8) | (dev[i]->enetaddr[3] << 0); + + ath_gmac_reg_wr(ath_gmac_macs[i], ATH_GE_MAC_ADDR1, mac_l); + ath_gmac_reg_wr(ath_gmac_macs[i], ATH_GE_MAC_ADDR2, mac_h); + + + ath_gmac_phy_setup(ath_gmac_macs[i]->mac_unit); + printf("%s up\n",dev[i]->name); + } + + + return 1; +} + +#if (CONFIG_COMMANDS & CFG_CMD_MII) +int +ath_gmac_miiphy_read(char *devname, uint32_t phy_addr, uint8_t reg, uint16_t *data) +{ + ath_gmac_mac_t *mac = ath_gmac_name2mac(devname); + uint16_t addr = (phy_addr << ATH_ADDR_SHIFT) | reg, val; + volatile int rddata; + uint16_t ii = 0xFFFF; + + + + + /* + * Check for previous transactions are complete. Added to avoid + * race condition while running at higher frequencies. + */ + do + { + udelay(5); + rddata = ath_gmac_reg_rd(mac, ATH_MII_MGMT_IND) & 0x1; + }while(rddata && --ii); + + if (ii == 0) + printf("ERROR:%s:%d transaction failed\n",__func__,__LINE__); + + + ath_gmac_reg_wr(mac, ATH_MII_MGMT_CMD, 0x0); + ath_gmac_reg_wr(mac, ATH_MII_MGMT_ADDRESS, addr); + ath_gmac_reg_wr(mac, ATH_MII_MGMT_CMD, ATH_MGMT_CMD_READ); + + do + { + udelay(5); + rddata = ath_gmac_reg_rd(mac, ATH_MII_MGMT_IND) & 0x1; + }while(rddata && --ii); + + if(ii==0) + printf("Error!!! Leave ath_gmac_miiphy_read without polling correct status!\n"); + + val = ath_gmac_reg_rd(mac, ATH_MII_MGMT_STATUS); + ath_gmac_reg_wr(mac, ATH_MII_MGMT_CMD, 0x0); + + if (data != NULL) + *data = val; + return val; +} + +int +ath_gmac_miiphy_write(char *devname, uint32_t phy_addr, uint8_t reg, uint16_t data) +{ + ath_gmac_mac_t *mac = ath_gmac_name2mac(devname); + uint16_t addr = (phy_addr << ATH_ADDR_SHIFT) | reg; + volatile int rddata; + uint16_t ii = 0xFFFF; + + + /* + * Check for previous transactions are complete. Added to avoid + * race condition while running at higher frequencies. + */ + do { + udelay(5); + rddata = ath_gmac_reg_rd(mac, ATH_MII_MGMT_IND) & 0x1; + } while (rddata && --ii); + + if (ii == 0) + printf("ERROR:%s:%d transaction failed\n",__func__,__LINE__); + + ath_gmac_reg_wr(mac, ATH_MII_MGMT_ADDRESS, addr); + ath_gmac_reg_wr(mac, ATH_MII_MGMT_CTRL, data); + + do { + rddata = ath_gmac_reg_rd(mac, ATH_MII_MGMT_IND) & 0x1; + } while (rddata && --ii); + + if (ii == 0) + printf("Error!!! Leave ath_gmac_miiphy_write without polling correct status!\n"); + + return 0; +} +#endif /* CONFIG_COMMANDS & CFG_CMD_MII */ + +int cpu_eth_init(bd_t *bis) +{ + ath_gmac_enet_initialize(bis); + return 0; +} + diff --git a/board/qca/mips32/qca955x/qca-eth-955x.h b/board/qca/mips32/qca955x/qca-eth-955x.h new file mode 100644 index 0000000000..f59283e3d8 --- /dev/null +++ b/board/qca/mips32/qca955x/qca-eth-955x.h @@ -0,0 +1,421 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _AGxxxx_H +#define _AGxxxx_H + +#include + +#ifdef ATH_RGMII_CAL +#define rgmii_cal_alg() rgmii_calib(mac); +#else +#define rgmii_cal_alg() +#endif + +/* + * h/w descriptor + */ +typedef struct { + uint32_t pkt_start_addr, + is_empty : 1, + res1 : 10, + ftpp_override : 5, + res2 : 4, + pkt_size : 12, + next_desc; +} ath_gmac_desc_t; + +#define NO_OF_TX_FIFOS 8 +#define NO_OF_RX_FIFOS 8 + +typedef struct { + ath_gmac_desc_t *fifo_tx[NO_OF_TX_FIFOS], + *fifo_rx[NO_OF_RX_FIFOS]; + struct eth_device *dev; + uint32_t next_tx, + next_rx, + link, + duplex, + speed, + mac_unit, + mac_base; +} ath_gmac_mac_t; + +#define ath_gmac_reg_wr(_mac, _x, _y) ath_reg_wr(((_x) + _mac->mac_base), (_y)) +#define ath_gmac_reg_rd(_mac, _x) ath_reg_rd(((_x) + _mac->mac_base)) + +#define ath_gmac_reg_rmw_set(_mac, _x, _y) \ + ath_reg_rmw_set(((_x) + _mac->mac_base ), (_y)) +#define ath_gmac_reg_rmw_clear(_mac, _x, _y) \ + ath_reg_rmw_clear(((_x) + _mac->mac_base), (_y)) + +#ifdef COMPRESSED_UBOOT +#define _1000BASET 1000 +#define _100BASET 100 +#define _10BASET 10 +#endif /* #ifdef COMPRESSED_UBOOT */ + +/* + * spd is _1000BASET, _100BASET etc. defined in include/miiphy.h + */ +#define mii_reg(_mac) (ATH_MII0_CTRL + ((_mac)->mac_unit * 4)) +#define mii_if(_mac) (((_mac)->mac_unit == 0) ? mii0_if : mii1_if) + +#define ath_gmac_set_mii_ctrl_speed(_mac, _spd) do { \ + ath_reg_rmw_clear(mii_reg(_mac), (3 << 4)); \ + ath_reg_rmw_set(mii_reg(_mac), ((_spd) << 4)); \ +} while (0) + +#if defined (CFG_MII0_GMII) +# define ath_gmac_get_mii_if() 0 +#elif defined (CFG_MII0_MII) +# define ath_gmac_get_mii_if() 0 +#elif defined (CFG_MII0_RGMII) +# define ath_gmac_get_mii_if() 0 +#elif defined (CFG_MII0_RMII) +# define ath_gmac_get_mii_if() 0 +#endif + +#define MAX_WAIT 1000 + +/* + * Config/Mac Register definitions + */ +#define ATH_MAC_CFG1 0x00 +#define ATH_MAC_CFG2 0x04 +#define ATH_MAC_IFCTL 0x38 + +/* + * fifo control registers + */ +#define ATH_MAC_FIFO_CFG_0 0x48 +#define ATH_MAC_FIFO_CFG_1 0x4c +#define ATH_MAC_FIFO_CFG_2 0x50 +#define ATH_MAC_FIFO_CFG_3 0x54 +#define ATH_MAC_FIFO_CFG_4 0x58 + +#define ATH_MAC_FIFO_CFG_5 0x5c +#define ATH_BYTE_PER_CLK_EN (1 << 19) + +#define ATH_MAC_FIFO_RAM_0 0x60 +#define ATH_MAC_FIFO_RAM_1 0x64 +#define ATH_MAC_FIFO_RAM_2 0x68 +#define ATH_MAC_FIFO_RAM_3 0x6c +#define ATH_MAC_FIFO_RAM_4 0x70 +#define ATH_MAC_FIFO_RAM_5 0x74 +#define ATH_MAC_FIFO_RAM_6 0x78 +#define ATH_MAC_FIFO_RAM_7 0x7c + +/* + * fields + */ +#define ATH_MAC_CFG1_SOFT_RST (1 << 31) +#define ATH_MAC_CFG1_RX_RST (1 << 19) +#define ATH_MAC_CFG1_TX_RST (1 << 18) +#define ATH_MAC_CFG1_LOOPBACK (1 << 8) +#define ATH_MAC_CFG1_RX_EN (1 << 2) +#define ATH_MAC_CFG1_TX_EN (1 << 0) + +#define ATH_MAC_CFG2_FDX (1 << 0) +#define ATH_MAC_CFG2_PAD_CRC_EN (1 << 2) +#define ATH_MAC_CFG2_LEN_CHECK (1 << 4) +#define ATH_MAC_CFG2_HUGE_FRAME_EN (1 << 5) +#define ATH_MAC_CFG2_IF_1000 (1 << 9) +#define ATH_MAC_CFG2_IF_10_100 (1 << 8) + +#define ATH_MAC_IFCTL_SPEED (1 << 16) + +/* + * DMA (tx/rx) register defines + */ +#define ATH_DMA_TX_CTRL 0x180 +#define ATH_DMA_TX_DESC 0x184 +#define ATH_DMA_TX_STATUS 0x188 +#define ATH_DMA_RX_CTRL 0x18c +#define ATH_DMA_RX_DESC 0x190 +#define ATH_DMA_RX_STATUS 0x194 +#define ATH_DMA_INTR_MASK 0x198 +#define ATH_DMA_INTR 0x19c + +/* + * tx/rx ctrl and status bits + */ +#define ATH_TXE (1 << 0) +#define ATH_TX_STATUS_PKTCNT_SHIFT 16 +#define ATH_TX_STATUS_PKT_SENT 0x1 +#define ATH_TX_STATUS_URN 0x2 +#define ATH_TX_STATUS_BUS_ERROR 0x8 + +#define ATH_RXE (1 << 0) + +#define ATH_RX_STATUS_PKTCNT_MASK 0xff0000 +#define ATH_RX_STATUS_PKT_RCVD (1 << 0) +#define ATH_RX_STATUS_OVF (1 << 2) +#define ATH_RX_STATUS_BUS_ERROR (1 << 3) + +/* + * Int and int mask + */ +#define ATH_INTR_TX (1 << 0) +#define ATH_INTR_TX_URN (1 << 1) +#define ATH_INTR_TX_BUS_ERROR (1 << 3) +#define ATH_INTR_RX (1 << 4) +#define ATH_INTR_RX_OVF (1 << 6) +#define ATH_INTR_RX_BUS_ERROR (1 << 7) + +/* + * MII registers + */ +#define ATH_MAC_MII_MGMT_CFG 0x20 +#define ATH_MGMT_CFG_CLK_DIV_20 0x07 + +#define ATH_MII_MGMT_CMD 0x24 +#define ATH_MGMT_CMD_READ 0x1 + +#define ATH_MII_MGMT_ADDRESS 0x28 +#define ATH_ADDR_SHIFT 8 + +#define ATH_MII_MGMT_CTRL 0x2c +#define ATH_MII_MGMT_STATUS 0x30 + +#define ATH_MII_MGMT_IND 0x34 +#define ATH_MGMT_IND_BUSY (1 << 0) +#define ATH_MGMT_IND_INVALID (1 << 2) + +#define ATH_GE_MAC_ADDR1 0x40 +#define ATH_GE_MAC_ADDR2 0x44 + +/* + * Ethernet config registers + */ +#define ATH_ETH_CFG 0x18070000 +#define ATH_ETH_CFG_RGMII_GE0 (1<<0) +#define ATH_ETH_CFG_MII_GE0 (1<<1) +#define ATH_ETH_CFG_GMII_GE0 (1<<2) +#define ATH_ETH_CFG_RMII_GE0 (1<<10) +#define ATH_ETH_CFG_RMII_HISPD_GE0 (1<<11) +#define ATH_ETH_CFG_RMII_MASTER_MODE (1<<12) +#define ATH_ETH_CFG_MII_GE0_MASTER (1<<3) +#define ATH_ETH_CFG_MII_GE0_SLAVE (1<<4) +#define ATH_ETH_CFG_GE0_ERR_EN (1<<5) +#define ATH_ETH_CFG_SW_ONLY_MODE (1<<6) +#define ATH_ETH_CFG_SW_PHY_SWAP (1<<7) +#define ATH_ETH_CFG_SW_PHY_ADDR_SWAP (1<<8) +#define ATH_ETH_CFG_RXD_DELAY (1 << 14) +#define ATH_ETH_CFG_RDV_DELAY (1 << 16) +#define ATH_ETH_SWITCH_CLK_SPARE 0x18050024 + +#define ETH_XMII_TX_INVERT_MSB 31 +#define ETH_XMII_TX_INVERT_LSB 31 +#define ETH_XMII_TX_INVERT_MASK 0x80000000 +#define ETH_XMII_TX_INVERT_GET(x) (((x) & ETH_XMII_TX_INVERT_MASK) >> ETH_XMII_TX_INVERT_LSB) +#define ETH_XMII_TX_INVERT_SET(x) (((x) << ETH_XMII_TX_INVERT_LSB) & ETH_XMII_TX_INVERT_MASK) +#define ETH_XMII_TX_INVERT_RESET 0x0 // 0 +#define ETH_XMII_GIGE_QUAD_MSB 30 +#define ETH_XMII_GIGE_QUAD_LSB 30 +#define ETH_XMII_GIGE_QUAD_MASK 0x40000000 +#define ETH_XMII_GIGE_QUAD_GET(x) (((x) & ETH_XMII_GIGE_QUAD_MASK) >> ETH_XMII_GIGE_QUAD_LSB) +#define ETH_XMII_GIGE_QUAD_SET(x) (((x) << ETH_XMII_GIGE_QUAD_LSB) & ETH_XMII_GIGE_QUAD_MASK) +#define ETH_XMII_GIGE_QUAD_RESET 0x0 // 0 +#define ETH_XMII_RX_DELAY_MSB 29 +#define ETH_XMII_RX_DELAY_LSB 28 +#define ETH_XMII_RX_DELAY_MASK 0x30000000 +#define ETH_XMII_RX_DELAY_GET(x) (((x) & ETH_XMII_RX_DELAY_MASK) >> ETH_XMII_RX_DELAY_LSB) +#define ETH_XMII_RX_DELAY_SET(x) (((x) << ETH_XMII_RX_DELAY_LSB) & ETH_XMII_RX_DELAY_MASK) +#define ETH_XMII_RX_DELAY_RESET 0x0 // 0 +#define ETH_XMII_TX_DELAY_MSB 27 +#define ETH_XMII_TX_DELAY_LSB 26 +#define ETH_XMII_TX_DELAY_MASK 0x0c000000 +#define ETH_XMII_TX_DELAY_GET(x) (((x) & ETH_XMII_TX_DELAY_MASK) >> ETH_XMII_TX_DELAY_LSB) +#define ETH_XMII_TX_DELAY_SET(x) (((x) << ETH_XMII_TX_DELAY_LSB) & ETH_XMII_TX_DELAY_MASK) +#define ETH_XMII_TX_DELAY_RESET 0x0 // 0 +#define ETH_XMII_GIGE_MSB 25 +#define ETH_XMII_GIGE_LSB 25 +#define ETH_XMII_GIGE_MASK 0x02000000 +#define ETH_XMII_GIGE_GET(x) (((x) & ETH_XMII_GIGE_MASK) >> ETH_XMII_GIGE_LSB) +#define ETH_XMII_GIGE_SET(x) (((x) << ETH_XMII_GIGE_LSB) & ETH_XMII_GIGE_MASK) +#define ETH_XMII_GIGE_RESET 0x0 // 0 +#define ETH_XMII_OFFSET_PHASE_MSB 24 +#define ETH_XMII_OFFSET_PHASE_LSB 24 +#define ETH_XMII_OFFSET_PHASE_MASK 0x01000000 +#define ETH_XMII_OFFSET_PHASE_GET(x) (((x) & ETH_XMII_OFFSET_PHASE_MASK) >> ETH_XMII_OFFSET_PHASE_LSB) +#define ETH_XMII_OFFSET_PHASE_SET(x) (((x) << ETH_XMII_OFFSET_PHASE_LSB) & ETH_XMII_OFFSET_PHASE_MASK) +#define ETH_XMII_OFFSET_PHASE_RESET 0x0 // 0 +#define ETH_XMII_OFFSET_COUNT_MSB 23 +#define ETH_XMII_OFFSET_COUNT_LSB 16 +#define ETH_XMII_OFFSET_COUNT_MASK 0x00ff0000 +#define ETH_XMII_OFFSET_COUNT_GET(x) (((x) & ETH_XMII_OFFSET_COUNT_MASK) >> ETH_XMII_OFFSET_COUNT_LSB) +#define ETH_XMII_OFFSET_COUNT_SET(x) (((x) << ETH_XMII_OFFSET_COUNT_LSB) & ETH_XMII_OFFSET_COUNT_MASK) +#define ETH_XMII_OFFSET_COUNT_RESET 0x0 // 0 +#define ETH_XMII_PHASE1_COUNT_MSB 15 +#define ETH_XMII_PHASE1_COUNT_LSB 8 +#define ETH_XMII_PHASE1_COUNT_MASK 0x0000ff00 +#define ETH_XMII_PHASE1_COUNT_GET(x) (((x) & ETH_XMII_PHASE1_COUNT_MASK) >> ETH_XMII_PHASE1_COUNT_LSB) +#define ETH_XMII_PHASE1_COUNT_SET(x) (((x) << ETH_XMII_PHASE1_COUNT_LSB) & ETH_XMII_PHASE1_COUNT_MASK) +#define ETH_XMII_PHASE1_COUNT_RESET 0x1 // 1 +#define ETH_XMII_PHASE0_COUNT_MSB 7 +#define ETH_XMII_PHASE0_COUNT_LSB 0 +#define ETH_XMII_PHASE0_COUNT_MASK 0x000000ff +#define ETH_XMII_PHASE0_COUNT_GET(x) (((x) & ETH_XMII_PHASE0_COUNT_MASK) >> ETH_XMII_PHASE0_COUNT_LSB) +#define ETH_XMII_PHASE0_COUNT_SET(x) (((x) << ETH_XMII_PHASE0_COUNT_LSB) & ETH_XMII_PHASE0_COUNT_MASK) +#define ETH_XMII_PHASE0_COUNT_RESET 0x1 // 1 +#define ETH_XMII_ADDRESS 0x18050028 + + + +#define ETH_CFG_ETH_SPARE_MSB 31 +#define ETH_CFG_ETH_SPARE_LSB 22 +#define ETH_CFG_ETH_SPARE_MASK 0xffc00000 +#define ETH_CFG_ETH_SPARE_GET(x) (((x) & ETH_CFG_ETH_SPARE_MASK) >> ETH_CFG_ETH_SPARE_LSB) +#define ETH_CFG_ETH_SPARE_SET(x) (((x) << ETH_CFG_ETH_SPARE_LSB) & ETH_CFG_ETH_SPARE_MASK) +#define ETH_CFG_ETH_SPARE_RESET 0x0 // 0 +#define ETH_CFG_ETH_TXEN_DELAY_MSB 21 +#define ETH_CFG_ETH_TXEN_DELAY_LSB 20 +#define ETH_CFG_ETH_TXEN_DELAY_MASK 0x00300000 +#define ETH_CFG_ETH_TXEN_DELAY_GET(x) (((x) & ETH_CFG_ETH_TXEN_DELAY_MASK) >> ETH_CFG_ETH_TXEN_DELAY_LSB) +#define ETH_CFG_ETH_TXEN_DELAY_SET(x) (((x) << ETH_CFG_ETH_TXEN_DELAY_LSB) & ETH_CFG_ETH_TXEN_DELAY_MASK) +#define ETH_CFG_ETH_TXEN_DELAY_RESET 0x0 // 0 +#define ETH_CFG_ETH_TXD_DELAY_MSB 19 +#define ETH_CFG_ETH_TXD_DELAY_LSB 18 +#define ETH_CFG_ETH_TXD_DELAY_MASK 0x000c0000 +#define ETH_CFG_ETH_TXD_DELAY_GET(x) (((x) & ETH_CFG_ETH_TXD_DELAY_MASK) >> ETH_CFG_ETH_TXD_DELAY_LSB) +#define ETH_CFG_ETH_TXD_DELAY_SET(x) (((x) << ETH_CFG_ETH_TXD_DELAY_LSB) & ETH_CFG_ETH_TXD_DELAY_MASK) +#define ETH_CFG_ETH_TXD_DELAY_RESET 0x0 // 0 +#define ETH_CFG_ETH_RXDV_DELAY_MSB 17 +#define ETH_CFG_ETH_RXDV_DELAY_LSB 16 +#define ETH_CFG_ETH_RXDV_DELAY_MASK 0x00030000 +#define ETH_CFG_ETH_RXDV_DELAY_GET(x) (((x) & ETH_CFG_ETH_RXDV_DELAY_MASK) >> ETH_CFG_ETH_RXDV_DELAY_LSB) +#define ETH_CFG_ETH_RXDV_DELAY_SET(x) (((x) << ETH_CFG_ETH_RXDV_DELAY_LSB) & ETH_CFG_ETH_RXDV_DELAY_MASK) +#define ETH_CFG_ETH_RXDV_DELAY_RESET 0x0 // 0 +#define ETH_CFG_ETH_RXD_DELAY_MSB 15 +#define ETH_CFG_ETH_RXD_DELAY_LSB 14 +#define ETH_CFG_ETH_RXD_DELAY_MASK 0x0000c000 +#define ETH_CFG_ETH_RXD_DELAY_GET(x) (((x) & ETH_CFG_ETH_RXD_DELAY_MASK) >> ETH_CFG_ETH_RXD_DELAY_LSB) +#define ETH_CFG_ETH_RXD_DELAY_SET(x) (((x) << ETH_CFG_ETH_RXD_DELAY_LSB) & ETH_CFG_ETH_RXD_DELAY_MASK) +#define ETH_CFG_ETH_RXD_DELAY_RESET 0x0 // 0 +#define ETH_CFG_RMII_GE0_MASTER_MSB 12 +#define ETH_CFG_RMII_GE0_MASTER_LSB 12 +#define ETH_CFG_RMII_GE0_MASTER_MASK 0x00001000 +#define ETH_CFG_RMII_GE0_MASTER_GET(x) (((x) & ETH_CFG_RMII_GE0_MASTER_MASK) >> ETH_CFG_RMII_GE0_MASTER_LSB) +#define ETH_CFG_RMII_GE0_MASTER_SET(x) (((x) << ETH_CFG_RMII_GE0_MASTER_LSB) & ETH_CFG_RMII_GE0_MASTER_MASK) +#define ETH_CFG_RMII_GE0_MASTER_RESET 0x1 // 1 +#define ETH_CFG_MII_CNTL_SPEED_MSB 11 +#define ETH_CFG_MII_CNTL_SPEED_LSB 11 +#define ETH_CFG_MII_CNTL_SPEED_MASK 0x00000800 +#define ETH_CFG_MII_CNTL_SPEED_GET(x) (((x) & ETH_CFG_MII_CNTL_SPEED_MASK) >> ETH_CFG_MII_CNTL_SPEED_LSB) +#define ETH_CFG_MII_CNTL_SPEED_SET(x) (((x) << ETH_CFG_MII_CNTL_SPEED_LSB) & ETH_CFG_MII_CNTL_SPEED_MASK) +#define ETH_CFG_MII_CNTL_SPEED_RESET 0x0 // 0 +#define ETH_CFG_RMII_GE0_MSB 10 +#define ETH_CFG_RMII_GE0_LSB 10 +#define ETH_CFG_RMII_GE0_MASK 0x00000400 +#define ETH_CFG_RMII_GE0_GET(x) (((x) & ETH_CFG_RMII_GE0_MASK) >> ETH_CFG_RMII_GE0_LSB) +#define ETH_CFG_RMII_GE0_SET(x) (((x) << ETH_CFG_RMII_GE0_LSB) & ETH_CFG_RMII_GE0_MASK) +#define ETH_CFG_RMII_GE0_RESET 0x0 // 0 +#define ETH_CFG_GE0_SGMII_MSB 6 +#define ETH_CFG_GE0_SGMII_LSB 6 +#define ETH_CFG_GE0_SGMII_MASK 0x00000040 +#define ETH_CFG_GE0_SGMII_GET(x) (((x) & ETH_CFG_GE0_SGMII_MASK) >> ETH_CFG_GE0_SGMII_LSB) +#define ETH_CFG_GE0_SGMII_SET(x) (((x) << ETH_CFG_GE0_SGMII_LSB) & ETH_CFG_GE0_SGMII_MASK) +#define ETH_CFG_GE0_SGMII_RESET 0x0 // 0 +#define ETH_CFG_GE0_ERR_EN_MSB 5 +#define ETH_CFG_GE0_ERR_EN_LSB 5 +#define ETH_CFG_GE0_ERR_EN_MASK 0x00000020 +#define ETH_CFG_GE0_ERR_EN_GET(x) (((x) & ETH_CFG_GE0_ERR_EN_MASK) >> ETH_CFG_GE0_ERR_EN_LSB) +#define ETH_CFG_GE0_ERR_EN_SET(x) (((x) << ETH_CFG_GE0_ERR_EN_LSB) & ETH_CFG_GE0_ERR_EN_MASK) +#define ETH_CFG_GE0_ERR_EN_RESET 0x0 // 0 +#define ETH_CFG_MII_GE0_SLAVE_MSB 4 +#define ETH_CFG_MII_GE0_SLAVE_LSB 4 +#define ETH_CFG_MII_GE0_SLAVE_MASK 0x00000010 +#define ETH_CFG_MII_GE0_SLAVE_GET(x) (((x) & ETH_CFG_MII_GE0_SLAVE_MASK) >> ETH_CFG_MII_GE0_SLAVE_LSB) +#define ETH_CFG_MII_GE0_SLAVE_SET(x) (((x) << ETH_CFG_MII_GE0_SLAVE_LSB) & ETH_CFG_MII_GE0_SLAVE_MASK) +#define ETH_CFG_MII_GE0_SLAVE_RESET 0x0 // 0 +#define ETH_CFG_MII_GE0_MASTER_MSB 3 +#define ETH_CFG_MII_GE0_MASTER_LSB 3 +#define ETH_CFG_MII_GE0_MASTER_MASK 0x00000008 +#define ETH_CFG_MII_GE0_MASTER_GET(x) (((x) & ETH_CFG_MII_GE0_MASTER_MASK) >> ETH_CFG_MII_GE0_MASTER_LSB) +#define ETH_CFG_MII_GE0_MASTER_SET(x) (((x) << ETH_CFG_MII_GE0_MASTER_LSB) & ETH_CFG_MII_GE0_MASTER_MASK) +#define ETH_CFG_MII_GE0_MASTER_RESET 0x0 // 0 +#define ETH_CFG_GMII_GE0_MSB 2 +#define ETH_CFG_GMII_GE0_LSB 2 +#define ETH_CFG_GMII_GE0_MASK 0x00000004 +#define ETH_CFG_GMII_GE0_GET(x) (((x) & ETH_CFG_GMII_GE0_MASK) >> ETH_CFG_GMII_GE0_LSB) +#define ETH_CFG_GMII_GE0_SET(x) (((x) << ETH_CFG_GMII_GE0_LSB) & ETH_CFG_GMII_GE0_MASK) +#define ETH_CFG_GMII_GE0_RESET 0x0 // 0 +#define ETH_CFG_MII_GE0_MSB 1 +#define ETH_CFG_MII_GE0_LSB 1 +#define ETH_CFG_MII_GE0_MASK 0x00000002 +#define ETH_CFG_MII_GE0_GET(x) (((x) & ETH_CFG_MII_GE0_MASK) >> ETH_CFG_MII_GE0_LSB) +#define ETH_CFG_MII_GE0_SET(x) (((x) << ETH_CFG_MII_GE0_LSB) & ETH_CFG_MII_GE0_MASK) +#define ETH_CFG_MII_GE0_RESET 0x0 // 0 +#define ETH_CFG_RGMII_GE0_MSB 0 +#define ETH_CFG_RGMII_GE0_LSB 0 +#define ETH_CFG_RGMII_GE0_MASK 0x00000001 +#define ETH_CFG_RGMII_GE0_GET(x) (((x) & ETH_CFG_RGMII_GE0_MASK) >> ETH_CFG_RGMII_GE0_LSB) +#define ETH_CFG_RGMII_GE0_SET(x) (((x) << ETH_CFG_RGMII_GE0_LSB) & ETH_CFG_RGMII_GE0_MASK) +#define ETH_CFG_RGMII_GE0_RESET 0x0 // 0 +#define ETH_CFG_ADDRESS 0x18070000 + + + + +/* + * ownership of descriptors between DMA and cpu + */ +#define ath_gmac_rx_owned_by_dma(_ds) ((_ds)->is_empty == 1) +#define ath_gmac_rx_give_to_dma(_ds) ((_ds)->is_empty = 1) +#define ath_gmac_tx_owned_by_dma(_ds) ((_ds)->is_empty == 0) +#define ath_gmac_tx_give_to_dma(_ds) ((_ds)->is_empty = 0) +#define ath_gmac_tx_own(_ds) ((_ds)->is_empty = 1) + +/* + * link settings + */ +#define ath_gmac_set_mac_duplex(_mac, _fdx) do { \ + if ((_fdx)) { \ + ath_gmac_reg_rmw_set(_mac, \ + ATH_MAC_CFG2, ATH_MAC_CFG2_FDX);\ + } else { \ + ath_gmac_reg_rmw_clear(_mac, \ + ATH_MAC_CFG2, ATH_MAC_CFG2_FDX);\ + } \ +} while (0) + +#define ath_gmac_set_mac_if(_mac, _isXGMII) do { \ + ath_gmac_reg_rmw_clear(_mac, ATH_MAC_CFG2, \ + ATH_MAC_CFG2_IF_1000 | \ + ATH_MAC_CFG2_IF_10_100); \ + if ((_isXGMII)) { \ + ath_gmac_reg_rmw_set(_mac, ATH_MAC_CFG2, \ + ATH_MAC_CFG2_IF_1000); \ + ath_gmac_reg_rmw_set(_mac, ATH_MAC_FIFO_CFG_5, \ + ATH_BYTE_PER_CLK_EN); \ + } else { \ + ath_gmac_reg_rmw_set(_mac, ATH_MAC_CFG2, \ + ATH_MAC_CFG2_IF_10_100); \ + ath_gmac_reg_rmw_clear(_mac, ATH_MAC_FIFO_CFG_5,\ + ATH_BYTE_PER_CLK_EN); \ + } \ +} while (0) + +#define ath_gmac_set_mac_speed(_mac, _is100) do { \ + if ((_is100)) { \ + ath_gmac_reg_rmw_set(_mac, ATH_MAC_IFCTL, \ + ATH_MAC_IFCTL_SPEED); \ + } else { \ + ath_gmac_reg_rmw_clear(_mac, ATH_MAC_IFCTL, \ + ATH_MAC_IFCTL_SPEED); \ + } \ +} while (0) + +#endif diff --git a/board/qca/mips32/qca955x/qca-eth-955x_phy.h b/board/qca/mips32/qca955x/qca-eth-955x_phy.h new file mode 100644 index 0000000000..e3c283b21e --- /dev/null +++ b/board/qca/mips32/qca955x/qca-eth-955x_phy.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _QCA_ETH_955x_PHY_H +#define _QCA_ETH_955x_PHY_H +#include + + +#ifdef CONFIG_ATHR_8033_PHY +extern int athrs_ar8033_reg_init(void *arg); +extern int athrs_ar8033_phy_setup(void *arg); +extern int athrs_ar8033_phy_is_fdx(int ethUnit); +extern int athrs_ar8033_phy_is_link_alive(int phyUnit); +extern int athrs_ar8033_phy_is_up(int ethUnit); +extern int athrs_ar8033_phy_speed(int ethUnit,int phyUnit); +#endif + +#ifdef CONFIG_ATHRS17_PHY +extern int athrs17_phy_setup(int ethUnit); +extern int athrs17_phy_is_up(int ethUnit); +extern int athrs17_phy_is_fdx(int ethUnit); +extern int athrs17_phy_speed(int ethUnit); +#endif + +static inline void ath_gmac_phy_setup(int unit) +{ +#ifdef CONFIG_ATHRS17_PHY + if (unit == 0) { + athrs17_phy_setup(unit); + } else +#endif + { +#ifdef CONFIG_VIR_PHY + athr_vir_phy_setup(unit); +#endif +#if defined(CONFIG_ATHRS17_PHY) && !defined (CFG_DUAL_PHY_SUPPORT) + athrs17_phy_setup(unit); +#endif + + } +} + +static inline void ath_gmac_phy_link(int unit, int *link) +{ +#ifdef CONFIG_ATHRS17_PHY + if (unit == 0) { + *link = athrs17_phy_is_up(unit); + } else +#endif + { +#ifdef CONFIG_VIR_PHY + *link = athr_vir_phy_is_up(unit); +#endif +#ifdef CONFIG_ATHR_8033_PHY + *link = athrs_ar8033_phy_is_up(unit); +#endif +#if defined(CONFIG_ATHRS17_PHY) && !defined (CFG_DUAL_PHY_SUPPORT) + *link = athrs17_phy_is_up(unit); +#endif + + } +} + +static inline void ath_gmac_phy_duplex(int unit, int *duplex) +{ +#ifdef CONFIG_ATHRS17_PHY + if (unit == 0) { + *duplex = athrs17_phy_is_fdx(unit); + } else +#endif + { +#ifdef CONFIG_VIR_PHY + *duplex = athr_vir_phy_is_fdx(unit); +#endif +#ifdef CONFIG_ATHR_8033_PHY + *duplex = athrs_ar8033_phy_is_fdx(unit); +#endif +#if defined(CONFIG_ATHRS17_PHY) && !defined(CFG_DUAL_PHY_SUPPORT) + *duplex = athrs17_phy_is_fdx(unit); +#endif + } +} + +static inline void ath_gmac_phy_speed(int unit, int *speed) +{ +#ifdef CONFIG_ATHRS17_PHY + if (unit == 0) { + *speed = _1000BASET; + } else +#endif + { +#ifdef CONFIG_VIR_PHY + *speed = athr_vir_phy_speed(unit); +#endif +#ifdef CONFIG_ATHR_8033_PHY + *speed = athrs_ar8033_phy_speed(unit, 5); +#endif + +#if defined(CONFIG_ATHRS17_PHY) && !defined (CFG_DUAL_PHY_SUPPORT) + *speed = _1000BASET; +#endif + } +} + +#endif /* _QCA_ETH_955x_PHY_H */ diff --git a/board/qca/mips32/qca955x/rgmii-cal-955x.c b/board/qca/mips32/qca955x/rgmii-cal-955x.c new file mode 100644 index 0000000000..0330019fad --- /dev/null +++ b/board/qca/mips32/qca955x/rgmii-cal-955x.c @@ -0,0 +1,618 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +//#include +//#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "qca-eth-955x.h" +#include "qca-eth-955x_phy.h" + +#ifdef ATH_RGMII_CAL + +#define NUM_DESCRIPTORS 10 //Number of packets to be looped back +#define node_tx_buf_len 100 // No of bytes per packet to be looped back + +#define DEBUG 0 +#define DEBUG_1 1 + +#define GE0_PEMSTAT_RBYT (0x9c + ATH_GE0_BASE) +#define GE0_PEMSTAT_RPKT (0xA0 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RFCS (0xA4 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RMCA (0xA8 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RBCA (0xAC + ATH_GE0_BASE) +#define GE0_PEMSTAT_RXCF (0xB0 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RXPF (0xB4 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RXUO (0xB8 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RALN (0xBC + ATH_GE0_BASE) +#define GE0_PEMSTAT_RFLR (0xC0 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RCDE (0xC4 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RCSE (0xC8 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RUND (0xCC + ATH_GE0_BASE) +#define GE0_PEMSTAT_ROVR (0xD0 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RFRG (0xD4 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RJBR (0xD8 + ATH_GE0_BASE) +#define GE0_PEMSTAT_RDRP (0xDC + ATH_GE0_BASE) +#define GE0_PEMSTAT_TPKT (0xE0 + ATH_GE0_BASE) + +#define NUM_DESCS 10 + +void init_s17_lpbk(void); +uint32_t athrs17_reg_read(uint32_t reg_addr); +void athrs17_reg_write(uint32_t reg_addr, uint32_t reg_val); + +int results[5] = { 0, 1, 1, 1, 0 }; + +int find; + +void big_del(void) +{ + int i; + for (i = 0; i < 10000; i++) ; +} + +// This should tell us what the best of the 4 values is. It should also tell us what the longest sequence is. +// Since only four bits are used the best of 4 values can be easily arrived at by a truth table. +// Presently we have an algorithm though. +int find_value(void) +{ + int i; + int start_ok = 9; + int end_ok = 9; + int longest_start_ok = 0; + int longest_end_ok = 0; + int longest_ok_cnt = -1; + int first = 0; + + for (i = 0; i < 5; i++) { +#if DEBUG + printf("results [%d]: %d\n", i, results[i]); +#endif + if (results[i] == 1) { + if (start_ok == 9) { + start_ok = i; + if (first == 0) { + longest_start_ok = i; + longest_end_ok = i; + first = 1; + } + } + } + if (results[i] == 0) { + if (end_ok == 9) { + end_ok = i - 1; + } + if ((end_ok - start_ok) > longest_ok_cnt) { + longest_start_ok = start_ok; + longest_end_ok = end_ok; + longest_ok_cnt = (end_ok - start_ok); + } + start_ok = 9; + end_ok = 9; + } + } + +#if DEBUG + printf("FINAL VALUE - "); +#endif + find = (longest_end_ok + longest_start_ok) / 2; +#if DEBUG + printf("find - %d\n", find); + printf("FINAL OK COUNT - %d\n", longest_ok_cnt + 1); +#endif + return (longest_ok_cnt + 1); +} + +int pkt_compare_data(void) +{ + unsigned int i, j; + //unsigned int k,rddata; + unsigned int node_rx_buf_len; + //unsigned int * node_tx_desc_ptr = (unsigned int *) 0xa0280000; + unsigned int *node_rx_desc_ptr = (unsigned int *)0xa0380000; + unsigned int *node_tx_buf_addr = (unsigned int *)0xa0680000; + unsigned int *node_rx_buf_addr = (unsigned int *)0xa0580000; + unsigned int error = 0; + unsigned pkt_err[NUM_DESCS]; + + node_rx_buf_len = (*(node_rx_desc_ptr + 0x1) & 0xfff) - 0x4; + // node_tx_buf_len = *(node_tx_desc_ptr + (NUM_DESCS-1)*0x3+0x1) & 0xfff; + + for (j = 0; j < NUM_DESCS; j++) { + node_rx_buf_len = (*(node_rx_desc_ptr + (NUM_DESCS - 1) * 0x3 + 0x1) & 0xfff) - 0x4; + pkt_err[j] = 0; + for (i = 0; i < (node_rx_buf_len / 4); i++) { + if (((*(node_rx_buf_addr + i + (j * 0x100))) != *(node_tx_buf_addr + i))) { + error = error + 0x1; + pkt_err[j] = 1; + } + } + //node_rx_buf_addr = node_rx_buf_addr + 0x100; + } + if (error == 0) { + return 0; + } else { + for (j = 0; j < NUM_DESCS; j++) { + node_rx_buf_len = (*(node_rx_desc_ptr + (NUM_DESCS - 1) * 0x3 + 0x1) & 0xfff) - 0x4; + if (pkt_err[j] == 1) { +#if DEBUG + printf("PKT %d\n", j); + printf("---------------------------------\n"); + + for (i = 0; i < (node_rx_buf_len / 4); i++) { + //if(((*(node_rx_buf_addr + i )) != *(node_tx_buf_addr + i))) + if (((*(node_rx_buf_addr + i + (j * 0x100))) != *(node_tx_buf_addr + i))) { + printf("->"); + } else { + printf(" "); + } + printf("%x", (*(node_rx_buf_addr + i + (j * 0x100)))); + printf(" "); + printf("%x\n", (*(node_tx_buf_addr + i))); + } + printf("---------------------------------\n"); +#endif + } + //node_rx_buf_addr = node_rx_buf_addr + 0x100; + } + return 1; + } +} + +void rgmii_calib(ath_gmac_mac_t * mac) +{ + + unsigned int i; + unsigned int j; + unsigned int k, l, m; + unsigned int rddata, error = 0; + volatile unsigned int * rd_register; + unsigned int node_rx_buf_len = 1600; + unsigned int node_rx_buf_len1; + unsigned int *node_tx_desc_ptr = (unsigned int *)0xa0280000; + unsigned int *node_rx_desc_ptr = (unsigned int *)0xa0380000; + unsigned int *node_rx_buf_addr = (unsigned int *)0xa0580000; + unsigned int *node_tx_buf_addr = (unsigned int *)0xa0680000; + unsigned int *node_comp_result = (unsigned int *)0xa0200000; + unsigned int s17_tx_pkt = 0; + unsigned int s17_rx_pkt = 0; + unsigned int to; + unsigned int pass = 1; + unsigned int fail = 0; + int lgst = 0; + int old_lgst = 0; + unsigned int xmii[16]; + unsigned int eth_cfg[16]; + unsigned int xmii_val = 0; + unsigned int eth_cfg_val = 1; + unsigned int tx_fix = 0; + + + // GIGE Enable + ath_reg_wr(ETH_XMII_ADDRESS, ETH_XMII_TX_INVERT_SET(0x1) | + ETH_XMII_RX_DELAY_SET(0x2) | + ETH_XMII_TX_DELAY_SET(0x1) | + ETH_XMII_GIGE_SET(0x1)); + + while ((ath_reg_rd(SGMII_SERDES_ADDRESS) & SGMII_SERDES_LOCK_DETECT_STATUS_SET(1)) == 0) { + printf("TEST: WAIT FOR LOCK\n"); + } + + big_del(); + + // MAC INITS + // RGMII Enable on GE0 + //eth_init(); + init_s17_lpbk(); + athrs17_reg_write(0x30, 1); + + ath_reg_wr(ETH_CFG_ADDRESS, ETH_CFG_ETH_RXDV_DELAY_SET(0x3) | + ETH_CFG_ETH_RXD_DELAY_SET(0x3) | + ETH_CFG_RGMII_GE0_SET(0x1)); + + ath_reg_rmw_clear(RST_RESET_ADDRESS, RST_RESET_GE0_MAC_RESET_MASK); // Bringing GE0 out of RESET + ath_gmac_reg_wr(mac, ATH_MAC_CFG2, 0x7235); //for 1000mbps + //ath_reg_wr(GE0_MAC_CONFIG_2,0x7135); //for 100mbps + ath_gmac_reg_wr(mac, ATH_MAC_IFCTL, 0x00000); + ath_gmac_reg_wr(mac, ATH_MAC_CFG1, 0x005); + //ath_reg_wr(GE0_MAC_CONFIG_1,0x105); // For MAC Loopback + ath_gmac_reg_wr(mac, ATH_DMA_INTR_MASK, 0); // Disable interrupt mask + ath_gmac_reg_wr(mac, ATH_GE_MAC_ADDR1, 0x003fffff); //ethernet mac address + ath_gmac_reg_wr(mac, ATH_GE_MAC_ADDR2, 0xfffe0000); //ethernet mac address + ath_gmac_reg_wr(mac, ATH_MAC_MII_MGMT_CFG, 0x6); //clock/20= 2MHz + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_0, 0x1f00); // Enable the FIFO modules + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_1, 0x10ffff); + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_3, 0x1f00140); + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_4, 0x1000); + //ath_reg_wr(GE0_FIFO_CFG_REG_5, 0xbefff); //enable drop + ath_gmac_reg_wr(mac, ATH_MAC_FIFO_CFG_5, 0xfffff); //for 1000Mbps + //ath_reg_wr(GE0_FIFO_CFG_REG_5, 0x7ffff);//for 100Mbps + + //************ + // PACKETS + //*********** + + // Initialise Data in Memory for TX and RX + for (i = 0; i < node_tx_buf_len; i++) + *(node_tx_buf_addr + i) = i | (i + 1) << 8 | (i + 2) << 16 | (i + 3) << 24; + +#if DEBUG + printf("TEST: Inits Done\n"); +#endif + // Set Up Transmit Descriptor Table + + for (i = 0; i < NUM_DESCRIPTORS; i++) { + *(node_tx_desc_ptr + (i * 0x3)) = ((unsigned int)node_tx_buf_addr & 0x0fffffff); + *(node_tx_desc_ptr + (i * 0x3) + 0x1) = (node_tx_buf_len & 0x7fffffff); + + if (i == (NUM_DESCRIPTORS - 1)) + *(node_tx_desc_ptr + (i * 0x3) + 0x2) = ((unsigned int)node_tx_desc_ptr & 0x0fffffff); + else + *(node_tx_desc_ptr + (i * 0x3) + 0x2) = ((unsigned int)node_tx_desc_ptr & 0x0fffffff) + (i * 0xc) + 0xc; + } + + ath_gmac_reg_wr(mac, ATH_DMA_TX_DESC, ((unsigned int)node_tx_desc_ptr & 0x0fffffff)); + ath_gmac_reg_wr(mac, ATH_DMA_TX_STATUS, 0xfffffff); // clear dma status + + for (i = 0; i < NUM_DESCRIPTORS; i++) { + *(node_rx_desc_ptr + (i * 0x3)) = ((unsigned int)node_rx_buf_addr & 0x0fffffff); + *(node_rx_desc_ptr + (i * 0x3) + 0x1) = (node_rx_buf_len & 0xfff) | (1 << 31); + if (i == (NUM_DESCRIPTORS - 1)) + *(node_rx_desc_ptr + (i * 0x3) + 0x2) = ((unsigned int)node_rx_desc_ptr & 0x0fffffff); + else + *(node_rx_desc_ptr + (i * 0x3) + 0x2) = ((unsigned int)node_rx_desc_ptr & 0x0fffffff) + (i * 0xc) + 0xc; + node_rx_buf_addr = node_rx_buf_addr + 0x100; + + } + + ath_gmac_reg_wr(mac, ATH_DMA_RX_DESC, ((unsigned int)node_rx_desc_ptr & 0x0fffffff)); + ath_gmac_reg_wr(mac, ATH_DMA_RX_STATUS, 0xfffffff); // clear dma status + + k = 0; + + // Enable TX and RX MAC + ath_gmac_reg_wr(mac, ATH_MAC_CFG1, 0x005); + + // This routine will go through 16 combinations to find the best value for TX_DELAY, GIGE_QUAD, TX_INVERT + for (l = 0; l < 16; l++) { + // initialize pass. this will be made zero if there is a failure in packet reception compare + pass = 1; + // fail due to checks in rx etc. this is not the same as !pass + fail = 0; + + // GIGE_QUAD - 0 + // TX_INVERT - 0 + // TX_DELAY - 0,1,2,3 + if (l < 4) { + // GIGE Enable and TX_DELAY + rddata = ETH_XMII_GIGE_SET(0x1) | + ETH_XMII_TX_DELAY_SET(l); + ath_reg_wr(ETH_XMII_ADDRESS, rddata); + rddata = ath_reg_rd(ETH_XMII_ADDRESS); +#if DEBUG + printf("TEST: ETH_XMII - 0x%08x\n", rddata); +#endif + } + // GIGE_QUAD - 1 + // TX_INVERT - 0 + // TX_DELAY - 0,1,2,3 + if ((l < 8) && (l > 3)) { + // GIGE Enable and TX_DELAY & GIGE_QUAD + rddata = ETH_XMII_GIGE_QUAD_SET(0x1) | + ETH_XMII_GIGE_SET(0x1) | + ETH_XMII_TX_DELAY_SET(l); + ath_reg_wr(ETH_XMII_ADDRESS, rddata); + rddata = ath_reg_rd(ETH_XMII_ADDRESS); +#if DEBUG + printf("TEST: ETH_XMII - 0x%08x\n", rddata); +#endif + } + // GIGE_QUAD - 0 + // TX_INVERT - 1 + // TX_DELAY - 0,1,2,3 + if ((l < 12) && (l > 7)) { + // GIGE Enable and TX_DELAY and TX_INVERT + rddata = ETH_XMII_TX_INVERT_SET(0x1) | + ETH_XMII_GIGE_SET(0x1) | + ETH_XMII_TX_DELAY_SET(l); + ath_reg_wr(ETH_XMII_ADDRESS, rddata); + rddata = ath_reg_rd(ETH_XMII_ADDRESS); +#if DEBUG + printf("TEST: ETH_XMII - 0x%08x\n", rddata); +#endif + } + // GIGE_QUAD - 0 + // TX_INVERT - 1 + // TX_DELAY - 0,1,2,3 + if ((l < 16) && (l > 11)) { + // GIGE Enable and TX_DELAY and TX_INVERT and GIGE_QUAD + rddata = ETH_XMII_TX_INVERT_SET(0x1) | + ETH_XMII_GIGE_QUAD_SET(0x1) | + ETH_XMII_GIGE_SET(0x1) | + ETH_XMII_TX_DELAY_SET(l); + ath_reg_wr(ETH_XMII_ADDRESS, rddata); + rddata = ath_reg_rd(ETH_XMII_ADDRESS); +#if DEBUG + printf("TEST: ETH_XMII - 0x%08x\n", rddata); +#endif + } + xmii[l] = rddata; + + // counts when to print out counter stats + k++; + // Set Up Receive Descriptor Table + node_rx_buf_len = 0x0; + ath_gmac_reg_wr(mac, ATH_DMA_RX_CTRL, 0x1); // enable dma rx + ath_gmac_reg_wr(mac, ATH_DMA_TX_CTRL, 0x1); // enable dma tx + + rd_register = node_tx_desc_ptr + (NUM_DESCRIPTORS - 1) * 0x3 + 0x1; + rddata = (*(rd_register) & (1 << 31)); + while (rddata != (1 << 31)) + rddata = (*(rd_register) & (1 << 31)); +#if DEBUG + printf("TEST: Tx Done \n"); +#endif + + to = 0; + rd_register = node_rx_desc_ptr + (NUM_DESCS - 1) * 0x3 + 0x1; + rddata = (*(rd_register) & (1 << 31)); + while (rddata != 0x0) { + rddata = (*(rd_register) & (1 << 31)); + to++; + if (to > 100000) { +#if DEBUG + printf("TEST: ERROR!! Atleast 1 packet in GE0 not seen.\n"); +#endif + fail = 1; + break; + } + } +#if DEBUG + printf("TEST: Rx Done \n"); +#endif + + if (k % 1 == 0) { + for (j = GE0_PEMSTAT_RBYT; j <= GE0_PEMSTAT_RDRP; j = j + 4) { + rddata = ath_reg_rd(j); + switch (j) { +#if DEBUG + case GE0_PEMSTAT_RPKT: + printf("TEST: RPKT - 0x%08x\n", rddata); + break; + case GE0_PEMSTAT_TPKT: + printf("TEST: TPKT - 0x%08x\n", rddata); + break; +#endif + } + } +#ifdef ATH_S17_MAC0_SGMII + s17_rx_pkt = athrs17_reg_read(0x163c) + (athrs17_reg_read(0x1640) << 16); +#else + s17_rx_pkt = athrs17_reg_read(0x103c) + (athrs17_reg_read(0x1040) << 16); +#endif +#if DEBUG + printf("TEST: RPKT in S17 0x%08x\n", s17_rx_pkt); +#endif +#ifdef ATH_S17_MAC0_SGMII + s17_tx_pkt = athrs17_reg_read(0x1684) + (athrs17_reg_read(0x1688) << 16); +#else + s17_tx_pkt = athrs17_reg_read(0x1084) + (athrs17_reg_read(0x1088) << 16); +#endif +#if DEBUG + printf("TEST: TPKT in S17 0x%08x\n", s17_tx_pkt); +#endif + // Compare BYTES in TX + if (s17_tx_pkt != 0x410) { +#if DEBUG + printf("TEST: PKTS @ S17 - 0x%08x\n", rddata); +#endif + pass = 0; + fail = 1; + } + + } + if (fail == 0) { + error = pkt_compare_data(); + } + if (error == 0) { +#if DEBUG + printf("TEST: PACKET COMPARISON PASS\n"); +#endif + } else { +#if DEBUG + printf("TEST: ERROR!! PACKET COMPARISON FAIL\n"); +#endif + fail = 1; + } + + for (i = 0; i < NUM_DESCRIPTORS; i++) { + *(node_tx_desc_ptr + (i * 0x3) + 0x1) = (node_tx_buf_len & 0x7fffffff); + *(node_rx_desc_ptr + (i * 0x3) + 0x1) = (node_rx_buf_len & 0xfff) | (1 << 31); + } + + // populate results and find the optimum value of programming + results[(l % 4)] = pass; + if (((l % 4) == 3)) { + lgst = find_value(); + if (lgst > old_lgst) { + old_lgst = lgst; + xmii_val = xmii[(l - 3) + find]; + } + } + } +#if DEBUG_1 + printf("TEST: FINAL REG VAL after TX Calibration - 0x%08x\n", xmii_val); +#endif + tx_fix = xmii_val; + + old_lgst = 0; + + // Using the previously arrived at value of TX Calib we calibrate RX DELAYS. For this we use RX DAT and EN Delays + for (l = 0; l < 16; l++) { + // initialize pass. this will be made zero if there is a failure in packet reception compare + pass = 1; + // fail due to checks in rx etc. this is not the same as !pass + fail = 0; + rddata = ath_reg_rd(ETH_CFG_ADDRESS); +#if DEBUG + printf("TEST: Initial ETH_CFG - 0x%08x\n", rddata); +#endif + + // RXD_DELAY - l / 4 -> 0, 1, 2, 3 + // RXEN_DELAY - l / 4 -> 0, 1, 2, 3 + // RX_DELAY - l & 3 -> 0, 1, 2, 3 + ath_reg_rmw_clear(ETH_CFG_ADDRESS, + ETH_CFG_ETH_RXDV_DELAY_MASK | + ETH_CFG_ETH_RXD_DELAY_MASK); + ath_reg_rmw_set(ETH_CFG_ADDRESS, + ETH_CFG_ETH_RXDV_DELAY_SET(l / 4) | + ETH_CFG_ETH_RXD_DELAY_SET(l / 4)); + rddata = ath_reg_rd(ETH_CFG_ADDRESS); +#if DEBUG + printf("TEST: ETH_CFG - 0x%08x\n", rddata); +#endif + eth_cfg[l] = rddata; + rddata = tx_fix | ETH_XMII_RX_DELAY_SET(l); + ath_reg_wr(ETH_XMII_ADDRESS, rddata); + + xmii[l] = rddata; + + // counts when to print out counter stats + k++; + // Set Up Receive Descriptor Table + node_rx_buf_len = 0x0; + ath_gmac_reg_wr(mac, ATH_DMA_RX_CTRL, 0x1); // enable dma rx + ath_gmac_reg_wr(mac, ATH_DMA_TX_CTRL, 0x1); // enable dma tx + rd_register = node_tx_desc_ptr + (NUM_DESCRIPTORS - 1) * 0x3 + 0x1; + rddata = (*(rd_register) & (1 << 31)); + while (rddata != (1 << 31)) + rddata = (*(rd_register) & (1 << 31)); +#if DEBUG + printf("TEST: Tx Done \n"); +#endif + + to = 0; + rd_register = node_rx_desc_ptr + (NUM_DESCS - 1) * 0x3 + 0x1; + rddata = (*(rd_register) & (1 << 31)); + while (rddata != 0x0) { + rddata = (*(rd_register) & (1 << 31)); + to++; + if (to > 100000) { +#if DEBUG + printf("TEST: ERROR!! Atleast 1 packet in GE0 not seen.\n"); +#endif + // This check for RX. + pass = 0; + fail = 1; + break; + } + } +#if DEBUG + printf("TEST: Rx Done \n"); +#endif + + if (k % 1 == 0) { + for (j = GE0_PEMSTAT_RBYT; j <= GE0_PEMSTAT_RDRP; j = j + 4) { + rddata = ath_reg_rd(j); + switch (j) { +#if DEBUG + case GE0_PEMSTAT_RPKT: + printf("TEST: RPKT 0x%08x\n", rddata); + break; + case GE0_PEMSTAT_TPKT: + printf("TEST: TPKT 0x%08x\n", rddata); + break; +#endif + } + } +#ifdef ATH_S17_MAC0_SGMII + s17_rx_pkt = athrs17_reg_read(0x163c) + (athrs17_reg_read(0x1640) << 16); +#else + s17_rx_pkt = athrs17_reg_read(0x103c) + (athrs17_reg_read(0x1040) << 16); +#endif +#if DEBUG + printf("TEST: RPKT in S17 0x%08x\n", s17_rx_pkt); +#endif +#ifdef ATH_S17_MAC0_SGMII + s17_tx_pkt = athrs17_reg_read(0x1684) + (athrs17_reg_read(0x1688) << 16); +#else + s17_tx_pkt = athrs17_reg_read(0x1084) + (athrs17_reg_read(0x1088) << 16); +#endif +#if DEBUG + printf("TEST: TPKT in S17 0x%08x\n", s17_tx_pkt); +#endif + // Compare BYTES in TX + if (s17_tx_pkt != 0x410) { +#if DEBUG + printf("TEST: PKTS @ S17 - 0x%08x\n", rddata); +#endif + pass = 0; + fail = 1; + } + + } + if (fail == 0) { + error = pkt_compare_data(); + } + if (error == 0) { + //printf("TEST: PACKET COMPARISON PASS\n"); + } else { +#if DEBUG + printf("TEST: ERROR!! PACKET COMPARISON FAIL\n"); +#endif + fail = 1; + // Different from TX. This ensures packets are received back properly for a valid config. + pass = 0; + } + + for (i = 0; i < NUM_DESCRIPTORS; i++) { + *(node_tx_desc_ptr + (i * 0x3) + 0x1) = (node_tx_buf_len & 0x7fffffff); + *(node_rx_desc_ptr + (i * 0x3) + 0x1) = (node_rx_buf_len & 0xfff) | (1 << 31); + } + + // populate results and find the optimum value of programming + // For every set of 4 configurations find longest valid configs and number. + results[(l % 4)] = pass; + if (((l % 4) == 3)) { + lgst = find_value(); + if (lgst > old_lgst) { + old_lgst = lgst; + xmii_val = xmii[(l - 3) + find]; + eth_cfg_val = eth_cfg[(l - 3) + find]; + } + } + } + // And write to these registers. +#if DEBUG_1 + printf("TEST: FINAL XMII VAL after RX Calibration - 0x%08x\n", xmii_val); +#endif + ath_reg_wr(ETH_XMII_ADDRESS, xmii_val); +#if DEBUG_1 + printf("TEST: FINAL ETH_CFG VAL after RX Calibration - 0x%08x\n", eth_cfg_val); +#endif + ath_reg_wr(ETH_CFG_ADDRESS, eth_cfg_val); + ath_gmac_reg_wr(mac,ATH_MAC_CFG1,1<<31); + +} + +#endif /* #ifdef RGMII_CAL */ diff --git a/board/qca/mips32/qca955x/tap-955x.S b/board/qca/mips32/qca955x/tap-955x.S new file mode 100644 index 0000000000..28cc9b9ead --- /dev/null +++ b/board/qca/mips32/qca955x/tap-955x.S @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include + +.globl ath_ddr_tap_cal + .type ath_ddr_tap_cal, @function + .text + .align 4 +ath_ddr_tap_cal: + + li a0, 0xbd007f00 + sw zero, 0x0(a0) // Place where the tap values are saved and used for SWEEP + sw zero, 0x4(a0) // Place where the number of passing taps are saved. + sw zero, 0x14(a0) // Place where the last pass tap value is stored + li a1, 0xaa55aa55 // Indicates that the First pass tap value is not found + sw a1, 0x10(a0) // Place where the First pass tap value is stored + nop + + li a0, 0xb8060000 // RESET_BASE_ADDRESS + lw a1, 0x1c(a0) // Reading the RST_RESET_ADDRESS + li a2, 0x08000000 // Setting the RST_RESET_RTC_RESET + or a1, a1, a2 + sw a1, 0x1c(a0) + + li a3, 0xffffffff + xor a2, a2, a3 + and a1, a1, a2 + sw a1, 0x1c(a0) // Taking the RTC out of RESET + nop + + li a0, 0xb8107000 // RTC_BASE_ADDRESS + li a1, 0x1 + sw a1, 0x0040(a0) // RTC_SYNC_RESET_ADDRESS + + li a2, 0x2 + +_poll_for_RTC_ON: + lw a1, 0x0044(a0) // RTC_SYNC_STATUS_ADDRESS + and a1, a2, a1 + bne a1, a2, _poll_for_RTC_ON + + +_CHANGE_TAPS: + + li t0, 0xbd007f00 // Read the current value of the TAP for programming + lw t1, 0x0(t0) + li t2, 0x00000000 + or t3, t1, t2 + + + li t0, 0xb8000000 // DDR_BASE_ADDRESS + + sw t3, 0x1c(t0) // TAP_CONTROL_0_ADDRESS + sw t3, 0x20(t0) // TAP_CONTROL_1_ADDRESS + sw t3, 0x24(t0) // TAP_CONTROL_2_ADDRESS + sw t3, 0x28(t0) // TAP_CONTROL_3_ADDRESS + + li t1, 0x00000010 // Running the test 8 times + sw t1, 0x0068(t0) // PERF_COMP_ADDR_1_ADDRESS + + li t1, 0xfa5de83f // 4 Row Address Bits, 4 Column Address Bits, 2 BA bits + sw t1, 0x002c(t0) // PERF_MASK_ADDR_0_ADDRESS + + li t1, 0x545fc332 + sw t1, 0x0070(t0) // PERF_COMP_AHB_GE0_1_ADDRESS + + li t1, 0xaba03ccd + sw t1, 0x0040(t0) // PERF_COMP_AHB_GE1_0_ADDRESS + + li t1, 0x545fc332 + sw t1, 0x0078(t0) // PERF_COMP_AHB_GE1_1_ADDRESS + + li t1, 0xaba03ccd + sw t1, 0x0034(t0) // PERF_MASK_AHB_GE0_0_ADDRESS + + li t1, 0x545fc332 + sw t1, 0x006c(t0) // PERF_MASK_AHB_GE0_1_ADDRESS + + li t1, 0xaba03ccd + sw t1, 0x003c(t0) // PERF_MASK_AHB_GE1_0_ADDRESS + + li t1, 0x545fc332 + sw t1, 0x0074(t0) // PERF_MASK_AHB_GE1_1_ADDRESS + + li t1, 0xaba03ccd + sw t1, 0x0038(t0) // PERF_COMP_AHB_GE0_0_ADDRESS + + li t1, 0x00000001 + sw t1, 0x011c(t0) // DDR_BIST_ADDRESS + + li t2, 0x1 +_bist_done_poll: + lw t1, 0x0120(t0) // DDR_BIST_STATUS_ADDRESS + and t1, t1, t2 + bne t1, t2, _bist_done_poll + + lw t1, 0x0120(t0) // DDR_BIST_STATUS_ADDRESS + li t4, 0x000001fe + and t2, t1, t4 + srl t2, t2, 0x1 // no. of Pass Runs + + li t5, 0x00000000 + sw t5, 0x011c(t0) //DDR_BIST_ADDRESS - Stop the DDR BIST test + + li t5, 0x0001fe00 + and t5, t5, t1 + bnez t5, _iterate_tap // This is a redundant compare but nevertheless - Comparing the FAILS + + lw t1, 0x0068(t0) // PERF_COMP_ADDR_1_ADDRESS + li t3, 0x000001fe + and t3, t3, t1 + srl t3, t3, 0x1 // No. of runs in the config register. + + bne t3, t2, _iterate_tap + +pass_tap: + li t0, 0xbd007f00 + lw t1, 0x4(t0) + addiu t1, t1, 0x1 + sw t1, 0x4(t0) + + li t0, 0xbd007f10 + lw t1, 0x0(t0) + li t2, 0xaa55aa55 + beq t1, t2, _first_pass + nop + li t0, 0xbd007f00 + lw t1, 0x0(t0) + li t0, 0xbd007f10 + sw t1, 0x4(t0) + nop + b _iterate_tap + nop + +_first_pass: + li t0, 0xbd007f00 + lw t1, 0x0(t0) + li t0, 0xbd007f10 + sw t1, 0x0(t0) + sw t1, 0x4(t0) + nop + +_iterate_tap: + + li t0, 0xbd007f00 + lw t1, 0x0(t0) + li t2, 0x3f + beq t1, t2, _STOP_TEST + nop + addiu t1, t1, 0x1 + sw t1, 0x0(t0) + nop + b _CHANGE_TAPS + +_STOP_TEST: + li t0, 0xbd007f00 + lw t1, 0x4(t0) + bnez t1, _load_center_tap + nop + li t3, 0x8 // Default Tap to be used + b _load_tap_into_reg + +_load_center_tap: + li t0, 0xbd007f10 + lw t1, 0x0(t0) + lw t2, 0x4(t0) + add t3, t1, t2 + srl t3, t3, 0x1 + li t4, 0x3f + and t3, t3, t4 + +_load_tap_into_reg: + li t0, 0xb8000000 + sw t3, 0x1c(t0) // TAP_CONTROL_0_ADDRESS + sw t3, 0x20(t0) // TAP_CONTROL_1_ADDRESS + sw t3, 0x24(t0) // TAP_CONTROL_2_ADDRESS + sw t3, 0x28(t0) // TAP_CONTROL_3_ADDRESS + + jr ra + nop + diff --git a/configs/qca955x_defconfig b/configs/qca955x_defconfig new file mode 100644 index 0000000000..ca2c5e6e1f --- /dev/null +++ b/configs/qca955x_defconfig @@ -0,0 +1,17 @@ +CONFIG_MIPS=y +CONFIG_TARGET_QCA955X=y +CONFIG_SYS_EXTRA_OPTIONS="QCA955X" +CONFIG_SYS_PROMPT="QCA955X# " +# CONFIG_CMD_BDI is not set +# CONFIG_CMD_ELF is not set +CONFIG_CMD_RUN=y +CONFIG_CMD_SAVEENV=y +CONFIG_CMD_PING=y +# CONFIG_CMD_LOADB is not set +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_FLASH=y +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_SETEXPR is not set +CONFIG_USE_PRIVATE_LIBGCC=y +CONFIG_SYS_MALLOC_F_LEN=0x200 +CONFIG_SYS_MALLOC_F=y diff --git a/include/955x.h b/include/955x.h new file mode 100644 index 0000000000..0c5f78a5c7 --- /dev/null +++ b/include/955x.h @@ -0,0 +1,3477 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _QCA955X_H +#define _QCA955X_H + +#ifndef __ASSEMBLY__ +#include +#include +#include +#include +#endif /* __ASSEMBLY__ */ + +#undef is_qca955x +#undef is_sco + +#define is_qca955x() (1) +#define is_sco() (1) + + +#define CPU_PLL_CONFIG_UPDATING_MSB 31 +#define CPU_PLL_CONFIG_UPDATING_LSB 31 +#define CPU_PLL_CONFIG_UPDATING_MASK 0x80000000 +#define CPU_PLL_CONFIG_UPDATING_GET(x) (((x) & CPU_PLL_CONFIG_UPDATING_MASK) >> CPU_PLL_CONFIG_UPDATING_LSB) +#define CPU_PLL_CONFIG_UPDATING_SET(x) (((x) << CPU_PLL_CONFIG_UPDATING_LSB) & CPU_PLL_CONFIG_UPDATING_MASK) +#define CPU_PLL_CONFIG_UPDATING_RESET 0x1 // 1 +#define CPU_PLL_CONFIG_PLLPWD_MSB 30 +#define CPU_PLL_CONFIG_PLLPWD_LSB 30 +#define CPU_PLL_CONFIG_PLLPWD_MASK 0x40000000 +#define CPU_PLL_CONFIG_PLLPWD_GET(x) (((x) & CPU_PLL_CONFIG_PLLPWD_MASK) >> CPU_PLL_CONFIG_PLLPWD_LSB) +#define CPU_PLL_CONFIG_PLLPWD_SET(x) (((x) << CPU_PLL_CONFIG_PLLPWD_LSB) & CPU_PLL_CONFIG_PLLPWD_MASK) +#define CPU_PLL_CONFIG_PLLPWD_RESET 0x1 // 1 +#define CPU_PLL_CONFIG_SPARE_MSB 29 +#define CPU_PLL_CONFIG_SPARE_LSB 22 +#define CPU_PLL_CONFIG_SPARE_MASK 0x3fc00000 +#define CPU_PLL_CONFIG_SPARE_GET(x) (((x) & CPU_PLL_CONFIG_SPARE_MASK) >> CPU_PLL_CONFIG_SPARE_LSB) +#define CPU_PLL_CONFIG_SPARE_SET(x) (((x) << CPU_PLL_CONFIG_SPARE_LSB) & CPU_PLL_CONFIG_SPARE_MASK) +#define CPU_PLL_CONFIG_SPARE_RESET 0x0 // 0 +#define CPU_PLL_CONFIG_OUTDIV_MSB 21 +#define CPU_PLL_CONFIG_OUTDIV_LSB 19 +#define CPU_PLL_CONFIG_OUTDIV_MASK 0x00380000 +#define CPU_PLL_CONFIG_OUTDIV_GET(x) (((x) & CPU_PLL_CONFIG_OUTDIV_MASK) >> CPU_PLL_CONFIG_OUTDIV_LSB) +#define CPU_PLL_CONFIG_OUTDIV_SET(x) (((x) << CPU_PLL_CONFIG_OUTDIV_LSB) & CPU_PLL_CONFIG_OUTDIV_MASK) +#define CPU_PLL_CONFIG_OUTDIV_RESET 0x0 // 0 +#define CPU_PLL_CONFIG_RANGE_MSB 18 +#define CPU_PLL_CONFIG_RANGE_LSB 17 +#define CPU_PLL_CONFIG_RANGE_MASK 0x00060000 +#define CPU_PLL_CONFIG_RANGE_GET(x) (((x) & CPU_PLL_CONFIG_RANGE_MASK) >> CPU_PLL_CONFIG_RANGE_LSB) +#define CPU_PLL_CONFIG_RANGE_SET(x) (((x) << CPU_PLL_CONFIG_RANGE_LSB) & CPU_PLL_CONFIG_RANGE_MASK) +#define CPU_PLL_CONFIG_RANGE_RESET 0x3 // 3 +#define CPU_PLL_CONFIG_REFDIV_MSB 16 +#define CPU_PLL_CONFIG_REFDIV_LSB 12 +#define CPU_PLL_CONFIG_REFDIV_MASK 0x0001f000 +#define CPU_PLL_CONFIG_REFDIV_GET(x) (((x) & CPU_PLL_CONFIG_REFDIV_MASK) >> CPU_PLL_CONFIG_REFDIV_LSB) +#define CPU_PLL_CONFIG_REFDIV_SET(x) (((x) << CPU_PLL_CONFIG_REFDIV_LSB) & CPU_PLL_CONFIG_REFDIV_MASK) +#define CPU_PLL_CONFIG_REFDIV_RESET 0x2 // 2 +#define CPU_PLL_CONFIG_NINT_MSB 11 +#define CPU_PLL_CONFIG_NINT_LSB 6 +#define CPU_PLL_CONFIG_NINT_MASK 0x00000fc0 +#define CPU_PLL_CONFIG_NINT_GET(x) (((x) & CPU_PLL_CONFIG_NINT_MASK) >> CPU_PLL_CONFIG_NINT_LSB) +#define CPU_PLL_CONFIG_NINT_SET(x) (((x) << CPU_PLL_CONFIG_NINT_LSB) & CPU_PLL_CONFIG_NINT_MASK) +#define CPU_PLL_CONFIG_NINT_RESET 0x14 // 20 +#define CPU_PLL_CONFIG_NFRAC_MSB 5 +#define CPU_PLL_CONFIG_NFRAC_LSB 0 +#define CPU_PLL_CONFIG_NFRAC_MASK 0x0000003f +#define CPU_PLL_CONFIG_NFRAC_GET(x) (((x) & CPU_PLL_CONFIG_NFRAC_MASK) >> CPU_PLL_CONFIG_NFRAC_LSB) +#define CPU_PLL_CONFIG_NFRAC_SET(x) (((x) << CPU_PLL_CONFIG_NFRAC_LSB) & CPU_PLL_CONFIG_NFRAC_MASK) +#define CPU_PLL_CONFIG_NFRAC_RESET 0x10 // 16 +#define CPU_PLL_CONFIG_ADDRESS 0x18050000 + +#define DDR_PLL_CONFIG_UPDATING_MSB 31 +#define DDR_PLL_CONFIG_UPDATING_LSB 31 +#define DDR_PLL_CONFIG_UPDATING_MASK 0x80000000 +#define DDR_PLL_CONFIG_UPDATING_GET(x) (((x) & DDR_PLL_CONFIG_UPDATING_MASK) >> DDR_PLL_CONFIG_UPDATING_LSB) +#define DDR_PLL_CONFIG_UPDATING_SET(x) (((x) << DDR_PLL_CONFIG_UPDATING_LSB) & DDR_PLL_CONFIG_UPDATING_MASK) +#define DDR_PLL_CONFIG_UPDATING_RESET 0x1 // 1 +#define DDR_PLL_CONFIG_PLLPWD_MSB 30 +#define DDR_PLL_CONFIG_PLLPWD_LSB 30 +#define DDR_PLL_CONFIG_PLLPWD_MASK 0x40000000 +#define DDR_PLL_CONFIG_PLLPWD_GET(x) (((x) & DDR_PLL_CONFIG_PLLPWD_MASK) >> DDR_PLL_CONFIG_PLLPWD_LSB) +#define DDR_PLL_CONFIG_PLLPWD_SET(x) (((x) << DDR_PLL_CONFIG_PLLPWD_LSB) & DDR_PLL_CONFIG_PLLPWD_MASK) +#define DDR_PLL_CONFIG_PLLPWD_RESET 0x1 // 1 +#define DDR_PLL_CONFIG_SPARE_MSB 29 +#define DDR_PLL_CONFIG_SPARE_LSB 26 +#define DDR_PLL_CONFIG_SPARE_MASK 0x3c000000 +#define DDR_PLL_CONFIG_SPARE_GET(x) (((x) & DDR_PLL_CONFIG_SPARE_MASK) >> DDR_PLL_CONFIG_SPARE_LSB) +#define DDR_PLL_CONFIG_SPARE_SET(x) (((x) << DDR_PLL_CONFIG_SPARE_LSB) & DDR_PLL_CONFIG_SPARE_MASK) +#define DDR_PLL_CONFIG_SPARE_RESET 0x0 // 0 +#define DDR_PLL_CONFIG_OUTDIV_MSB 25 +#define DDR_PLL_CONFIG_OUTDIV_LSB 23 +#define DDR_PLL_CONFIG_OUTDIV_MASK 0x03800000 +#define DDR_PLL_CONFIG_OUTDIV_GET(x) (((x) & DDR_PLL_CONFIG_OUTDIV_MASK) >> DDR_PLL_CONFIG_OUTDIV_LSB) +#define DDR_PLL_CONFIG_OUTDIV_SET(x) (((x) << DDR_PLL_CONFIG_OUTDIV_LSB) & DDR_PLL_CONFIG_OUTDIV_MASK) +#define DDR_PLL_CONFIG_OUTDIV_RESET 0x0 // 0 +#define DDR_PLL_CONFIG_RANGE_MSB 22 +#define DDR_PLL_CONFIG_RANGE_LSB 21 +#define DDR_PLL_CONFIG_RANGE_MASK 0x00600000 +#define DDR_PLL_CONFIG_RANGE_GET(x) (((x) & DDR_PLL_CONFIG_RANGE_MASK) >> DDR_PLL_CONFIG_RANGE_LSB) +#define DDR_PLL_CONFIG_RANGE_SET(x) (((x) << DDR_PLL_CONFIG_RANGE_LSB) & DDR_PLL_CONFIG_RANGE_MASK) +#define DDR_PLL_CONFIG_RANGE_RESET 0x3 // 3 +#define DDR_PLL_CONFIG_REFDIV_MSB 20 +#define DDR_PLL_CONFIG_REFDIV_LSB 16 +#define DDR_PLL_CONFIG_REFDIV_MASK 0x001f0000 +#define DDR_PLL_CONFIG_REFDIV_GET(x) (((x) & DDR_PLL_CONFIG_REFDIV_MASK) >> DDR_PLL_CONFIG_REFDIV_LSB) +#define DDR_PLL_CONFIG_REFDIV_SET(x) (((x) << DDR_PLL_CONFIG_REFDIV_LSB) & DDR_PLL_CONFIG_REFDIV_MASK) +#define DDR_PLL_CONFIG_REFDIV_RESET 0x2 // 2 +#define DDR_PLL_CONFIG_NINT_MSB 15 +#define DDR_PLL_CONFIG_NINT_LSB 10 +#define DDR_PLL_CONFIG_NINT_MASK 0x0000fc00 +#define DDR_PLL_CONFIG_NINT_GET(x) (((x) & DDR_PLL_CONFIG_NINT_MASK) >> DDR_PLL_CONFIG_NINT_LSB) +#define DDR_PLL_CONFIG_NINT_SET(x) (((x) << DDR_PLL_CONFIG_NINT_LSB) & DDR_PLL_CONFIG_NINT_MASK) +#define DDR_PLL_CONFIG_NINT_RESET 0x14 // 20 +#define DDR_PLL_CONFIG_NFRAC_MSB 9 +#define DDR_PLL_CONFIG_NFRAC_LSB 0 +#define DDR_PLL_CONFIG_NFRAC_MASK 0x000003ff +#define DDR_PLL_CONFIG_NFRAC_GET(x) (((x) & DDR_PLL_CONFIG_NFRAC_MASK) >> DDR_PLL_CONFIG_NFRAC_LSB) +#define DDR_PLL_CONFIG_NFRAC_SET(x) (((x) << DDR_PLL_CONFIG_NFRAC_LSB) & DDR_PLL_CONFIG_NFRAC_MASK) +#define DDR_PLL_CONFIG_NFRAC_RESET 0x200 // 512 +#define DDR_PLL_CONFIG_ADDRESS 0x18050004 + +#define DDR_CTL_CONFIG_SRAM_TSEL_MSB 31 +#define DDR_CTL_CONFIG_SRAM_TSEL_LSB 30 +#define DDR_CTL_CONFIG_SRAM_TSEL_MASK 0xc0000000 +#define DDR_CTL_CONFIG_SRAM_TSEL_GET(x) (((x) & DDR_CTL_CONFIG_SRAM_TSEL_MASK) >> DDR_CTL_CONFIG_SRAM_TSEL_LSB) +#define DDR_CTL_CONFIG_SRAM_TSEL_SET(x) (((x) << DDR_CTL_CONFIG_SRAM_TSEL_LSB) & DDR_CTL_CONFIG_SRAM_TSEL_MASK) +#define DDR_CTL_CONFIG_SRAM_TSEL_RESET 0x1 // 1 +#define DDR_CTL_CONFIG_CLIENT_ACTIVITY_MSB 29 +#define DDR_CTL_CONFIG_CLIENT_ACTIVITY_LSB 21 +#define DDR_CTL_CONFIG_CLIENT_ACTIVITY_MASK 0x3fe00000 +#define DDR_CTL_CONFIG_CLIENT_ACTIVITY_GET(x) (((x) & DDR_CTL_CONFIG_CLIENT_ACTIVITY_MASK) >> DDR_CTL_CONFIG_CLIENT_ACTIVITY_LSB) +#define DDR_CTL_CONFIG_CLIENT_ACTIVITY_SET(x) (((x) << DDR_CTL_CONFIG_CLIENT_ACTIVITY_LSB) & DDR_CTL_CONFIG_CLIENT_ACTIVITY_MASK) +#define DDR_CTL_CONFIG_CLIENT_ACTIVITY_RESET 0x0 // 0 +#define DDR_CTL_CONFIG_GE0_SRAM_SYNC_MSB 20 +#define DDR_CTL_CONFIG_GE0_SRAM_SYNC_LSB 20 +#define DDR_CTL_CONFIG_GE0_SRAM_SYNC_MASK 0x00100000 +#define DDR_CTL_CONFIG_GE0_SRAM_SYNC_GET(x) (((x) & DDR_CTL_CONFIG_GE0_SRAM_SYNC_MASK) >> DDR_CTL_CONFIG_GE0_SRAM_SYNC_LSB) +#define DDR_CTL_CONFIG_GE0_SRAM_SYNC_SET(x) (((x) << DDR_CTL_CONFIG_GE0_SRAM_SYNC_LSB) & DDR_CTL_CONFIG_GE0_SRAM_SYNC_MASK) +#define DDR_CTL_CONFIG_GE0_SRAM_SYNC_RESET 0x1 // 1 +#define DDR_CTL_CONFIG_GE1_SRAM_SYNC_MSB 19 +#define DDR_CTL_CONFIG_GE1_SRAM_SYNC_LSB 19 +#define DDR_CTL_CONFIG_GE1_SRAM_SYNC_MASK 0x00080000 +#define DDR_CTL_CONFIG_GE1_SRAM_SYNC_GET(x) (((x) & DDR_CTL_CONFIG_GE1_SRAM_SYNC_MASK) >> DDR_CTL_CONFIG_GE1_SRAM_SYNC_LSB) +#define DDR_CTL_CONFIG_GE1_SRAM_SYNC_SET(x) (((x) << DDR_CTL_CONFIG_GE1_SRAM_SYNC_LSB) & DDR_CTL_CONFIG_GE1_SRAM_SYNC_MASK) +#define DDR_CTL_CONFIG_GE1_SRAM_SYNC_RESET 0x1 // 1 +#define DDR_CTL_CONFIG_USB_SRAM_SYNC_MSB 18 +#define DDR_CTL_CONFIG_USB_SRAM_SYNC_LSB 18 +#define DDR_CTL_CONFIG_USB_SRAM_SYNC_MASK 0x00040000 +#define DDR_CTL_CONFIG_USB_SRAM_SYNC_GET(x) (((x) & DDR_CTL_CONFIG_USB_SRAM_SYNC_MASK) >> DDR_CTL_CONFIG_USB_SRAM_SYNC_LSB) +#define DDR_CTL_CONFIG_USB_SRAM_SYNC_SET(x) (((x) << DDR_CTL_CONFIG_USB_SRAM_SYNC_LSB) & DDR_CTL_CONFIG_USB_SRAM_SYNC_MASK) +#define DDR_CTL_CONFIG_USB_SRAM_SYNC_RESET 0x1 // 1 +#define DDR_CTL_CONFIG_PCIE_SRAM_SYNC_MSB 17 +#define DDR_CTL_CONFIG_PCIE_SRAM_SYNC_LSB 17 +#define DDR_CTL_CONFIG_PCIE_SRAM_SYNC_MASK 0x00020000 +#define DDR_CTL_CONFIG_PCIE_SRAM_SYNC_GET(x) (((x) & DDR_CTL_CONFIG_PCIE_SRAM_SYNC_MASK) >> DDR_CTL_CONFIG_PCIE_SRAM_SYNC_LSB) +#define DDR_CTL_CONFIG_PCIE_SRAM_SYNC_SET(x) (((x) << DDR_CTL_CONFIG_PCIE_SRAM_SYNC_LSB) & DDR_CTL_CONFIG_PCIE_SRAM_SYNC_MASK) +#define DDR_CTL_CONFIG_PCIE_SRAM_SYNC_RESET 0x1 // 1 +#define DDR_CTL_CONFIG_WMAC_SRAM_SYNC_MSB 16 +#define DDR_CTL_CONFIG_WMAC_SRAM_SYNC_LSB 16 +#define DDR_CTL_CONFIG_WMAC_SRAM_SYNC_MASK 0x00010000 +#define DDR_CTL_CONFIG_WMAC_SRAM_SYNC_GET(x) (((x) & DDR_CTL_CONFIG_WMAC_SRAM_SYNC_MASK) >> DDR_CTL_CONFIG_WMAC_SRAM_SYNC_LSB) +#define DDR_CTL_CONFIG_WMAC_SRAM_SYNC_SET(x) (((x) << DDR_CTL_CONFIG_WMAC_SRAM_SYNC_LSB) & DDR_CTL_CONFIG_WMAC_SRAM_SYNC_MASK) +#define DDR_CTL_CONFIG_WMAC_SRAM_SYNC_RESET 0x1 // 1 +#define DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_MSB 15 +#define DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_LSB 15 +#define DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_MASK 0x00008000 +#define DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_GET(x) (((x) & DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_MASK) >> DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_LSB) +#define DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_SET(x) (((x) << DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_LSB) & DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_MASK) +#define DDR_CTL_CONFIG_MISC_SRC1_SRAM_SYNC_RESET 0x1 // 1 +#define DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_MSB 14 +#define DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_LSB 14 +#define DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_MASK 0x00004000 +#define DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_GET(x) (((x) & DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_MASK) >> DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_LSB) +#define DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_SET(x) (((x) << DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_LSB) & DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_MASK) +#define DDR_CTL_CONFIG_MISC_SRC2_SRAM_SYNC_RESET 0x1 // 1 +#define DDR_CTL_CONFIG_SPARE_MSB 13 +#define DDR_CTL_CONFIG_SPARE_LSB 7 +#define DDR_CTL_CONFIG_SPARE_MASK 0x00003f80 +#define DDR_CTL_CONFIG_SPARE_GET(x) (((x) & DDR_CTL_CONFIG_SPARE_MASK) >> DDR_CTL_CONFIG_SPARE_LSB) +#define DDR_CTL_CONFIG_SPARE_SET(x) (((x) << DDR_CTL_CONFIG_SPARE_LSB) & DDR_CTL_CONFIG_SPARE_MASK) +#define DDR_CTL_CONFIG_SPARE_RESET 0x0 // 0 +#define DDR_CTL_CONFIG_PAD_DDR2_SEL_MSB 6 +#define DDR_CTL_CONFIG_PAD_DDR2_SEL_LSB 6 +#define DDR_CTL_CONFIG_PAD_DDR2_SEL_MASK 0x00000040 +#define DDR_CTL_CONFIG_PAD_DDR2_SEL_GET(x) (((x) & DDR_CTL_CONFIG_PAD_DDR2_SEL_MASK) >> DDR_CTL_CONFIG_PAD_DDR2_SEL_LSB) +#define DDR_CTL_CONFIG_PAD_DDR2_SEL_SET(x) (((x) << DDR_CTL_CONFIG_PAD_DDR2_SEL_LSB) & DDR_CTL_CONFIG_PAD_DDR2_SEL_MASK) +#define DDR_CTL_CONFIG_PAD_DDR2_SEL_RESET 0x0 // 0 +#define DDR_CTL_CONFIG_GATE_SRAM_CLK_MSB 4 +#define DDR_CTL_CONFIG_GATE_SRAM_CLK_LSB 4 +#define DDR_CTL_CONFIG_GATE_SRAM_CLK_MASK 0x00000010 +#define DDR_CTL_CONFIG_GATE_SRAM_CLK_GET(x) (((x) & DDR_CTL_CONFIG_GATE_SRAM_CLK_MASK) >> DDR_CTL_CONFIG_GATE_SRAM_CLK_LSB) +#define DDR_CTL_CONFIG_GATE_SRAM_CLK_SET(x) (((x) << DDR_CTL_CONFIG_GATE_SRAM_CLK_LSB) & DDR_CTL_CONFIG_GATE_SRAM_CLK_MASK) +#define DDR_CTL_CONFIG_GATE_SRAM_CLK_RESET 0x0 // 0 +#define DDR_CTL_CONFIG_SRAM_REQ_ACK_MSB 3 +#define DDR_CTL_CONFIG_SRAM_REQ_ACK_LSB 3 +#define DDR_CTL_CONFIG_SRAM_REQ_ACK_MASK 0x00000008 +#define DDR_CTL_CONFIG_SRAM_REQ_ACK_GET(x) (((x) & DDR_CTL_CONFIG_SRAM_REQ_ACK_MASK) >> DDR_CTL_CONFIG_SRAM_REQ_ACK_LSB) +#define DDR_CTL_CONFIG_SRAM_REQ_ACK_SET(x) (((x) << DDR_CTL_CONFIG_SRAM_REQ_ACK_LSB) & DDR_CTL_CONFIG_SRAM_REQ_ACK_MASK) +#define DDR_CTL_CONFIG_SRAM_REQ_ACK_RESET 0x0 // 0 +#define DDR_CTL_CONFIG_CPU_DDR_SYNC_MSB 2 +#define DDR_CTL_CONFIG_CPU_DDR_SYNC_LSB 2 +#define DDR_CTL_CONFIG_CPU_DDR_SYNC_MASK 0x00000004 +#define DDR_CTL_CONFIG_CPU_DDR_SYNC_GET(x) (((x) & DDR_CTL_CONFIG_CPU_DDR_SYNC_MASK) >> DDR_CTL_CONFIG_CPU_DDR_SYNC_LSB) +#define DDR_CTL_CONFIG_CPU_DDR_SYNC_SET(x) (((x) << DDR_CTL_CONFIG_CPU_DDR_SYNC_LSB) & DDR_CTL_CONFIG_CPU_DDR_SYNC_MASK) +#define DDR_CTL_CONFIG_CPU_DDR_SYNC_RESET 0x0 // 0 +#define DDR_CTL_CONFIG_HALF_WIDTH_MSB 1 +#define DDR_CTL_CONFIG_HALF_WIDTH_LSB 1 +#define DDR_CTL_CONFIG_HALF_WIDTH_MASK 0x00000002 +#define DDR_CTL_CONFIG_HALF_WIDTH_GET(x) (((x) & DDR_CTL_CONFIG_HALF_WIDTH_MASK) >> DDR_CTL_CONFIG_HALF_WIDTH_LSB) +#define DDR_CTL_CONFIG_HALF_WIDTH_SET(x) (((x) << DDR_CTL_CONFIG_HALF_WIDTH_LSB) & DDR_CTL_CONFIG_HALF_WIDTH_MASK) +#define DDR_CTL_CONFIG_HALF_WIDTH_RESET 0x1 // 1 +#define DDR_CTL_CONFIG_SDRAM_MODE_EN_MSB 0 +#define DDR_CTL_CONFIG_SDRAM_MODE_EN_LSB 0 +#define DDR_CTL_CONFIG_SDRAM_MODE_EN_MASK 0x00000001 +#define DDR_CTL_CONFIG_SDRAM_MODE_EN_GET(x) (((x) & DDR_CTL_CONFIG_SDRAM_MODE_EN_MASK) >> DDR_CTL_CONFIG_SDRAM_MODE_EN_LSB) +#define DDR_CTL_CONFIG_SDRAM_MODE_EN_SET(x) (((x) << DDR_CTL_CONFIG_SDRAM_MODE_EN_LSB) & DDR_CTL_CONFIG_SDRAM_MODE_EN_MASK) +#define DDR_CTL_CONFIG_SDRAM_MODE_EN_RESET 0x0 // 0 +#define DDR_CTL_CONFIG_ADDRESS 0x18000108 + +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_MSB 31 +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_LSB 31 +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_MASK 0x80000000 +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_GET(x) (((x) & DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_MASK) >> DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_LSB) +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_SET(x) (((x) << DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_LSB) & DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_MASK) +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQ_RESET 0x0 // 0 +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_MSB 30 +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_LSB 30 +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_MASK 0x40000000 +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_GET(x) (((x) & DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_MASK) >> DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_LSB) +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_SET(x) (((x) << DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_LSB) & DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_MASK) +#define DDR_DEBUG_RD_CNTL_FORCE_WR_DQS_RESET 0x0 // 0 +#define DDR_DEBUG_RD_CNTL_USE_LB_CLK_MSB 29 +#define DDR_DEBUG_RD_CNTL_USE_LB_CLK_LSB 29 +#define DDR_DEBUG_RD_CNTL_USE_LB_CLK_MASK 0x20000000 +#define DDR_DEBUG_RD_CNTL_USE_LB_CLK_GET(x) (((x) & DDR_DEBUG_RD_CNTL_USE_LB_CLK_MASK) >> DDR_DEBUG_RD_CNTL_USE_LB_CLK_LSB) +#define DDR_DEBUG_RD_CNTL_USE_LB_CLK_SET(x) (((x) << DDR_DEBUG_RD_CNTL_USE_LB_CLK_LSB) & DDR_DEBUG_RD_CNTL_USE_LB_CLK_MASK) +#define DDR_DEBUG_RD_CNTL_USE_LB_CLK_RESET 0x0 // 0 +#define DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_MSB 28 +#define DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_LSB 28 +#define DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_MASK 0x10000000 +#define DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_GET(x) (((x) & DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_MASK) >> DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_LSB) +#define DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_SET(x) (((x) << DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_LSB) & DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_MASK) +#define DDR_DEBUG_RD_CNTL_LB_SRC_CK_P_RESET 0x1 // 1 +#define DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_MSB 27 +#define DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_LSB 27 +#define DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_MASK 0x08000000 +#define DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_GET(x) (((x) & DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_MASK) >> DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_LSB) +#define DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_SET(x) (((x) << DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_LSB) & DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_MASK) +#define DDR_DEBUG_RD_CNTL_EN_RD_ON_WR_RESET 0x0 // 0 +#define DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_MSB 14 +#define DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_LSB 13 +#define DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_MASK 0x00006000 +#define DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_GET(x) (((x) & DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_MASK) >> DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_LSB) +#define DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_SET(x) (((x) << DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_LSB) & DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_MASK) +#define DDR_DEBUG_RD_CNTL_GATE_TAP_PDLY_RESET 0x0 // 0 +#define DDR_DEBUG_RD_CNTL_GATE_TAP_MSB 12 +#define DDR_DEBUG_RD_CNTL_GATE_TAP_LSB 8 +#define DDR_DEBUG_RD_CNTL_GATE_TAP_MASK 0x00001f00 +#define DDR_DEBUG_RD_CNTL_GATE_TAP_GET(x) (((x) & DDR_DEBUG_RD_CNTL_GATE_TAP_MASK) >> DDR_DEBUG_RD_CNTL_GATE_TAP_LSB) +#define DDR_DEBUG_RD_CNTL_GATE_TAP_SET(x) (((x) << DDR_DEBUG_RD_CNTL_GATE_TAP_LSB) & DDR_DEBUG_RD_CNTL_GATE_TAP_MASK) +#define DDR_DEBUG_RD_CNTL_GATE_TAP_RESET 0x1 // 1 +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_MSB 6 +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_LSB 5 +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_MASK 0x00000060 +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_GET(x) (((x) & DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_MASK) >> DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_LSB) +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_SET(x) (((x) << DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_LSB) & DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_MASK) +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_PDLY_RESET 0x0 // 0 +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_MSB 4 +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_LSB 0 +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_MASK 0x0000001f +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_GET(x) (((x) & DDR_DEBUG_RD_CNTL_CK_P_TAP_MASK) >> DDR_DEBUG_RD_CNTL_CK_P_TAP_LSB) +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_SET(x) (((x) << DDR_DEBUG_RD_CNTL_CK_P_TAP_LSB) & DDR_DEBUG_RD_CNTL_CK_P_TAP_MASK) +#define DDR_DEBUG_RD_CNTL_CK_P_TAP_RESET 0x1 // 1 +#define DDR_DEBUG_RD_CNTL_ADDRESS 0x18000118 + +#define DDR2_CONFIG_DDR2_TWL_MSB 13 +#define DDR2_CONFIG_DDR2_TWL_LSB 10 +#define DDR2_CONFIG_DDR2_TWL_MASK 0x00003c00 +#define DDR2_CONFIG_DDR2_TWL_GET(x) (((x) & DDR2_CONFIG_DDR2_TWL_MASK) >> DDR2_CONFIG_DDR2_TWL_LSB) +#define DDR2_CONFIG_DDR2_TWL_SET(x) (((x) << DDR2_CONFIG_DDR2_TWL_LSB) & DDR2_CONFIG_DDR2_TWL_MASK) +#define DDR2_CONFIG_DDR2_TWL_RESET 0x1 // 1 +#define DDR2_CONFIG_DDR2_ODT_MSB 9 +#define DDR2_CONFIG_DDR2_ODT_LSB 9 +#define DDR2_CONFIG_DDR2_ODT_MASK 0x00000200 +#define DDR2_CONFIG_DDR2_ODT_GET(x) (((x) & DDR2_CONFIG_DDR2_ODT_MASK) >> DDR2_CONFIG_DDR2_ODT_LSB) +#define DDR2_CONFIG_DDR2_ODT_SET(x) (((x) << DDR2_CONFIG_DDR2_ODT_LSB) & DDR2_CONFIG_DDR2_ODT_MASK) +#define DDR2_CONFIG_DDR2_ODT_RESET 0x1 // 1 +#define DDR2_CONFIG_TFAW_MSB 7 +#define DDR2_CONFIG_TFAW_LSB 2 +#define DDR2_CONFIG_TFAW_MASK 0x000000fc +#define DDR2_CONFIG_TFAW_GET(x) (((x) & DDR2_CONFIG_TFAW_MASK) >> DDR2_CONFIG_TFAW_LSB) +#define DDR2_CONFIG_TFAW_SET(x) (((x) << DDR2_CONFIG_TFAW_LSB) & DDR2_CONFIG_TFAW_MASK) +#define DDR2_CONFIG_TFAW_RESET 0x16 // 22 +#define DDR2_CONFIG_ENABLE_DDR2_MSB 0 +#define DDR2_CONFIG_ENABLE_DDR2_LSB 0 +#define DDR2_CONFIG_ENABLE_DDR2_MASK 0x00000001 +#define DDR2_CONFIG_ENABLE_DDR2_GET(x) (((x) & DDR2_CONFIG_ENABLE_DDR2_MASK) >> DDR2_CONFIG_ENABLE_DDR2_LSB) +#define DDR2_CONFIG_ENABLE_DDR2_SET(x) (((x) << DDR2_CONFIG_ENABLE_DDR2_LSB) & DDR2_CONFIG_ENABLE_DDR2_MASK) +#define DDR2_CONFIG_ENABLE_DDR2_RESET 0x0 // 0 +#define DDR2_CONFIG_ADDRESS 0x180000b8 + +#define DDR_CONTROL_EMR3S_MSB 5 +#define DDR_CONTROL_EMR3S_LSB 5 +#define DDR_CONTROL_EMR3S_MASK 0x00000020 +#define DDR_CONTROL_EMR3S_GET(x) (((x) & DDR_CONTROL_EMR3S_MASK) >> DDR_CONTROL_EMR3S_LSB) +#define DDR_CONTROL_EMR3S_SET(x) (((x) << DDR_CONTROL_EMR3S_LSB) & DDR_CONTROL_EMR3S_MASK) +#define DDR_CONTROL_EMR3S_RESET 0x0 // 0 +#define DDR_CONTROL_EMR2S_MSB 4 +#define DDR_CONTROL_EMR2S_LSB 4 +#define DDR_CONTROL_EMR2S_MASK 0x00000010 +#define DDR_CONTROL_EMR2S_GET(x) (((x) & DDR_CONTROL_EMR2S_MASK) >> DDR_CONTROL_EMR2S_LSB) +#define DDR_CONTROL_EMR2S_SET(x) (((x) << DDR_CONTROL_EMR2S_LSB) & DDR_CONTROL_EMR2S_MASK) +#define DDR_CONTROL_EMR2S_RESET 0x0 // 0 +#define DDR_CONTROL_PREA_MSB 3 +#define DDR_CONTROL_PREA_LSB 3 +#define DDR_CONTROL_PREA_MASK 0x00000008 +#define DDR_CONTROL_PREA_GET(x) (((x) & DDR_CONTROL_PREA_MASK) >> DDR_CONTROL_PREA_LSB) +#define DDR_CONTROL_PREA_SET(x) (((x) << DDR_CONTROL_PREA_LSB) & DDR_CONTROL_PREA_MASK) +#define DDR_CONTROL_PREA_RESET 0x0 // 0 +#define DDR_CONTROL_REF_MSB 2 +#define DDR_CONTROL_REF_LSB 2 +#define DDR_CONTROL_REF_MASK 0x00000004 +#define DDR_CONTROL_REF_GET(x) (((x) & DDR_CONTROL_REF_MASK) >> DDR_CONTROL_REF_LSB) +#define DDR_CONTROL_REF_SET(x) (((x) << DDR_CONTROL_REF_LSB) & DDR_CONTROL_REF_MASK) +#define DDR_CONTROL_REF_RESET 0x0 // 0 +#define DDR_CONTROL_EMRS_MSB 1 +#define DDR_CONTROL_EMRS_LSB 1 +#define DDR_CONTROL_EMRS_MASK 0x00000002 +#define DDR_CONTROL_EMRS_GET(x) (((x) & DDR_CONTROL_EMRS_MASK) >> DDR_CONTROL_EMRS_LSB) +#define DDR_CONTROL_EMRS_SET(x) (((x) << DDR_CONTROL_EMRS_LSB) & DDR_CONTROL_EMRS_MASK) +#define DDR_CONTROL_EMRS_RESET 0x0 // 0 +#define DDR_CONTROL_MRS_MSB 0 +#define DDR_CONTROL_MRS_LSB 0 +#define DDR_CONTROL_MRS_MASK 0x00000001 +#define DDR_CONTROL_MRS_GET(x) (((x) & DDR_CONTROL_MRS_MASK) >> DDR_CONTROL_MRS_LSB) +#define DDR_CONTROL_MRS_SET(x) (((x) << DDR_CONTROL_MRS_LSB) & DDR_CONTROL_MRS_MASK) +#define DDR_CONTROL_MRS_RESET 0x0 // 0 +#define DDR_CONTROL_ADDRESS 0x18000010 + +#define DDR_CONFIG_CAS_LATENCY_MSB_MSB 31 +#define DDR_CONFIG_CAS_LATENCY_MSB_LSB 31 +#define DDR_CONFIG_CAS_LATENCY_MSB_MASK 0x80000000 +#define DDR_CONFIG_CAS_LATENCY_MSB_GET(x) (((x) & DDR_CONFIG_CAS_LATENCY_MSB_MASK) >> DDR_CONFIG_CAS_LATENCY_MSB_LSB) +#define DDR_CONFIG_CAS_LATENCY_MSB_SET(x) (((x) << DDR_CONFIG_CAS_LATENCY_MSB_LSB) & DDR_CONFIG_CAS_LATENCY_MSB_MASK) +#define DDR_CONFIG_CAS_LATENCY_MSB_RESET 0x0 // 0 +#define DDR_CONFIG_OPEN_PAGE_MSB 30 +#define DDR_CONFIG_OPEN_PAGE_LSB 30 +#define DDR_CONFIG_OPEN_PAGE_MASK 0x40000000 +#define DDR_CONFIG_OPEN_PAGE_GET(x) (((x) & DDR_CONFIG_OPEN_PAGE_MASK) >> DDR_CONFIG_OPEN_PAGE_LSB) +#define DDR_CONFIG_OPEN_PAGE_SET(x) (((x) << DDR_CONFIG_OPEN_PAGE_LSB) & DDR_CONFIG_OPEN_PAGE_MASK) +#define DDR_CONFIG_OPEN_PAGE_RESET 0x1 // 1 +#define DDR_CONFIG_CAS_LATENCY_MSB 29 +#define DDR_CONFIG_CAS_LATENCY_LSB 27 +#define DDR_CONFIG_CAS_LATENCY_MASK 0x38000000 +#define DDR_CONFIG_CAS_LATENCY_GET(x) (((x) & DDR_CONFIG_CAS_LATENCY_MASK) >> DDR_CONFIG_CAS_LATENCY_LSB) +#define DDR_CONFIG_CAS_LATENCY_SET(x) (((x) << DDR_CONFIG_CAS_LATENCY_LSB) & DDR_CONFIG_CAS_LATENCY_MASK) +#define DDR_CONFIG_CAS_LATENCY_RESET 0x6 // 6 +#define DDR_CONFIG_TMRD_MSB 26 +#define DDR_CONFIG_TMRD_LSB 23 +#define DDR_CONFIG_TMRD_MASK 0x07800000 +#define DDR_CONFIG_TMRD_GET(x) (((x) & DDR_CONFIG_TMRD_MASK) >> DDR_CONFIG_TMRD_LSB) +#define DDR_CONFIG_TMRD_SET(x) (((x) << DDR_CONFIG_TMRD_LSB) & DDR_CONFIG_TMRD_MASK) +#define DDR_CONFIG_TMRD_RESET 0xf // 15 +#define DDR_CONFIG_TRFC_MSB 22 +#define DDR_CONFIG_TRFC_LSB 17 +#define DDR_CONFIG_TRFC_MASK 0x007e0000 +#define DDR_CONFIG_TRFC_GET(x) (((x) & DDR_CONFIG_TRFC_MASK) >> DDR_CONFIG_TRFC_LSB) +#define DDR_CONFIG_TRFC_SET(x) (((x) << DDR_CONFIG_TRFC_LSB) & DDR_CONFIG_TRFC_MASK) +#define DDR_CONFIG_TRFC_RESET 0x24 // 36 +#define DDR_CONFIG_TRRD_MSB 16 +#define DDR_CONFIG_TRRD_LSB 13 +#define DDR_CONFIG_TRRD_MASK 0x0001e000 +#define DDR_CONFIG_TRRD_GET(x) (((x) & DDR_CONFIG_TRRD_MASK) >> DDR_CONFIG_TRRD_LSB) +#define DDR_CONFIG_TRRD_SET(x) (((x) << DDR_CONFIG_TRRD_LSB) & DDR_CONFIG_TRRD_MASK) +#define DDR_CONFIG_TRRD_RESET 0x4 // 4 +#define DDR_CONFIG_TRP_MSB 12 +#define DDR_CONFIG_TRP_LSB 9 +#define DDR_CONFIG_TRP_MASK 0x00001e00 +#define DDR_CONFIG_TRP_GET(x) (((x) & DDR_CONFIG_TRP_MASK) >> DDR_CONFIG_TRP_LSB) +#define DDR_CONFIG_TRP_SET(x) (((x) << DDR_CONFIG_TRP_LSB) & DDR_CONFIG_TRP_MASK) +#define DDR_CONFIG_TRP_RESET 0x6 // 6 +#define DDR_CONFIG_TRCD_MSB 8 +#define DDR_CONFIG_TRCD_LSB 5 +#define DDR_CONFIG_TRCD_MASK 0x000001e0 +#define DDR_CONFIG_TRCD_GET(x) (((x) & DDR_CONFIG_TRCD_MASK) >> DDR_CONFIG_TRCD_LSB) +#define DDR_CONFIG_TRCD_SET(x) (((x) << DDR_CONFIG_TRCD_LSB) & DDR_CONFIG_TRCD_MASK) +#define DDR_CONFIG_TRCD_RESET 0x6 // 6 +#define DDR_CONFIG_TRAS_MSB 4 +#define DDR_CONFIG_TRAS_LSB 0 +#define DDR_CONFIG_TRAS_MASK 0x0000001f +#define DDR_CONFIG_TRAS_GET(x) (((x) & DDR_CONFIG_TRAS_MASK) >> DDR_CONFIG_TRAS_LSB) +#define DDR_CONFIG_TRAS_SET(x) (((x) << DDR_CONFIG_TRAS_LSB) & DDR_CONFIG_TRAS_MASK) +#define DDR_CONFIG_TRAS_RESET 0x10 // 16 +#define DDR_CONFIG_ADDRESS 0x18000000 + +#define DDR_CONFIG2_HALF_WIDTH_LOW_MSB 31 +#define DDR_CONFIG2_HALF_WIDTH_LOW_LSB 31 +#define DDR_CONFIG2_HALF_WIDTH_LOW_MASK 0x80000000 +#define DDR_CONFIG2_HALF_WIDTH_LOW_GET(x) (((x) & DDR_CONFIG2_HALF_WIDTH_LOW_MASK) >> DDR_CONFIG2_HALF_WIDTH_LOW_LSB) +#define DDR_CONFIG2_HALF_WIDTH_LOW_SET(x) (((x) << DDR_CONFIG2_HALF_WIDTH_LOW_LSB) & DDR_CONFIG2_HALF_WIDTH_LOW_MASK) +#define DDR_CONFIG2_HALF_WIDTH_LOW_RESET 0x1 // 1 +#define DDR_CONFIG2_SWAP_A26_A27_MSB 30 +#define DDR_CONFIG2_SWAP_A26_A27_LSB 30 +#define DDR_CONFIG2_SWAP_A26_A27_MASK 0x40000000 +#define DDR_CONFIG2_SWAP_A26_A27_GET(x) (((x) & DDR_CONFIG2_SWAP_A26_A27_MASK) >> DDR_CONFIG2_SWAP_A26_A27_LSB) +#define DDR_CONFIG2_SWAP_A26_A27_SET(x) (((x) << DDR_CONFIG2_SWAP_A26_A27_LSB) & DDR_CONFIG2_SWAP_A26_A27_MASK) +#define DDR_CONFIG2_SWAP_A26_A27_RESET 0x0 // 0 +#define DDR_CONFIG2_GATE_OPEN_LATENCY_MSB 29 +#define DDR_CONFIG2_GATE_OPEN_LATENCY_LSB 26 +#define DDR_CONFIG2_GATE_OPEN_LATENCY_MASK 0x3c000000 +#define DDR_CONFIG2_GATE_OPEN_LATENCY_GET(x) (((x) & DDR_CONFIG2_GATE_OPEN_LATENCY_MASK) >> DDR_CONFIG2_GATE_OPEN_LATENCY_LSB) +#define DDR_CONFIG2_GATE_OPEN_LATENCY_SET(x) (((x) << DDR_CONFIG2_GATE_OPEN_LATENCY_LSB) & DDR_CONFIG2_GATE_OPEN_LATENCY_MASK) +#define DDR_CONFIG2_GATE_OPEN_LATENCY_RESET 0x6 // 6 +#define DDR_CONFIG2_TWTR_MSB 25 +#define DDR_CONFIG2_TWTR_LSB 21 +#define DDR_CONFIG2_TWTR_MASK 0x03e00000 +#define DDR_CONFIG2_TWTR_GET(x) (((x) & DDR_CONFIG2_TWTR_MASK) >> DDR_CONFIG2_TWTR_LSB) +#define DDR_CONFIG2_TWTR_SET(x) (((x) << DDR_CONFIG2_TWTR_LSB) & DDR_CONFIG2_TWTR_MASK) +#define DDR_CONFIG2_TWTR_RESET 0xe // 14 +#define DDR_CONFIG2_TRTP_MSB 20 +#define DDR_CONFIG2_TRTP_LSB 17 +#define DDR_CONFIG2_TRTP_MASK 0x001e0000 +#define DDR_CONFIG2_TRTP_GET(x) (((x) & DDR_CONFIG2_TRTP_MASK) >> DDR_CONFIG2_TRTP_LSB) +#define DDR_CONFIG2_TRTP_SET(x) (((x) << DDR_CONFIG2_TRTP_LSB) & DDR_CONFIG2_TRTP_MASK) +#define DDR_CONFIG2_TRTP_RESET 0x8 // 8 +#define DDR_CONFIG2_TRTW_MSB 16 +#define DDR_CONFIG2_TRTW_LSB 12 +#define DDR_CONFIG2_TRTW_MASK 0x0001f000 +#define DDR_CONFIG2_TRTW_GET(x) (((x) & DDR_CONFIG2_TRTW_MASK) >> DDR_CONFIG2_TRTW_LSB) +#define DDR_CONFIG2_TRTW_SET(x) (((x) << DDR_CONFIG2_TRTW_LSB) & DDR_CONFIG2_TRTW_MASK) +#define DDR_CONFIG2_TRTW_RESET 0x10 // 16 +#define DDR_CONFIG2_TWR_MSB 11 +#define DDR_CONFIG2_TWR_LSB 8 +#define DDR_CONFIG2_TWR_MASK 0x00000f00 +#define DDR_CONFIG2_TWR_GET(x) (((x) & DDR_CONFIG2_TWR_MASK) >> DDR_CONFIG2_TWR_LSB) +#define DDR_CONFIG2_TWR_SET(x) (((x) << DDR_CONFIG2_TWR_LSB) & DDR_CONFIG2_TWR_MASK) +#define DDR_CONFIG2_TWR_RESET 0x6 // 6 +#define DDR_CONFIG2_CKE_MSB 7 +#define DDR_CONFIG2_CKE_LSB 7 +#define DDR_CONFIG2_CKE_MASK 0x00000080 +#define DDR_CONFIG2_CKE_GET(x) (((x) & DDR_CONFIG2_CKE_MASK) >> DDR_CONFIG2_CKE_LSB) +#define DDR_CONFIG2_CKE_SET(x) (((x) << DDR_CONFIG2_CKE_LSB) & DDR_CONFIG2_CKE_MASK) +#define DDR_CONFIG2_CKE_RESET 0x0 // 0 +#define DDR_CONFIG2_PHASE_SELECT_MSB 6 +#define DDR_CONFIG2_PHASE_SELECT_LSB 6 +#define DDR_CONFIG2_PHASE_SELECT_MASK 0x00000040 +#define DDR_CONFIG2_PHASE_SELECT_GET(x) (((x) & DDR_CONFIG2_PHASE_SELECT_MASK) >> DDR_CONFIG2_PHASE_SELECT_LSB) +#define DDR_CONFIG2_PHASE_SELECT_SET(x) (((x) << DDR_CONFIG2_PHASE_SELECT_LSB) & DDR_CONFIG2_PHASE_SELECT_MASK) +#define DDR_CONFIG2_PHASE_SELECT_RESET 0x0 // 0 +#define DDR_CONFIG2_CNTL_OE_EN_MSB 5 +#define DDR_CONFIG2_CNTL_OE_EN_LSB 5 +#define DDR_CONFIG2_CNTL_OE_EN_MASK 0x00000020 +#define DDR_CONFIG2_CNTL_OE_EN_GET(x) (((x) & DDR_CONFIG2_CNTL_OE_EN_MASK) >> DDR_CONFIG2_CNTL_OE_EN_LSB) +#define DDR_CONFIG2_CNTL_OE_EN_SET(x) (((x) << DDR_CONFIG2_CNTL_OE_EN_LSB) & DDR_CONFIG2_CNTL_OE_EN_MASK) +#define DDR_CONFIG2_CNTL_OE_EN_RESET 0x1 // 1 +#define DDR_CONFIG2_BURST_TYPE_MSB 4 +#define DDR_CONFIG2_BURST_TYPE_LSB 4 +#define DDR_CONFIG2_BURST_TYPE_MASK 0x00000010 +#define DDR_CONFIG2_BURST_TYPE_GET(x) (((x) & DDR_CONFIG2_BURST_TYPE_MASK) >> DDR_CONFIG2_BURST_TYPE_LSB) +#define DDR_CONFIG2_BURST_TYPE_SET(x) (((x) << DDR_CONFIG2_BURST_TYPE_LSB) & DDR_CONFIG2_BURST_TYPE_MASK) +#define DDR_CONFIG2_BURST_TYPE_RESET 0x0 // 0 +#define DDR_CONFIG2_BURST_LENGTH_MSB 3 +#define DDR_CONFIG2_BURST_LENGTH_LSB 0 +#define DDR_CONFIG2_BURST_LENGTH_MASK 0x0000000f +#define DDR_CONFIG2_BURST_LENGTH_GET(x) (((x) & DDR_CONFIG2_BURST_LENGTH_MASK) >> DDR_CONFIG2_BURST_LENGTH_LSB) +#define DDR_CONFIG2_BURST_LENGTH_SET(x) (((x) << DDR_CONFIG2_BURST_LENGTH_LSB) & DDR_CONFIG2_BURST_LENGTH_MASK) +#define DDR_CONFIG2_BURST_LENGTH_RESET 0x8 // 8 +#define DDR_CONFIG2_ADDRESS 0x18000004 + +#define DDR_CONFIG_3_SPARE_MSB 31 +#define DDR_CONFIG_3_SPARE_LSB 4 +#define DDR_CONFIG_3_SPARE_MASK 0xfffffff0 +#define DDR_CONFIG_3_SPARE_GET(x) (((x) & DDR_CONFIG_3_SPARE_MASK) >> DDR_CONFIG_3_SPARE_LSB) +#define DDR_CONFIG_3_SPARE_SET(x) (((x) << DDR_CONFIG_3_SPARE_LSB) & DDR_CONFIG_3_SPARE_MASK) +#define DDR_CONFIG_3_SPARE_RESET 0x0 // 0 +#define DDR_CONFIG_3_TWR_MSB_MSB 3 +#define DDR_CONFIG_3_TWR_MSB_LSB 3 +#define DDR_CONFIG_3_TWR_MSB_MASK 0x00000008 +#define DDR_CONFIG_3_TWR_MSB_GET(x) (((x) & DDR_CONFIG_3_TWR_MSB_MASK) >> DDR_CONFIG_3_TWR_MSB_LSB) +#define DDR_CONFIG_3_TWR_MSB_SET(x) (((x) << DDR_CONFIG_3_TWR_MSB_LSB) & DDR_CONFIG_3_TWR_MSB_MASK) +#define DDR_CONFIG_3_TWR_MSB_RESET 0x0 // 0 +#define DDR_CONFIG_3_TRAS_MSB_MSB 2 +#define DDR_CONFIG_3_TRAS_MSB_LSB 2 +#define DDR_CONFIG_3_TRAS_MSB_MASK 0x00000004 +#define DDR_CONFIG_3_TRAS_MSB_GET(x) (((x) & DDR_CONFIG_3_TRAS_MSB_MASK) >> DDR_CONFIG_3_TRAS_MSB_LSB) +#define DDR_CONFIG_3_TRAS_MSB_SET(x) (((x) << DDR_CONFIG_3_TRAS_MSB_LSB) & DDR_CONFIG_3_TRAS_MSB_MASK) +#define DDR_CONFIG_3_TRAS_MSB_RESET 0x0 // 0 +#define DDR_CONFIG_3_TRFC_LSB_MSB 1 +#define DDR_CONFIG_3_TRFC_LSB_LSB 0 +#define DDR_CONFIG_3_TRFC_LSB_MASK 0x00000003 +#define DDR_CONFIG_3_TRFC_LSB_GET(x) (((x) & DDR_CONFIG_3_TRFC_LSB_MASK) >> DDR_CONFIG_3_TRFC_LSB_LSB) +#define DDR_CONFIG_3_TRFC_LSB_SET(x) (((x) << DDR_CONFIG_3_TRFC_LSB_LSB) & DDR_CONFIG_3_TRFC_LSB_MASK) +#define DDR_CONFIG_3_TRFC_LSB_RESET 0x0 // 0 +#define DDR_CONFIG_3_ADDRESS 0x1800015c + +#define DDR_MODE_REGISTER_VALUE_MSB 13 +#define DDR_MODE_REGISTER_VALUE_LSB 0 +#define DDR_MODE_REGISTER_VALUE_MASK 0x00003fff +#define DDR_MODE_REGISTER_VALUE_GET(x) (((x) & DDR_MODE_REGISTER_VALUE_MASK) >> DDR_MODE_REGISTER_VALUE_LSB) +#define DDR_MODE_REGISTER_VALUE_SET(x) (((x) << DDR_MODE_REGISTER_VALUE_LSB) & DDR_MODE_REGISTER_VALUE_MASK) +#define DDR_MODE_REGISTER_VALUE_RESET 0x133 // 307 +#define DDR_MODE_REGISTER_ADDRESS 0x18000008 + +#define DDR_EXTENDED_MODE_REGISTER_VALUE_MSB 13 +#define DDR_EXTENDED_MODE_REGISTER_VALUE_LSB 0 +#define DDR_EXTENDED_MODE_REGISTER_VALUE_MASK 0x00003fff +#define DDR_EXTENDED_MODE_REGISTER_VALUE_GET(x) (((x) & DDR_EXTENDED_MODE_REGISTER_VALUE_MASK) >> DDR_EXTENDED_MODE_REGISTER_VALUE_LSB) +#define DDR_EXTENDED_MODE_REGISTER_VALUE_SET(x) (((x) << DDR_EXTENDED_MODE_REGISTER_VALUE_LSB) & DDR_EXTENDED_MODE_REGISTER_VALUE_MASK) +#define DDR_EXTENDED_MODE_REGISTER_VALUE_RESET 0x2 // 2 +#define DDR_EXTENDED_MODE_REGISTER_ADDRESS 0x1800000c + +#define DDR_REFRESH_ENABLE_MSB 14 +#define DDR_REFRESH_ENABLE_LSB 14 +#define DDR_REFRESH_ENABLE_MASK 0x00004000 +#define DDR_REFRESH_ENABLE_GET(x) (((x) & DDR_REFRESH_ENABLE_MASK) >> DDR_REFRESH_ENABLE_LSB) +#define DDR_REFRESH_ENABLE_SET(x) (((x) << DDR_REFRESH_ENABLE_LSB) & DDR_REFRESH_ENABLE_MASK) +#define DDR_REFRESH_ENABLE_RESET 0x0 // 0 +#define DDR_REFRESH_PERIOD_MSB 13 +#define DDR_REFRESH_PERIOD_LSB 0 +#define DDR_REFRESH_PERIOD_MASK 0x00003fff +#define DDR_REFRESH_PERIOD_GET(x) (((x) & DDR_REFRESH_PERIOD_MASK) >> DDR_REFRESH_PERIOD_LSB) +#define DDR_REFRESH_PERIOD_SET(x) (((x) << DDR_REFRESH_PERIOD_LSB) & DDR_REFRESH_PERIOD_MASK) +#define DDR_REFRESH_PERIOD_RESET 0x12c // 300 +#define DDR_REFRESH_ADDRESS 0x18000014 + +#define BB_DPLL2_RANGE_MSB 31 +#define BB_DPLL2_RANGE_LSB 31 +#define BB_DPLL2_RANGE_MASK 0x80000000 +#define BB_DPLL2_RANGE_GET(x) (((x) & BB_DPLL2_RANGE_MASK) >> BB_DPLL2_RANGE_LSB) +#define BB_DPLL2_RANGE_SET(x) (((x) << BB_DPLL2_RANGE_LSB) & BB_DPLL2_RANGE_MASK) +#define BB_DPLL2_RANGE_RESET 0x0 // 0 +#define BB_DPLL2_LOCAL_PLL_MSB 30 +#define BB_DPLL2_LOCAL_PLL_LSB 30 +#define BB_DPLL2_LOCAL_PLL_MASK 0x40000000 +#define BB_DPLL2_LOCAL_PLL_GET(x) (((x) & BB_DPLL2_LOCAL_PLL_MASK) >> BB_DPLL2_LOCAL_PLL_LSB) +#define BB_DPLL2_LOCAL_PLL_SET(x) (((x) << BB_DPLL2_LOCAL_PLL_LSB) & BB_DPLL2_LOCAL_PLL_MASK) +#define BB_DPLL2_LOCAL_PLL_RESET 0x0 // 0 +#define BB_DPLL2_KI_MSB 29 +#define BB_DPLL2_KI_LSB 26 +#define BB_DPLL2_KI_MASK 0x3c000000 +#define BB_DPLL2_KI_GET(x) (((x) & BB_DPLL2_KI_MASK) >> BB_DPLL2_KI_LSB) +#define BB_DPLL2_KI_SET(x) (((x) << BB_DPLL2_KI_LSB) & BB_DPLL2_KI_MASK) +#define BB_DPLL2_KI_RESET 0x6 // 6 +#define BB_DPLL2_KD_MSB 25 +#define BB_DPLL2_KD_LSB 19 +#define BB_DPLL2_KD_MASK 0x03f80000 +#define BB_DPLL2_KD_GET(x) (((x) & BB_DPLL2_KD_MASK) >> BB_DPLL2_KD_LSB) +#define BB_DPLL2_KD_SET(x) (((x) << BB_DPLL2_KD_LSB) & BB_DPLL2_KD_MASK) +#define BB_DPLL2_KD_RESET 0x7f // 127 +#define BB_DPLL2_EN_NEGTRIG_MSB 18 +#define BB_DPLL2_EN_NEGTRIG_LSB 18 +#define BB_DPLL2_EN_NEGTRIG_MASK 0x00040000 +#define BB_DPLL2_EN_NEGTRIG_GET(x) (((x) & BB_DPLL2_EN_NEGTRIG_MASK) >> BB_DPLL2_EN_NEGTRIG_LSB) +#define BB_DPLL2_EN_NEGTRIG_SET(x) (((x) << BB_DPLL2_EN_NEGTRIG_LSB) & BB_DPLL2_EN_NEGTRIG_MASK) +#define BB_DPLL2_EN_NEGTRIG_RESET 0x0 // 0 +#define BB_DPLL2_SEL_1SDM_MSB 17 +#define BB_DPLL2_SEL_1SDM_LSB 17 +#define BB_DPLL2_SEL_1SDM_MASK 0x00020000 +#define BB_DPLL2_SEL_1SDM_GET(x) (((x) & BB_DPLL2_SEL_1SDM_MASK) >> BB_DPLL2_SEL_1SDM_LSB) +#define BB_DPLL2_SEL_1SDM_SET(x) (((x) << BB_DPLL2_SEL_1SDM_LSB) & BB_DPLL2_SEL_1SDM_MASK) +#define BB_DPLL2_SEL_1SDM_RESET 0x0 // 0 +#define BB_DPLL2_PLL_PWD_MSB 16 +#define BB_DPLL2_PLL_PWD_LSB 16 +#define BB_DPLL2_PLL_PWD_MASK 0x00010000 +#define BB_DPLL2_PLL_PWD_GET(x) (((x) & BB_DPLL2_PLL_PWD_MASK) >> BB_DPLL2_PLL_PWD_LSB) +#define BB_DPLL2_PLL_PWD_SET(x) (((x) << BB_DPLL2_PLL_PWD_LSB) & BB_DPLL2_PLL_PWD_MASK) +#define BB_DPLL2_PLL_PWD_RESET 0x1 // 1 +#define BB_DPLL2_OUTDIV_MSB 15 +#define BB_DPLL2_OUTDIV_LSB 13 +#define BB_DPLL2_OUTDIV_MASK 0x0000e000 +#define BB_DPLL2_OUTDIV_GET(x) (((x) & BB_DPLL2_OUTDIV_MASK) >> BB_DPLL2_OUTDIV_LSB) +#define BB_DPLL2_OUTDIV_SET(x) (((x) << BB_DPLL2_OUTDIV_LSB) & BB_DPLL2_OUTDIV_MASK) +#define BB_DPLL2_OUTDIV_RESET 0x0 // 0 +#define BB_DPLL2_DELTA_MSB 12 +#define BB_DPLL2_DELTA_LSB 7 +#define BB_DPLL2_DELTA_MASK 0x00001f80 +#define BB_DPLL2_DELTA_GET(x) (((x) & BB_DPLL2_DELTA_MASK) >> BB_DPLL2_DELTA_LSB) +#define BB_DPLL2_DELTA_SET(x) (((x) << BB_DPLL2_DELTA_LSB) & BB_DPLL2_DELTA_MASK) +#define BB_DPLL2_DELTA_RESET 0x1e // 30 +#define BB_DPLL2_TESTINMSB_MSB 6 +#define BB_DPLL2_TESTINMSB_LSB 0 +#define BB_DPLL2_TESTINMSB_MASK 0x0000007f +#define BB_DPLL2_TESTINMSB_GET(x) (((x) & BB_DPLL2_TESTINMSB_MASK) >> BB_DPLL2_TESTINMSB_LSB) +#define BB_DPLL2_TESTINMSB_SET(x) (((x) << BB_DPLL2_TESTINMSB_LSB) & BB_DPLL2_TESTINMSB_MASK) +#define BB_DPLL2_TESTINMSB_RESET 0x0 // 0 +#define BB_DPLL2_ADDRESS 0x18116184 + +#define PCIe_DPLL2_RANGE_MSB 31 +#define PCIe_DPLL2_RANGE_LSB 31 +#define PCIe_DPLL2_RANGE_MASK 0x80000000 +#define PCIe_DPLL2_RANGE_GET(x) (((x) & PCIe_DPLL2_RANGE_MASK) >> PCIe_DPLL2_RANGE_LSB) +#define PCIe_DPLL2_RANGE_SET(x) (((x) << PCIe_DPLL2_RANGE_LSB) & PCIe_DPLL2_RANGE_MASK) +#define PCIe_DPLL2_RANGE_RESET 0x0 // 0 +#define PCIe_DPLL2_LOCAL_PLL_MSB 30 +#define PCIe_DPLL2_LOCAL_PLL_LSB 30 +#define PCIe_DPLL2_LOCAL_PLL_MASK 0x40000000 +#define PCIe_DPLL2_LOCAL_PLL_GET(x) (((x) & PCIe_DPLL2_LOCAL_PLL_MASK) >> PCIe_DPLL2_LOCAL_PLL_LSB) +#define PCIe_DPLL2_LOCAL_PLL_SET(x) (((x) << PCIe_DPLL2_LOCAL_PLL_LSB) & PCIe_DPLL2_LOCAL_PLL_MASK) +#define PCIe_DPLL2_LOCAL_PLL_RESET 0x0 // 0 +#define PCIe_DPLL2_KI_MSB 29 +#define PCIe_DPLL2_KI_LSB 26 +#define PCIe_DPLL2_KI_MASK 0x3c000000 +#define PCIe_DPLL2_KI_GET(x) (((x) & PCIe_DPLL2_KI_MASK) >> PCIe_DPLL2_KI_LSB) +#define PCIe_DPLL2_KI_SET(x) (((x) << PCIe_DPLL2_KI_LSB) & PCIe_DPLL2_KI_MASK) +#define PCIe_DPLL2_KI_RESET 0x6 // 6 +#define PCIe_DPLL2_KD_MSB 25 +#define PCIe_DPLL2_KD_LSB 19 +#define PCIe_DPLL2_KD_MASK 0x03f80000 +#define PCIe_DPLL2_KD_GET(x) (((x) & PCIe_DPLL2_KD_MASK) >> PCIe_DPLL2_KD_LSB) +#define PCIe_DPLL2_KD_SET(x) (((x) << PCIe_DPLL2_KD_LSB) & PCIe_DPLL2_KD_MASK) +#define PCIe_DPLL2_KD_RESET 0x7f // 127 +#define PCIe_DPLL2_EN_NEGTRIG_MSB 18 +#define PCIe_DPLL2_EN_NEGTRIG_LSB 18 +#define PCIe_DPLL2_EN_NEGTRIG_MASK 0x00040000 +#define PCIe_DPLL2_EN_NEGTRIG_GET(x) (((x) & PCIe_DPLL2_EN_NEGTRIG_MASK) >> PCIe_DPLL2_EN_NEGTRIG_LSB) +#define PCIe_DPLL2_EN_NEGTRIG_SET(x) (((x) << PCIe_DPLL2_EN_NEGTRIG_LSB) & PCIe_DPLL2_EN_NEGTRIG_MASK) +#define PCIe_DPLL2_EN_NEGTRIG_RESET 0x0 // 0 +#define PCIe_DPLL2_SEL_1SDM_MSB 17 +#define PCIe_DPLL2_SEL_1SDM_LSB 17 +#define PCIe_DPLL2_SEL_1SDM_MASK 0x00020000 +#define PCIe_DPLL2_SEL_1SDM_GET(x) (((x) & PCIe_DPLL2_SEL_1SDM_MASK) >> PCIe_DPLL2_SEL_1SDM_LSB) +#define PCIe_DPLL2_SEL_1SDM_SET(x) (((x) << PCIe_DPLL2_SEL_1SDM_LSB) & PCIe_DPLL2_SEL_1SDM_MASK) +#define PCIe_DPLL2_SEL_1SDM_RESET 0x0 // 0 +#define PCIe_DPLL2_PLL_PWD_MSB 16 +#define PCIe_DPLL2_PLL_PWD_LSB 16 +#define PCIe_DPLL2_PLL_PWD_MASK 0x00010000 +#define PCIe_DPLL2_PLL_PWD_GET(x) (((x) & PCIe_DPLL2_PLL_PWD_MASK) >> PCIe_DPLL2_PLL_PWD_LSB) +#define PCIe_DPLL2_PLL_PWD_SET(x) (((x) << PCIe_DPLL2_PLL_PWD_LSB) & PCIe_DPLL2_PLL_PWD_MASK) +#define PCIe_DPLL2_PLL_PWD_RESET 0x1 // 1 +#define PCIe_DPLL2_OUTDIV_MSB 15 +#define PCIe_DPLL2_OUTDIV_LSB 13 +#define PCIe_DPLL2_OUTDIV_MASK 0x0000e000 +#define PCIe_DPLL2_OUTDIV_GET(x) (((x) & PCIe_DPLL2_OUTDIV_MASK) >> PCIe_DPLL2_OUTDIV_LSB) +#define PCIe_DPLL2_OUTDIV_SET(x) (((x) << PCIe_DPLL2_OUTDIV_LSB) & PCIe_DPLL2_OUTDIV_MASK) +#define PCIe_DPLL2_OUTDIV_RESET 0x0 // 0 +#define PCIe_DPLL2_DELTA_MSB 12 +#define PCIe_DPLL2_DELTA_LSB 7 +#define PCIe_DPLL2_DELTA_MASK 0x00001f80 +#define PCIe_DPLL2_DELTA_GET(x) (((x) & PCIe_DPLL2_DELTA_MASK) >> PCIe_DPLL2_DELTA_LSB) +#define PCIe_DPLL2_DELTA_SET(x) (((x) << PCIe_DPLL2_DELTA_LSB) & PCIe_DPLL2_DELTA_MASK) +#define PCIe_DPLL2_DELTA_RESET 0x1e // 30 +#define PCIe_DPLL2_TESTINMSB_MSB 6 +#define PCIe_DPLL2_TESTINMSB_LSB 0 +#define PCIe_DPLL2_TESTINMSB_MASK 0x0000007f +#define PCIe_DPLL2_TESTINMSB_GET(x) (((x) & PCIe_DPLL2_TESTINMSB_MASK) >> PCIe_DPLL2_TESTINMSB_LSB) +#define PCIe_DPLL2_TESTINMSB_SET(x) (((x) << PCIe_DPLL2_TESTINMSB_LSB) & PCIe_DPLL2_TESTINMSB_MASK) +#define PCIe_DPLL2_TESTINMSB_RESET 0x0 // 0 +#define PCIe_DPLL2_ADDRESS 0x18116c84 + +#define DDR_DPLL2_RANGE_MSB 31 +#define DDR_DPLL2_RANGE_LSB 31 +#define DDR_DPLL2_RANGE_MASK 0x80000000 +#define DDR_DPLL2_RANGE_GET(x) (((x) & DDR_DPLL2_RANGE_MASK) >> DDR_DPLL2_RANGE_LSB) +#define DDR_DPLL2_RANGE_SET(x) (((x) << DDR_DPLL2_RANGE_LSB) & DDR_DPLL2_RANGE_MASK) +#define DDR_DPLL2_RANGE_RESET 0x0 // 0 +#define DDR_DPLL2_LOCAL_PLL_MSB 30 +#define DDR_DPLL2_LOCAL_PLL_LSB 30 +#define DDR_DPLL2_LOCAL_PLL_MASK 0x40000000 +#define DDR_DPLL2_LOCAL_PLL_GET(x) (((x) & DDR_DPLL2_LOCAL_PLL_MASK) >> DDR_DPLL2_LOCAL_PLL_LSB) +#define DDR_DPLL2_LOCAL_PLL_SET(x) (((x) << DDR_DPLL2_LOCAL_PLL_LSB) & DDR_DPLL2_LOCAL_PLL_MASK) +#define DDR_DPLL2_LOCAL_PLL_RESET 0x0 // 0 +#define DDR_DPLL2_KI_MSB 29 +#define DDR_DPLL2_KI_LSB 26 +#define DDR_DPLL2_KI_MASK 0x3c000000 +#define DDR_DPLL2_KI_GET(x) (((x) & DDR_DPLL2_KI_MASK) >> DDR_DPLL2_KI_LSB) +#define DDR_DPLL2_KI_SET(x) (((x) << DDR_DPLL2_KI_LSB) & DDR_DPLL2_KI_MASK) +#define DDR_DPLL2_KI_RESET 0x6 // 6 +#define DDR_DPLL2_KD_MSB 25 +#define DDR_DPLL2_KD_LSB 19 +#define DDR_DPLL2_KD_MASK 0x03f80000 +#define DDR_DPLL2_KD_GET(x) (((x) & DDR_DPLL2_KD_MASK) >> DDR_DPLL2_KD_LSB) +#define DDR_DPLL2_KD_SET(x) (((x) << DDR_DPLL2_KD_LSB) & DDR_DPLL2_KD_MASK) +#define DDR_DPLL2_KD_RESET 0x7f // 127 +#define DDR_DPLL2_EN_NEGTRIG_MSB 18 +#define DDR_DPLL2_EN_NEGTRIG_LSB 18 +#define DDR_DPLL2_EN_NEGTRIG_MASK 0x00040000 +#define DDR_DPLL2_EN_NEGTRIG_GET(x) (((x) & DDR_DPLL2_EN_NEGTRIG_MASK) >> DDR_DPLL2_EN_NEGTRIG_LSB) +#define DDR_DPLL2_EN_NEGTRIG_SET(x) (((x) << DDR_DPLL2_EN_NEGTRIG_LSB) & DDR_DPLL2_EN_NEGTRIG_MASK) +#define DDR_DPLL2_EN_NEGTRIG_RESET 0x0 // 0 +#define DDR_DPLL2_SEL_1SDM_MSB 17 +#define DDR_DPLL2_SEL_1SDM_LSB 17 +#define DDR_DPLL2_SEL_1SDM_MASK 0x00020000 +#define DDR_DPLL2_SEL_1SDM_GET(x) (((x) & DDR_DPLL2_SEL_1SDM_MASK) >> DDR_DPLL2_SEL_1SDM_LSB) +#define DDR_DPLL2_SEL_1SDM_SET(x) (((x) << DDR_DPLL2_SEL_1SDM_LSB) & DDR_DPLL2_SEL_1SDM_MASK) +#define DDR_DPLL2_SEL_1SDM_RESET 0x0 // 0 +#define DDR_DPLL2_PLL_PWD_MSB 16 +#define DDR_DPLL2_PLL_PWD_LSB 16 +#define DDR_DPLL2_PLL_PWD_MASK 0x00010000 +#define DDR_DPLL2_PLL_PWD_GET(x) (((x) & DDR_DPLL2_PLL_PWD_MASK) >> DDR_DPLL2_PLL_PWD_LSB) +#define DDR_DPLL2_PLL_PWD_SET(x) (((x) << DDR_DPLL2_PLL_PWD_LSB) & DDR_DPLL2_PLL_PWD_MASK) +#define DDR_DPLL2_PLL_PWD_RESET 0x1 // 1 +#define DDR_DPLL2_OUTDIV_MSB 15 +#define DDR_DPLL2_OUTDIV_LSB 13 +#define DDR_DPLL2_OUTDIV_MASK 0x0000e000 +#define DDR_DPLL2_OUTDIV_GET(x) (((x) & DDR_DPLL2_OUTDIV_MASK) >> DDR_DPLL2_OUTDIV_LSB) +#define DDR_DPLL2_OUTDIV_SET(x) (((x) << DDR_DPLL2_OUTDIV_LSB) & DDR_DPLL2_OUTDIV_MASK) +#define DDR_DPLL2_OUTDIV_RESET 0x0 // 0 +#define DDR_DPLL2_DELTA_MSB 12 +#define DDR_DPLL2_DELTA_LSB 7 +#define DDR_DPLL2_DELTA_MASK 0x00001f80 +#define DDR_DPLL2_DELTA_GET(x) (((x) & DDR_DPLL2_DELTA_MASK) >> DDR_DPLL2_DELTA_LSB) +#define DDR_DPLL2_DELTA_SET(x) (((x) << DDR_DPLL2_DELTA_LSB) & DDR_DPLL2_DELTA_MASK) +#define DDR_DPLL2_DELTA_RESET 0x1e // 30 +#define DDR_DPLL2_TESTINMSB_MSB 6 +#define DDR_DPLL2_TESTINMSB_LSB 0 +#define DDR_DPLL2_TESTINMSB_MASK 0x0000007f +#define DDR_DPLL2_TESTINMSB_GET(x) (((x) & DDR_DPLL2_TESTINMSB_MASK) >> DDR_DPLL2_TESTINMSB_LSB) +#define DDR_DPLL2_TESTINMSB_SET(x) (((x) << DDR_DPLL2_TESTINMSB_LSB) & DDR_DPLL2_TESTINMSB_MASK) +#define DDR_DPLL2_TESTINMSB_RESET 0x0 // 0 +#define DDR_DPLL2_ADDRESS 0x18116ec4 + +#define CPU_DPLL2_RANGE_MSB 31 +#define CPU_DPLL2_RANGE_LSB 31 +#define CPU_DPLL2_RANGE_MASK 0x80000000 +#define CPU_DPLL2_RANGE_GET(x) (((x) & CPU_DPLL2_RANGE_MASK) >> CPU_DPLL2_RANGE_LSB) +#define CPU_DPLL2_RANGE_SET(x) (((x) << CPU_DPLL2_RANGE_LSB) & CPU_DPLL2_RANGE_MASK) +#define CPU_DPLL2_RANGE_RESET 0x0 // 0 +#define CPU_DPLL2_LOCAL_PLL_MSB 30 +#define CPU_DPLL2_LOCAL_PLL_LSB 30 +#define CPU_DPLL2_LOCAL_PLL_MASK 0x40000000 +#define CPU_DPLL2_LOCAL_PLL_GET(x) (((x) & CPU_DPLL2_LOCAL_PLL_MASK) >> CPU_DPLL2_LOCAL_PLL_LSB) +#define CPU_DPLL2_LOCAL_PLL_SET(x) (((x) << CPU_DPLL2_LOCAL_PLL_LSB) & CPU_DPLL2_LOCAL_PLL_MASK) +#define CPU_DPLL2_LOCAL_PLL_RESET 0x0 // 0 +#define CPU_DPLL2_KI_MSB 29 +#define CPU_DPLL2_KI_LSB 26 +#define CPU_DPLL2_KI_MASK 0x3c000000 +#define CPU_DPLL2_KI_GET(x) (((x) & CPU_DPLL2_KI_MASK) >> CPU_DPLL2_KI_LSB) +#define CPU_DPLL2_KI_SET(x) (((x) << CPU_DPLL2_KI_LSB) & CPU_DPLL2_KI_MASK) +#define CPU_DPLL2_KI_RESET 0x6 // 6 +#define CPU_DPLL2_KD_MSB 25 +#define CPU_DPLL2_KD_LSB 19 +#define CPU_DPLL2_KD_MASK 0x03f80000 +#define CPU_DPLL2_KD_GET(x) (((x) & CPU_DPLL2_KD_MASK) >> CPU_DPLL2_KD_LSB) +#define CPU_DPLL2_KD_SET(x) (((x) << CPU_DPLL2_KD_LSB) & CPU_DPLL2_KD_MASK) +#define CPU_DPLL2_KD_RESET 0x7f // 127 +#define CPU_DPLL2_EN_NEGTRIG_MSB 18 +#define CPU_DPLL2_EN_NEGTRIG_LSB 18 +#define CPU_DPLL2_EN_NEGTRIG_MASK 0x00040000 +#define CPU_DPLL2_EN_NEGTRIG_GET(x) (((x) & CPU_DPLL2_EN_NEGTRIG_MASK) >> CPU_DPLL2_EN_NEGTRIG_LSB) +#define CPU_DPLL2_EN_NEGTRIG_SET(x) (((x) << CPU_DPLL2_EN_NEGTRIG_LSB) & CPU_DPLL2_EN_NEGTRIG_MASK) +#define CPU_DPLL2_EN_NEGTRIG_RESET 0x0 // 0 +#define CPU_DPLL2_SEL_1SDM_MSB 17 +#define CPU_DPLL2_SEL_1SDM_LSB 17 +#define CPU_DPLL2_SEL_1SDM_MASK 0x00020000 +#define CPU_DPLL2_SEL_1SDM_GET(x) (((x) & CPU_DPLL2_SEL_1SDM_MASK) >> CPU_DPLL2_SEL_1SDM_LSB) +#define CPU_DPLL2_SEL_1SDM_SET(x) (((x) << CPU_DPLL2_SEL_1SDM_LSB) & CPU_DPLL2_SEL_1SDM_MASK) +#define CPU_DPLL2_SEL_1SDM_RESET 0x0 // 0 +#define CPU_DPLL2_PLL_PWD_MSB 16 +#define CPU_DPLL2_PLL_PWD_LSB 16 +#define CPU_DPLL2_PLL_PWD_MASK 0x00010000 +#define CPU_DPLL2_PLL_PWD_GET(x) (((x) & CPU_DPLL2_PLL_PWD_MASK) >> CPU_DPLL2_PLL_PWD_LSB) +#define CPU_DPLL2_PLL_PWD_SET(x) (((x) << CPU_DPLL2_PLL_PWD_LSB) & CPU_DPLL2_PLL_PWD_MASK) +#define CPU_DPLL2_PLL_PWD_RESET 0x1 // 1 +#define CPU_DPLL2_OUTDIV_MSB 15 +#define CPU_DPLL2_OUTDIV_LSB 13 +#define CPU_DPLL2_OUTDIV_MASK 0x0000e000 +#define CPU_DPLL2_OUTDIV_GET(x) (((x) & CPU_DPLL2_OUTDIV_MASK) >> CPU_DPLL2_OUTDIV_LSB) +#define CPU_DPLL2_OUTDIV_SET(x) (((x) << CPU_DPLL2_OUTDIV_LSB) & CPU_DPLL2_OUTDIV_MASK) +#define CPU_DPLL2_OUTDIV_RESET 0x0 // 0 +#define CPU_DPLL2_DELTA_MSB 12 +#define CPU_DPLL2_DELTA_LSB 7 +#define CPU_DPLL2_DELTA_MASK 0x00001f80 +#define CPU_DPLL2_DELTA_GET(x) (((x) & CPU_DPLL2_DELTA_MASK) >> CPU_DPLL2_DELTA_LSB) +#define CPU_DPLL2_DELTA_SET(x) (((x) << CPU_DPLL2_DELTA_LSB) & CPU_DPLL2_DELTA_MASK) +#define CPU_DPLL2_DELTA_RESET 0x1e // 30 +#define CPU_DPLL2_TESTINMSB_MSB 6 +#define CPU_DPLL2_TESTINMSB_LSB 0 +#define CPU_DPLL2_TESTINMSB_MASK 0x0000007f +#define CPU_DPLL2_TESTINMSB_GET(x) (((x) & CPU_DPLL2_TESTINMSB_MASK) >> CPU_DPLL2_TESTINMSB_LSB) +#define CPU_DPLL2_TESTINMSB_SET(x) (((x) << CPU_DPLL2_TESTINMSB_LSB) & CPU_DPLL2_TESTINMSB_MASK) +#define CPU_DPLL2_TESTINMSB_RESET 0x0 // 0 +#define CPU_DPLL2_ADDRESS 0x18116f04 + +#define DDR_RD_DATA_THIS_CYCLE_ADDRESS 0x18000018 + +/*#define TAP_CONTROL_0_ADDRESS 0x1800001c*/ /* Causes Exception in U-boot-2016*/ +#define TAP_CONTROL_0_ADDRESS 0xB800001c +#define TAP_CONTROL_1_ADDRESS 0x18000020 +#define TAP_CONTROL_2_ADDRESS 0x18000024 +#define TAP_CONTROL_3_ADDRESS 0x18000028 + +#define DDR_BURST_ADDRESS 0x180000c4 +#define DDR_BURST2_ADDRESS 0x180000c8 +#define DDR_AHB_MASTER_TIMEOUT_MAX_ADDRESS 0x180000cc + +#define PMU1_ADDRESS 0x18116cc0 + +#define PMU2_SWREGMSB_MSB 31 +#define PMU2_SWREGMSB_LSB 22 +#define PMU2_SWREGMSB_MASK 0xffc00000 +#define PMU2_SWREGMSB_GET(x) (((x) & PMU2_SWREGMSB_MASK) >> PMU2_SWREGMSB_LSB) +#define PMU2_SWREGMSB_SET(x) (((x) << PMU2_SWREGMSB_LSB) & PMU2_SWREGMSB_MASK) +#define PMU2_SWREGMSB_RESET 0x0 // 0 +#define PMU2_PGM_MSB 21 +#define PMU2_PGM_LSB 21 +#define PMU2_PGM_MASK 0x00200000 +#define PMU2_PGM_GET(x) (((x) & PMU2_PGM_MASK) >> PMU2_PGM_LSB) +#define PMU2_PGM_SET(x) (((x) << PMU2_PGM_LSB) & PMU2_PGM_MASK) +#define PMU2_PGM_RESET 0x0 // 0 +#define PMU2_LDO_TUNE_MSB 20 +#define PMU2_LDO_TUNE_LSB 19 +#define PMU2_LDO_TUNE_MASK 0x00180000 +#define PMU2_LDO_TUNE_GET(x) (((x) & PMU2_LDO_TUNE_MASK) >> PMU2_LDO_TUNE_LSB) +#define PMU2_LDO_TUNE_SET(x) (((x) << PMU2_LDO_TUNE_LSB) & PMU2_LDO_TUNE_MASK) +#define PMU2_LDO_TUNE_RESET 0x0 // 0 +#define PMU2_PWDLDO_DDR_MSB 18 +#define PMU2_PWDLDO_DDR_LSB 18 +#define PMU2_PWDLDO_DDR_MASK 0x00040000 +#define PMU2_PWDLDO_DDR_GET(x) (((x) & PMU2_PWDLDO_DDR_MASK) >> PMU2_PWDLDO_DDR_LSB) +#define PMU2_PWDLDO_DDR_SET(x) (((x) << PMU2_PWDLDO_DDR_LSB) & PMU2_PWDLDO_DDR_MASK) +#define PMU2_PWDLDO_DDR_RESET 0x0 // 0 +#define PMU2_LPOPWD_MSB 17 +#define PMU2_LPOPWD_LSB 17 +#define PMU2_LPOPWD_MASK 0x00020000 +#define PMU2_LPOPWD_GET(x) (((x) & PMU2_LPOPWD_MASK) >> PMU2_LPOPWD_LSB) +#define PMU2_LPOPWD_SET(x) (((x) << PMU2_LPOPWD_LSB) & PMU2_LPOPWD_MASK) +#define PMU2_LPOPWD_RESET 0x0 // 0 +#define PMU2_SPARE_MSB 16 +#define PMU2_SPARE_LSB 0 +#define PMU2_SPARE_MASK 0x0001ffff +#define PMU2_SPARE_GET(x) (((x) & PMU2_SPARE_MASK) >> PMU2_SPARE_LSB) +#define PMU2_SPARE_SET(x) (((x) << PMU2_SPARE_LSB) & PMU2_SPARE_MASK) +#define PMU2_SPARE_RESET 0x0 // 0 +#define PMU2_ADDRESS 0x18116cc4 + + + + + + +#define CPU_DDR_CLOCK_CONTROL_SPARE_MSB 31 +#define CPU_DDR_CLOCK_CONTROL_SPARE_LSB 25 +#define CPU_DDR_CLOCK_CONTROL_SPARE_MASK 0xfe000000 +#define CPU_DDR_CLOCK_CONTROL_SPARE_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_SPARE_MASK) >> CPU_DDR_CLOCK_CONTROL_SPARE_LSB) +#define CPU_DDR_CLOCK_CONTROL_SPARE_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_SPARE_LSB) & CPU_DDR_CLOCK_CONTROL_SPARE_MASK) +#define CPU_DDR_CLOCK_CONTROL_SPARE_RESET 0 +#define CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_MSB 24 +#define CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_LSB 24 +#define CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_MASK 0x01000000 +#define CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_MASK) >> CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_LSB) +#define CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_LSB) & CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_MASK) +#define CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_RESET 1 +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_MSB 23 +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_LSB 23 +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_MASK 0x00800000 +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_MASK) >> CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_LSB) +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_LSB) & CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_MASK) +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_DEASSRT_RESET 0 +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_MSB 22 +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_LSB 22 +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_MASK 0x00400000 +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_MASK) >> CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_LSB) +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_LSB) & CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_MASK) +#define CPU_DDR_CLOCK_CONTROL_CPU_RESET_EN_BP_ASRT_RESET 0x0 +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_MSB 21 +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_LSB 21 +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_MASK 0x00200000 +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_MASK) >> CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_LSB) +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_LSB) & CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_MASK) +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_RESET 0x0 +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_MSB 20 +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_LSB 20 +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_MASK 0x00100000 +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_MASK) >> CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_LSB) +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_LSB) & CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_MASK) +#define CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_RESET 0x0 // 0 +#define CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_MSB 19 +#define CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_LSB 15 +#define CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_MASK 0x000f8000 +#define CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_MASK) >> CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_LSB) +#define CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_LSB) & CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_MASK) +#define CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_RESET 0 +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_MSB 14 +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_LSB 10 +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_MASK 0x00007c00 +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_MASK) >> CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_LSB) +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_LSB) & CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_MASK) +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_RESET 0 +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_MSB 9 +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_LSB 5 +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_MASK 0x000003e0 +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_MASK) >> CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_LSB) +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_LSB) & CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_MASK) +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_RESET 0 +#define CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_MSB 4 +#define CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_LSB 4 +#define CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_MASK 0x00000010 +#define CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_MASK) >> CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_LSB) +#define CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_LSB) & CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_MASK) +#define CPU_DDR_CLOCK_CONTROL_AHB_PLL_BYPASS_RESET 1 +#define CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_MSB 3 +#define CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_LSB 3 +#define CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_MASK 0x00000008 +#define CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_MASK) >> CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_LSB) +#define CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_LSB) & CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_MASK) +#define CPU_DDR_CLOCK_CONTROL_DDR_PLL_BYPASS_RESET 1 +#define CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_MSB 2 +#define CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_LSB 2 +#define CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_MASK 0x00000004 +#define CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_MASK) >> CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_LSB) +#define CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_LSB) & CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_MASK) +#define CPU_DDR_CLOCK_CONTROL_CPU_PLL_BYPASS_RESET 1 +#define CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_MSB 1 +#define CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_LSB 1 +#define CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_MASK 0x00000002 +#define CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_MASK) >> CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_LSB) +#define CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_LSB) & CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_MASK) +#define CPU_DDR_CLOCK_CONTROL_RESET_SWITCH_RESET 0 +#define CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_MSB 0 +#define CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_LSB 0 +#define CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_MASK 0x00000001 +#define CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_GET(x) (((x) & CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_MASK) >> CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_LSB) +#define CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_SET(x) (((x) << CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_LSB) & CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_MASK) +#define CPU_DDR_CLOCK_CONTROL_CLOCK_SWITCH_RESET 0 +#define CPU_DDR_CLOCK_CONTROL_ADDRESS 0x18050008 + +#define PCIE_PLL_CONFIG_UPDATING_MSB 31 +#define PCIE_PLL_CONFIG_UPDATING_LSB 31 +#define PCIE_PLL_CONFIG_UPDATING_MASK 0x80000000 +#define PCIE_PLL_CONFIG_UPDATING_GET(x) (((x) & PCIE_PLL_CONFIG_UPDATING_MASK) >> PCIE_PLL_CONFIG_UPDATING_LSB) +#define PCIE_PLL_CONFIG_UPDATING_SET(x) (((x) << PCIE_PLL_CONFIG_UPDATING_LSB) & PCIE_PLL_CONFIG_UPDATING_MASK) +#define PCIE_PLL_CONFIG_UPDATING_RESET 0x0 // 0 +#define PCIE_PLL_CONFIG_PLLPWD_MSB 30 +#define PCIE_PLL_CONFIG_PLLPWD_LSB 30 +#define PCIE_PLL_CONFIG_PLLPWD_MASK 0x40000000 +#define PCIE_PLL_CONFIG_PLLPWD_GET(x) (((x) & PCIE_PLL_CONFIG_PLLPWD_MASK) >> PCIE_PLL_CONFIG_PLLPWD_LSB) +#define PCIE_PLL_CONFIG_PLLPWD_SET(x) (((x) << PCIE_PLL_CONFIG_PLLPWD_LSB) & PCIE_PLL_CONFIG_PLLPWD_MASK) +#define PCIE_PLL_CONFIG_PLLPWD_RESET 0x1 // 1 +#define PCIE_PLL_CONFIG_BYPASS_MSB 16 +#define PCIE_PLL_CONFIG_BYPASS_LSB 16 +#define PCIE_PLL_CONFIG_BYPASS_MASK 0x00010000 +#define PCIE_PLL_CONFIG_BYPASS_GET(x) (((x) & PCIE_PLL_CONFIG_BYPASS_MASK) >> PCIE_PLL_CONFIG_BYPASS_LSB) +#define PCIE_PLL_CONFIG_BYPASS_SET(x) (((x) << PCIE_PLL_CONFIG_BYPASS_LSB) & PCIE_PLL_CONFIG_BYPASS_MASK) +#define PCIE_PLL_CONFIG_BYPASS_RESET 0x1 // 1 +#define PCIE_PLL_CONFIG_REFDIV_MSB 14 +#define PCIE_PLL_CONFIG_REFDIV_LSB 10 +#define PCIE_PLL_CONFIG_REFDIV_MASK 0x00007c00 +#define PCIE_PLL_CONFIG_REFDIV_GET(x) (((x) & PCIE_PLL_CONFIG_REFDIV_MASK) >> PCIE_PLL_CONFIG_REFDIV_LSB) +#define PCIE_PLL_CONFIG_REFDIV_SET(x) (((x) << PCIE_PLL_CONFIG_REFDIV_LSB) & PCIE_PLL_CONFIG_REFDIV_MASK) +#define PCIE_PLL_CONFIG_REFDIV_RESET 0x1 // 1 +#define PCIE_PLL_CONFIG_ADDRESS 0x1805000c + +#define PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_MSB 31 +#define PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_LSB 31 +#define PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_MASK 0x80000000 +#define PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_GET(x) (((x) & PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_MASK) >> PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_LSB) +#define PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_SET(x) (((x) << PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_LSB) & PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_MASK) +#define PCIE_PLL_DITHER_DIV_MAX_EN_DITHER_RESET 0x1 // 1 +#define PCIE_PLL_DITHER_DIV_MAX_USE_MAX_MSB 30 +#define PCIE_PLL_DITHER_DIV_MAX_USE_MAX_LSB 30 +#define PCIE_PLL_DITHER_DIV_MAX_USE_MAX_MASK 0x40000000 +#define PCIE_PLL_DITHER_DIV_MAX_USE_MAX_GET(x) (((x) & PCIE_PLL_DITHER_DIV_MAX_USE_MAX_MASK) >> PCIE_PLL_DITHER_DIV_MAX_USE_MAX_LSB) +#define PCIE_PLL_DITHER_DIV_MAX_USE_MAX_SET(x) (((x) << PCIE_PLL_DITHER_DIV_MAX_USE_MAX_LSB) & PCIE_PLL_DITHER_DIV_MAX_USE_MAX_MASK) +#define PCIE_PLL_DITHER_DIV_MAX_USE_MAX_RESET 0x1 // 1 +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_MSB 20 +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_LSB 15 +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_MASK 0x001f8000 +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_GET(x) (((x) & PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_MASK) >> PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_LSB) +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_SET(x) (((x) << PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_LSB) & PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_MASK) +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_INT_RESET 0x13 // 19 +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_MSB 14 +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_LSB 1 +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_MASK 0x00007ffe +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_GET(x) (((x) & PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_MASK) >> PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_LSB) +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_SET(x) (((x) << PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_LSB) & PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_MASK) +#define PCIE_PLL_DITHER_DIV_MAX_DIV_MAX_FRAC_RESET 0x3fff // 16383 +#define PCIE_PLL_DITHER_DIV_MAX_ADDRESS 0x18050010 + +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_MSB 20 +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_LSB 15 +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_MASK 0x001f8000 +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_GET(x) (((x) & PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_MASK) >> PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_LSB) +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_SET(x) (((x) << PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_LSB) & PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_MASK) +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_INT_RESET 0x13 // 19 +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_MSB 14 +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_LSB 1 +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_MASK 0x00007ffe +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_GET(x) (((x) & PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_MASK) >> PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_LSB) +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_SET(x) (((x) << PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_LSB) & PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_MASK) +#define PCIE_PLL_DITHER_DIV_MIN_DIV_MIN_FRAC_RESET 0x399d // 14749 +#define PCIE_PLL_DITHER_DIV_MIN_ADDRESS 0x18050014 + +#define PCIE_PLL_DITHER_STEP_UPDATE_CNT_MSB 31 +#define PCIE_PLL_DITHER_STEP_UPDATE_CNT_LSB 28 +#define PCIE_PLL_DITHER_STEP_UPDATE_CNT_MASK 0xf0000000 +#define PCIE_PLL_DITHER_STEP_UPDATE_CNT_GET(x) (((x) & PCIE_PLL_DITHER_STEP_UPDATE_CNT_MASK) >> PCIE_PLL_DITHER_STEP_UPDATE_CNT_LSB) +#define PCIE_PLL_DITHER_STEP_UPDATE_CNT_SET(x) (((x) << PCIE_PLL_DITHER_STEP_UPDATE_CNT_LSB) & PCIE_PLL_DITHER_STEP_UPDATE_CNT_MASK) +#define PCIE_PLL_DITHER_STEP_UPDATE_CNT_RESET 0x0 // 0 +#define PCIE_PLL_DITHER_STEP_STEP_INT_MSB 24 +#define PCIE_PLL_DITHER_STEP_STEP_INT_LSB 15 +#define PCIE_PLL_DITHER_STEP_STEP_INT_MASK 0x01ff8000 +#define PCIE_PLL_DITHER_STEP_STEP_INT_GET(x) (((x) & PCIE_PLL_DITHER_STEP_STEP_INT_MASK) >> PCIE_PLL_DITHER_STEP_STEP_INT_LSB) +#define PCIE_PLL_DITHER_STEP_STEP_INT_SET(x) (((x) << PCIE_PLL_DITHER_STEP_STEP_INT_LSB) & PCIE_PLL_DITHER_STEP_STEP_INT_MASK) +#define PCIE_PLL_DITHER_STEP_STEP_INT_RESET 0x0 // 0 +#define PCIE_PLL_DITHER_STEP_STEP_FRAC_MSB 14 +#define PCIE_PLL_DITHER_STEP_STEP_FRAC_LSB 1 +#define PCIE_PLL_DITHER_STEP_STEP_FRAC_MASK 0x00007ffe +#define PCIE_PLL_DITHER_STEP_STEP_FRAC_GET(x) (((x) & PCIE_PLL_DITHER_STEP_STEP_FRAC_MASK) >> PCIE_PLL_DITHER_STEP_STEP_FRAC_LSB) +#define PCIE_PLL_DITHER_STEP_STEP_FRAC_SET(x) (((x) << PCIE_PLL_DITHER_STEP_STEP_FRAC_LSB) & PCIE_PLL_DITHER_STEP_STEP_FRAC_MASK) +#define PCIE_PLL_DITHER_STEP_STEP_FRAC_RESET 0xa // 10 +#define PCIE_PLL_DITHER_STEP_ADDRESS 0x18050018 + +#define LDO_POWER_CONTROL_PKG_SEL_MSB 5 +#define LDO_POWER_CONTROL_PKG_SEL_LSB 5 +#define LDO_POWER_CONTROL_PKG_SEL_MASK 0x00000020 +#define LDO_POWER_CONTROL_PKG_SEL_GET(x) (((x) & LDO_POWER_CONTROL_PKG_SEL_MASK) >> LDO_POWER_CONTROL_PKG_SEL_LSB) +#define LDO_POWER_CONTROL_PKG_SEL_SET(x) (((x) << LDO_POWER_CONTROL_PKG_SEL_LSB) & LDO_POWER_CONTROL_PKG_SEL_MASK) +#define LDO_POWER_CONTROL_PKG_SEL_RESET 0x0 // 0 +#define LDO_POWER_CONTROL_PWDLDO_CPU_MSB 4 +#define LDO_POWER_CONTROL_PWDLDO_CPU_LSB 4 +#define LDO_POWER_CONTROL_PWDLDO_CPU_MASK 0x00000010 +#define LDO_POWER_CONTROL_PWDLDO_CPU_GET(x) (((x) & LDO_POWER_CONTROL_PWDLDO_CPU_MASK) >> LDO_POWER_CONTROL_PWDLDO_CPU_LSB) +#define LDO_POWER_CONTROL_PWDLDO_CPU_SET(x) (((x) << LDO_POWER_CONTROL_PWDLDO_CPU_LSB) & LDO_POWER_CONTROL_PWDLDO_CPU_MASK) +#define LDO_POWER_CONTROL_PWDLDO_CPU_RESET 0x0 // 0 +#define LDO_POWER_CONTROL_PWDLDO_DDR_MSB 3 +#define LDO_POWER_CONTROL_PWDLDO_DDR_LSB 3 +#define LDO_POWER_CONTROL_PWDLDO_DDR_MASK 0x00000008 +#define LDO_POWER_CONTROL_PWDLDO_DDR_GET(x) (((x) & LDO_POWER_CONTROL_PWDLDO_DDR_MASK) >> LDO_POWER_CONTROL_PWDLDO_DDR_LSB) +#define LDO_POWER_CONTROL_PWDLDO_DDR_SET(x) (((x) << LDO_POWER_CONTROL_PWDLDO_DDR_LSB) & LDO_POWER_CONTROL_PWDLDO_DDR_MASK) +#define LDO_POWER_CONTROL_PWDLDO_DDR_RESET 0x0 // 0 +#define LDO_POWER_CONTROL_CPU_REFSEL_MSB 2 +#define LDO_POWER_CONTROL_CPU_REFSEL_LSB 1 +#define LDO_POWER_CONTROL_CPU_REFSEL_MASK 0x00000006 +#define LDO_POWER_CONTROL_CPU_REFSEL_GET(x) (((x) & LDO_POWER_CONTROL_CPU_REFSEL_MASK) >> LDO_POWER_CONTROL_CPU_REFSEL_LSB) +#define LDO_POWER_CONTROL_CPU_REFSEL_SET(x) (((x) << LDO_POWER_CONTROL_CPU_REFSEL_LSB) & LDO_POWER_CONTROL_CPU_REFSEL_MASK) +#define LDO_POWER_CONTROL_CPU_REFSEL_RESET 0x3 // 3 +#define LDO_POWER_CONTROL_SELECT_DDR1_MSB 0 +#define LDO_POWER_CONTROL_SELECT_DDR1_LSB 0 +#define LDO_POWER_CONTROL_SELECT_DDR1_MASK 0x00000001 +#define LDO_POWER_CONTROL_SELECT_DDR1_GET(x) (((x) & LDO_POWER_CONTROL_SELECT_DDR1_MASK) >> LDO_POWER_CONTROL_SELECT_DDR1_LSB) +#define LDO_POWER_CONTROL_SELECT_DDR1_SET(x) (((x) << LDO_POWER_CONTROL_SELECT_DDR1_LSB) & LDO_POWER_CONTROL_SELECT_DDR1_MASK) +#define LDO_POWER_CONTROL_SELECT_DDR1_RESET 0x0 // 0 +#define LDO_POWER_CONTROL_ADDRESS 0x1805001c + +#define SWITCH_CLOCK_SPARE_SPARE_MSB 31 +#define SWITCH_CLOCK_SPARE_SPARE_LSB 16 +#define SWITCH_CLOCK_SPARE_SPARE_MASK 0xffff0000 +#define SWITCH_CLOCK_SPARE_SPARE_GET(x) (((x) & SWITCH_CLOCK_SPARE_SPARE_MASK) >> SWITCH_CLOCK_SPARE_SPARE_LSB) +#define SWITCH_CLOCK_SPARE_SPARE_SET(x) (((x) << SWITCH_CLOCK_SPARE_SPARE_LSB) & SWITCH_CLOCK_SPARE_SPARE_MASK) +#define SWITCH_CLOCK_SPARE_SPARE_RESET 0x0 // 0 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_MSB 15 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_LSB 15 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_MASK 0x00008000 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_GET(x) (((x) & SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_MASK) >> SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_LSB) +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_SET(x) (((x) << SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_LSB) & SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_MASK) +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_2_RESET 0x0 // 0 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_MSB 14 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_LSB 14 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_MASK 0x00004000 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_GET(x) (((x) & SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_MASK) >> SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_LSB) +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_SET(x) (((x) << SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_LSB) & SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_MASK) +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL1_1_RESET 0x0 // 0 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_MSB 13 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_LSB 13 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_MASK 0x00002000 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_GET(x) (((x) & SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_MASK) >> SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_LSB) +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_SET(x) (((x) << SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_LSB) & SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_MASK) +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_2_RESET 0x0 // 0 +#define SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_MSB 12 +#define SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_LSB 12 +#define SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_MASK 0x00001000 +#define SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_GET(x) (((x) & SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_MASK) >> SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_LSB) +#define SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_SET(x) (((x) << SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_LSB) & SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_MASK) +#define SWITCH_CLOCK_SPARE_NANDF_CLK_SEL_RESET 0x0 // 0 +#define SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_MSB 11 +#define SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_LSB 8 +#define SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_MASK 0x00000f00 +#define SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_GET(x) (((x) & SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_MASK) >> SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_LSB) +#define SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_SET(x) (((x) << SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_LSB) & SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_MASK) +#define SWITCH_CLOCK_SPARE_USB_REFCLK_FREQ_SEL_RESET 0x5 // 5 +#define SWITCH_CLOCK_SPARE_UART1_CLK_SEL_MSB 7 +#define SWITCH_CLOCK_SPARE_UART1_CLK_SEL_LSB 7 +#define SWITCH_CLOCK_SPARE_UART1_CLK_SEL_MASK 0x00000080 +#define SWITCH_CLOCK_SPARE_UART1_CLK_SEL_GET(x) (((x) & SWITCH_CLOCK_SPARE_UART1_CLK_SEL_MASK) >> SWITCH_CLOCK_SPARE_UART1_CLK_SEL_LSB) +#define SWITCH_CLOCK_SPARE_UART1_CLK_SEL_SET(x) (((x) << SWITCH_CLOCK_SPARE_UART1_CLK_SEL_LSB) & SWITCH_CLOCK_SPARE_UART1_CLK_SEL_MASK) +#define SWITCH_CLOCK_SPARE_UART1_CLK_SEL_RESET 0x0 // 0 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_MSB 6 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_LSB 6 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_MASK 0x00000040 +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_GET(x) (((x) & SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_MASK) >> SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_LSB) +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_SET(x) (((x) << SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_LSB) & SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_MASK) +#define SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1_RESET 0x0 // 0 +#define SWITCH_CLOCK_SPARE_I2C_CLK_SEL_MSB 5 +#define SWITCH_CLOCK_SPARE_I2C_CLK_SEL_LSB 5 +#define SWITCH_CLOCK_SPARE_I2C_CLK_SEL_MASK 0x00000020 +#define SWITCH_CLOCK_SPARE_I2C_CLK_SEL_GET(x) (((x) & SWITCH_CLOCK_SPARE_I2C_CLK_SEL_MASK) >> SWITCH_CLOCK_SPARE_I2C_CLK_SEL_LSB) +#define SWITCH_CLOCK_SPARE_I2C_CLK_SEL_SET(x) (((x) << SWITCH_CLOCK_SPARE_I2C_CLK_SEL_LSB) & SWITCH_CLOCK_SPARE_I2C_CLK_SEL_MASK) +#define SWITCH_CLOCK_SPARE_I2C_CLK_SEL_RESET 0x0 // 0 +#define SWITCH_CLOCK_SPARE_SPARE_0_MSB 4 +#define SWITCH_CLOCK_SPARE_SPARE_0_LSB 0 +#define SWITCH_CLOCK_SPARE_SPARE_0_MASK 0x0000001f +#define SWITCH_CLOCK_SPARE_SPARE_0_GET(x) (((x) & SWITCH_CLOCK_SPARE_SPARE_0_MASK) >> SWITCH_CLOCK_SPARE_SPARE_0_LSB) +#define SWITCH_CLOCK_SPARE_SPARE_0_SET(x) (((x) << SWITCH_CLOCK_SPARE_SPARE_0_LSB) & SWITCH_CLOCK_SPARE_SPARE_0_MASK) +#define SWITCH_CLOCK_SPARE_SPARE_0_RESET 0x0 // 0 +#define SWITCH_CLOCK_SPARE_ADDRESS 0x18050020 + +#define CURRENT_PCIE_PLL_DITHER_INT_MSB 20 +#define CURRENT_PCIE_PLL_DITHER_INT_LSB 15 +#define CURRENT_PCIE_PLL_DITHER_INT_MASK 0x001f8000 +#define CURRENT_PCIE_PLL_DITHER_INT_GET(x) (((x) & CURRENT_PCIE_PLL_DITHER_INT_MASK) >> CURRENT_PCIE_PLL_DITHER_INT_LSB) +#define CURRENT_PCIE_PLL_DITHER_INT_SET(x) (((x) << CURRENT_PCIE_PLL_DITHER_INT_LSB) & CURRENT_PCIE_PLL_DITHER_INT_MASK) +#define CURRENT_PCIE_PLL_DITHER_INT_RESET 0x1 // 1 +#define CURRENT_PCIE_PLL_DITHER_FRAC_MSB 13 +#define CURRENT_PCIE_PLL_DITHER_FRAC_LSB 0 +#define CURRENT_PCIE_PLL_DITHER_FRAC_MASK 0x00003fff +#define CURRENT_PCIE_PLL_DITHER_FRAC_GET(x) (((x) & CURRENT_PCIE_PLL_DITHER_FRAC_MASK) >> CURRENT_PCIE_PLL_DITHER_FRAC_LSB) +#define CURRENT_PCIE_PLL_DITHER_FRAC_SET(x) (((x) << CURRENT_PCIE_PLL_DITHER_FRAC_LSB) & CURRENT_PCIE_PLL_DITHER_FRAC_MASK) +#define CURRENT_PCIE_PLL_DITHER_FRAC_RESET 0x0 // 0 +#define CURRENT_PCIE_PLL_DITHER_ADDRESS 0x18050024 + +#define ETH_XMII_TX_INVERT_MSB 31 +#define ETH_XMII_TX_INVERT_LSB 31 +#define ETH_XMII_TX_INVERT_MASK 0x80000000 +#define ETH_XMII_TX_INVERT_GET(x) (((x) & ETH_XMII_TX_INVERT_MASK) >> ETH_XMII_TX_INVERT_LSB) +#define ETH_XMII_TX_INVERT_SET(x) (((x) << ETH_XMII_TX_INVERT_LSB) & ETH_XMII_TX_INVERT_MASK) +#define ETH_XMII_TX_INVERT_RESET 0x0 // 0 +#define ETH_XMII_GIGE_QUAD_MSB 30 +#define ETH_XMII_GIGE_QUAD_LSB 30 +#define ETH_XMII_GIGE_QUAD_MASK 0x40000000 +#define ETH_XMII_GIGE_QUAD_GET(x) (((x) & ETH_XMII_GIGE_QUAD_MASK) >> ETH_XMII_GIGE_QUAD_LSB) +#define ETH_XMII_GIGE_QUAD_SET(x) (((x) << ETH_XMII_GIGE_QUAD_LSB) & ETH_XMII_GIGE_QUAD_MASK) +#define ETH_XMII_GIGE_QUAD_RESET 0x0 // 0 +#define ETH_XMII_RX_DELAY_MSB 29 +#define ETH_XMII_RX_DELAY_LSB 28 +#define ETH_XMII_RX_DELAY_MASK 0x30000000 +#define ETH_XMII_RX_DELAY_GET(x) (((x) & ETH_XMII_RX_DELAY_MASK) >> ETH_XMII_RX_DELAY_LSB) +#define ETH_XMII_RX_DELAY_SET(x) (((x) << ETH_XMII_RX_DELAY_LSB) & ETH_XMII_RX_DELAY_MASK) +#define ETH_XMII_RX_DELAY_RESET 0x0 // 0 +#define ETH_XMII_TX_DELAY_MSB 27 +#define ETH_XMII_TX_DELAY_LSB 26 +#define ETH_XMII_TX_DELAY_MASK 0x0c000000 +#define ETH_XMII_TX_DELAY_GET(x) (((x) & ETH_XMII_TX_DELAY_MASK) >> ETH_XMII_TX_DELAY_LSB) +#define ETH_XMII_TX_DELAY_SET(x) (((x) << ETH_XMII_TX_DELAY_LSB) & ETH_XMII_TX_DELAY_MASK) +#define ETH_XMII_TX_DELAY_RESET 0x0 // 0 +#define ETH_XMII_GIGE_MSB 25 +#define ETH_XMII_GIGE_LSB 25 +#define ETH_XMII_GIGE_MASK 0x02000000 +#define ETH_XMII_GIGE_GET(x) (((x) & ETH_XMII_GIGE_MASK) >> ETH_XMII_GIGE_LSB) +#define ETH_XMII_GIGE_SET(x) (((x) << ETH_XMII_GIGE_LSB) & ETH_XMII_GIGE_MASK) +#define ETH_XMII_GIGE_RESET 0x0 // 0 +#define ETH_XMII_OFFSET_PHASE_MSB 24 +#define ETH_XMII_OFFSET_PHASE_LSB 24 +#define ETH_XMII_OFFSET_PHASE_MASK 0x01000000 +#define ETH_XMII_OFFSET_PHASE_GET(x) (((x) & ETH_XMII_OFFSET_PHASE_MASK) >> ETH_XMII_OFFSET_PHASE_LSB) +#define ETH_XMII_OFFSET_PHASE_SET(x) (((x) << ETH_XMII_OFFSET_PHASE_LSB) & ETH_XMII_OFFSET_PHASE_MASK) +#define ETH_XMII_OFFSET_PHASE_RESET 0x0 // 0 +#define ETH_XMII_OFFSET_COUNT_MSB 23 +#define ETH_XMII_OFFSET_COUNT_LSB 16 +#define ETH_XMII_OFFSET_COUNT_MASK 0x00ff0000 +#define ETH_XMII_OFFSET_COUNT_GET(x) (((x) & ETH_XMII_OFFSET_COUNT_MASK) >> ETH_XMII_OFFSET_COUNT_LSB) +#define ETH_XMII_OFFSET_COUNT_SET(x) (((x) << ETH_XMII_OFFSET_COUNT_LSB) & ETH_XMII_OFFSET_COUNT_MASK) +#define ETH_XMII_OFFSET_COUNT_RESET 0x0 // 0 +#define ETH_XMII_PHASE1_COUNT_MSB 15 +#define ETH_XMII_PHASE1_COUNT_LSB 8 +#define ETH_XMII_PHASE1_COUNT_MASK 0x0000ff00 +#define ETH_XMII_PHASE1_COUNT_GET(x) (((x) & ETH_XMII_PHASE1_COUNT_MASK) >> ETH_XMII_PHASE1_COUNT_LSB) +#define ETH_XMII_PHASE1_COUNT_SET(x) (((x) << ETH_XMII_PHASE1_COUNT_LSB) & ETH_XMII_PHASE1_COUNT_MASK) +#define ETH_XMII_PHASE1_COUNT_RESET 0x1 // 1 +#define ETH_XMII_PHASE0_COUNT_MSB 7 +#define ETH_XMII_PHASE0_COUNT_LSB 0 +#define ETH_XMII_PHASE0_COUNT_MASK 0x000000ff +#define ETH_XMII_PHASE0_COUNT_GET(x) (((x) & ETH_XMII_PHASE0_COUNT_MASK) >> ETH_XMII_PHASE0_COUNT_LSB) +#define ETH_XMII_PHASE0_COUNT_SET(x) (((x) << ETH_XMII_PHASE0_COUNT_LSB) & ETH_XMII_PHASE0_COUNT_MASK) +#define ETH_XMII_PHASE0_COUNT_RESET 0x1 // 1 +#define ETH_XMII_ADDRESS 0x18050028 + +#define AUDIO_PLL_CONFIG_UPDATING_MSB 31 +#define AUDIO_PLL_CONFIG_UPDATING_LSB 31 +#define AUDIO_PLL_CONFIG_UPDATING_MASK 0x80000000 +#define AUDIO_PLL_CONFIG_UPDATING_GET(x) (((x) & AUDIO_PLL_CONFIG_UPDATING_MASK) >> AUDIO_PLL_CONFIG_UPDATING_LSB) +#define AUDIO_PLL_CONFIG_UPDATING_SET(x) (((x) << AUDIO_PLL_CONFIG_UPDATING_LSB) & AUDIO_PLL_CONFIG_UPDATING_MASK) +#define AUDIO_PLL_CONFIG_UPDATING_RESET 0x1 // 1 +#define AUDIO_PLL_CONFIG_EXT_DIV_MSB 14 +#define AUDIO_PLL_CONFIG_EXT_DIV_LSB 12 +#define AUDIO_PLL_CONFIG_EXT_DIV_MASK 0x00007000 +#define AUDIO_PLL_CONFIG_EXT_DIV_GET(x) (((x) & AUDIO_PLL_CONFIG_EXT_DIV_MASK) >> AUDIO_PLL_CONFIG_EXT_DIV_LSB) +#define AUDIO_PLL_CONFIG_EXT_DIV_SET(x) (((x) << AUDIO_PLL_CONFIG_EXT_DIV_LSB) & AUDIO_PLL_CONFIG_EXT_DIV_MASK) +#define AUDIO_PLL_CONFIG_EXT_DIV_RESET 0x1 // 1 +#define AUDIO_PLL_CONFIG_POSTPLLDIV_MSB 9 +#define AUDIO_PLL_CONFIG_POSTPLLDIV_LSB 7 +#define AUDIO_PLL_CONFIG_POSTPLLDIV_MASK 0x00000380 +#define AUDIO_PLL_CONFIG_POSTPLLDIV_GET(x) (((x) & AUDIO_PLL_CONFIG_POSTPLLDIV_MASK) >> AUDIO_PLL_CONFIG_POSTPLLDIV_LSB) +#define AUDIO_PLL_CONFIG_POSTPLLDIV_SET(x) (((x) << AUDIO_PLL_CONFIG_POSTPLLDIV_LSB) & AUDIO_PLL_CONFIG_POSTPLLDIV_MASK) +#define AUDIO_PLL_CONFIG_POSTPLLDIV_RESET 0x1 // 1 +#define AUDIO_PLL_CONFIG_PLLPWD_MSB 5 +#define AUDIO_PLL_CONFIG_PLLPWD_LSB 5 +#define AUDIO_PLL_CONFIG_PLLPWD_MASK 0x00000020 +#define AUDIO_PLL_CONFIG_PLLPWD_GET(x) (((x) & AUDIO_PLL_CONFIG_PLLPWD_MASK) >> AUDIO_PLL_CONFIG_PLLPWD_LSB) +#define AUDIO_PLL_CONFIG_PLLPWD_SET(x) (((x) << AUDIO_PLL_CONFIG_PLLPWD_LSB) & AUDIO_PLL_CONFIG_PLLPWD_MASK) +#define AUDIO_PLL_CONFIG_PLLPWD_RESET 0x1 // 1 +#define AUDIO_PLL_CONFIG_BYPASS_MSB 4 +#define AUDIO_PLL_CONFIG_BYPASS_LSB 4 +#define AUDIO_PLL_CONFIG_BYPASS_MASK 0x00000010 +#define AUDIO_PLL_CONFIG_BYPASS_GET(x) (((x) & AUDIO_PLL_CONFIG_BYPASS_MASK) >> AUDIO_PLL_CONFIG_BYPASS_LSB) +#define AUDIO_PLL_CONFIG_BYPASS_SET(x) (((x) << AUDIO_PLL_CONFIG_BYPASS_LSB) & AUDIO_PLL_CONFIG_BYPASS_MASK) +#define AUDIO_PLL_CONFIG_BYPASS_RESET 0x1 // 1 +#define AUDIO_PLL_CONFIG_REFDIV_MSB 3 +#define AUDIO_PLL_CONFIG_REFDIV_LSB 0 +#define AUDIO_PLL_CONFIG_REFDIV_MASK 0x0000000f +#define AUDIO_PLL_CONFIG_REFDIV_GET(x) (((x) & AUDIO_PLL_CONFIG_REFDIV_MASK) >> AUDIO_PLL_CONFIG_REFDIV_LSB) +#define AUDIO_PLL_CONFIG_REFDIV_SET(x) (((x) << AUDIO_PLL_CONFIG_REFDIV_LSB) & AUDIO_PLL_CONFIG_REFDIV_MASK) +#define AUDIO_PLL_CONFIG_REFDIV_RESET 0x3 // 3 +#define AUDIO_PLL_CONFIG_ADDRESS 0x1805002c + +#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_MSB 28 +#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_LSB 11 +#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_MASK 0x1ffff800 +#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_GET(x) (((x) & AUDIO_PLL_MODULATION_TGT_DIV_FRAC_MASK) >> AUDIO_PLL_MODULATION_TGT_DIV_FRAC_LSB) +#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_SET(x) (((x) << AUDIO_PLL_MODULATION_TGT_DIV_FRAC_LSB) & AUDIO_PLL_MODULATION_TGT_DIV_FRAC_MASK) +#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_RESET 0x148fe // 84222 +#define AUDIO_PLL_MODULATION_TGT_DIV_INT_MSB 6 +#define AUDIO_PLL_MODULATION_TGT_DIV_INT_LSB 1 +#define AUDIO_PLL_MODULATION_TGT_DIV_INT_MASK 0x0000007e +#define AUDIO_PLL_MODULATION_TGT_DIV_INT_GET(x) (((x) & AUDIO_PLL_MODULATION_TGT_DIV_INT_MASK) >> AUDIO_PLL_MODULATION_TGT_DIV_INT_LSB) +#define AUDIO_PLL_MODULATION_TGT_DIV_INT_SET(x) (((x) << AUDIO_PLL_MODULATION_TGT_DIV_INT_LSB) & AUDIO_PLL_MODULATION_TGT_DIV_INT_MASK) +#define AUDIO_PLL_MODULATION_TGT_DIV_INT_RESET 0x14 // 20 +#define AUDIO_PLL_MODULATION_START_MSB 0 +#define AUDIO_PLL_MODULATION_START_LSB 0 +#define AUDIO_PLL_MODULATION_START_MASK 0x00000001 +#define AUDIO_PLL_MODULATION_START_GET(x) (((x) & AUDIO_PLL_MODULATION_START_MASK) >> AUDIO_PLL_MODULATION_START_LSB) +#define AUDIO_PLL_MODULATION_START_SET(x) (((x) << AUDIO_PLL_MODULATION_START_LSB) & AUDIO_PLL_MODULATION_START_MASK) +#define AUDIO_PLL_MODULATION_START_RESET 0x0 // 0 +#define AUDIO_PLL_MODULATION_ADDRESS 0x18050030 + +#define AUDIO_PLL_MOD_STEP_FRAC_MSB 31 +#define AUDIO_PLL_MOD_STEP_FRAC_LSB 14 +#define AUDIO_PLL_MOD_STEP_FRAC_MASK 0xffffc000 +#define AUDIO_PLL_MOD_STEP_FRAC_GET(x) (((x) & AUDIO_PLL_MOD_STEP_FRAC_MASK) >> AUDIO_PLL_MOD_STEP_FRAC_LSB) +#define AUDIO_PLL_MOD_STEP_FRAC_SET(x) (((x) << AUDIO_PLL_MOD_STEP_FRAC_LSB) & AUDIO_PLL_MOD_STEP_FRAC_MASK) +#define AUDIO_PLL_MOD_STEP_FRAC_RESET 0x1 // 1 +#define AUDIO_PLL_MOD_STEP_INT_MSB 13 +#define AUDIO_PLL_MOD_STEP_INT_LSB 4 +#define AUDIO_PLL_MOD_STEP_INT_MASK 0x00003ff0 +#define AUDIO_PLL_MOD_STEP_INT_GET(x) (((x) & AUDIO_PLL_MOD_STEP_INT_MASK) >> AUDIO_PLL_MOD_STEP_INT_LSB) +#define AUDIO_PLL_MOD_STEP_INT_SET(x) (((x) << AUDIO_PLL_MOD_STEP_INT_LSB) & AUDIO_PLL_MOD_STEP_INT_MASK) +#define AUDIO_PLL_MOD_STEP_INT_RESET 0x0 // 0 +#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_MSB 3 +#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_LSB 0 +#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_MASK 0x0000000f +#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_GET(x) (((x) & AUDIO_PLL_MOD_STEP_UPDATE_CNT_MASK) >> AUDIO_PLL_MOD_STEP_UPDATE_CNT_LSB) +#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_SET(x) (((x) << AUDIO_PLL_MOD_STEP_UPDATE_CNT_LSB) & AUDIO_PLL_MOD_STEP_UPDATE_CNT_MASK) +#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_RESET 0x0 // 0 +#define AUDIO_PLL_MOD_STEP_ADDRESS 0x18050034 + +#define CURRENT_AUDIO_PLL_MODULATION_FRAC_MSB 27 +#define CURRENT_AUDIO_PLL_MODULATION_FRAC_LSB 10 +#define CURRENT_AUDIO_PLL_MODULATION_FRAC_MASK 0x0ffffc00 +#define CURRENT_AUDIO_PLL_MODULATION_FRAC_GET(x) (((x) & CURRENT_AUDIO_PLL_MODULATION_FRAC_MASK) >> CURRENT_AUDIO_PLL_MODULATION_FRAC_LSB) +#define CURRENT_AUDIO_PLL_MODULATION_FRAC_SET(x) (((x) << CURRENT_AUDIO_PLL_MODULATION_FRAC_LSB) & CURRENT_AUDIO_PLL_MODULATION_FRAC_MASK) +#define CURRENT_AUDIO_PLL_MODULATION_FRAC_RESET 0x1 // 1 +#define CURRENT_AUDIO_PLL_MODULATION_INT_MSB 6 +#define CURRENT_AUDIO_PLL_MODULATION_INT_LSB 1 +#define CURRENT_AUDIO_PLL_MODULATION_INT_MASK 0x0000007e +#define CURRENT_AUDIO_PLL_MODULATION_INT_GET(x) (((x) & CURRENT_AUDIO_PLL_MODULATION_INT_MASK) >> CURRENT_AUDIO_PLL_MODULATION_INT_LSB) +#define CURRENT_AUDIO_PLL_MODULATION_INT_SET(x) (((x) << CURRENT_AUDIO_PLL_MODULATION_INT_LSB) & CURRENT_AUDIO_PLL_MODULATION_INT_MASK) +#define CURRENT_AUDIO_PLL_MODULATION_INT_RESET 0x0 // 0 +#define CURRENT_AUDIO_PLL_MODULATION_ADDRESS 0x18050038 + +#define BB_PLL_CONFIG_UPDATING_MSB 31 +#define BB_PLL_CONFIG_UPDATING_LSB 31 +#define BB_PLL_CONFIG_UPDATING_MASK 0x80000000 +#define BB_PLL_CONFIG_UPDATING_GET(x) (((x) & BB_PLL_CONFIG_UPDATING_MASK) >> BB_PLL_CONFIG_UPDATING_LSB) +#define BB_PLL_CONFIG_UPDATING_SET(x) (((x) << BB_PLL_CONFIG_UPDATING_LSB) & BB_PLL_CONFIG_UPDATING_MASK) +#define BB_PLL_CONFIG_UPDATING_RESET 0x1 // 1 +#define BB_PLL_CONFIG_PLLPWD_MSB 30 +#define BB_PLL_CONFIG_PLLPWD_LSB 30 +#define BB_PLL_CONFIG_PLLPWD_MASK 0x40000000 +#define BB_PLL_CONFIG_PLLPWD_GET(x) (((x) & BB_PLL_CONFIG_PLLPWD_MASK) >> BB_PLL_CONFIG_PLLPWD_LSB) +#define BB_PLL_CONFIG_PLLPWD_SET(x) (((x) << BB_PLL_CONFIG_PLLPWD_LSB) & BB_PLL_CONFIG_PLLPWD_MASK) +#define BB_PLL_CONFIG_PLLPWD_RESET 0x1 // 1 +#define BB_PLL_CONFIG_SPARE_MSB 29 +#define BB_PLL_CONFIG_SPARE_LSB 29 +#define BB_PLL_CONFIG_SPARE_MASK 0x20000000 +#define BB_PLL_CONFIG_SPARE_GET(x) (((x) & BB_PLL_CONFIG_SPARE_MASK) >> BB_PLL_CONFIG_SPARE_LSB) +#define BB_PLL_CONFIG_SPARE_SET(x) (((x) << BB_PLL_CONFIG_SPARE_LSB) & BB_PLL_CONFIG_SPARE_MASK) +#define BB_PLL_CONFIG_SPARE_RESET 0x0 // 0 +#define BB_PLL_CONFIG_REFDIV_MSB 28 +#define BB_PLL_CONFIG_REFDIV_LSB 24 +#define BB_PLL_CONFIG_REFDIV_MASK 0x1f000000 +#define BB_PLL_CONFIG_REFDIV_GET(x) (((x) & BB_PLL_CONFIG_REFDIV_MASK) >> BB_PLL_CONFIG_REFDIV_LSB) +#define BB_PLL_CONFIG_REFDIV_SET(x) (((x) << BB_PLL_CONFIG_REFDIV_LSB) & BB_PLL_CONFIG_REFDIV_MASK) +#define BB_PLL_CONFIG_REFDIV_RESET 0x1 // 1 +#define BB_PLL_CONFIG_NINT_MSB 21 +#define BB_PLL_CONFIG_NINT_LSB 16 +#define BB_PLL_CONFIG_NINT_MASK 0x003f0000 +#define BB_PLL_CONFIG_NINT_GET(x) (((x) & BB_PLL_CONFIG_NINT_MASK) >> BB_PLL_CONFIG_NINT_LSB) +#define BB_PLL_CONFIG_NINT_SET(x) (((x) << BB_PLL_CONFIG_NINT_LSB) & BB_PLL_CONFIG_NINT_MASK) +#define BB_PLL_CONFIG_NINT_RESET 0x2 // 2 +#define BB_PLL_CONFIG_NFRAC_MSB 13 +#define BB_PLL_CONFIG_NFRAC_LSB 0 +#define BB_PLL_CONFIG_NFRAC_MASK 0x00003fff +#define BB_PLL_CONFIG_NFRAC_GET(x) (((x) & BB_PLL_CONFIG_NFRAC_MASK) >> BB_PLL_CONFIG_NFRAC_LSB) +#define BB_PLL_CONFIG_NFRAC_SET(x) (((x) << BB_PLL_CONFIG_NFRAC_LSB) & BB_PLL_CONFIG_NFRAC_MASK) +#define BB_PLL_CONFIG_NFRAC_RESET 0xccc // 3276 +#define BB_PLL_CONFIG_ADDRESS 0x1805003c + +#define DDR_PLL_DITHER_DITHER_EN_MSB 31 +#define DDR_PLL_DITHER_DITHER_EN_LSB 31 +#define DDR_PLL_DITHER_DITHER_EN_MASK 0x80000000 +#define DDR_PLL_DITHER_DITHER_EN_GET(x) (((x) & DDR_PLL_DITHER_DITHER_EN_MASK) >> DDR_PLL_DITHER_DITHER_EN_LSB) +#define DDR_PLL_DITHER_DITHER_EN_SET(x) (((x) << DDR_PLL_DITHER_DITHER_EN_LSB) & DDR_PLL_DITHER_DITHER_EN_MASK) +#define DDR_PLL_DITHER_DITHER_EN_RESET 0x0 // 0 +#define DDR_PLL_DITHER_UPDATE_COUNT_MSB 30 +#define DDR_PLL_DITHER_UPDATE_COUNT_LSB 27 +#define DDR_PLL_DITHER_UPDATE_COUNT_MASK 0x78000000 +#define DDR_PLL_DITHER_UPDATE_COUNT_GET(x) (((x) & DDR_PLL_DITHER_UPDATE_COUNT_MASK) >> DDR_PLL_DITHER_UPDATE_COUNT_LSB) +#define DDR_PLL_DITHER_UPDATE_COUNT_SET(x) (((x) << DDR_PLL_DITHER_UPDATE_COUNT_LSB) & DDR_PLL_DITHER_UPDATE_COUNT_MASK) +#define DDR_PLL_DITHER_UPDATE_COUNT_RESET 0xf // 15 +#define DDR_PLL_DITHER_NFRAC_STEP_MSB 26 +#define DDR_PLL_DITHER_NFRAC_STEP_LSB 20 +#define DDR_PLL_DITHER_NFRAC_STEP_MASK 0x07f00000 +#define DDR_PLL_DITHER_NFRAC_STEP_GET(x) (((x) & DDR_PLL_DITHER_NFRAC_STEP_MASK) >> DDR_PLL_DITHER_NFRAC_STEP_LSB) +#define DDR_PLL_DITHER_NFRAC_STEP_SET(x) (((x) << DDR_PLL_DITHER_NFRAC_STEP_LSB) & DDR_PLL_DITHER_NFRAC_STEP_MASK) +#define DDR_PLL_DITHER_NFRAC_STEP_RESET 0x1 // 1 +#define DDR_PLL_DITHER_NFRAC_MIN_MSB 19 +#define DDR_PLL_DITHER_NFRAC_MIN_LSB 10 +#define DDR_PLL_DITHER_NFRAC_MIN_MASK 0x000ffc00 +#define DDR_PLL_DITHER_NFRAC_MIN_GET(x) (((x) & DDR_PLL_DITHER_NFRAC_MIN_MASK) >> DDR_PLL_DITHER_NFRAC_MIN_LSB) +#define DDR_PLL_DITHER_NFRAC_MIN_SET(x) (((x) << DDR_PLL_DITHER_NFRAC_MIN_LSB) & DDR_PLL_DITHER_NFRAC_MIN_MASK) +#define DDR_PLL_DITHER_NFRAC_MIN_RESET 0x19 // 25 +#define DDR_PLL_DITHER_NFRAC_MAX_MSB 9 +#define DDR_PLL_DITHER_NFRAC_MAX_LSB 0 +#define DDR_PLL_DITHER_NFRAC_MAX_MASK 0x000003ff +#define DDR_PLL_DITHER_NFRAC_MAX_GET(x) (((x) & DDR_PLL_DITHER_NFRAC_MAX_MASK) >> DDR_PLL_DITHER_NFRAC_MAX_LSB) +#define DDR_PLL_DITHER_NFRAC_MAX_SET(x) (((x) << DDR_PLL_DITHER_NFRAC_MAX_LSB) & DDR_PLL_DITHER_NFRAC_MAX_MASK) +#define DDR_PLL_DITHER_NFRAC_MAX_RESET 0x3e8 // 1000 +#define DDR_PLL_DITHER_ADDRESS 0x18050040 + +#define CPU_PLL_DITHER_DITHER_EN_MSB 31 +#define CPU_PLL_DITHER_DITHER_EN_LSB 31 +#define CPU_PLL_DITHER_DITHER_EN_MASK 0x80000000 +#define CPU_PLL_DITHER_DITHER_EN_GET(x) (((x) & CPU_PLL_DITHER_DITHER_EN_MASK) >> CPU_PLL_DITHER_DITHER_EN_LSB) +#define CPU_PLL_DITHER_DITHER_EN_SET(x) (((x) << CPU_PLL_DITHER_DITHER_EN_LSB) & CPU_PLL_DITHER_DITHER_EN_MASK) +#define CPU_PLL_DITHER_DITHER_EN_RESET 0x0 // 0 +#define CPU_PLL_DITHER_UPDATE_COUNT_MSB 23 +#define CPU_PLL_DITHER_UPDATE_COUNT_LSB 18 +#define CPU_PLL_DITHER_UPDATE_COUNT_MASK 0x00fc0000 +#define CPU_PLL_DITHER_UPDATE_COUNT_GET(x) (((x) & CPU_PLL_DITHER_UPDATE_COUNT_MASK) >> CPU_PLL_DITHER_UPDATE_COUNT_LSB) +#define CPU_PLL_DITHER_UPDATE_COUNT_SET(x) (((x) << CPU_PLL_DITHER_UPDATE_COUNT_LSB) & CPU_PLL_DITHER_UPDATE_COUNT_MASK) +#define CPU_PLL_DITHER_UPDATE_COUNT_RESET 0x14 // 20 +#define CPU_PLL_DITHER_NFRAC_STEP_MSB 17 +#define CPU_PLL_DITHER_NFRAC_STEP_LSB 12 +#define CPU_PLL_DITHER_NFRAC_STEP_MASK 0x0003f000 +#define CPU_PLL_DITHER_NFRAC_STEP_GET(x) (((x) & CPU_PLL_DITHER_NFRAC_STEP_MASK) >> CPU_PLL_DITHER_NFRAC_STEP_LSB) +#define CPU_PLL_DITHER_NFRAC_STEP_SET(x) (((x) << CPU_PLL_DITHER_NFRAC_STEP_LSB) & CPU_PLL_DITHER_NFRAC_STEP_MASK) +#define CPU_PLL_DITHER_NFRAC_STEP_RESET 0x1 // 1 +#define CPU_PLL_DITHER_NFRAC_MIN_MSB 11 +#define CPU_PLL_DITHER_NFRAC_MIN_LSB 6 +#define CPU_PLL_DITHER_NFRAC_MIN_MASK 0x00000fc0 +#define CPU_PLL_DITHER_NFRAC_MIN_GET(x) (((x) & CPU_PLL_DITHER_NFRAC_MIN_MASK) >> CPU_PLL_DITHER_NFRAC_MIN_LSB) +#define CPU_PLL_DITHER_NFRAC_MIN_SET(x) (((x) << CPU_PLL_DITHER_NFRAC_MIN_LSB) & CPU_PLL_DITHER_NFRAC_MIN_MASK) +#define CPU_PLL_DITHER_NFRAC_MIN_RESET 0x3 // 3 +#define CPU_PLL_DITHER_NFRAC_MAX_MSB 5 +#define CPU_PLL_DITHER_NFRAC_MAX_LSB 0 +#define CPU_PLL_DITHER_NFRAC_MAX_MASK 0x0000003f +#define CPU_PLL_DITHER_NFRAC_MAX_GET(x) (((x) & CPU_PLL_DITHER_NFRAC_MAX_MASK) >> CPU_PLL_DITHER_NFRAC_MAX_LSB) +#define CPU_PLL_DITHER_NFRAC_MAX_SET(x) (((x) << CPU_PLL_DITHER_NFRAC_MAX_LSB) & CPU_PLL_DITHER_NFRAC_MAX_MASK) +#define CPU_PLL_DITHER_NFRAC_MAX_RESET 0x3c // 60 +#define CPU_PLL_DITHER_ADDRESS 0x18050044 + +#define RST_RESET_HOST_RESET_MSB 31 +#define RST_RESET_HOST_RESET_LSB 31 +#define RST_RESET_HOST_RESET_MASK 0x80000000 +#define RST_RESET_HOST_RESET_GET(x) (((x) & RST_RESET_HOST_RESET_MASK) >> RST_RESET_HOST_RESET_LSB) +#define RST_RESET_HOST_RESET_SET(x) (((x) << RST_RESET_HOST_RESET_LSB) & RST_RESET_HOST_RESET_MASK) +#define RST_RESET_HOST_RESET_RESET 0x0 // 0 +#define RST_RESET_SLIC_RESET_MSB 30 +#define RST_RESET_SLIC_RESET_LSB 30 +#define RST_RESET_SLIC_RESET_MASK 0x40000000 +#define RST_RESET_SLIC_RESET_GET(x) (((x) & RST_RESET_SLIC_RESET_MASK) >> RST_RESET_SLIC_RESET_LSB) +#define RST_RESET_SLIC_RESET_SET(x) (((x) << RST_RESET_SLIC_RESET_LSB) & RST_RESET_SLIC_RESET_MASK) +#define RST_RESET_SLIC_RESET_RESET 0x0 // 0 +#define RST_RESET_HDMA_RESET_MSB 29 +#define RST_RESET_HDMA_RESET_LSB 29 +#define RST_RESET_HDMA_RESET_MASK 0x20000000 +#define RST_RESET_HDMA_RESET_GET(x) (((x) & RST_RESET_HDMA_RESET_MASK) >> RST_RESET_HDMA_RESET_LSB) +#define RST_RESET_HDMA_RESET_SET(x) (((x) << RST_RESET_HDMA_RESET_LSB) & RST_RESET_HDMA_RESET_MASK) +#define RST_RESET_HDMA_RESET_RESET 0x1 // 1 +#define RST_RESET_EXTERNAL_RESET_MSB 28 +#define RST_RESET_EXTERNAL_RESET_LSB 28 +#define RST_RESET_EXTERNAL_RESET_MASK 0x10000000 +#define RST_RESET_EXTERNAL_RESET_GET(x) (((x) & RST_RESET_EXTERNAL_RESET_MASK) >> RST_RESET_EXTERNAL_RESET_LSB) +#define RST_RESET_EXTERNAL_RESET_SET(x) (((x) << RST_RESET_EXTERNAL_RESET_LSB) & RST_RESET_EXTERNAL_RESET_MASK) +#define RST_RESET_EXTERNAL_RESET_RESET 0x0 // 0 +#define RST_RESET_RTC_RESET_MSB 27 +#define RST_RESET_RTC_RESET_LSB 27 +#define RST_RESET_RTC_RESET_MASK 0x08000000 +#define RST_RESET_RTC_RESET_GET(x) (((x) & RST_RESET_RTC_RESET_MASK) >> RST_RESET_RTC_RESET_LSB) +#define RST_RESET_RTC_RESET_SET(x) (((x) << RST_RESET_RTC_RESET_LSB) & RST_RESET_RTC_RESET_MASK) +#define RST_RESET_RTC_RESET_RESET 0x1 // 1 +#define RST_RESET_PCIEEP_RST_INT_MSB 26 +#define RST_RESET_PCIEEP_RST_INT_LSB 26 +#define RST_RESET_PCIEEP_RST_INT_MASK 0x04000000 +#define RST_RESET_PCIEEP_RST_INT_GET(x) (((x) & RST_RESET_PCIEEP_RST_INT_MASK) >> RST_RESET_PCIEEP_RST_INT_LSB) +#define RST_RESET_PCIEEP_RST_INT_SET(x) (((x) << RST_RESET_PCIEEP_RST_INT_LSB) & RST_RESET_PCIEEP_RST_INT_MASK) +#define RST_RESET_PCIEEP_RST_INT_RESET 0x0 // 0 +#define RST_RESET_CHKSUM_ACC_RESET_MSB 25 +#define RST_RESET_CHKSUM_ACC_RESET_LSB 25 +#define RST_RESET_CHKSUM_ACC_RESET_MASK 0x02000000 +#define RST_RESET_CHKSUM_ACC_RESET_GET(x) (((x) & RST_RESET_CHKSUM_ACC_RESET_MASK) >> RST_RESET_CHKSUM_ACC_RESET_LSB) +#define RST_RESET_CHKSUM_ACC_RESET_SET(x) (((x) << RST_RESET_CHKSUM_ACC_RESET_LSB) & RST_RESET_CHKSUM_ACC_RESET_MASK) +#define RST_RESET_CHKSUM_ACC_RESET_RESET 0x0 // 0 +#define RST_RESET_FULL_CHIP_RESET_MSB 24 +#define RST_RESET_FULL_CHIP_RESET_LSB 24 +#define RST_RESET_FULL_CHIP_RESET_MASK 0x01000000 +#define RST_RESET_FULL_CHIP_RESET_GET(x) (((x) & RST_RESET_FULL_CHIP_RESET_MASK) >> RST_RESET_FULL_CHIP_RESET_LSB) +#define RST_RESET_FULL_CHIP_RESET_SET(x) (((x) << RST_RESET_FULL_CHIP_RESET_LSB) & RST_RESET_FULL_CHIP_RESET_MASK) +#define RST_RESET_FULL_CHIP_RESET_RESET 0x0 // 0 +#define RST_RESET_GE1_MDIO_RESET_MSB 23 +#define RST_RESET_GE1_MDIO_RESET_LSB 23 +#define RST_RESET_GE1_MDIO_RESET_MASK 0x00800000 +#define RST_RESET_GE1_MDIO_RESET_GET(x) (((x) & RST_RESET_GE1_MDIO_RESET_MASK) >> RST_RESET_GE1_MDIO_RESET_LSB) +#define RST_RESET_GE1_MDIO_RESET_SET(x) (((x) << RST_RESET_GE1_MDIO_RESET_LSB) & RST_RESET_GE1_MDIO_RESET_MASK) +#define RST_RESET_GE1_MDIO_RESET_RESET 0x1 // 1 +#define RST_RESET_GE0_MDIO_RESET_MSB 22 +#define RST_RESET_GE0_MDIO_RESET_LSB 22 +#define RST_RESET_GE0_MDIO_RESET_MASK 0x00400000 +#define RST_RESET_GE0_MDIO_RESET_GET(x) (((x) & RST_RESET_GE0_MDIO_RESET_MASK) >> RST_RESET_GE0_MDIO_RESET_LSB) +#define RST_RESET_GE0_MDIO_RESET_SET(x) (((x) << RST_RESET_GE0_MDIO_RESET_LSB) & RST_RESET_GE0_MDIO_RESET_MASK) +#define RST_RESET_GE0_MDIO_RESET_RESET 0x1 // 1 +#define RST_RESET_CPU_NMI_MSB 21 +#define RST_RESET_CPU_NMI_LSB 21 +#define RST_RESET_CPU_NMI_MASK 0x00200000 +#define RST_RESET_CPU_NMI_GET(x) (((x) & RST_RESET_CPU_NMI_MASK) >> RST_RESET_CPU_NMI_LSB) +#define RST_RESET_CPU_NMI_SET(x) (((x) << RST_RESET_CPU_NMI_LSB) & RST_RESET_CPU_NMI_MASK) +#define RST_RESET_CPU_NMI_RESET 0x0 // 0 +#define RST_RESET_CPU_COLD_RESET_MSB 20 +#define RST_RESET_CPU_COLD_RESET_LSB 20 +#define RST_RESET_CPU_COLD_RESET_MASK 0x00100000 +#define RST_RESET_CPU_COLD_RESET_GET(x) (((x) & RST_RESET_CPU_COLD_RESET_MASK) >> RST_RESET_CPU_COLD_RESET_LSB) +#define RST_RESET_CPU_COLD_RESET_SET(x) (((x) << RST_RESET_CPU_COLD_RESET_LSB) & RST_RESET_CPU_COLD_RESET_MASK) +#define RST_RESET_CPU_COLD_RESET_RESET 0x0 // 0 +#define RST_RESET_HOST_RESET_INT_MSB 19 +#define RST_RESET_HOST_RESET_INT_LSB 19 +#define RST_RESET_HOST_RESET_INT_MASK 0x00080000 +#define RST_RESET_HOST_RESET_INT_GET(x) (((x) & RST_RESET_HOST_RESET_INT_MASK) >> RST_RESET_HOST_RESET_INT_LSB) +#define RST_RESET_HOST_RESET_INT_SET(x) (((x) << RST_RESET_HOST_RESET_INT_LSB) & RST_RESET_HOST_RESET_INT_MASK) +#define RST_RESET_HOST_RESET_INT_RESET 0x0 // 0 +#define RST_RESET_PCIEEP_RESET_MSB 18 +#define RST_RESET_PCIEEP_RESET_LSB 18 +#define RST_RESET_PCIEEP_RESET_MASK 0x00040000 +#define RST_RESET_PCIEEP_RESET_GET(x) (((x) & RST_RESET_PCIEEP_RESET_MASK) >> RST_RESET_PCIEEP_RESET_LSB) +#define RST_RESET_PCIEEP_RESET_SET(x) (((x) << RST_RESET_PCIEEP_RESET_LSB) & RST_RESET_PCIEEP_RESET_MASK) +#define RST_RESET_PCIEEP_RESET_RESET 0x0 // 0 +#define RST_RESET_UART1_RESET_MSB 17 +#define RST_RESET_UART1_RESET_LSB 17 +#define RST_RESET_UART1_RESET_MASK 0x00020000 +#define RST_RESET_UART1_RESET_GET(x) (((x) & RST_RESET_UART1_RESET_MASK) >> RST_RESET_UART1_RESET_LSB) +#define RST_RESET_UART1_RESET_SET(x) (((x) << RST_RESET_UART1_RESET_LSB) & RST_RESET_UART1_RESET_MASK) +#define RST_RESET_UART1_RESET_RESET 0x0 // 0 +#define RST_RESET_DDR_RESET_MSB 16 +#define RST_RESET_DDR_RESET_LSB 16 +#define RST_RESET_DDR_RESET_MASK 0x00010000 +#define RST_RESET_DDR_RESET_GET(x) (((x) & RST_RESET_DDR_RESET_MASK) >> RST_RESET_DDR_RESET_LSB) +#define RST_RESET_DDR_RESET_SET(x) (((x) << RST_RESET_DDR_RESET_LSB) & RST_RESET_DDR_RESET_MASK) +#define RST_RESET_DDR_RESET_RESET 0x0 // 0 +#define RST_RESET_USB_PHY_PLL_PWD_EXT_MSB 15 +#define RST_RESET_USB_PHY_PLL_PWD_EXT_LSB 15 +#define RST_RESET_USB_PHY_PLL_PWD_EXT_MASK 0x00008000 +#define RST_RESET_USB_PHY_PLL_PWD_EXT_GET(x) (((x) & RST_RESET_USB_PHY_PLL_PWD_EXT_MASK) >> RST_RESET_USB_PHY_PLL_PWD_EXT_LSB) +#define RST_RESET_USB_PHY_PLL_PWD_EXT_SET(x) (((x) << RST_RESET_USB_PHY_PLL_PWD_EXT_LSB) & RST_RESET_USB_PHY_PLL_PWD_EXT_MASK) +#define RST_RESET_USB_PHY_PLL_PWD_EXT_RESET 0x0 // 0 +#define RST_RESET_NANDF_RESET_MSB 14 +#define RST_RESET_NANDF_RESET_LSB 14 +#define RST_RESET_NANDF_RESET_MASK 0x00004000 +#define RST_RESET_NANDF_RESET_GET(x) (((x) & RST_RESET_NANDF_RESET_MASK) >> RST_RESET_NANDF_RESET_LSB) +#define RST_RESET_NANDF_RESET_SET(x) (((x) << RST_RESET_NANDF_RESET_LSB) & RST_RESET_NANDF_RESET_MASK) +#define RST_RESET_NANDF_RESET_RESET 0x1 // 1 +#define RST_RESET_GE1_MAC_RESET_MSB 13 +#define RST_RESET_GE1_MAC_RESET_LSB 13 +#define RST_RESET_GE1_MAC_RESET_MASK 0x00002000 +#define RST_RESET_GE1_MAC_RESET_GET(x) (((x) & RST_RESET_GE1_MAC_RESET_MASK) >> RST_RESET_GE1_MAC_RESET_LSB) +#define RST_RESET_GE1_MAC_RESET_SET(x) (((x) << RST_RESET_GE1_MAC_RESET_LSB) & RST_RESET_GE1_MAC_RESET_MASK) +#define RST_RESET_GE1_MAC_RESET_RESET 0x1 // 1 +#define RST_RESET_ETH_SGMII_ARESET_MSB 12 +#define RST_RESET_ETH_SGMII_ARESET_LSB 12 +#define RST_RESET_ETH_SGMII_ARESET_MASK 0x00001000 +#define RST_RESET_ETH_SGMII_ARESET_GET(x) (((x) & RST_RESET_ETH_SGMII_ARESET_MASK) >> RST_RESET_ETH_SGMII_ARESET_LSB) +#define RST_RESET_ETH_SGMII_ARESET_SET(x) (((x) << RST_RESET_ETH_SGMII_ARESET_LSB) & RST_RESET_ETH_SGMII_ARESET_MASK) +#define RST_RESET_ETH_SGMII_ARESET_RESET 0x1 // 1 +#define RST_RESET_USB_PHY_ARESET_MSB 11 +#define RST_RESET_USB_PHY_ARESET_LSB 11 +#define RST_RESET_USB_PHY_ARESET_MASK 0x00000800 +#define RST_RESET_USB_PHY_ARESET_GET(x) (((x) & RST_RESET_USB_PHY_ARESET_MASK) >> RST_RESET_USB_PHY_ARESET_LSB) +#define RST_RESET_USB_PHY_ARESET_SET(x) (((x) << RST_RESET_USB_PHY_ARESET_LSB) & RST_RESET_USB_PHY_ARESET_MASK) +#define RST_RESET_USB_PHY_ARESET_RESET 0x1 // 1 +#define RST_RESET_HOST_DMA_INT_MSB 10 +#define RST_RESET_HOST_DMA_INT_LSB 10 +#define RST_RESET_HOST_DMA_INT_MASK 0x00000400 +#define RST_RESET_HOST_DMA_INT_GET(x) (((x) & RST_RESET_HOST_DMA_INT_MASK) >> RST_RESET_HOST_DMA_INT_LSB) +#define RST_RESET_HOST_DMA_INT_SET(x) (((x) << RST_RESET_HOST_DMA_INT_LSB) & RST_RESET_HOST_DMA_INT_MASK) +#define RST_RESET_HOST_DMA_INT_RESET 0x0 // 0 +#define RST_RESET_GE0_MAC_RESET_MSB 9 +#define RST_RESET_GE0_MAC_RESET_LSB 9 +#define RST_RESET_GE0_MAC_RESET_MASK 0x00000200 +#define RST_RESET_GE0_MAC_RESET_GET(x) (((x) & RST_RESET_GE0_MAC_RESET_MASK) >> RST_RESET_GE0_MAC_RESET_LSB) +#define RST_RESET_GE0_MAC_RESET_SET(x) (((x) << RST_RESET_GE0_MAC_RESET_LSB) & RST_RESET_GE0_MAC_RESET_MASK) +#define RST_RESET_GE0_MAC_RESET_RESET 0x1 // 1 +#define RST_RESET_ETH_SGMII_RESET_MSB 8 +#define RST_RESET_ETH_SGMII_RESET_LSB 8 +#define RST_RESET_ETH_SGMII_RESET_MASK 0x00000100 +#define RST_RESET_ETH_SGMII_RESET_GET(x) (((x) & RST_RESET_ETH_SGMII_RESET_MASK) >> RST_RESET_ETH_SGMII_RESET_LSB) +#define RST_RESET_ETH_SGMII_RESET_SET(x) (((x) << RST_RESET_ETH_SGMII_RESET_LSB) & RST_RESET_ETH_SGMII_RESET_MASK) +#define RST_RESET_ETH_SGMII_RESET_RESET 0x1 // 1 +#define RST_RESET_PCIE_PHY_RESET_MSB 7 +#define RST_RESET_PCIE_PHY_RESET_LSB 7 +#define RST_RESET_PCIE_PHY_RESET_MASK 0x00000080 +#define RST_RESET_PCIE_PHY_RESET_GET(x) (((x) & RST_RESET_PCIE_PHY_RESET_MASK) >> RST_RESET_PCIE_PHY_RESET_LSB) +#define RST_RESET_PCIE_PHY_RESET_SET(x) (((x) << RST_RESET_PCIE_PHY_RESET_LSB) & RST_RESET_PCIE_PHY_RESET_MASK) +#define RST_RESET_PCIE_PHY_RESET_RESET 0x1 // 1 +#define RST_RESET_PCIE_RESET_MSB 6 +#define RST_RESET_PCIE_RESET_LSB 6 +#define RST_RESET_PCIE_RESET_MASK 0x00000040 +#define RST_RESET_PCIE_RESET_GET(x) (((x) & RST_RESET_PCIE_RESET_MASK) >> RST_RESET_PCIE_RESET_LSB) +#define RST_RESET_PCIE_RESET_SET(x) (((x) << RST_RESET_PCIE_RESET_LSB) & RST_RESET_PCIE_RESET_MASK) +#define RST_RESET_PCIE_RESET_RESET 0x1 // 1 +#define RST_RESET_USB_HOST_RESET_MSB 5 +#define RST_RESET_USB_HOST_RESET_LSB 5 +#define RST_RESET_USB_HOST_RESET_MASK 0x00000020 +#define RST_RESET_USB_HOST_RESET_GET(x) (((x) & RST_RESET_USB_HOST_RESET_MASK) >> RST_RESET_USB_HOST_RESET_LSB) +#define RST_RESET_USB_HOST_RESET_SET(x) (((x) << RST_RESET_USB_HOST_RESET_LSB) & RST_RESET_USB_HOST_RESET_MASK) +#define RST_RESET_USB_HOST_RESET_RESET 0x1 // 1 +#define RST_RESET_USB_PHY_RESET_MSB 4 +#define RST_RESET_USB_PHY_RESET_LSB 4 +#define RST_RESET_USB_PHY_RESET_MASK 0x00000010 +#define RST_RESET_USB_PHY_RESET_GET(x) (((x) & RST_RESET_USB_PHY_RESET_MASK) >> RST_RESET_USB_PHY_RESET_LSB) +#define RST_RESET_USB_PHY_RESET_SET(x) (((x) << RST_RESET_USB_PHY_RESET_LSB) & RST_RESET_USB_PHY_RESET_MASK) +#define RST_RESET_USB_PHY_RESET_RESET 0x1 // 1 +#define RST_RESET_USB_PHY_SUSPEND_OVERRIDE_MSB 3 +#define RST_RESET_USB_PHY_SUSPEND_OVERRIDE_LSB 3 +#define RST_RESET_USB_PHY_SUSPEND_OVERRIDE_MASK 0x00000008 +#define RST_RESET_USB_PHY_SUSPEND_OVERRIDE_GET(x) (((x) & RST_RESET_USB_PHY_SUSPEND_OVERRIDE_MASK) >> RST_RESET_USB_PHY_SUSPEND_OVERRIDE_LSB) +#define RST_RESET_USB_PHY_SUSPEND_OVERRIDE_SET(x) (((x) << RST_RESET_USB_PHY_SUSPEND_OVERRIDE_LSB) & RST_RESET_USB_PHY_SUSPEND_OVERRIDE_MASK) +#define RST_RESET_USB_PHY_SUSPEND_OVERRIDE_RESET 0x0 // 0 +#define RST_RESET_LUT_RESET_MSB 2 +#define RST_RESET_LUT_RESET_LSB 2 +#define RST_RESET_LUT_RESET_MASK 0x00000004 +#define RST_RESET_LUT_RESET_GET(x) (((x) & RST_RESET_LUT_RESET_MASK) >> RST_RESET_LUT_RESET_LSB) +#define RST_RESET_LUT_RESET_SET(x) (((x) << RST_RESET_LUT_RESET_LSB) & RST_RESET_LUT_RESET_MASK) +#define RST_RESET_LUT_RESET_RESET 0x0 // 0 +#define RST_RESET_MBOX_RESET_MSB 1 +#define RST_RESET_MBOX_RESET_LSB 1 +#define RST_RESET_MBOX_RESET_MASK 0x00000002 +#define RST_RESET_MBOX_RESET_GET(x) (((x) & RST_RESET_MBOX_RESET_MASK) >> RST_RESET_MBOX_RESET_LSB) +#define RST_RESET_MBOX_RESET_SET(x) (((x) << RST_RESET_MBOX_RESET_LSB) & RST_RESET_MBOX_RESET_MASK) +#define RST_RESET_MBOX_RESET_RESET 0x0 // 0 +#define RST_RESET_I2S_RESET_MSB 0 +#define RST_RESET_I2S_RESET_LSB 0 +#define RST_RESET_I2S_RESET_MASK 0x00000001 +#define RST_RESET_I2S_RESET_GET(x) (((x) & RST_RESET_I2S_RESET_MASK) >> RST_RESET_I2S_RESET_LSB) +#define RST_RESET_I2S_RESET_SET(x) (((x) << RST_RESET_I2S_RESET_LSB) & RST_RESET_I2S_RESET_MASK) +#define RST_RESET_I2S_RESET_RESET 0x0 // 0 +#define RST_RESET_ADDRESS 0x1806001c + +#define RST_MISC2_PCIEEP_LINK_UP_MSB 30 +#define RST_MISC2_PCIEEP_LINK_UP_LSB 30 +#define RST_MISC2_PCIEEP_LINK_UP_MASK 0x40000000 +#define RST_MISC2_PCIEEP_LINK_UP_GET(x) (((x) & RST_MISC2_PCIEEP_LINK_UP_MASK) >> RST_MISC2_PCIEEP_LINK_UP_LSB) +#define RST_MISC2_PCIEEP_LINK_UP_SET(x) (((x) << RST_MISC2_PCIEEP_LINK_UP_LSB) & RST_MISC2_PCIEEP_LINK_UP_MASK) +#define RST_MISC2_PCIEEP_LINK_UP_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_CLKOBS2_SEL_MSB 29 +#define RST_MISC2_PCIEEP_CLKOBS2_SEL_LSB 29 +#define RST_MISC2_PCIEEP_CLKOBS2_SEL_MASK 0x20000000 +#define RST_MISC2_PCIEEP_CLKOBS2_SEL_GET(x) (((x) & RST_MISC2_PCIEEP_CLKOBS2_SEL_MASK) >> RST_MISC2_PCIEEP_CLKOBS2_SEL_LSB) +#define RST_MISC2_PCIEEP_CLKOBS2_SEL_SET(x) (((x) << RST_MISC2_PCIEEP_CLKOBS2_SEL_LSB) & RST_MISC2_PCIEEP_CLKOBS2_SEL_MASK) +#define RST_MISC2_PCIEEP_CLKOBS2_SEL_RESET 0x0 // 0 +#define RST_MISC2_PCIE_CLKOBS1_SEL_MSB 28 +#define RST_MISC2_PCIE_CLKOBS1_SEL_LSB 28 +#define RST_MISC2_PCIE_CLKOBS1_SEL_MASK 0x10000000 +#define RST_MISC2_PCIE_CLKOBS1_SEL_GET(x) (((x) & RST_MISC2_PCIE_CLKOBS1_SEL_MASK) >> RST_MISC2_PCIE_CLKOBS1_SEL_LSB) +#define RST_MISC2_PCIE_CLKOBS1_SEL_SET(x) (((x) << RST_MISC2_PCIE_CLKOBS1_SEL_LSB) & RST_MISC2_PCIE_CLKOBS1_SEL_MASK) +#define RST_MISC2_PCIE_CLKOBS1_SEL_RESET 0x0 // 0 +#define RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_MSB 27 +#define RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_LSB 27 +#define RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_MASK 0x08000000 +#define RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_GET(x) (((x) & RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_MASK) >> RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_LSB) +#define RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_SET(x) (((x) << RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_LSB) & RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_MASK) +#define RST_MISC2_JTAG_EJTAG_SWITCH_CPU_CTRL_RESET 0x0 // 0 +#define RST_MISC2_WOW_STATUS_MSB 26 +#define RST_MISC2_WOW_STATUS_LSB 26 +#define RST_MISC2_WOW_STATUS_MASK 0x04000000 +#define RST_MISC2_WOW_STATUS_GET(x) (((x) & RST_MISC2_WOW_STATUS_MASK) >> RST_MISC2_WOW_STATUS_LSB) +#define RST_MISC2_WOW_STATUS_SET(x) (((x) << RST_MISC2_WOW_STATUS_LSB) & RST_MISC2_WOW_STATUS_MASK) +#define RST_MISC2_WOW_STATUS_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_L2_EXIT_INT_MSB 25 +#define RST_MISC2_PCIEEP_L2_EXIT_INT_LSB 25 +#define RST_MISC2_PCIEEP_L2_EXIT_INT_MASK 0x02000000 +#define RST_MISC2_PCIEEP_L2_EXIT_INT_GET(x) (((x) & RST_MISC2_PCIEEP_L2_EXIT_INT_MASK) >> RST_MISC2_PCIEEP_L2_EXIT_INT_LSB) +#define RST_MISC2_PCIEEP_L2_EXIT_INT_SET(x) (((x) << RST_MISC2_PCIEEP_L2_EXIT_INT_LSB) & RST_MISC2_PCIEEP_L2_EXIT_INT_MASK) +#define RST_MISC2_PCIEEP_L2_EXIT_INT_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_L2_ENTR_INT_MSB 24 +#define RST_MISC2_PCIEEP_L2_ENTR_INT_LSB 24 +#define RST_MISC2_PCIEEP_L2_ENTR_INT_MASK 0x01000000 +#define RST_MISC2_PCIEEP_L2_ENTR_INT_GET(x) (((x) & RST_MISC2_PCIEEP_L2_ENTR_INT_MASK) >> RST_MISC2_PCIEEP_L2_ENTR_INT_LSB) +#define RST_MISC2_PCIEEP_L2_ENTR_INT_SET(x) (((x) << RST_MISC2_PCIEEP_L2_ENTR_INT_LSB) & RST_MISC2_PCIEEP_L2_ENTR_INT_MASK) +#define RST_MISC2_PCIEEP_L2_ENTR_INT_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_L1_EXIT_INT_MSB 23 +#define RST_MISC2_PCIEEP_L1_EXIT_INT_LSB 23 +#define RST_MISC2_PCIEEP_L1_EXIT_INT_MASK 0x00800000 +#define RST_MISC2_PCIEEP_L1_EXIT_INT_GET(x) (((x) & RST_MISC2_PCIEEP_L1_EXIT_INT_MASK) >> RST_MISC2_PCIEEP_L1_EXIT_INT_LSB) +#define RST_MISC2_PCIEEP_L1_EXIT_INT_SET(x) (((x) << RST_MISC2_PCIEEP_L1_EXIT_INT_LSB) & RST_MISC2_PCIEEP_L1_EXIT_INT_MASK) +#define RST_MISC2_PCIEEP_L1_EXIT_INT_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_L1_ENTR_INT_MSB 22 +#define RST_MISC2_PCIEEP_L1_ENTR_INT_LSB 22 +#define RST_MISC2_PCIEEP_L1_ENTR_INT_MASK 0x00400000 +#define RST_MISC2_PCIEEP_L1_ENTR_INT_GET(x) (((x) & RST_MISC2_PCIEEP_L1_ENTR_INT_MASK) >> RST_MISC2_PCIEEP_L1_ENTR_INT_LSB) +#define RST_MISC2_PCIEEP_L1_ENTR_INT_SET(x) (((x) << RST_MISC2_PCIEEP_L1_ENTR_INT_LSB) & RST_MISC2_PCIEEP_L1_ENTR_INT_MASK) +#define RST_MISC2_PCIEEP_L1_ENTR_INT_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_L0S_EXIT_INT_MSB 21 +#define RST_MISC2_PCIEEP_L0S_EXIT_INT_LSB 21 +#define RST_MISC2_PCIEEP_L0S_EXIT_INT_MASK 0x00200000 +#define RST_MISC2_PCIEEP_L0S_EXIT_INT_GET(x) (((x) & RST_MISC2_PCIEEP_L0S_EXIT_INT_MASK) >> RST_MISC2_PCIEEP_L0S_EXIT_INT_LSB) +#define RST_MISC2_PCIEEP_L0S_EXIT_INT_SET(x) (((x) << RST_MISC2_PCIEEP_L0S_EXIT_INT_LSB) & RST_MISC2_PCIEEP_L0S_EXIT_INT_MASK) +#define RST_MISC2_PCIEEP_L0S_EXIT_INT_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_L0S_ENTR_INT_MSB 20 +#define RST_MISC2_PCIEEP_L0S_ENTR_INT_LSB 20 +#define RST_MISC2_PCIEEP_L0S_ENTR_INT_MASK 0x00100000 +#define RST_MISC2_PCIEEP_L0S_ENTR_INT_GET(x) (((x) & RST_MISC2_PCIEEP_L0S_ENTR_INT_MASK) >> RST_MISC2_PCIEEP_L0S_ENTR_INT_LSB) +#define RST_MISC2_PCIEEP_L0S_ENTR_INT_SET(x) (((x) << RST_MISC2_PCIEEP_L0S_ENTR_INT_LSB) & RST_MISC2_PCIEEP_L0S_ENTR_INT_MASK) +#define RST_MISC2_PCIEEP_L0S_ENTR_INT_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_REGWR_EN_MSB 19 +#define RST_MISC2_PCIEEP_REGWR_EN_LSB 19 +#define RST_MISC2_PCIEEP_REGWR_EN_MASK 0x00080000 +#define RST_MISC2_PCIEEP_REGWR_EN_GET(x) (((x) & RST_MISC2_PCIEEP_REGWR_EN_MASK) >> RST_MISC2_PCIEEP_REGWR_EN_LSB) +#define RST_MISC2_PCIEEP_REGWR_EN_SET(x) (((x) << RST_MISC2_PCIEEP_REGWR_EN_LSB) & RST_MISC2_PCIEEP_REGWR_EN_MASK) +#define RST_MISC2_PCIEEP_REGWR_EN_RESET 0x1 // 1 +#define RST_MISC2_EXT_HOST_WASP_RST_EN_MSB 18 +#define RST_MISC2_EXT_HOST_WASP_RST_EN_LSB 18 +#define RST_MISC2_EXT_HOST_WASP_RST_EN_MASK 0x00040000 +#define RST_MISC2_EXT_HOST_WASP_RST_EN_GET(x) (((x) & RST_MISC2_EXT_HOST_WASP_RST_EN_MASK) >> RST_MISC2_EXT_HOST_WASP_RST_EN_LSB) +#define RST_MISC2_EXT_HOST_WASP_RST_EN_SET(x) (((x) << RST_MISC2_EXT_HOST_WASP_RST_EN_LSB) & RST_MISC2_EXT_HOST_WASP_RST_EN_MASK) +#define RST_MISC2_EXT_HOST_WASP_RST_EN_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_RST_INT_MSB 17 +#define RST_MISC2_PCIEEP_RST_INT_LSB 17 +#define RST_MISC2_PCIEEP_RST_INT_MASK 0x00020000 +#define RST_MISC2_PCIEEP_RST_INT_GET(x) (((x) & RST_MISC2_PCIEEP_RST_INT_MASK) >> RST_MISC2_PCIEEP_RST_INT_LSB) +#define RST_MISC2_PCIEEP_RST_INT_SET(x) (((x) << RST_MISC2_PCIEEP_RST_INT_LSB) & RST_MISC2_PCIEEP_RST_INT_MASK) +#define RST_MISC2_PCIEEP_RST_INT_RESET 0x0 // 0 +#define RST_MISC2_HOST_RESET_INT_MSB 16 +#define RST_MISC2_HOST_RESET_INT_LSB 16 +#define RST_MISC2_HOST_RESET_INT_MASK 0x00010000 +#define RST_MISC2_HOST_RESET_INT_GET(x) (((x) & RST_MISC2_HOST_RESET_INT_MASK) >> RST_MISC2_HOST_RESET_INT_LSB) +#define RST_MISC2_HOST_RESET_INT_SET(x) (((x) << RST_MISC2_HOST_RESET_INT_LSB) & RST_MISC2_HOST_RESET_INT_MASK) +#define RST_MISC2_HOST_RESET_INT_RESET 0x0 // 0 +#define RST_MISC2_CPU_HOST_WA_MSB 15 +#define RST_MISC2_CPU_HOST_WA_LSB 15 +#define RST_MISC2_CPU_HOST_WA_MASK 0x00008000 +#define RST_MISC2_CPU_HOST_WA_GET(x) (((x) & RST_MISC2_CPU_HOST_WA_MASK) >> RST_MISC2_CPU_HOST_WA_LSB) +#define RST_MISC2_CPU_HOST_WA_SET(x) (((x) << RST_MISC2_CPU_HOST_WA_LSB) & RST_MISC2_CPU_HOST_WA_MASK) +#define RST_MISC2_CPU_HOST_WA_RESET 0x0 // 0 +#define RST_MISC2_PERSTN_RCPHY2_MSB 14 +#define RST_MISC2_PERSTN_RCPHY2_LSB 14 +#define RST_MISC2_PERSTN_RCPHY2_MASK 0x00004000 +#define RST_MISC2_PERSTN_RCPHY2_GET(x) (((x) & RST_MISC2_PERSTN_RCPHY2_MASK) >> RST_MISC2_PERSTN_RCPHY2_LSB) +#define RST_MISC2_PERSTN_RCPHY2_SET(x) (((x) << RST_MISC2_PERSTN_RCPHY2_LSB) & RST_MISC2_PERSTN_RCPHY2_MASK) +#define RST_MISC2_PERSTN_RCPHY2_RESET 0x1 // 1 +#define RST_MISC2_PERSTN_RCPHY_MSB 13 +#define RST_MISC2_PERSTN_RCPHY_LSB 13 +#define RST_MISC2_PERSTN_RCPHY_MASK 0x00002000 +#define RST_MISC2_PERSTN_RCPHY_GET(x) (((x) & RST_MISC2_PERSTN_RCPHY_MASK) >> RST_MISC2_PERSTN_RCPHY_LSB) +#define RST_MISC2_PERSTN_RCPHY_SET(x) (((x) << RST_MISC2_PERSTN_RCPHY_LSB) & RST_MISC2_PERSTN_RCPHY_MASK) +#define RST_MISC2_PERSTN_RCPHY_RESET 0x1 // 1 +#define RST_MISC2_PCIEEP_LTSSM_STATE_MSB 12 +#define RST_MISC2_PCIEEP_LTSSM_STATE_LSB 8 +#define RST_MISC2_PCIEEP_LTSSM_STATE_MASK 0x00001f00 +#define RST_MISC2_PCIEEP_LTSSM_STATE_GET(x) (((x) & RST_MISC2_PCIEEP_LTSSM_STATE_MASK) >> RST_MISC2_PCIEEP_LTSSM_STATE_LSB) +#define RST_MISC2_PCIEEP_LTSSM_STATE_SET(x) (((x) << RST_MISC2_PCIEEP_LTSSM_STATE_LSB) & RST_MISC2_PCIEEP_LTSSM_STATE_MASK) +#define RST_MISC2_PCIEEP_LTSSM_STATE_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_LINK_STATUS_MSB 4 +#define RST_MISC2_PCIEEP_LINK_STATUS_LSB 4 +#define RST_MISC2_PCIEEP_LINK_STATUS_MASK 0x00000010 +#define RST_MISC2_PCIEEP_LINK_STATUS_GET(x) (((x) & RST_MISC2_PCIEEP_LINK_STATUS_MASK) >> RST_MISC2_PCIEEP_LINK_STATUS_LSB) +#define RST_MISC2_PCIEEP_LINK_STATUS_SET(x) (((x) << RST_MISC2_PCIEEP_LINK_STATUS_LSB) & RST_MISC2_PCIEEP_LINK_STATUS_MASK) +#define RST_MISC2_PCIEEP_LINK_STATUS_RESET 0x0 // 0 +#define RST_MISC2_WOW_DETECT_MSB 3 +#define RST_MISC2_WOW_DETECT_LSB 3 +#define RST_MISC2_WOW_DETECT_MASK 0x00000008 +#define RST_MISC2_WOW_DETECT_GET(x) (((x) & RST_MISC2_WOW_DETECT_MASK) >> RST_MISC2_WOW_DETECT_LSB) +#define RST_MISC2_WOW_DETECT_SET(x) (((x) << RST_MISC2_WOW_DETECT_LSB) & RST_MISC2_WOW_DETECT_MASK) +#define RST_MISC2_WOW_DETECT_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_RXDETECT_DONE_MSB 2 +#define RST_MISC2_PCIEEP_RXDETECT_DONE_LSB 2 +#define RST_MISC2_PCIEEP_RXDETECT_DONE_MASK 0x00000004 +#define RST_MISC2_PCIEEP_RXDETECT_DONE_GET(x) (((x) & RST_MISC2_PCIEEP_RXDETECT_DONE_MASK) >> RST_MISC2_PCIEEP_RXDETECT_DONE_LSB) +#define RST_MISC2_PCIEEP_RXDETECT_DONE_SET(x) (((x) << RST_MISC2_PCIEEP_RXDETECT_DONE_LSB) & RST_MISC2_PCIEEP_RXDETECT_DONE_MASK) +#define RST_MISC2_PCIEEP_RXDETECT_DONE_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_WOW_INT_MSB 1 +#define RST_MISC2_PCIEEP_WOW_INT_LSB 1 +#define RST_MISC2_PCIEEP_WOW_INT_MASK 0x00000002 +#define RST_MISC2_PCIEEP_WOW_INT_GET(x) (((x) & RST_MISC2_PCIEEP_WOW_INT_MASK) >> RST_MISC2_PCIEEP_WOW_INT_LSB) +#define RST_MISC2_PCIEEP_WOW_INT_SET(x) (((x) << RST_MISC2_PCIEEP_WOW_INT_LSB) & RST_MISC2_PCIEEP_WOW_INT_MASK) +#define RST_MISC2_PCIEEP_WOW_INT_RESET 0x0 // 0 +#define RST_MISC2_PCIEEP_CFG_DONE_MSB 0 +#define RST_MISC2_PCIEEP_CFG_DONE_LSB 0 +#define RST_MISC2_PCIEEP_CFG_DONE_MASK 0x00000001 +#define RST_MISC2_PCIEEP_CFG_DONE_GET(x) (((x) & RST_MISC2_PCIEEP_CFG_DONE_MASK) >> RST_MISC2_PCIEEP_CFG_DONE_LSB) +#define RST_MISC2_PCIEEP_CFG_DONE_SET(x) (((x) << RST_MISC2_PCIEEP_CFG_DONE_LSB) & RST_MISC2_PCIEEP_CFG_DONE_MASK) +#define RST_MISC2_PCIEEP_CFG_DONE_RESET 0x0 // 0 +#define RST_MISC2_ADDRESS 0x180600bc + +#define PCIE_APP_CFG_TYPE_MSB 21 +#define PCIE_APP_CFG_TYPE_LSB 20 +#define PCIE_APP_CFG_TYPE_MASK 0x00300000 +#define PCIE_APP_CFG_TYPE_GET(x) (((x) & PCIE_APP_CFG_TYPE_MASK) >> PCIE_APP_CFG_TYPE_LSB) +#define PCIE_APP_CFG_TYPE_SET(x) (((x) << PCIE_APP_CFG_TYPE_LSB) & PCIE_APP_CFG_TYPE_MASK) +#define PCIE_APP_CFG_TYPE_RESET 0x0 // 0 +#define PCIE_APP_PCIE_BAR_MSN_MSB 19 +#define PCIE_APP_PCIE_BAR_MSN_LSB 16 +#define PCIE_APP_PCIE_BAR_MSN_MASK 0x000f0000 +#define PCIE_APP_PCIE_BAR_MSN_GET(x) (((x) & PCIE_APP_PCIE_BAR_MSN_MASK) >> PCIE_APP_PCIE_BAR_MSN_LSB) +#define PCIE_APP_PCIE_BAR_MSN_SET(x) (((x) << PCIE_APP_PCIE_BAR_MSN_LSB) & PCIE_APP_PCIE_BAR_MSN_MASK) +#define PCIE_APP_PCIE_BAR_MSN_RESET 0x1 // 1 +#define PCIE_APP_CFG_BE_MSB 15 +#define PCIE_APP_CFG_BE_LSB 12 +#define PCIE_APP_CFG_BE_MASK 0x0000f000 +#define PCIE_APP_CFG_BE_GET(x) (((x) & PCIE_APP_CFG_BE_MASK) >> PCIE_APP_CFG_BE_LSB) +#define PCIE_APP_CFG_BE_SET(x) (((x) << PCIE_APP_CFG_BE_LSB) & PCIE_APP_CFG_BE_MASK) +#define PCIE_APP_CFG_BE_RESET 0xf // 15 +#define PCIE_APP_SLV_RESP_ERR_MAP_MSB 11 +#define PCIE_APP_SLV_RESP_ERR_MAP_LSB 6 +#define PCIE_APP_SLV_RESP_ERR_MAP_MASK 0x00000fc0 +#define PCIE_APP_SLV_RESP_ERR_MAP_GET(x) (((x) & PCIE_APP_SLV_RESP_ERR_MAP_MASK) >> PCIE_APP_SLV_RESP_ERR_MAP_LSB) +#define PCIE_APP_SLV_RESP_ERR_MAP_SET(x) (((x) << PCIE_APP_SLV_RESP_ERR_MAP_LSB) & PCIE_APP_SLV_RESP_ERR_MAP_MASK) +#define PCIE_APP_SLV_RESP_ERR_MAP_RESET 0x3f // 63 +#define PCIE_APP_MSTR_RESP_ERR_MAP_MSB 5 +#define PCIE_APP_MSTR_RESP_ERR_MAP_LSB 4 +#define PCIE_APP_MSTR_RESP_ERR_MAP_MASK 0x00000030 +#define PCIE_APP_MSTR_RESP_ERR_MAP_GET(x) (((x) & PCIE_APP_MSTR_RESP_ERR_MAP_MASK) >> PCIE_APP_MSTR_RESP_ERR_MAP_LSB) +#define PCIE_APP_MSTR_RESP_ERR_MAP_SET(x) (((x) << PCIE_APP_MSTR_RESP_ERR_MAP_LSB) & PCIE_APP_MSTR_RESP_ERR_MAP_MASK) +#define PCIE_APP_MSTR_RESP_ERR_MAP_RESET 0x0 // 0 +#define PCIE_APP_INIT_RST_MSB 3 +#define PCIE_APP_INIT_RST_LSB 3 +#define PCIE_APP_INIT_RST_MASK 0x00000008 +#define PCIE_APP_INIT_RST_GET(x) (((x) & PCIE_APP_INIT_RST_MASK) >> PCIE_APP_INIT_RST_LSB) +#define PCIE_APP_INIT_RST_SET(x) (((x) << PCIE_APP_INIT_RST_LSB) & PCIE_APP_INIT_RST_MASK) +#define PCIE_APP_INIT_RST_RESET 0x0 // 0 +#define PCIE_APP_PM_XMT_TURNOFF_MSB 2 +#define PCIE_APP_PM_XMT_TURNOFF_LSB 2 +#define PCIE_APP_PM_XMT_TURNOFF_MASK 0x00000004 +#define PCIE_APP_PM_XMT_TURNOFF_GET(x) (((x) & PCIE_APP_PM_XMT_TURNOFF_MASK) >> PCIE_APP_PM_XMT_TURNOFF_LSB) +#define PCIE_APP_PM_XMT_TURNOFF_SET(x) (((x) << PCIE_APP_PM_XMT_TURNOFF_LSB) & PCIE_APP_PM_XMT_TURNOFF_MASK) +#define PCIE_APP_PM_XMT_TURNOFF_RESET 0x0 // 0 +#define PCIE_APP_UNLOCK_MSG_MSB 1 +#define PCIE_APP_UNLOCK_MSG_LSB 1 +#define PCIE_APP_UNLOCK_MSG_MASK 0x00000002 +#define PCIE_APP_UNLOCK_MSG_GET(x) (((x) & PCIE_APP_UNLOCK_MSG_MASK) >> PCIE_APP_UNLOCK_MSG_LSB) +#define PCIE_APP_UNLOCK_MSG_SET(x) (((x) << PCIE_APP_UNLOCK_MSG_LSB) & PCIE_APP_UNLOCK_MSG_MASK) +#define PCIE_APP_UNLOCK_MSG_RESET 0x0 // 0 +#define PCIE_APP_LTSSM_ENABLE_MSB 0 +#define PCIE_APP_LTSSM_ENABLE_LSB 0 +#define PCIE_APP_LTSSM_ENABLE_MASK 0x00000001 +#define PCIE_APP_LTSSM_ENABLE_GET(x) (((x) & PCIE_APP_LTSSM_ENABLE_MASK) >> PCIE_APP_LTSSM_ENABLE_LSB) +#define PCIE_APP_LTSSM_ENABLE_SET(x) (((x) << PCIE_APP_LTSSM_ENABLE_LSB) & PCIE_APP_LTSSM_ENABLE_MASK) +#define PCIE_APP_LTSSM_ENABLE_RESET 0x0 // 0 +#define PCIE_APP_ADDRESS 0x180f0000 + + +#define XTAL_TCXODET_MSB 31 +#define XTAL_TCXODET_LSB 31 +#define XTAL_TCXODET_MASK 0x80000000 +#define XTAL_TCXODET_GET(x) (((x) & XTAL_TCXODET_MASK) >> XTAL_TCXODET_LSB) +#define XTAL_TCXODET_SET(x) (((x) << XTAL_TCXODET_LSB) & XTAL_TCXODET_MASK) +#define XTAL_TCXODET_RESET 0x0 // 0 +#define XTAL_XTAL_CAPINDAC_MSB 30 +#define XTAL_XTAL_CAPINDAC_LSB 24 +#define XTAL_XTAL_CAPINDAC_MASK 0x7f000000 +#define XTAL_XTAL_CAPINDAC_GET(x) (((x) & XTAL_XTAL_CAPINDAC_MASK) >> XTAL_XTAL_CAPINDAC_LSB) +#define XTAL_XTAL_CAPINDAC_SET(x) (((x) << XTAL_XTAL_CAPINDAC_LSB) & XTAL_XTAL_CAPINDAC_MASK) +#define XTAL_XTAL_CAPINDAC_RESET 0x4b // 75 +#define XTAL_XTAL_CAPOUTDAC_MSB 23 +#define XTAL_XTAL_CAPOUTDAC_LSB 17 +#define XTAL_XTAL_CAPOUTDAC_MASK 0x00fe0000 +#define XTAL_XTAL_CAPOUTDAC_GET(x) (((x) & XTAL_XTAL_CAPOUTDAC_MASK) >> XTAL_XTAL_CAPOUTDAC_LSB) +#define XTAL_XTAL_CAPOUTDAC_SET(x) (((x) << XTAL_XTAL_CAPOUTDAC_LSB) & XTAL_XTAL_CAPOUTDAC_MASK) +#define XTAL_XTAL_CAPOUTDAC_RESET 0x4b // 75 +#define XTAL_XTAL_DRVSTR_MSB 16 +#define XTAL_XTAL_DRVSTR_LSB 15 +#define XTAL_XTAL_DRVSTR_MASK 0x00018000 +#define XTAL_XTAL_DRVSTR_GET(x) (((x) & XTAL_XTAL_DRVSTR_MASK) >> XTAL_XTAL_DRVSTR_LSB) +#define XTAL_XTAL_DRVSTR_SET(x) (((x) << XTAL_XTAL_DRVSTR_LSB) & XTAL_XTAL_DRVSTR_MASK) +#define XTAL_XTAL_DRVSTR_RESET 0x0 // 0 +#define XTAL_XTAL_SHORTXIN_MSB 14 +#define XTAL_XTAL_SHORTXIN_LSB 14 +#define XTAL_XTAL_SHORTXIN_MASK 0x00004000 +#define XTAL_XTAL_SHORTXIN_GET(x) (((x) & XTAL_XTAL_SHORTXIN_MASK) >> XTAL_XTAL_SHORTXIN_LSB) +#define XTAL_XTAL_SHORTXIN_SET(x) (((x) << XTAL_XTAL_SHORTXIN_LSB) & XTAL_XTAL_SHORTXIN_MASK) +#define XTAL_XTAL_SHORTXIN_RESET 0x0 // 0 +#define XTAL_XTAL_LOCALBIAS_MSB 13 +#define XTAL_XTAL_LOCALBIAS_LSB 13 +#define XTAL_XTAL_LOCALBIAS_MASK 0x00002000 +#define XTAL_XTAL_LOCALBIAS_GET(x) (((x) & XTAL_XTAL_LOCALBIAS_MASK) >> XTAL_XTAL_LOCALBIAS_LSB) +#define XTAL_XTAL_LOCALBIAS_SET(x) (((x) << XTAL_XTAL_LOCALBIAS_LSB) & XTAL_XTAL_LOCALBIAS_MASK) +#define XTAL_XTAL_LOCALBIAS_RESET 0x1 // 1 +#define XTAL_XTAL_PWDCLKD_MSB 12 +#define XTAL_XTAL_PWDCLKD_LSB 12 +#define XTAL_XTAL_PWDCLKD_MASK 0x00001000 +#define XTAL_XTAL_PWDCLKD_GET(x) (((x) & XTAL_XTAL_PWDCLKD_MASK) >> XTAL_XTAL_PWDCLKD_LSB) +#define XTAL_XTAL_PWDCLKD_SET(x) (((x) << XTAL_XTAL_PWDCLKD_LSB) & XTAL_XTAL_PWDCLKD_MASK) +#define XTAL_XTAL_PWDCLKD_RESET 0x0 // 0 +#define XTAL_XTAL_BIAS2X_MSB 11 +#define XTAL_XTAL_BIAS2X_LSB 11 +#define XTAL_XTAL_BIAS2X_MASK 0x00000800 +#define XTAL_XTAL_BIAS2X_GET(x) (((x) & XTAL_XTAL_BIAS2X_MASK) >> XTAL_XTAL_BIAS2X_LSB) +#define XTAL_XTAL_BIAS2X_SET(x) (((x) << XTAL_XTAL_BIAS2X_LSB) & XTAL_XTAL_BIAS2X_MASK) +#define XTAL_XTAL_BIAS2X_RESET 0x1 // 1 +#define XTAL_XTAL_LBIAS2X_MSB 10 +#define XTAL_XTAL_LBIAS2X_LSB 10 +#define XTAL_XTAL_LBIAS2X_MASK 0x00000400 +#define XTAL_XTAL_LBIAS2X_GET(x) (((x) & XTAL_XTAL_LBIAS2X_MASK) >> XTAL_XTAL_LBIAS2X_LSB) +#define XTAL_XTAL_LBIAS2X_SET(x) (((x) << XTAL_XTAL_LBIAS2X_LSB) & XTAL_XTAL_LBIAS2X_MASK) +#define XTAL_XTAL_LBIAS2X_RESET 0x1 // 1 +#define XTAL_XTAL_ATBVREG_MSB 9 +#define XTAL_XTAL_ATBVREG_LSB 9 +#define XTAL_XTAL_ATBVREG_MASK 0x00000200 +#define XTAL_XTAL_ATBVREG_GET(x) (((x) & XTAL_XTAL_ATBVREG_MASK) >> XTAL_XTAL_ATBVREG_LSB) +#define XTAL_XTAL_ATBVREG_SET(x) (((x) << XTAL_XTAL_ATBVREG_LSB) & XTAL_XTAL_ATBVREG_MASK) +#define XTAL_XTAL_ATBVREG_RESET 0x0 // 0 +#define XTAL_XTAL_OSCON_MSB 8 +#define XTAL_XTAL_OSCON_LSB 8 +#define XTAL_XTAL_OSCON_MASK 0x00000100 +#define XTAL_XTAL_OSCON_GET(x) (((x) & XTAL_XTAL_OSCON_MASK) >> XTAL_XTAL_OSCON_LSB) +#define XTAL_XTAL_OSCON_SET(x) (((x) << XTAL_XTAL_OSCON_LSB) & XTAL_XTAL_OSCON_MASK) +#define XTAL_XTAL_OSCON_RESET 0x1 // 1 +#define XTAL_XTAL_PWDCLKIN_MSB 7 +#define XTAL_XTAL_PWDCLKIN_LSB 7 +#define XTAL_XTAL_PWDCLKIN_MASK 0x00000080 +#define XTAL_XTAL_PWDCLKIN_GET(x) (((x) & XTAL_XTAL_PWDCLKIN_MASK) >> XTAL_XTAL_PWDCLKIN_LSB) +#define XTAL_XTAL_PWDCLKIN_SET(x) (((x) << XTAL_XTAL_PWDCLKIN_LSB) & XTAL_XTAL_PWDCLKIN_MASK) +#define XTAL_XTAL_PWDCLKIN_RESET 0x0 // 0 +#define XTAL_LOCAL_XTAL_MSB 6 +#define XTAL_LOCAL_XTAL_LSB 6 +#define XTAL_LOCAL_XTAL_MASK 0x00000040 +#define XTAL_LOCAL_XTAL_GET(x) (((x) & XTAL_LOCAL_XTAL_MASK) >> XTAL_LOCAL_XTAL_LSB) +#define XTAL_LOCAL_XTAL_SET(x) (((x) << XTAL_LOCAL_XTAL_LSB) & XTAL_LOCAL_XTAL_MASK) +#define XTAL_LOCAL_XTAL_RESET 0x0 // 0 +#define XTAL_PWD_SWREGCLK_MSB 5 +#define XTAL_PWD_SWREGCLK_LSB 5 +#define XTAL_PWD_SWREGCLK_MASK 0x00000020 +#define XTAL_PWD_SWREGCLK_GET(x) (((x) & XTAL_PWD_SWREGCLK_MASK) >> XTAL_PWD_SWREGCLK_LSB) +#define XTAL_PWD_SWREGCLK_SET(x) (((x) << XTAL_PWD_SWREGCLK_LSB) & XTAL_PWD_SWREGCLK_MASK) +#define XTAL_PWD_SWREGCLK_RESET 0x0 // 0 +#define XTAL_SWREGCLK_EDGE_SEL_MSB 4 +#define XTAL_SWREGCLK_EDGE_SEL_LSB 4 +#define XTAL_SWREGCLK_EDGE_SEL_MASK 0x00000010 +#define XTAL_SWREGCLK_EDGE_SEL_GET(x) (((x) & XTAL_SWREGCLK_EDGE_SEL_MASK) >> XTAL_SWREGCLK_EDGE_SEL_LSB) +#define XTAL_SWREGCLK_EDGE_SEL_SET(x) (((x) << XTAL_SWREGCLK_EDGE_SEL_LSB) & XTAL_SWREGCLK_EDGE_SEL_MASK) +#define XTAL_SWREGCLK_EDGE_SEL_RESET 0x0 // 0 +#define XTAL_SPARE_MSB 3 +#define XTAL_SPARE_LSB 0 +#define XTAL_SPARE_MASK 0x0000000f +#define XTAL_SPARE_GET(x) (((x) & XTAL_SPARE_MASK) >> XTAL_SPARE_LSB) +#define XTAL_SPARE_SET(x) (((x) << XTAL_SPARE_LSB) & XTAL_SPARE_MASK) +#define XTAL_SPARE_RESET 0xf // 15 +#define XTAL_ADDRESS 0x18116290 + +#define RST_REVISION_ID_ADDRESS 0x18060090 +#define is_drqfn() (!(ath_reg_rd(RST_REVISION_ID_ADDRESS) & 0x1000)) + +#define RST_BOOTSTRAP_BOOT_INTF_SEL_MSB 17 +#define RST_BOOTSTRAP_BOOT_INTF_SEL_LSB 16 +#define RST_BOOTSTRAP_BOOT_INTF_SEL_MASK 0x00030000 +#define RST_BOOTSTRAP_BOOT_INTF_SEL_GET(x) (((x) & RST_BOOTSTRAP_BOOT_INTF_SEL_MASK) >> RST_BOOTSTRAP_BOOT_INTF_SEL_LSB) +#define RST_BOOTSTRAP_BOOT_INTF_SEL_SET(x) (((x) << RST_BOOTSTRAP_BOOT_INTF_SEL_LSB) & RST_BOOTSTRAP_BOOT_INTF_SEL_MASK) +#define RST_BOOTSTRAP_BOOT_INTF_SEL_RESET 0x0 // 0 +#define RST_BOOTSTRAP_RES0_MSB 15 +#define RST_BOOTSTRAP_RES0_LSB 13 +#define RST_BOOTSTRAP_RES0_MASK 0x0000e000 +#define RST_BOOTSTRAP_RES0_GET(x) (((x) & RST_BOOTSTRAP_RES0_MASK) >> RST_BOOTSTRAP_RES0_LSB) +#define RST_BOOTSTRAP_RES0_SET(x) (((x) << RST_BOOTSTRAP_RES0_LSB) & RST_BOOTSTRAP_RES0_MASK) +#define RST_BOOTSTRAP_RES0_RESET 0x0 // 0 +#define RST_BOOTSTRAP_SW_OPTION2_MSB 12 +#define RST_BOOTSTRAP_SW_OPTION2_LSB 12 +#define RST_BOOTSTRAP_SW_OPTION2_MASK 0x00001000 +#define RST_BOOTSTRAP_SW_OPTION2_GET(x) (((x) & RST_BOOTSTRAP_SW_OPTION2_MASK) >> RST_BOOTSTRAP_SW_OPTION2_LSB) +#define RST_BOOTSTRAP_SW_OPTION2_SET(x) (((x) << RST_BOOTSTRAP_SW_OPTION2_LSB) & RST_BOOTSTRAP_SW_OPTION2_MASK) +#define RST_BOOTSTRAP_SW_OPTION2_RESET 0x0 // 0 +#define RST_BOOTSTRAP_SW_OPTION1_MSB 11 +#define RST_BOOTSTRAP_SW_OPTION1_LSB 11 +#define RST_BOOTSTRAP_SW_OPTION1_MASK 0x00000800 +#define RST_BOOTSTRAP_SW_OPTION1_GET(x) (((x) & RST_BOOTSTRAP_SW_OPTION1_MASK) >> RST_BOOTSTRAP_SW_OPTION1_LSB) +#define RST_BOOTSTRAP_SW_OPTION1_SET(x) (((x) << RST_BOOTSTRAP_SW_OPTION1_LSB) & RST_BOOTSTRAP_SW_OPTION1_MASK) +#define RST_BOOTSTRAP_SW_OPTION1_RESET 0x0 // 0 +#define RST_BOOTSTRAP_TESTROM_DISABLE_MSB 10 +#define RST_BOOTSTRAP_TESTROM_DISABLE_LSB 10 +#define RST_BOOTSTRAP_TESTROM_DISABLE_MASK 0x00000400 +#define RST_BOOTSTRAP_TESTROM_DISABLE_GET(x) (((x) & RST_BOOTSTRAP_TESTROM_DISABLE_MASK) >> RST_BOOTSTRAP_TESTROM_DISABLE_LSB) +#define RST_BOOTSTRAP_TESTROM_DISABLE_SET(x) (((x) << RST_BOOTSTRAP_TESTROM_DISABLE_LSB) & RST_BOOTSTRAP_TESTROM_DISABLE_MASK) +#define RST_BOOTSTRAP_TESTROM_DISABLE_RESET 0x1 // 1 +#define RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_MSB 9 +#define RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_LSB 9 +#define RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_MASK 0x00000200 +#define RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_GET(x) (((x) & RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_MASK) >> RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_LSB) +#define RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_SET(x) (((x) << RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_LSB) & RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_MASK) +#define RST_BOOTSTRAP_DISABLE_OTPMEM_ACCESS_RESET 0x0 // 0 +#define RST_BOOTSTRAP_SRIF_ENABLE_MSB 8 +#define RST_BOOTSTRAP_SRIF_ENABLE_LSB 8 +#define RST_BOOTSTRAP_SRIF_ENABLE_MASK 0x00000100 +#define RST_BOOTSTRAP_SRIF_ENABLE_GET(x) (((x) & RST_BOOTSTRAP_SRIF_ENABLE_MASK) >> RST_BOOTSTRAP_SRIF_ENABLE_LSB) +#define RST_BOOTSTRAP_SRIF_ENABLE_SET(x) (((x) << RST_BOOTSTRAP_SRIF_ENABLE_LSB) & RST_BOOTSTRAP_SRIF_ENABLE_MASK) +#define RST_BOOTSTRAP_SRIF_ENABLE_RESET 0x0 // 0 +#define RST_BOOTSTRAP_USB_MODE_MSB 7 +#define RST_BOOTSTRAP_USB_MODE_LSB 7 +#define RST_BOOTSTRAP_USB_MODE_MASK 0x00000080 +#define RST_BOOTSTRAP_USB_MODE_GET(x) (((x) & RST_BOOTSTRAP_USB_MODE_MASK) >> RST_BOOTSTRAP_USB_MODE_LSB) +#define RST_BOOTSTRAP_USB_MODE_SET(x) (((x) << RST_BOOTSTRAP_USB_MODE_LSB) & RST_BOOTSTRAP_USB_MODE_MASK) +#define RST_BOOTSTRAP_USB_MODE_RESET 0x0 // 0 +#define RST_BOOTSTRAP_PCIE_RC_EP_SELECT_MSB 6 +#define RST_BOOTSTRAP_PCIE_RC_EP_SELECT_LSB 6 +#define RST_BOOTSTRAP_PCIE_RC_EP_SELECT_MASK 0x00000040 +#define RST_BOOTSTRAP_PCIE_RC_EP_SELECT_GET(x) (((x) & RST_BOOTSTRAP_PCIE_RC_EP_SELECT_MASK) >> RST_BOOTSTRAP_PCIE_RC_EP_SELECT_LSB) +#define RST_BOOTSTRAP_PCIE_RC_EP_SELECT_SET(x) (((x) << RST_BOOTSTRAP_PCIE_RC_EP_SELECT_LSB) & RST_BOOTSTRAP_PCIE_RC_EP_SELECT_MASK) +#define RST_BOOTSTRAP_PCIE_RC_EP_SELECT_RESET 0x0 // 0 +#define RST_BOOTSTRAP_JTAG_MODE_MSB 5 +#define RST_BOOTSTRAP_JTAG_MODE_LSB 5 +#define RST_BOOTSTRAP_JTAG_MODE_MASK 0x00000020 +#define RST_BOOTSTRAP_JTAG_MODE_GET(x) (((x) & RST_BOOTSTRAP_JTAG_MODE_MASK) >> RST_BOOTSTRAP_JTAG_MODE_LSB) +#define RST_BOOTSTRAP_JTAG_MODE_SET(x) (((x) << RST_BOOTSTRAP_JTAG_MODE_LSB) & RST_BOOTSTRAP_JTAG_MODE_MASK) +#define RST_BOOTSTRAP_JTAG_MODE_RESET 0x1 // 1 +#define RST_BOOTSTRAP_REF_CLK_MSB 4 +#define RST_BOOTSTRAP_REF_CLK_LSB 4 +#define RST_BOOTSTRAP_REF_CLK_MASK 0x00000010 +#define RST_BOOTSTRAP_REF_CLK_GET(x) (((x) & RST_BOOTSTRAP_REF_CLK_MASK) >> RST_BOOTSTRAP_REF_CLK_LSB) +#define RST_BOOTSTRAP_REF_CLK_SET(x) (((x) << RST_BOOTSTRAP_REF_CLK_LSB) & RST_BOOTSTRAP_REF_CLK_MASK) +#define RST_BOOTSTRAP_REF_CLK_RESET 0x0 // 0 +#define RST_BOOTSTRAP_DDR_WIDTH_MSB 3 +#define RST_BOOTSTRAP_DDR_WIDTH_LSB 3 +#define RST_BOOTSTRAP_DDR_WIDTH_MASK 0x00000008 +#define RST_BOOTSTRAP_DDR_WIDTH_GET(x) (((x) & RST_BOOTSTRAP_DDR_WIDTH_MASK) >> RST_BOOTSTRAP_DDR_WIDTH_LSB) +#define RST_BOOTSTRAP_DDR_WIDTH_SET(x) (((x) << RST_BOOTSTRAP_DDR_WIDTH_LSB) & RST_BOOTSTRAP_DDR_WIDTH_MASK) +#define RST_BOOTSTRAP_DDR_WIDTH_RESET 0x0 // 0 +#define RST_BOOTSTRAP_BOOT_SELECT_MSB 2 +#define RST_BOOTSTRAP_BOOT_SELECT_LSB 2 +#define RST_BOOTSTRAP_BOOT_SELECT_MASK 0x00000004 +#define RST_BOOTSTRAP_BOOT_SELECT_GET(x) (((x) & RST_BOOTSTRAP_BOOT_SELECT_MASK) >> RST_BOOTSTRAP_BOOT_SELECT_LSB) +#define RST_BOOTSTRAP_BOOT_SELECT_SET(x) (((x) << RST_BOOTSTRAP_BOOT_SELECT_LSB) & RST_BOOTSTRAP_BOOT_SELECT_MASK) +#define RST_BOOTSTRAP_BOOT_SELECT_RESET 0x0 // 0 +#define RST_BOOTSTRAP_SDRAM_DISABLE_MSB 1 +#define RST_BOOTSTRAP_SDRAM_DISABLE_LSB 1 +#define RST_BOOTSTRAP_SDRAM_DISABLE_MASK 0x00000002 +#define RST_BOOTSTRAP_SDRAM_DISABLE_GET(x) (((x) & RST_BOOTSTRAP_SDRAM_DISABLE_MASK) >> RST_BOOTSTRAP_SDRAM_DISABLE_LSB) +#define RST_BOOTSTRAP_SDRAM_DISABLE_SET(x) (((x) << RST_BOOTSTRAP_SDRAM_DISABLE_LSB) & RST_BOOTSTRAP_SDRAM_DISABLE_MASK) +#define RST_BOOTSTRAP_SDRAM_DISABLE_RESET 0x0 // 0 +#define RST_BOOTSTRAP_DDR_SELECT_MSB 0 +#define RST_BOOTSTRAP_DDR_SELECT_LSB 0 +#define RST_BOOTSTRAP_DDR_SELECT_MASK 0x00000001 +#define RST_BOOTSTRAP_DDR_SELECT_GET(x) (((x) & RST_BOOTSTRAP_DDR_SELECT_MASK) >> RST_BOOTSTRAP_DDR_SELECT_LSB) +#define RST_BOOTSTRAP_DDR_SELECT_SET(x) (((x) << RST_BOOTSTRAP_DDR_SELECT_LSB) & RST_BOOTSTRAP_DDR_SELECT_MASK) +#define RST_BOOTSTRAP_DDR_SELECT_RESET 0x0 // 0 +#define RST_BOOTSTRAP_ADDRESS 0x180600b0 + +#define GPIO_OE_ADDRESS 0x18040000 +#define GPIO_OUT_ADDRESS 0x18040008 +#define GPIO_SPARE_ADDRESS 0x18040028 + +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_MSB 31 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_LSB 24 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_MASK 0xff000000 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_GET(x) (((x) & GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_MASK) >> GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_LSB) +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_SET(x) (((x) << GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_LSB) & GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_MASK) +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_7_RESET 0xb // 11 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_MSB 23 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_LSB 16 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_MASK 0x00ff0000 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_GET(x) (((x) & GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_MASK) >> GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_LSB) +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_SET(x) (((x) << GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_LSB) & GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_MASK) +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_6_RESET 0xa // 10 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_MSB 15 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_LSB 8 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_MASK 0x0000ff00 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_GET(x) (((x) & GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_MASK) >> GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_LSB) +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_SET(x) (((x) << GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_LSB) & GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_MASK) +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_5_RESET 0x9 // 9 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_MSB 7 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_LSB 0 +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_MASK 0x000000ff +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_GET(x) (((x) & GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_MASK) >> GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_LSB) +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_SET(x) (((x) << GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_LSB) & GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_MASK) +#define GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_RESET 0x14 // 20 +#define GPIO_OUT_FUNCTION1_ADDRESS 0x18040030 + +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_MSB 31 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_LSB 24 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_MASK 0xff000000 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_GET(x) (((x) & GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_MASK) >> GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_LSB) +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_SET(x) (((x) << GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_LSB) & GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_MASK) +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_11_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_MSB 23 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_LSB 16 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_MASK 0x00ff0000 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_GET(x) (((x) & GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_MASK) >> GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_LSB) +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_SET(x) (((x) << GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_LSB) & GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_MASK) +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_10_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_MSB 15 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_LSB 8 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_MASK 0x0000ff00 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_GET(x) (((x) & GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_MASK) >> GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_LSB) +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_SET(x) (((x) << GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_LSB) & GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_MASK) +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_9_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_MSB 7 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_LSB 0 +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_MASK 0x000000ff +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_GET(x) (((x) & GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_MASK) >> GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_LSB) +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_SET(x) (((x) << GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_LSB) & GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_MASK) +#define GPIO_OUT_FUNCTION2_ENABLE_GPIO_8_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION2_ADDRESS 0x18040034 + +#define GPIO_IN_ENABLE0_UART_SIN_MSB 15 +#define GPIO_IN_ENABLE0_UART_SIN_LSB 8 +#define GPIO_IN_ENABLE0_UART_SIN_MASK 0x0000ff00 +#define GPIO_IN_ENABLE0_UART_SIN_GET(x) (((x) & GPIO_IN_ENABLE0_UART_SIN_MASK) >> GPIO_IN_ENABLE0_UART_SIN_LSB) +#define GPIO_IN_ENABLE0_UART_SIN_SET(x) (((x) << GPIO_IN_ENABLE0_UART_SIN_LSB) & GPIO_IN_ENABLE0_UART_SIN_MASK) +#define GPIO_IN_ENABLE0_UART_SIN_RESET 0x0 // 0 +#define GPIO_IN_ENABLE0_SPI_DATA_IN_MSB 7 +#define GPIO_IN_ENABLE0_SPI_DATA_IN_LSB 0 +#define GPIO_IN_ENABLE0_SPI_DATA_IN_MASK 0x000000ff +#define GPIO_IN_ENABLE0_SPI_DATA_IN_GET(x) (((x) & GPIO_IN_ENABLE0_SPI_DATA_IN_MASK) >> GPIO_IN_ENABLE0_SPI_DATA_IN_LSB) +#define GPIO_IN_ENABLE0_SPI_DATA_IN_SET(x) (((x) << GPIO_IN_ENABLE0_SPI_DATA_IN_LSB) & GPIO_IN_ENABLE0_SPI_DATA_IN_MASK) +#define GPIO_IN_ENABLE0_SPI_DATA_IN_RESET 0x8 // 8 +#define GPIO_IN_ENABLE0_ADDRESS 0x18040044 + + +#define GPIO_IN_ENABLE3_MII_GE1_MDI_MSB 23 +#define GPIO_IN_ENABLE3_MII_GE1_MDI_LSB 16 +#define GPIO_IN_ENABLE3_MII_GE1_MDI_MASK 0x00ff0000 +#define GPIO_IN_ENABLE3_MII_GE1_MDI_GET(x) (((x) & GPIO_IN_ENABLE3_MII_GE1_MDI_MASK) >> GPIO_IN_ENABLE3_MII_GE1_MDI_LSB) +#define GPIO_IN_ENABLE3_MII_GE1_MDI_SET(x) (((x) << GPIO_IN_ENABLE3_MII_GE1_MDI_LSB) & GPIO_IN_ENABLE3_MII_GE1_MDI_MASK) +#define GPIO_IN_ENABLE3_MII_GE1_MDI_RESET 0x80 // 128 +#define GPIO_IN_ENABLE3_BOOT_EXT_MDC_MSB 15 +#define GPIO_IN_ENABLE3_BOOT_EXT_MDC_LSB 8 +#define GPIO_IN_ENABLE3_BOOT_EXT_MDC_MASK 0x0000ff00 +#define GPIO_IN_ENABLE3_BOOT_EXT_MDC_GET(x) (((x) & GPIO_IN_ENABLE3_BOOT_EXT_MDC_MASK) >> GPIO_IN_ENABLE3_BOOT_EXT_MDC_LSB) +#define GPIO_IN_ENABLE3_BOOT_EXT_MDC_SET(x) (((x) << GPIO_IN_ENABLE3_BOOT_EXT_MDC_LSB) & GPIO_IN_ENABLE3_BOOT_EXT_MDC_MASK) +#define GPIO_IN_ENABLE3_BOOT_EXT_MDC_RESET 0x80 // 128 +#define GPIO_IN_ENABLE3_BOOT_EXT_MDO_MSB 7 +#define GPIO_IN_ENABLE3_BOOT_EXT_MDO_LSB 0 +#define GPIO_IN_ENABLE3_BOOT_EXT_MDO_MASK 0x000000ff +#define GPIO_IN_ENABLE3_BOOT_EXT_MDO_GET(x) (((x) & GPIO_IN_ENABLE3_BOOT_EXT_MDO_MASK) >> GPIO_IN_ENABLE3_BOOT_EXT_MDO_LSB) +#define GPIO_IN_ENABLE3_BOOT_EXT_MDO_SET(x) (((x) << GPIO_IN_ENABLE3_BOOT_EXT_MDO_LSB) & GPIO_IN_ENABLE3_BOOT_EXT_MDO_MASK) +#define GPIO_IN_ENABLE3_BOOT_EXT_MDO_RESET 0x80 // 128 +#define GPIO_IN_ENABLE3_ADDRESS 0x18040050 + +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_MSB 31 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_LSB 24 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_MASK 0xff000000 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_GET(x) (((x) & GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_MASK) >> GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_LSB) +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_SET(x) (((x) << GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_LSB) & GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_MASK) +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_15_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_MSB 23 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_LSB 16 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_MASK 0x00ff0000 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_GET(x) (((x) & GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_MASK) >> GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_LSB) +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_SET(x) (((x) << GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_LSB) & GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_MASK) +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_14_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_MSB 15 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_LSB 8 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_MASK 0x0000ff00 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_GET(x) (((x) & GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_MASK) >> GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_LSB) +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_SET(x) (((x) << GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_LSB) & GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_MASK) +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_13_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_MSB 7 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_LSB 0 +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_MASK 0x000000ff +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_GET(x) (((x) & GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_MASK) >> GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_LSB) +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_SET(x) (((x) << GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_LSB) & GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_MASK) +#define GPIO_OUT_FUNCTION3_ENABLE_GPIO_12_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION3_ADDRESS 0x18040038 + +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MSB 31 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_LSB 24 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK 0xff000000 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_GET(x) (((x) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK) >> GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_LSB) +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_SET(x) (((x) << GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_LSB) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_MASK) +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_19_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_MSB 23 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_LSB 16 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_MASK 0x00ff0000 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_GET(x) (((x) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_MASK) >> GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_LSB) +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_SET(x) (((x) << GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_LSB) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_MASK) +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_18_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MSB 15 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_LSB 8 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK 0x0000ff00 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_GET(x) (((x) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK) >> GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_LSB) +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_SET(x) (((x) << GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_LSB) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_MASK) +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_17_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_MSB 7 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_LSB 0 +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_MASK 0x000000ff +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_GET(x) (((x) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_MASK) >> GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_LSB) +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_SET(x) (((x) << GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_LSB) & GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_MASK) +#define GPIO_OUT_FUNCTION4_ENABLE_GPIO_16_RESET 0x0 // 0 +#define GPIO_OUT_FUNCTION4_ADDRESS 0x1804003c + +#define GPIO_FUNCTION_CLK_OBS9_ENABLE_MSB 11 +#define GPIO_FUNCTION_CLK_OBS9_ENABLE_LSB 11 +#define GPIO_FUNCTION_CLK_OBS9_ENABLE_MASK 0x00000800 +#define GPIO_FUNCTION_CLK_OBS9_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS9_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS9_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS9_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS9_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS9_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS9_ENABLE_RESET 0x0 // 0 +#define GPIO_FUNCTION_CLK_OBS8_ENABLE_MSB 10 +#define GPIO_FUNCTION_CLK_OBS8_ENABLE_LSB 10 +#define GPIO_FUNCTION_CLK_OBS8_ENABLE_MASK 0x00000400 +#define GPIO_FUNCTION_CLK_OBS8_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS8_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS8_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS8_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS8_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS8_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS8_ENABLE_RESET 0x0 // 0 +#define GPIO_FUNCTION_CLK_OBS7_ENABLE_MSB 9 +#define GPIO_FUNCTION_CLK_OBS7_ENABLE_LSB 9 +#define GPIO_FUNCTION_CLK_OBS7_ENABLE_MASK 0x00000200 +#define GPIO_FUNCTION_CLK_OBS7_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS7_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS7_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS7_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS7_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS7_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS7_ENABLE_RESET 0x0 // 0 +#define GPIO_FUNCTION_CLK_OBS6_ENABLE_MSB 8 +#define GPIO_FUNCTION_CLK_OBS6_ENABLE_LSB 8 +#define GPIO_FUNCTION_CLK_OBS6_ENABLE_MASK 0x00000100 +#define GPIO_FUNCTION_CLK_OBS6_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS6_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS6_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS6_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS6_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS6_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS6_ENABLE_RESET 0x0 // 0 +#define GPIO_FUNCTION_CLK_OBS5_ENABLE_MSB 7 +#define GPIO_FUNCTION_CLK_OBS5_ENABLE_LSB 7 +#define GPIO_FUNCTION_CLK_OBS5_ENABLE_MASK 0x00000080 +#define GPIO_FUNCTION_CLK_OBS5_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS5_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS5_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS5_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS5_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS5_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS5_ENABLE_RESET 0x1 // 1 +#define GPIO_FUNCTION_CLK_OBS4_ENABLE_MSB 6 +#define GPIO_FUNCTION_CLK_OBS4_ENABLE_LSB 6 +#define GPIO_FUNCTION_CLK_OBS4_ENABLE_MASK 0x00000040 +#define GPIO_FUNCTION_CLK_OBS4_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS4_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS4_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS4_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS4_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS4_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS4_ENABLE_RESET 0x0 // 0 +#define GPIO_FUNCTION_CLK_OBS3_ENABLE_MSB 5 +#define GPIO_FUNCTION_CLK_OBS3_ENABLE_LSB 5 +#define GPIO_FUNCTION_CLK_OBS3_ENABLE_MASK 0x00000020 +#define GPIO_FUNCTION_CLK_OBS3_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS3_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS3_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS3_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS3_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS3_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS3_ENABLE_RESET 0x0 // 0 +#define GPIO_FUNCTION_CLK_OBS2_ENABLE_MSB 4 +#define GPIO_FUNCTION_CLK_OBS2_ENABLE_LSB 4 +#define GPIO_FUNCTION_CLK_OBS2_ENABLE_MASK 0x00000010 +#define GPIO_FUNCTION_CLK_OBS2_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS2_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS2_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS2_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS2_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS2_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS2_ENABLE_RESET 0x0 // 0 +#define GPIO_FUNCTION_CLK_OBS1_ENABLE_MSB 3 +#define GPIO_FUNCTION_CLK_OBS1_ENABLE_LSB 3 +#define GPIO_FUNCTION_CLK_OBS1_ENABLE_MASK 0x00000008 +#define GPIO_FUNCTION_CLK_OBS1_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS1_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS1_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS1_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS1_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS1_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS1_ENABLE_RESET 0x0 // 0 +#define GPIO_FUNCTION_CLK_OBS0_ENABLE_MSB 2 +#define GPIO_FUNCTION_CLK_OBS0_ENABLE_LSB 2 +#define GPIO_FUNCTION_CLK_OBS0_ENABLE_MASK 0x00000004 +#define GPIO_FUNCTION_CLK_OBS0_ENABLE_GET(x) (((x) & GPIO_FUNCTION_CLK_OBS0_ENABLE_MASK) >> GPIO_FUNCTION_CLK_OBS0_ENABLE_LSB) +#define GPIO_FUNCTION_CLK_OBS0_ENABLE_SET(x) (((x) << GPIO_FUNCTION_CLK_OBS0_ENABLE_LSB) & GPIO_FUNCTION_CLK_OBS0_ENABLE_MASK) +#define GPIO_FUNCTION_CLK_OBS0_ENABLE_RESET 0x0 // 0 +#define GPIO_FUNCTION_DISABLE_JTAG_MSB 1 +#define GPIO_FUNCTION_DISABLE_JTAG_LSB 1 +#define GPIO_FUNCTION_DISABLE_JTAG_MASK 0x00000002 +#define GPIO_FUNCTION_DISABLE_JTAG_GET(x) (((x) & GPIO_FUNCTION_DISABLE_JTAG_MASK) >> GPIO_FUNCTION_DISABLE_JTAG_LSB) +#define GPIO_FUNCTION_DISABLE_JTAG_SET(x) (((x) << GPIO_FUNCTION_DISABLE_JTAG_LSB) & GPIO_FUNCTION_DISABLE_JTAG_MASK) +#define GPIO_FUNCTION_DISABLE_JTAG_RESET 0x0 // 0 +#define GPIO_FUNCTION_ENABLE_GPIO_SRIF_MSB 0 +#define GPIO_FUNCTION_ENABLE_GPIO_SRIF_LSB 0 +#define GPIO_FUNCTION_ENABLE_GPIO_SRIF_MASK 0x00000001 +#define GPIO_FUNCTION_ENABLE_GPIO_SRIF_GET(x) (((x) & GPIO_FUNCTION_ENABLE_GPIO_SRIF_MASK) >> GPIO_FUNCTION_ENABLE_GPIO_SRIF_LSB) +#define GPIO_FUNCTION_ENABLE_GPIO_SRIF_SET(x) (((x) << GPIO_FUNCTION_ENABLE_GPIO_SRIF_LSB) & GPIO_FUNCTION_ENABLE_GPIO_SRIF_MASK) +#define GPIO_FUNCTION_ENABLE_GPIO_SRIF_RESET 0x0 // 0 +#define GPIO_FUNCTION_ADDRESS 0x1804006c + + + +#define PCIE_RESET_EP_RESET_L_MSB 2 +#define PCIE_RESET_EP_RESET_L_LSB 2 +#define PCIE_RESET_EP_RESET_L_MASK 0x00000004 +#define PCIE_RESET_EP_RESET_L_GET(x) (((x) & PCIE_RESET_EP_RESET_L_MASK) >> PCIE_RESET_EP_RESET_L_LSB) +#define PCIE_RESET_EP_RESET_L_SET(x) (((x) << PCIE_RESET_EP_RESET_L_LSB) & PCIE_RESET_EP_RESET_L_MASK) +#define PCIE_RESET_EP_RESET_L_RESET 0x0 // 0 +#define PCIE_RESET_LINK_REQ_RESET_MSB 1 +#define PCIE_RESET_LINK_REQ_RESET_LSB 1 +#define PCIE_RESET_LINK_REQ_RESET_MASK 0x00000002 +#define PCIE_RESET_LINK_REQ_RESET_GET(x) (((x) & PCIE_RESET_LINK_REQ_RESET_MASK) >> PCIE_RESET_LINK_REQ_RESET_LSB) +#define PCIE_RESET_LINK_REQ_RESET_SET(x) (((x) << PCIE_RESET_LINK_REQ_RESET_LSB) & PCIE_RESET_LINK_REQ_RESET_MASK) +#define PCIE_RESET_LINK_REQ_RESET_RESET 0x0 // 0 +#define PCIE_RESET_LINK_UP_MSB 0 +#define PCIE_RESET_LINK_UP_LSB 0 +#define PCIE_RESET_LINK_UP_MASK 0x00000001 +#define PCIE_RESET_LINK_UP_GET(x) (((x) & PCIE_RESET_LINK_UP_MASK) >> PCIE_RESET_LINK_UP_LSB) +#define PCIE_RESET_LINK_UP_SET(x) (((x) << PCIE_RESET_LINK_UP_LSB) & PCIE_RESET_LINK_UP_MASK) +#define PCIE_RESET_LINK_UP_RESET 0x0 // 0 +#define PCIE_RESET_ADDRESS 0x180f0018 + +#define ETH_SGMII_SERDES_EN_LOCK_DETECT_MSB 2 +#define ETH_SGMII_SERDES_EN_LOCK_DETECT_LSB 2 +#define ETH_SGMII_SERDES_EN_LOCK_DETECT_MASK 0x00000004 +#define ETH_SGMII_SERDES_EN_LOCK_DETECT_GET(x) (((x) & ETH_SGMII_SERDES_EN_LOCK_DETECT_MASK) >> ETH_SGMII_SERDES_EN_LOCK_DETECT_LSB) +#define ETH_SGMII_SERDES_EN_LOCK_DETECT_SET(x) (((x) << ETH_SGMII_SERDES_EN_LOCK_DETECT_LSB) & ETH_SGMII_SERDES_EN_LOCK_DETECT_MASK) +#define ETH_SGMII_SERDES_EN_LOCK_DETECT_RESET 0x0 // 0 +#define ETH_SGMII_SERDES_PLL_REFCLK_SEL_MSB 1 +#define ETH_SGMII_SERDES_PLL_REFCLK_SEL_LSB 1 +#define ETH_SGMII_SERDES_PLL_REFCLK_SEL_MASK 0x00000002 +#define ETH_SGMII_SERDES_PLL_REFCLK_SEL_GET(x) (((x) & ETH_SGMII_SERDES_PLL_REFCLK_SEL_MASK) >> ETH_SGMII_SERDES_PLL_REFCLK_SEL_LSB) +#define ETH_SGMII_SERDES_PLL_REFCLK_SEL_SET(x) (((x) << ETH_SGMII_SERDES_PLL_REFCLK_SEL_LSB) & ETH_SGMII_SERDES_PLL_REFCLK_SEL_MASK) +#define ETH_SGMII_SERDES_PLL_REFCLK_SEL_RESET 0x0 // 0 +#define ETH_SGMII_SERDES_EN_PLL_MSB 0 +#define ETH_SGMII_SERDES_EN_PLL_LSB 0 +#define ETH_SGMII_SERDES_EN_PLL_MASK 0x00000001 +#define ETH_SGMII_SERDES_EN_PLL_GET(x) (((x) & ETH_SGMII_SERDES_EN_PLL_MASK) >> ETH_SGMII_SERDES_EN_PLL_LSB) +#define ETH_SGMII_SERDES_EN_PLL_SET(x) (((x) << ETH_SGMII_SERDES_EN_PLL_LSB) & ETH_SGMII_SERDES_EN_PLL_MASK) +#define ETH_SGMII_SERDES_EN_PLL_RESET 0x1 // 1 +#define ETH_SGMII_SERDES_ADDRESS 0x1805004c + + +#define ETH_CFG_ETH_SPARE_MSB 31 +#define ETH_CFG_ETH_SPARE_LSB 22 +#define ETH_CFG_ETH_SPARE_MASK 0xffc00000 +#define ETH_CFG_ETH_SPARE_GET(x) (((x) & ETH_CFG_ETH_SPARE_MASK) >> ETH_CFG_ETH_SPARE_LSB) +#define ETH_CFG_ETH_SPARE_SET(x) (((x) << ETH_CFG_ETH_SPARE_LSB) & ETH_CFG_ETH_SPARE_MASK) +#define ETH_CFG_ETH_SPARE_RESET 0x0 // 0 +#define ETH_CFG_ETH_TXEN_DELAY_MSB 21 +#define ETH_CFG_ETH_TXEN_DELAY_LSB 20 +#define ETH_CFG_ETH_TXEN_DELAY_MASK 0x00300000 +#define ETH_CFG_ETH_TXEN_DELAY_GET(x) (((x) & ETH_CFG_ETH_TXEN_DELAY_MASK) >> ETH_CFG_ETH_TXEN_DELAY_LSB) +#define ETH_CFG_ETH_TXEN_DELAY_SET(x) (((x) << ETH_CFG_ETH_TXEN_DELAY_LSB) & ETH_CFG_ETH_TXEN_DELAY_MASK) +#define ETH_CFG_ETH_TXEN_DELAY_RESET 0x0 // 0 +#define ETH_CFG_ETH_TXD_DELAY_MSB 19 +#define ETH_CFG_ETH_TXD_DELAY_LSB 18 +#define ETH_CFG_ETH_TXD_DELAY_MASK 0x000c0000 +#define ETH_CFG_ETH_TXD_DELAY_GET(x) (((x) & ETH_CFG_ETH_TXD_DELAY_MASK) >> ETH_CFG_ETH_TXD_DELAY_LSB) +#define ETH_CFG_ETH_TXD_DELAY_SET(x) (((x) << ETH_CFG_ETH_TXD_DELAY_LSB) & ETH_CFG_ETH_TXD_DELAY_MASK) +#define ETH_CFG_ETH_TXD_DELAY_RESET 0x0 // 0 +#define ETH_CFG_ETH_RXDV_DELAY_MSB 17 +#define ETH_CFG_ETH_RXDV_DELAY_LSB 16 +#define ETH_CFG_ETH_RXDV_DELAY_MASK 0x00030000 +#define ETH_CFG_ETH_RXDV_DELAY_GET(x) (((x) & ETH_CFG_ETH_RXDV_DELAY_MASK) >> ETH_CFG_ETH_RXDV_DELAY_LSB) +#define ETH_CFG_ETH_RXDV_DELAY_SET(x) (((x) << ETH_CFG_ETH_RXDV_DELAY_LSB) & ETH_CFG_ETH_RXDV_DELAY_MASK) +#define ETH_CFG_ETH_RXDV_DELAY_RESET 0x0 // 0 +#define ETH_CFG_ETH_RXD_DELAY_MSB 15 +#define ETH_CFG_ETH_RXD_DELAY_LSB 14 +#define ETH_CFG_ETH_RXD_DELAY_MASK 0x0000c000 +#define ETH_CFG_ETH_RXD_DELAY_GET(x) (((x) & ETH_CFG_ETH_RXD_DELAY_MASK) >> ETH_CFG_ETH_RXD_DELAY_LSB) +#define ETH_CFG_ETH_RXD_DELAY_SET(x) (((x) << ETH_CFG_ETH_RXD_DELAY_LSB) & ETH_CFG_ETH_RXD_DELAY_MASK) +#define ETH_CFG_ETH_RXD_DELAY_RESET 0x0 // 0 +#define ETH_CFG_RMII_GE0_MASTER_MSB 12 +#define ETH_CFG_RMII_GE0_MASTER_LSB 12 +#define ETH_CFG_RMII_GE0_MASTER_MASK 0x00001000 +#define ETH_CFG_RMII_GE0_MASTER_GET(x) (((x) & ETH_CFG_RMII_GE0_MASTER_MASK) >> ETH_CFG_RMII_GE0_MASTER_LSB) +#define ETH_CFG_RMII_GE0_MASTER_SET(x) (((x) << ETH_CFG_RMII_GE0_MASTER_LSB) & ETH_CFG_RMII_GE0_MASTER_MASK) +#define ETH_CFG_RMII_GE0_MASTER_RESET 0x1 // 1 +#define ETH_CFG_MII_CNTL_SPEED_MSB 11 +#define ETH_CFG_MII_CNTL_SPEED_LSB 11 +#define ETH_CFG_MII_CNTL_SPEED_MASK 0x00000800 +#define ETH_CFG_MII_CNTL_SPEED_GET(x) (((x) & ETH_CFG_MII_CNTL_SPEED_MASK) >> ETH_CFG_MII_CNTL_SPEED_LSB) +#define ETH_CFG_MII_CNTL_SPEED_SET(x) (((x) << ETH_CFG_MII_CNTL_SPEED_LSB) & ETH_CFG_MII_CNTL_SPEED_MASK) +#define ETH_CFG_MII_CNTL_SPEED_RESET 0x0 // 0 +#define ETH_CFG_RMII_GE0_MSB 10 +#define ETH_CFG_RMII_GE0_LSB 10 +#define ETH_CFG_RMII_GE0_MASK 0x00000400 +#define ETH_CFG_RMII_GE0_GET(x) (((x) & ETH_CFG_RMII_GE0_MASK) >> ETH_CFG_RMII_GE0_LSB) +#define ETH_CFG_RMII_GE0_SET(x) (((x) << ETH_CFG_RMII_GE0_LSB) & ETH_CFG_RMII_GE0_MASK) +#define ETH_CFG_RMII_GE0_RESET 0x0 // 0 +#define ETH_CFG_GE0_SGMII_MSB 6 +#define ETH_CFG_GE0_SGMII_LSB 6 +#define ETH_CFG_GE0_SGMII_MASK 0x00000040 +#define ETH_CFG_GE0_SGMII_GET(x) (((x) & ETH_CFG_GE0_SGMII_MASK) >> ETH_CFG_GE0_SGMII_LSB) +#define ETH_CFG_GE0_SGMII_SET(x) (((x) << ETH_CFG_GE0_SGMII_LSB) & ETH_CFG_GE0_SGMII_MASK) +#define ETH_CFG_GE0_SGMII_RESET 0x0 // 0 +#define ETH_CFG_GE0_ERR_EN_MSB 5 +#define ETH_CFG_GE0_ERR_EN_LSB 5 +#define ETH_CFG_GE0_ERR_EN_MASK 0x00000020 +#define ETH_CFG_GE0_ERR_EN_GET(x) (((x) & ETH_CFG_GE0_ERR_EN_MASK) >> ETH_CFG_GE0_ERR_EN_LSB) +#define ETH_CFG_GE0_ERR_EN_SET(x) (((x) << ETH_CFG_GE0_ERR_EN_LSB) & ETH_CFG_GE0_ERR_EN_MASK) +#define ETH_CFG_GE0_ERR_EN_RESET 0x0 // 0 +#define ETH_CFG_MII_GE0_SLAVE_MSB 4 +#define ETH_CFG_MII_GE0_SLAVE_LSB 4 +#define ETH_CFG_MII_GE0_SLAVE_MASK 0x00000010 +#define ETH_CFG_MII_GE0_SLAVE_GET(x) (((x) & ETH_CFG_MII_GE0_SLAVE_MASK) >> ETH_CFG_MII_GE0_SLAVE_LSB) +#define ETH_CFG_MII_GE0_SLAVE_SET(x) (((x) << ETH_CFG_MII_GE0_SLAVE_LSB) & ETH_CFG_MII_GE0_SLAVE_MASK) +#define ETH_CFG_MII_GE0_SLAVE_RESET 0x0 // 0 +#define ETH_CFG_MII_GE0_MASTER_MSB 3 +#define ETH_CFG_MII_GE0_MASTER_LSB 3 +#define ETH_CFG_MII_GE0_MASTER_MASK 0x00000008 +#define ETH_CFG_MII_GE0_MASTER_GET(x) (((x) & ETH_CFG_MII_GE0_MASTER_MASK) >> ETH_CFG_MII_GE0_MASTER_LSB) +#define ETH_CFG_MII_GE0_MASTER_SET(x) (((x) << ETH_CFG_MII_GE0_MASTER_LSB) & ETH_CFG_MII_GE0_MASTER_MASK) +#define ETH_CFG_MII_GE0_MASTER_RESET 0x0 // 0 +#define ETH_CFG_GMII_GE0_MSB 2 +#define ETH_CFG_GMII_GE0_LSB 2 +#define ETH_CFG_GMII_GE0_MASK 0x00000004 +#define ETH_CFG_GMII_GE0_GET(x) (((x) & ETH_CFG_GMII_GE0_MASK) >> ETH_CFG_GMII_GE0_LSB) +#define ETH_CFG_GMII_GE0_SET(x) (((x) << ETH_CFG_GMII_GE0_LSB) & ETH_CFG_GMII_GE0_MASK) +#define ETH_CFG_GMII_GE0_RESET 0x0 // 0 +#define ETH_CFG_MII_GE0_MSB 1 +#define ETH_CFG_MII_GE0_LSB 1 +#define ETH_CFG_MII_GE0_MASK 0x00000002 +#define ETH_CFG_MII_GE0_GET(x) (((x) & ETH_CFG_MII_GE0_MASK) >> ETH_CFG_MII_GE0_LSB) +#define ETH_CFG_MII_GE0_SET(x) (((x) << ETH_CFG_MII_GE0_LSB) & ETH_CFG_MII_GE0_MASK) +#define ETH_CFG_MII_GE0_RESET 0x0 // 0 +#define ETH_CFG_RGMII_GE0_MSB 0 +#define ETH_CFG_RGMII_GE0_LSB 0 +#define ETH_CFG_RGMII_GE0_MASK 0x00000001 +#define ETH_CFG_RGMII_GE0_GET(x) (((x) & ETH_CFG_RGMII_GE0_MASK) >> ETH_CFG_RGMII_GE0_LSB) +#define ETH_CFG_RGMII_GE0_SET(x) (((x) << ETH_CFG_RGMII_GE0_LSB) & ETH_CFG_RGMII_GE0_MASK) +#define ETH_CFG_RGMII_GE0_RESET 0x0 // 0 +#define ETH_CFG_ADDRESS 0x18070000 + + + +#define SGMII_SERDES_VCO_REG_MSB 30 +#define SGMII_SERDES_VCO_REG_LSB 27 +#define SGMII_SERDES_VCO_REG_MASK 0x78000000 +#define SGMII_SERDES_VCO_REG_GET(x) (((x) & SGMII_SERDES_VCO_REG_MASK) >> SGMII_SERDES_VCO_REG_LSB) +#define SGMII_SERDES_VCO_REG_SET(x) (((x) << SGMII_SERDES_VCO_REG_LSB) & SGMII_SERDES_VCO_REG_MASK) +#define SGMII_SERDES_VCO_REG_RESET 0x3 // 3 +#define SGMII_SERDES_RES_CALIBRATION_MSB 26 +#define SGMII_SERDES_RES_CALIBRATION_LSB 23 +#define SGMII_SERDES_RES_CALIBRATION_MASK 0x07800000 +#define SGMII_SERDES_RES_CALIBRATION_GET(x) (((x) & SGMII_SERDES_RES_CALIBRATION_MASK) >> SGMII_SERDES_RES_CALIBRATION_LSB) +#define SGMII_SERDES_RES_CALIBRATION_SET(x) (((x) << SGMII_SERDES_RES_CALIBRATION_LSB) & SGMII_SERDES_RES_CALIBRATION_MASK) +#define SGMII_SERDES_RES_CALIBRATION_RESET 0x0 // 0 +#define SGMII_SERDES_FIBER_MODE_MSB 21 +#define SGMII_SERDES_FIBER_MODE_LSB 20 +#define SGMII_SERDES_FIBER_MODE_MASK 0x00300000 +#define SGMII_SERDES_FIBER_MODE_GET(x) (((x) & SGMII_SERDES_FIBER_MODE_MASK) >> SGMII_SERDES_FIBER_MODE_LSB) +#define SGMII_SERDES_FIBER_MODE_SET(x) (((x) << SGMII_SERDES_FIBER_MODE_LSB) & SGMII_SERDES_FIBER_MODE_MASK) +#define SGMII_SERDES_FIBER_MODE_RESET 0x0 // 0 +#define SGMII_SERDES_THRESHOLD_CTRL_MSB 19 +#define SGMII_SERDES_THRESHOLD_CTRL_LSB 18 +#define SGMII_SERDES_THRESHOLD_CTRL_MASK 0x000c0000 +#define SGMII_SERDES_THRESHOLD_CTRL_GET(x) (((x) & SGMII_SERDES_THRESHOLD_CTRL_MASK) >> SGMII_SERDES_THRESHOLD_CTRL_LSB) +#define SGMII_SERDES_THRESHOLD_CTRL_SET(x) (((x) << SGMII_SERDES_THRESHOLD_CTRL_LSB) & SGMII_SERDES_THRESHOLD_CTRL_MASK) +#define SGMII_SERDES_THRESHOLD_CTRL_RESET 0x0 // 0 +#define SGMII_SERDES_FIBER_SDO_MSB 17 +#define SGMII_SERDES_FIBER_SDO_LSB 17 +#define SGMII_SERDES_FIBER_SDO_MASK 0x00020000 +#define SGMII_SERDES_FIBER_SDO_GET(x) (((x) & SGMII_SERDES_FIBER_SDO_MASK) >> SGMII_SERDES_FIBER_SDO_LSB) +#define SGMII_SERDES_FIBER_SDO_SET(x) (((x) << SGMII_SERDES_FIBER_SDO_LSB) & SGMII_SERDES_FIBER_SDO_MASK) +#define SGMII_SERDES_FIBER_SDO_RESET 0x0 // 0 +#define SGMII_SERDES_EN_SIGNAL_DETECT_MSB 16 +#define SGMII_SERDES_EN_SIGNAL_DETECT_LSB 16 +#define SGMII_SERDES_EN_SIGNAL_DETECT_MASK 0x00010000 +#define SGMII_SERDES_EN_SIGNAL_DETECT_GET(x) (((x) & SGMII_SERDES_EN_SIGNAL_DETECT_MASK) >> SGMII_SERDES_EN_SIGNAL_DETECT_LSB) +#define SGMII_SERDES_EN_SIGNAL_DETECT_SET(x) (((x) << SGMII_SERDES_EN_SIGNAL_DETECT_LSB) & SGMII_SERDES_EN_SIGNAL_DETECT_MASK) +#define SGMII_SERDES_EN_SIGNAL_DETECT_RESET 0x1 // 1 +#define SGMII_SERDES_LOCK_DETECT_STATUS_MSB 15 +#define SGMII_SERDES_LOCK_DETECT_STATUS_LSB 15 +#define SGMII_SERDES_LOCK_DETECT_STATUS_MASK 0x00008000 +#define SGMII_SERDES_LOCK_DETECT_STATUS_GET(x) (((x) & SGMII_SERDES_LOCK_DETECT_STATUS_MASK) >> SGMII_SERDES_LOCK_DETECT_STATUS_LSB) +#define SGMII_SERDES_LOCK_DETECT_STATUS_SET(x) (((x) << SGMII_SERDES_LOCK_DETECT_STATUS_LSB) & SGMII_SERDES_LOCK_DETECT_STATUS_MASK) +#define SGMII_SERDES_LOCK_DETECT_STATUS_RESET 0x0 // 0 +#define SGMII_SERDES_SPARE0_MSB 14 +#define SGMII_SERDES_SPARE0_LSB 11 +#define SGMII_SERDES_SPARE0_MASK 0x00007800 +#define SGMII_SERDES_SPARE0_GET(x) (((x) & SGMII_SERDES_SPARE0_MASK) >> SGMII_SERDES_SPARE0_LSB) +#define SGMII_SERDES_SPARE0_SET(x) (((x) << SGMII_SERDES_SPARE0_LSB) & SGMII_SERDES_SPARE0_MASK) +#define SGMII_SERDES_SPARE0_RESET 0x0 // 0 +#define SGMII_SERDES_VCO_SLOW_MSB 10 +#define SGMII_SERDES_VCO_SLOW_LSB 10 +#define SGMII_SERDES_VCO_SLOW_MASK 0x00000400 +#define SGMII_SERDES_VCO_SLOW_GET(x) (((x) & SGMII_SERDES_VCO_SLOW_MASK) >> SGMII_SERDES_VCO_SLOW_LSB) +#define SGMII_SERDES_VCO_SLOW_SET(x) (((x) << SGMII_SERDES_VCO_SLOW_LSB) & SGMII_SERDES_VCO_SLOW_MASK) +#define SGMII_SERDES_VCO_SLOW_RESET 0x0 // 0 +#define SGMII_SERDES_VCO_FAST_MSB 9 +#define SGMII_SERDES_VCO_FAST_LSB 9 +#define SGMII_SERDES_VCO_FAST_MASK 0x00000200 +#define SGMII_SERDES_VCO_FAST_GET(x) (((x) & SGMII_SERDES_VCO_FAST_MASK) >> SGMII_SERDES_VCO_FAST_LSB) +#define SGMII_SERDES_VCO_FAST_SET(x) (((x) << SGMII_SERDES_VCO_FAST_LSB) & SGMII_SERDES_VCO_FAST_MASK) +#define SGMII_SERDES_VCO_FAST_RESET 0x0 // 0 +#define SGMII_SERDES_PLL_BW_MSB 8 +#define SGMII_SERDES_PLL_BW_LSB 8 +#define SGMII_SERDES_PLL_BW_MASK 0x00000100 +#define SGMII_SERDES_PLL_BW_GET(x) (((x) & SGMII_SERDES_PLL_BW_MASK) >> SGMII_SERDES_PLL_BW_LSB) +#define SGMII_SERDES_PLL_BW_SET(x) (((x) << SGMII_SERDES_PLL_BW_LSB) & SGMII_SERDES_PLL_BW_MASK) +#define SGMII_SERDES_PLL_BW_RESET 0x1 // 1 +#define SGMII_SERDES_TX_IMPEDANCE_MSB 7 +#define SGMII_SERDES_TX_IMPEDANCE_LSB 7 +#define SGMII_SERDES_TX_IMPEDANCE_MASK 0x00000080 +#define SGMII_SERDES_TX_IMPEDANCE_GET(x) (((x) & SGMII_SERDES_TX_IMPEDANCE_MASK) >> SGMII_SERDES_TX_IMPEDANCE_LSB) +#define SGMII_SERDES_TX_IMPEDANCE_SET(x) (((x) << SGMII_SERDES_TX_IMPEDANCE_LSB) & SGMII_SERDES_TX_IMPEDANCE_MASK) +#define SGMII_SERDES_TX_IMPEDANCE_RESET 0x0 // 0 +#define SGMII_SERDES_TX_DR_CTRL_MSB 6 +#define SGMII_SERDES_TX_DR_CTRL_LSB 4 +#define SGMII_SERDES_TX_DR_CTRL_MASK 0x00000070 +#define SGMII_SERDES_TX_DR_CTRL_GET(x) (((x) & SGMII_SERDES_TX_DR_CTRL_MASK) >> SGMII_SERDES_TX_DR_CTRL_LSB) +#define SGMII_SERDES_TX_DR_CTRL_SET(x) (((x) << SGMII_SERDES_TX_DR_CTRL_LSB) & SGMII_SERDES_TX_DR_CTRL_MASK) +#define SGMII_SERDES_TX_DR_CTRL_RESET 0x1 // 1 +#define SGMII_SERDES_HALF_TX_MSB 3 +#define SGMII_SERDES_HALF_TX_LSB 3 +#define SGMII_SERDES_HALF_TX_MASK 0x00000008 +#define SGMII_SERDES_HALF_TX_GET(x) (((x) & SGMII_SERDES_HALF_TX_MASK) >> SGMII_SERDES_HALF_TX_LSB) +#define SGMII_SERDES_HALF_TX_SET(x) (((x) << SGMII_SERDES_HALF_TX_LSB) & SGMII_SERDES_HALF_TX_MASK) +#define SGMII_SERDES_HALF_TX_RESET 0x0 // 0 +#define SGMII_SERDES_CDR_BW_MSB 2 +#define SGMII_SERDES_CDR_BW_LSB 1 +#define SGMII_SERDES_CDR_BW_MASK 0x00000006 +#define SGMII_SERDES_CDR_BW_GET(x) (((x) & SGMII_SERDES_CDR_BW_MASK) >> SGMII_SERDES_CDR_BW_LSB) +#define SGMII_SERDES_CDR_BW_SET(x) (((x) << SGMII_SERDES_CDR_BW_LSB) & SGMII_SERDES_CDR_BW_MASK) +#define SGMII_SERDES_CDR_BW_RESET 0x3 // 3 +#define SGMII_SERDES_RX_IMPEDANCE_MSB 0 +#define SGMII_SERDES_RX_IMPEDANCE_LSB 0 +#define SGMII_SERDES_RX_IMPEDANCE_MASK 0x00000001 +#define SGMII_SERDES_RX_IMPEDANCE_GET(x) (((x) & SGMII_SERDES_RX_IMPEDANCE_MASK) >> SGMII_SERDES_RX_IMPEDANCE_LSB) +#define SGMII_SERDES_RX_IMPEDANCE_SET(x) (((x) << SGMII_SERDES_RX_IMPEDANCE_LSB) & SGMII_SERDES_RX_IMPEDANCE_MASK) +#define SGMII_SERDES_RX_IMPEDANCE_RESET 0x0 // 0 +#define SGMII_SERDES_ADDRESS 0x18070018 + +#define RST_RESET2_SPARE_MSB 31 +#define RST_RESET2_SPARE_LSB 19 +#define RST_RESET2_SPARE_MASK 0xfff80000 +#define RST_RESET2_SPARE_GET(x) (((x) & RST_RESET2_SPARE_MASK) >> RST_RESET2_SPARE_LSB) +#define RST_RESET2_SPARE_SET(x) (((x) << RST_RESET2_SPARE_LSB) & RST_RESET2_SPARE_MASK) +#define RST_RESET2_SPARE_RESET 0x0 // 0 +#define RST_RESET2_EP_MODE_MSB 18 +#define RST_RESET2_EP_MODE_LSB 18 +#define RST_RESET2_EP_MODE_MASK 0x00040000 +#define RST_RESET2_EP_MODE_GET(x) (((x) & RST_RESET2_EP_MODE_MASK) >> RST_RESET2_EP_MODE_LSB) +#define RST_RESET2_EP_MODE_SET(x) (((x) << RST_RESET2_EP_MODE_LSB) & RST_RESET2_EP_MODE_MASK) +#define RST_RESET2_EP_MODE_RESET 0x0 // 0 +#define RST_RESET2_USB2_EXT_PWR_SEQ_MSB 17 +#define RST_RESET2_USB2_EXT_PWR_SEQ_LSB 17 +#define RST_RESET2_USB2_EXT_PWR_SEQ_MASK 0x00020000 +#define RST_RESET2_USB2_EXT_PWR_SEQ_GET(x) (((x) & RST_RESET2_USB2_EXT_PWR_SEQ_MASK) >> RST_RESET2_USB2_EXT_PWR_SEQ_LSB) +#define RST_RESET2_USB2_EXT_PWR_SEQ_SET(x) (((x) << RST_RESET2_USB2_EXT_PWR_SEQ_LSB) & RST_RESET2_USB2_EXT_PWR_SEQ_MASK) +#define RST_RESET2_USB2_EXT_PWR_SEQ_RESET 0x1 // 1 +#define RST_RESET2_USB1_EXT_PWR_SEQ_MSB 16 +#define RST_RESET2_USB1_EXT_PWR_SEQ_LSB 16 +#define RST_RESET2_USB1_EXT_PWR_SEQ_MASK 0x00010000 +#define RST_RESET2_USB1_EXT_PWR_SEQ_GET(x) (((x) & RST_RESET2_USB1_EXT_PWR_SEQ_MASK) >> RST_RESET2_USB1_EXT_PWR_SEQ_LSB) +#define RST_RESET2_USB1_EXT_PWR_SEQ_SET(x) (((x) << RST_RESET2_USB1_EXT_PWR_SEQ_LSB) & RST_RESET2_USB1_EXT_PWR_SEQ_MASK) +#define RST_RESET2_USB1_EXT_PWR_SEQ_RESET 0x1 // 1 +#define RST_RESET2_USB_PHY2_PLL_PWD_EXT_MSB 15 +#define RST_RESET2_USB_PHY2_PLL_PWD_EXT_LSB 15 +#define RST_RESET2_USB_PHY2_PLL_PWD_EXT_MASK 0x00008000 +#define RST_RESET2_USB_PHY2_PLL_PWD_EXT_GET(x) (((x) & RST_RESET2_USB_PHY2_PLL_PWD_EXT_MASK) >> RST_RESET2_USB_PHY2_PLL_PWD_EXT_LSB) +#define RST_RESET2_USB_PHY2_PLL_PWD_EXT_SET(x) (((x) << RST_RESET2_USB_PHY2_PLL_PWD_EXT_LSB) & RST_RESET2_USB_PHY2_PLL_PWD_EXT_MASK) +#define RST_RESET2_USB_PHY2_PLL_PWD_EXT_RESET 0x0 // 0 +#define RST_RESET2_USB_PHY2_ARESET_MSB 11 +#define RST_RESET2_USB_PHY2_ARESET_LSB 11 +#define RST_RESET2_USB_PHY2_ARESET_MASK 0x00000800 +#define RST_RESET2_USB_PHY2_ARESET_GET(x) (((x) & RST_RESET2_USB_PHY2_ARESET_MASK) >> RST_RESET2_USB_PHY2_ARESET_LSB) +#define RST_RESET2_USB_PHY2_ARESET_SET(x) (((x) << RST_RESET2_USB_PHY2_ARESET_LSB) & RST_RESET2_USB_PHY2_ARESET_MASK) +#define RST_RESET2_USB_PHY2_ARESET_RESET 0x1 // 1 +#define RST_RESET2_PCIE2_PHY_RESET_MSB 7 +#define RST_RESET2_PCIE2_PHY_RESET_LSB 7 +#define RST_RESET2_PCIE2_PHY_RESET_MASK 0x00000080 +#define RST_RESET2_PCIE2_PHY_RESET_GET(x) (((x) & RST_RESET2_PCIE2_PHY_RESET_MASK) >> RST_RESET2_PCIE2_PHY_RESET_LSB) +#define RST_RESET2_PCIE2_PHY_RESET_SET(x) (((x) << RST_RESET2_PCIE2_PHY_RESET_LSB) & RST_RESET2_PCIE2_PHY_RESET_MASK) +#define RST_RESET2_PCIE2_PHY_RESET_RESET 0x1 // 1 +#define RST_RESET2_PCIE2_RESET_MSB 6 +#define RST_RESET2_PCIE2_RESET_LSB 6 +#define RST_RESET2_PCIE2_RESET_MASK 0x00000040 +#define RST_RESET2_PCIE2_RESET_GET(x) (((x) & RST_RESET2_PCIE2_RESET_MASK) >> RST_RESET2_PCIE2_RESET_LSB) +#define RST_RESET2_PCIE2_RESET_SET(x) (((x) << RST_RESET2_PCIE2_RESET_LSB) & RST_RESET2_PCIE2_RESET_MASK) +#define RST_RESET2_PCIE2_RESET_RESET 0x1 // 1 +#define RST_RESET2_USB_HOST2_RESET_MSB 5 +#define RST_RESET2_USB_HOST2_RESET_LSB 5 +#define RST_RESET2_USB_HOST2_RESET_MASK 0x00000020 +#define RST_RESET2_USB_HOST2_RESET_GET(x) (((x) & RST_RESET2_USB_HOST2_RESET_MASK) >> RST_RESET2_USB_HOST2_RESET_LSB) +#define RST_RESET2_USB_HOST2_RESET_SET(x) (((x) << RST_RESET2_USB_HOST2_RESET_LSB) & RST_RESET2_USB_HOST2_RESET_MASK) +#define RST_RESET2_USB_HOST2_RESET_RESET 0x1 // 1 +#define RST_RESET2_USB_PHY2_RESET_MSB 4 +#define RST_RESET2_USB_PHY2_RESET_LSB 4 +#define RST_RESET2_USB_PHY2_RESET_MASK 0x00000010 +#define RST_RESET2_USB_PHY2_RESET_GET(x) (((x) & RST_RESET2_USB_PHY2_RESET_MASK) >> RST_RESET2_USB_PHY2_RESET_LSB) +#define RST_RESET2_USB_PHY2_RESET_SET(x) (((x) << RST_RESET2_USB_PHY2_RESET_LSB) & RST_RESET2_USB_PHY2_RESET_MASK) +#define RST_RESET2_USB_PHY2_RESET_RESET 0x1 // 1 +#define RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_MSB 3 +#define RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_LSB 3 +#define RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_MASK 0x00000008 +#define RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_GET(x) (((x) & RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_MASK) >> RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_LSB) +#define RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_SET(x) (((x) << RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_LSB) & RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_MASK) +#define RST_RESET2_USB_PHY2_SUSPEND_OVERRIDE_RESET 0x0 // 0 +#define RST_RESET2_USB2_MODE_MSB 0 +#define RST_RESET2_USB2_MODE_LSB 0 +#define RST_RESET2_USB2_MODE_MASK 0x00000001 +#define RST_RESET2_USB2_MODE_GET(x) (((x) & RST_RESET2_USB2_MODE_MASK) >> RST_RESET2_USB2_MODE_LSB) +#define RST_RESET2_USB2_MODE_SET(x) (((x) << RST_RESET2_USB2_MODE_LSB) & RST_RESET2_USB2_MODE_MASK) +#define RST_RESET2_USB2_MODE_RESET 0x1 // 1 +#define RST_RESET2_ADDRESS 0x180600c4 + +#define PCIE2_RESET_EP_RESET_L_MSB 2 +#define PCIE2_RESET_EP_RESET_L_LSB 2 +#define PCIE2_RESET_EP_RESET_L_MASK 0x00000004 +#define PCIE2_RESET_EP_RESET_L_GET(x) (((x) & PCIE2_RESET_EP_RESET_L_MASK) >> PCIE2_RESET_EP_RESET_L_LSB) +#define PCIE2_RESET_EP_RESET_L_SET(x) (((x) << PCIE2_RESET_EP_RESET_L_LSB) & PCIE2_RESET_EP_RESET_L_MASK) +#define PCIE2_RESET_EP_RESET_L_RESET 0x0 // 0 +#define PCIE2_RESET_LINK_REQ_RESET_MSB 1 +#define PCIE2_RESET_LINK_REQ_RESET_LSB 1 +#define PCIE2_RESET_LINK_REQ_RESET_MASK 0x00000002 +#define PCIE2_RESET_LINK_REQ_RESET_GET(x) (((x) & PCIE2_RESET_LINK_REQ_RESET_MASK) >> PCIE2_RESET_LINK_REQ_RESET_LSB) +#define PCIE2_RESET_LINK_REQ_RESET_SET(x) (((x) << PCIE2_RESET_LINK_REQ_RESET_LSB) & PCIE2_RESET_LINK_REQ_RESET_MASK) +#define PCIE2_RESET_LINK_REQ_RESET_RESET 0x0 // 0 +#define PCIE2_RESET_LINK_UP_MSB 0 +#define PCIE2_RESET_LINK_UP_LSB 0 +#define PCIE2_RESET_LINK_UP_MASK 0x00000001 +#define PCIE2_RESET_LINK_UP_GET(x) (((x) & PCIE2_RESET_LINK_UP_MASK) >> PCIE2_RESET_LINK_UP_LSB) +#define PCIE2_RESET_LINK_UP_SET(x) (((x) << PCIE2_RESET_LINK_UP_LSB) & PCIE2_RESET_LINK_UP_MASK) +#define PCIE2_RESET_LINK_UP_RESET 0x0 // 0 +#define PCIE2_RESET_ADDRESS 0x18280018 + +#define PCIE2_APP_CFG_TYPE_MSB 21 +#define PCIE2_APP_CFG_TYPE_LSB 20 +#define PCIE2_APP_CFG_TYPE_MASK 0x00300000 +#define PCIE2_APP_CFG_TYPE_GET(x) (((x) & PCIE2_APP_CFG_TYPE_MASK) >> PCIE2_APP_CFG_TYPE_LSB) +#define PCIE2_APP_CFG_TYPE_SET(x) (((x) << PCIE2_APP_CFG_TYPE_LSB) & PCIE2_APP_CFG_TYPE_MASK) +#define PCIE2_APP_CFG_TYPE_RESET 0x0 // 0 +#define PCIE2_APP_PCIE2_BAR_MSN_MSB 19 +#define PCIE2_APP_PCIE2_BAR_MSN_LSB 16 +#define PCIE2_APP_PCIE2_BAR_MSN_MASK 0x000f0000 +#define PCIE2_APP_PCIE2_BAR_MSN_GET(x) (((x) & PCIE2_APP_PCIE2_BAR_MSN_MASK) >> PCIE2_APP_PCIE2_BAR_MSN_LSB) +#define PCIE2_APP_PCIE2_BAR_MSN_SET(x) (((x) << PCIE2_APP_PCIE2_BAR_MSN_LSB) & PCIE2_APP_PCIE2_BAR_MSN_MASK) +#define PCIE2_APP_PCIE2_BAR_MSN_RESET 0x1 // 1 +#define PCIE2_APP_CFG_BE_MSB 15 +#define PCIE2_APP_CFG_BE_LSB 12 +#define PCIE2_APP_CFG_BE_MASK 0x0000f000 +#define PCIE2_APP_CFG_BE_GET(x) (((x) & PCIE2_APP_CFG_BE_MASK) >> PCIE2_APP_CFG_BE_LSB) +#define PCIE2_APP_CFG_BE_SET(x) (((x) << PCIE2_APP_CFG_BE_LSB) & PCIE2_APP_CFG_BE_MASK) +#define PCIE2_APP_CFG_BE_RESET 0xf // 15 +#define PCIE2_APP_SLV_RESP_ERR_MAP_MSB 11 +#define PCIE2_APP_SLV_RESP_ERR_MAP_LSB 6 +#define PCIE2_APP_SLV_RESP_ERR_MAP_MASK 0x00000fc0 +#define PCIE2_APP_SLV_RESP_ERR_MAP_GET(x) (((x) & PCIE2_APP_SLV_RESP_ERR_MAP_MASK) >> PCIE2_APP_SLV_RESP_ERR_MAP_LSB) +#define PCIE2_APP_SLV_RESP_ERR_MAP_SET(x) (((x) << PCIE2_APP_SLV_RESP_ERR_MAP_LSB) & PCIE2_APP_SLV_RESP_ERR_MAP_MASK) +#define PCIE2_APP_SLV_RESP_ERR_MAP_RESET 0x3f // 63 +#define PCIE2_APP_MSTR_RESP_ERR_MAP_MSB 5 +#define PCIE2_APP_MSTR_RESP_ERR_MAP_LSB 4 +#define PCIE2_APP_MSTR_RESP_ERR_MAP_MASK 0x00000030 +#define PCIE2_APP_MSTR_RESP_ERR_MAP_GET(x) (((x) & PCIE2_APP_MSTR_RESP_ERR_MAP_MASK) >> PCIE2_APP_MSTR_RESP_ERR_MAP_LSB) +#define PCIE2_APP_MSTR_RESP_ERR_MAP_SET(x) (((x) << PCIE2_APP_MSTR_RESP_ERR_MAP_LSB) & PCIE2_APP_MSTR_RESP_ERR_MAP_MASK) +#define PCIE2_APP_MSTR_RESP_ERR_MAP_RESET 0x0 // 0 +#define PCIE2_APP_INIT_RST_MSB 3 +#define PCIE2_APP_INIT_RST_LSB 3 +#define PCIE2_APP_INIT_RST_MASK 0x00000008 +#define PCIE2_APP_INIT_RST_GET(x) (((x) & PCIE2_APP_INIT_RST_MASK) >> PCIE2_APP_INIT_RST_LSB) +#define PCIE2_APP_INIT_RST_SET(x) (((x) << PCIE2_APP_INIT_RST_LSB) & PCIE2_APP_INIT_RST_MASK) +#define PCIE2_APP_INIT_RST_RESET 0x0 // 0 +#define PCIE2_APP_PM_XMT_TURNOFF_MSB 2 +#define PCIE2_APP_PM_XMT_TURNOFF_LSB 2 +#define PCIE2_APP_PM_XMT_TURNOFF_MASK 0x00000004 +#define PCIE2_APP_PM_XMT_TURNOFF_GET(x) (((x) & PCIE2_APP_PM_XMT_TURNOFF_MASK) >> PCIE2_APP_PM_XMT_TURNOFF_LSB) +#define PCIE2_APP_PM_XMT_TURNOFF_SET(x) (((x) << PCIE2_APP_PM_XMT_TURNOFF_LSB) & PCIE2_APP_PM_XMT_TURNOFF_MASK) +#define PCIE2_APP_PM_XMT_TURNOFF_RESET 0x0 // 0 +#define PCIE2_APP_UNLOCK_MSG_MSB 1 +#define PCIE2_APP_UNLOCK_MSG_LSB 1 +#define PCIE2_APP_UNLOCK_MSG_MASK 0x00000002 +#define PCIE2_APP_UNLOCK_MSG_GET(x) (((x) & PCIE2_APP_UNLOCK_MSG_MASK) >> PCIE2_APP_UNLOCK_MSG_LSB) +#define PCIE2_APP_UNLOCK_MSG_SET(x) (((x) << PCIE2_APP_UNLOCK_MSG_LSB) & PCIE2_APP_UNLOCK_MSG_MASK) +#define PCIE2_APP_UNLOCK_MSG_RESET 0x0 // 0 +#define PCIE2_APP_LTSSM_ENABLE_MSB 0 +#define PCIE2_APP_LTSSM_ENABLE_LSB 0 +#define PCIE2_APP_LTSSM_ENABLE_MASK 0x00000001 +#define PCIE2_APP_LTSSM_ENABLE_GET(x) (((x) & PCIE2_APP_LTSSM_ENABLE_MASK) >> PCIE2_APP_LTSSM_ENABLE_LSB) +#define PCIE2_APP_LTSSM_ENABLE_SET(x) (((x) << PCIE2_APP_LTSSM_ENABLE_LSB) & PCIE2_APP_LTSSM_ENABLE_MASK) +#define PCIE2_APP_LTSSM_ENABLE_RESET 0x0 // 0 +#define PCIE2_APP_ADDRESS 0x18280000 + + + + +//#define CONFIG_MIPS32 1 /* MIPS32 CPU core */ /*Moved to qca955x board config*/ + +//#define CONFIG_BOOTDELAY 2 /* autoboot after 4 seconds */ /*Moved to qca955x board config*/ + +//#define CONFIG_BAUDRATE 115200 /*Moved to qca955x board config*/ +//#define CFG_BAUDRATE_TABLE {115200} /*Moved to qca955x board config*/ + +//#define CONFIG_TIMESTAMP /* Print image info with timestamp */ /*Moved to qca955x board config*/ + +#define CONFIG_ROOTFS_RD + +#define CONFIG_BOOTARGS_RD "console=ttyS0,115200 root=01:00 rd_start=0x802d0000 rd_size=5242880 init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),4096k(rootfs),2048k(uImage)" + +/* XXX - putting rootfs in last partition results in jffs errors */ +#define CONFIG_BOOTARGS_FL "console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),5120k(rootfs),2048k(uImage)" + +#ifdef CONFIG_ROOTFS_FLASH +#define CONFIG_BOOTARGS CONFIG_BOOTARGS_FL +#else +#define CONFIG_BOOTARGS "" +#endif + +/* + * Miscellaneous configurable options + */ +#define CFG_LONGHELP /* undef to save memory */ +#define CFG_PROMPT "ath> " /* Monitor Command Prompt */ +#define CFG_CBSIZE 512 /* Console I/O Buffer Size */ +#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */ +#define CFG_MAXARGS 16 /* max number of command args*/ + +//#define CFG_MALLOC_LEN (128*1024) /*Moved to qca955x board config*/ + +#define CFG_BOOTPARAMS_LEN (128*1024) + +//#define CFG_SDRAM_BASE 0x80000000 /* Cached addr */ /*Moved to qca955x board config */ +//#define CFG_SDRAM_BASE 0xa0000000 /* Cached addr */ + +//#define CFG_LOAD_ADDR 0x81000000 /* default load address */ /* Moved to qca955x board config */ +//#define CFG_LOAD_ADDR 0xa1000000 /* default load address */ + +#define CFG_MEMTEST_START 0x80100000 +#undef CFG_MEMTEST_START +#define CFG_MEMTEST_START 0x80200000 +#define CFG_MEMTEST_END 0x83800000 + +/*------------------------------------------------------------------------ + * * * JFFS2 + */ +#define CFG_JFFS_CUSTOM_PART /* board defined part */ +#define CONFIG_JFFS2_CMDLINE +#define MTDIDS_DEFAULT "nor0=ath-nor0" + +#define CONFIG_MEMSIZE_IN_BYTES + +//#define CFG_RX_ETH_BUFFER 16 /* Moved to qca955x board config */ + + +/*----------------------------------------------------------------------- + * Cache Configuration + */ +//#define CFG_DCACHE_SIZE 32768 /* Moved to qca955x board config */ +//#define CFG_ICACHE_SIZE 65536 /* Moved to qca955x board config */ +//#define CFG_CACHELINE_SIZE 32 /* Moved to qca955x board config */ + +/* + * Address map + */ +#define ATH_PCI_MEM_BASE 0x10000000 /* 128M */ +#define ATH_APB_BASE 0x18000000 /* 384M */ +#define ATH_GE0_BASE 0x19000000 /* 16M */ +#define ATH_GE1_BASE 0x1a000000 /* 16M */ +#define ATH_USB_OHCI_BASE 0x1b000000 +#define ATH_USB_EHCI_BASE 0x1b000000 +#define ATH_USB_EHCI_BASE_1 0x1b000000 +#define ATH_USB_EHCI_BASE_2 0x1b400000 +#define ATH_SPI_BASE 0x1f000000 + +/* + * Added the PCI LCL RESET register from u-boot + * ath_soc.h so that we can query the PCI LCL RESET + * register for the presence of WLAN H/W. + */ +#define ATH_PCI_LCL_BASE (ATH_APB_BASE+0x000f0000) +#define ATH_PCI_LCL_APP (ATH_PCI_LCL_BASE+0x00) +#define ATH_PCI_LCL_RESET (ATH_PCI_LCL_BASE+0x18) + +/* + * APB block + */ +#define ATH_DDR_CTL_BASE ATH_APB_BASE+0x00000000 +#define ATH_CPU_BASE ATH_APB_BASE+0x00010000 +#define ATH_UART_BASE ATH_APB_BASE+0x00020000 +#define ATH_USB_CONFIG_BASE ATH_APB_BASE+0x00030000 +#define ATH_GPIO_BASE ATH_APB_BASE+0x00040000 +#define ATH_PLL_BASE ATH_APB_BASE+0x00050000 +#define ATH_RESET_BASE ATH_APB_BASE+0x00060000 +#define ATH_DMA_BASE ATH_APB_BASE+0x000A0000 +#define ATH_SLIC_BASE ATH_APB_BASE+0x000A9000 +#define ATH_STEREO_BASE ATH_APB_BASE+0x000B0000 +#define ATH_PCI_CTLR_BASE ATH_APB_BASE+0x000F0000 +#define ATH_OTP_BASE ATH_APB_BASE+0x00130000 +#define ATH_NAND_FLASH_BASE 0x1b800000u + + +/* + * DDR Config values + */ +#define ATH_DDR_CONFIG_16BIT (1 << 31) +#define ATH_DDR_CONFIG_PAGE_OPEN (1 << 30) +#define ATH_DDR_CONFIG_CAS_LAT_SHIFT 27 +#define ATH_DDR_CONFIG_TMRD_SHIFT 23 +#define ATH_DDR_CONFIG_TRFC_SHIFT 17 +#define ATH_DDR_CONFIG_TRRD_SHIFT 13 +#define ATH_DDR_CONFIG_TRP_SHIFT 9 +#define ATH_DDR_CONFIG_TRCD_SHIFT 5 +#define ATH_DDR_CONFIG_TRAS_SHIFT 0 + +#define ATH_DDR_CONFIG2_BL2 (2 << 0) +#define ATH_DDR_CONFIG2_BL4 (4 << 0) +#define ATH_DDR_CONFIG2_BL8 (8 << 0) + +#define ATH_DDR_CONFIG2_BT_IL (1 << 4) +#define ATH_DDR_CONFIG2_CNTL_OE_EN (1 << 5) +#define ATH_DDR_CONFIG2_PHASE_SEL (1 << 6) +#define ATH_DDR_CONFIG2_DRAM_CKE (1 << 7) +#define ATH_DDR_CONFIG2_TWR_SHIFT 8 +#define ATH_DDR_CONFIG2_TRTW_SHIFT 12 +#define ATH_DDR_CONFIG2_TRTP_SHIFT 17 +#define ATH_DDR_CONFIG2_TWTR_SHIFT 21 +#define ATH_DDR_CONFIG2_HALF_WIDTH_L (1 << 31) + +#define ATH_DDR_TAP_DEFAULT 0x18 + +/* + * DDR block, gmac flushing + */ +#define ATH_DDR_GE0_FLUSH ATH_DDR_CTL_BASE+0x9c +#define ATH_DDR_GE1_FLUSH ATH_DDR_CTL_BASE+0xa0 +#define ATH_DDR_USB_FLUSH ATH_DDR_CTL_BASE+0xa4 +#define ATH_DDR_PCIE_FLUSH ATH_DDR_CTL_BASE+0x88 + +#define ATH_EEPROM_GE0_MAC_ADDR 0xbfff1000 +#define ATH_EEPROM_GE1_MAC_ADDR 0xbfff1006 + +/* + * PLL block/CPU + */ + +#define ATH_PLL_CONFIG ATH_PLL_BASE+0x0 +#define ATH_DDR_CLK_CTRL ATH_PLL_BASE+0x8 + + +#define PLL_DIV_SHIFT 0 +#define PLL_DIV_MASK 0x3ff +#define REF_DIV_SHIFT 10 +#define REF_DIV_MASK 0xf +#define AHB_DIV_SHIFT 19 +#define AHB_DIV_MASK 0x1 +#define DDR_DIV_SHIFT 22 +#define DDR_DIV_MASK 0x1 +#define ATH_DDR_PLL_CONFIG ATH_PLL_BASE+0x4 +#define ATH_ETH_XMII_CONFIG ATH_PLL_BASE+0x2c +#define ATH_AUDIO_PLL_CONFIG ATH_PLL_BASE+0x30 + +#define ATH_ETH_INT0_CLK ATH_PLL_BASE+0x14 +#define ATH_ETH_INT1_CLK ATH_PLL_BASE+0x18 + + +/* + * USB block + */ +#define ATH_USB_FLADJ_VAL ATH_USB_CONFIG_BASE +#define ATH_USB_CONFIG ATH_USB_CONFIG_BASE+0x4 +#define ATH_USB_WINDOW 0x10000 +#define ATH_USB_MODE ATH_USB_EHCI_BASE+0x1a8 + +/* + * PCI block + */ +#define ATH_PCI_WINDOW 0x8000000 /* 128MB */ +#define ATH_PCI_WINDOW0_OFFSET ATH_DDR_CTL_BASE+0x7c +#define ATH_PCI_WINDOW1_OFFSET ATH_DDR_CTL_BASE+0x80 +#define ATH_PCI_WINDOW2_OFFSET ATH_DDR_CTL_BASE+0x84 +#define ATH_PCI_WINDOW3_OFFSET ATH_DDR_CTL_BASE+0x88 +#define ATH_PCI_WINDOW4_OFFSET ATH_DDR_CTL_BASE+0x8c +#define ATH_PCI_WINDOW5_OFFSET ATH_DDR_CTL_BASE+0x90 +#define ATH_PCI_WINDOW6_OFFSET ATH_DDR_CTL_BASE+0x94 +#define ATH_PCI_WINDOW7_OFFSET ATH_DDR_CTL_BASE+0x98 + +#define ATH_PCI_WINDOW0_VAL 0x10000000 +#define ATH_PCI_WINDOW1_VAL 0x11000000 +#define ATH_PCI_WINDOW2_VAL 0x12000000 +#define ATH_PCI_WINDOW3_VAL 0x13000000 +#define ATH_PCI_WINDOW4_VAL 0x14000000 +#define ATH_PCI_WINDOW5_VAL 0x15000000 +#define ATH_PCI_WINDOW6_VAL 0x16000000 +#define ATH_PCI_WINDOW7_VAL 0x07000000 + +#define ath_write_pci_window(_no) \ + ath_reg_wr(ATH_PCI_WINDOW##_no##_OFFSET, ATH_PCI_WINDOW##_no##_VAL); + +/* + * CRP. To access the host controller config and status registers + */ +#define ATH_PCI_CRP 0x180c0000 +#define ATH_PCI_DEV_CFGBASE 0x14000000 +#define ATH_PCI_CRP_AD_CBE ATH_PCI_CRP +#define ATH_PCI_CRP_WRDATA ATH_PCI_CRP+0x4 +#define ATH_PCI_CRP_RDDATA ATH_PCI_CRP+0x8 +#define ATH_PCI_ERROR ATH_PCI_CRP+0x1c +#define ATH_PCI_ERROR_ADDRESS ATH_PCI_CRP+0x20 +#define ATH_PCI_AHB_ERROR ATH_PCI_CRP+0x24 +#define ATH_PCI_AHB_ERROR_ADDRESS ATH_PCI_CRP+0x28 + +#define ATH_CRP_CMD_WRITE 0x00010000 +#define ATH_CRP_CMD_READ 0x00000000 + +/* + * PCI CFG. To generate config cycles + */ +#define ATH_PCI_CFG_AD ATH_PCI_CRP+0xc +#define ATH_PCI_CFG_CBE ATH_PCI_CRP+0x10 +#define ATH_PCI_CFG_WRDATA ATH_PCI_CRP+0x14 +#define ATH_PCI_CFG_RDDATA ATH_PCI_CRP+0x18 +#define ATH_CFG_CMD_READ 0x0000000a +#define ATH_CFG_CMD_WRITE 0x0000000b + +#define ATH_PCI_IDSEL_ADLINE_START 17 + +#define ATH_SPI_FS (ATH_SPI_BASE+0x00) +#define ATH_SPI_READ (ATH_SPI_BASE+0x00) +#define ATH_SPI_CLOCK (ATH_SPI_BASE+0x04) +#define ATH_SPI_WRITE (ATH_SPI_BASE+0x08) +#define ATH_SPI_RD_STATUS (ATH_SPI_BASE+0x0c) +#define ATH_SPI_SHIFT_DO (ATH_SPI_BASE+0x10) +#define ATH_SPI_SHIFT_CNT (ATH_SPI_BASE+0x14) +#define ATH_SPI_SHIFT_DI (ATH_SPI_BASE+0x18) +#define ATH_SPI_D0_HIGH (1<<0) /* Pin spi_do */ +#define ATH_SPI_CLK_HIGH (1<<8) /* Pin spi_clk */ + +#define ATH_SPI_CS_ENABLE_0 (6<<16) /* Pin gpio/cs0 (active low) */ +#define ATH_SPI_CS_ENABLE_1 (5<<16) /* Pin gpio/cs1 (active low) */ +#define ATH_SPI_CS_ENABLE_2 (3<<16) /* Pin gpio/cs2 (active low) */ +#define ATH_SPI_CS_DIS 0x70000 +#define ATH_SPI_CE_LOW 0x60000 +#define ATH_SPI_CE_HIGH 0x60100 + +#define ATH_SPI_SECTOR_SIZE (1024*64) +#define ATH_SPI_PAGE_SIZE 256 + +#define ATH_RESET_GE0_MAC RST_RESET_GE0_MAC_RESET_SET(1) +#define ATH_RESET_GE0_PHY (0) // Nothing similar to wasp?? +#define ATH_RESET_GE1_MAC RST_RESET_GE1_MAC_RESET_SET(1) +#define ATH_RESET_GE1_PHY (0) // Nothing similar to wasp?? +#define ATH_RESET_GE0_MDIO RST_RESET_GE0_MDIO_RESET_SET(1) +#define ATH_RESET_GE1_MDIO RST_RESET_GE1_MDIO_RESET_SET(1) + +/* + * SOC + */ +#define ATH_SPI_CMD_WRITE_SR 0x01 +#define ATH_SPI_CMD_WREN 0x06 +#define ATH_SPI_CMD_RD_STATUS 0x05 +#define ATH_SPI_CMD_FAST_READ 0x0b +#define ATH_SPI_CMD_PAGE_PROG 0x02 +#define ATH_SPI_CMD_SECTOR_ERASE 0xd8 +#define ATH_SPI_CMD_CHIP_ERASE 0xc7 +#define ATH_SPI_CMD_RDID 0x9f + +#if defined(CFG_ATH_EMULATION) + +#define CPU_PLL_CONFIG_NINT_VAL CPU_PLL_CONFIG_NINT_SET(2) // 80 MHz +#define DDR_PLL_CONFIG_NINT_VAL DDR_PLL_CONFIG_NINT_SET(1) // 40 MHz + +#elif (CFG_PLL_FREQ == CFG_PLL_720_600_200) + +#define CPU_DDR_SYNC_MODE DDR_CTL_CONFIG_CPU_DDR_SYNC_SET(0) + +#define CPU_PLL_CONFIG_NINT_VAL CPU_PLL_CONFIG_NINT_SET(18) +#define CPU_PLL_CONFIG_REF_DIV_VAL CPU_PLL_CONFIG_REFDIV_SET(1) +#define CPU_PLL_CONFIG_RANGE_VAL CPU_PLL_CONFIG_RANGE_SET(1) +#define CPU_PLL_CONFIG_OUT_DIV_VAL1 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_CONFIG_OUT_DIV_VAL2 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_DITHER_VAL CPU_PLL_DITHER_DITHER_EN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_MAX_SET(0x3f) | \ + CPU_PLL_DITHER_NFRAC_MIN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_STEP_SET(1) | \ + CPU_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define DDR_PLL_CONFIG_NINT_VAL DDR_PLL_CONFIG_NINT_SET(15) +#define DDR_PLL_CONFIG_REF_DIV_VAL DDR_PLL_CONFIG_REFDIV_SET(1) +#define DDR_PLL_CONFIG_RANGE_VAL DDR_PLL_CONFIG_RANGE_SET(1) +#define DDR_PLL_CONFIG_OUT_DIV_VAL1 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_CONFIG_OUT_DIV_VAL2 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_DITHER_VAL DDR_PLL_DITHER_DITHER_EN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_MAX_SET(0x3ff) | \ + DDR_PLL_DITHER_NFRAC_MIN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_STEP_SET(1) | \ + DDR_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define CPU_DDR_CLOCK_CONTROL_AHB_DIV_VAL CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_SET(2) +#define AHB_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_SET(1) +#define CPU_AND_DDR_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_SET(0) +#define CPU_AND_DDR_CLK_FROM_CPU CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_SET(0) +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_SET(0) +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_SET(0) + +#elif (CFG_PLL_FREQ == CFG_PLL_720_600_300) + +#define CPU_DDR_SYNC_MODE DDR_CTL_CONFIG_CPU_DDR_SYNC_SET(0) + +#define CPU_PLL_CONFIG_NINT_VAL CPU_PLL_CONFIG_NINT_SET(18) +#define CPU_PLL_CONFIG_REF_DIV_VAL CPU_PLL_CONFIG_REFDIV_SET(1) +#define CPU_PLL_CONFIG_RANGE_VAL CPU_PLL_CONFIG_RANGE_SET(1) +#define CPU_PLL_CONFIG_OUT_DIV_VAL1 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_CONFIG_OUT_DIV_VAL2 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_DITHER_VAL CPU_PLL_DITHER_DITHER_EN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_MAX_SET(0x3f) | \ + CPU_PLL_DITHER_NFRAC_MIN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_STEP_SET(1) | \ + CPU_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define DDR_PLL_CONFIG_NINT_VAL DDR_PLL_CONFIG_NINT_SET(15) +#define DDR_PLL_CONFIG_REF_DIV_VAL DDR_PLL_CONFIG_REFDIV_SET(1) +#define DDR_PLL_CONFIG_RANGE_VAL DDR_PLL_CONFIG_RANGE_SET(1) +#define DDR_PLL_CONFIG_OUT_DIV_VAL1 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_CONFIG_OUT_DIV_VAL2 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_DITHER_VAL DDR_PLL_DITHER_DITHER_EN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_MAX_SET(0x3ff) | \ + DDR_PLL_DITHER_NFRAC_MIN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_STEP_SET(1) | \ + DDR_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define CPU_DDR_CLOCK_CONTROL_AHB_DIV_VAL CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_SET(1) +#define AHB_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_SET(1) +#define CPU_AND_DDR_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_SET(0) +#define CPU_AND_DDR_CLK_FROM_CPU CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_SET(0) +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_SET(0) +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_SET(0) + +#elif (CFG_PLL_FREQ == CFG_PLL_400_400_200) + +#define CPU_DDR_SYNC_MODE DDR_CTL_CONFIG_CPU_DDR_SYNC_SET(0) + +#define CPU_PLL_CONFIG_NINT_VAL CPU_PLL_CONFIG_NINT_SET(10) +#define CPU_PLL_CONFIG_REF_DIV_VAL CPU_PLL_CONFIG_REFDIV_SET(1) +#define CPU_PLL_CONFIG_RANGE_VAL CPU_PLL_CONFIG_RANGE_SET(1) +#define CPU_PLL_CONFIG_OUT_DIV_VAL1 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_CONFIG_OUT_DIV_VAL2 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_DITHER_VAL CPU_PLL_DITHER_DITHER_EN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_MAX_SET(0x3f) | \ + CPU_PLL_DITHER_NFRAC_MIN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_STEP_SET(1) | \ + CPU_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define DDR_PLL_CONFIG_NINT_VAL DDR_PLL_CONFIG_NINT_SET(10) +#define DDR_PLL_CONFIG_REF_DIV_VAL DDR_PLL_CONFIG_REFDIV_SET(1) +#define DDR_PLL_CONFIG_RANGE_VAL DDR_PLL_CONFIG_RANGE_SET(1) +#define DDR_PLL_CONFIG_OUT_DIV_VAL1 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_CONFIG_OUT_DIV_VAL2 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_DITHER_VAL DDR_PLL_DITHER_DITHER_EN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_MAX_SET(0x3ff) | \ + DDR_PLL_DITHER_NFRAC_MIN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_STEP_SET(1) | \ + DDR_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define CPU_DDR_CLOCK_CONTROL_AHB_DIV_VAL CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_SET(1) +#define AHB_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_SET(1) +#define CPU_AND_DDR_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_SET(0) +#define CPU_AND_DDR_CLK_FROM_CPU CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_SET(0) +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_SET(0) +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_SET(0) + +#elif (CFG_PLL_FREQ == CFG_PLL_720_680_240) + +#define CPU_DDR_SYNC_MODE DDR_CTL_CONFIG_CPU_DDR_SYNC_SET(0) + +#define CPU_PLL_CONFIG_NINT_VAL CPU_PLL_CONFIG_NINT_SET(18) +#define CPU_PLL_CONFIG_REF_DIV_VAL CPU_PLL_CONFIG_REFDIV_SET(1) +#define CPU_PLL_CONFIG_RANGE_VAL CPU_PLL_CONFIG_RANGE_SET(1) +#define CPU_PLL_CONFIG_OUT_DIV_VAL1 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_CONFIG_OUT_DIV_VAL2 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_DITHER_VAL CPU_PLL_DITHER_DITHER_EN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_MAX_SET(0x3f) | \ + CPU_PLL_DITHER_NFRAC_MIN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_STEP_SET(1) | \ + CPU_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define DDR_PLL_CONFIG_NINT_VAL DDR_PLL_CONFIG_NINT_SET(17) +#define DDR_PLL_CONFIG_REF_DIV_VAL DDR_PLL_CONFIG_REFDIV_SET(1) +#define DDR_PLL_CONFIG_RANGE_VAL DDR_PLL_CONFIG_RANGE_SET(1) +#define DDR_PLL_CONFIG_OUT_DIV_VAL1 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_CONFIG_OUT_DIV_VAL2 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_DITHER_VAL DDR_PLL_DITHER_DITHER_EN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_MAX_SET(0x3ff) | \ + DDR_PLL_DITHER_NFRAC_MIN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_STEP_SET(1) | \ + DDR_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define CPU_DDR_CLOCK_CONTROL_AHB_DIV_VAL CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_SET(2) +#define AHB_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_SET(0) +#define CPU_AND_DDR_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_SET(0) +#define CPU_AND_DDR_CLK_FROM_CPU CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_SET(0) +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_SET(0) +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_SET(0) + +#elif (CFG_PLL_FREQ == CFG_PLL_720_600_240) + +#define CPU_DDR_SYNC_MODE DDR_CTL_CONFIG_CPU_DDR_SYNC_SET(0) + +#define CPU_PLL_CONFIG_NINT_VAL CPU_PLL_CONFIG_NINT_SET(18) +#define CPU_PLL_CONFIG_REF_DIV_VAL CPU_PLL_CONFIG_REFDIV_SET(1) +#define CPU_PLL_CONFIG_RANGE_VAL CPU_PLL_CONFIG_RANGE_SET(1) +#define CPU_PLL_CONFIG_OUT_DIV_VAL1 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_CONFIG_OUT_DIV_VAL2 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_DITHER_VAL CPU_PLL_DITHER_DITHER_EN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_MAX_SET(0x3f) | \ + CPU_PLL_DITHER_NFRAC_MIN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_STEP_SET(1) | \ + CPU_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define DDR_PLL_CONFIG_NINT_VAL DDR_PLL_CONFIG_NINT_SET(15) +#define DDR_PLL_CONFIG_REF_DIV_VAL DDR_PLL_CONFIG_REFDIV_SET(1) +#define DDR_PLL_CONFIG_RANGE_VAL DDR_PLL_CONFIG_RANGE_SET(1) +#define DDR_PLL_CONFIG_OUT_DIV_VAL1 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_CONFIG_OUT_DIV_VAL2 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_DITHER_VAL DDR_PLL_DITHER_DITHER_EN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_MAX_SET(0x3ff) | \ + DDR_PLL_DITHER_NFRAC_MIN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_STEP_SET(1) | \ + DDR_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define CPU_DDR_CLOCK_CONTROL_AHB_DIV_VAL CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_SET(2) +#define AHB_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_SET(0) +#define CPU_AND_DDR_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_SET(0) +#define CPU_AND_DDR_CLK_FROM_CPU CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_SET(0) +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_SET(0) +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_SET(0) + +#elif (CFG_PLL_FREQ == CFG_PLL_560_450_220) + +#define CPU_DDR_SYNC_MODE DDR_CTL_CONFIG_CPU_DDR_SYNC_SET(0) + +#define CPU_PLL_CONFIG_NINT_VAL CPU_PLL_CONFIG_NINT_SET(14) +#define CPU_PLL_CONFIG_REF_DIV_VAL CPU_PLL_CONFIG_REFDIV_SET(1) +#define CPU_PLL_CONFIG_RANGE_VAL CPU_PLL_CONFIG_RANGE_SET(1) +#define CPU_PLL_CONFIG_OUT_DIV_VAL1 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_CONFIG_OUT_DIV_VAL2 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_DITHER_VAL CPU_PLL_DITHER_DITHER_EN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_MAX_SET(0x3f) | \ + CPU_PLL_DITHER_NFRAC_MIN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_STEP_SET(1) | \ + CPU_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define DDR_PLL_CONFIG_NINT_VAL DDR_PLL_CONFIG_NINT_SET(11) +#define DDR_PLL_CONFIG_REF_DIV_VAL DDR_PLL_CONFIG_REFDIV_SET(1) +#define DDR_PLL_CONFIG_RANGE_VAL DDR_PLL_CONFIG_RANGE_SET(1) +#define DDR_PLL_CONFIG_OUT_DIV_VAL1 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_CONFIG_OUT_DIV_VAL2 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_DITHER_VAL DDR_PLL_DITHER_DITHER_EN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_MAX_SET(0x3ff) | \ + DDR_PLL_DITHER_NFRAC_MIN_SET(0x100) | \ + DDR_PLL_DITHER_NFRAC_STEP_SET(1) | \ + DDR_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define CPU_DDR_CLOCK_CONTROL_AHB_DIV_VAL CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_SET(1) +#define AHB_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_SET(1) +#define CPU_AND_DDR_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_SET(0) +#define CPU_AND_DDR_CLK_FROM_CPU CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_SET(0) +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_SET(0) +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_SET(0) + +#elif (CFG_PLL_FREQ == CFG_PLL_680_680_226) + +#define CPU_DDR_SYNC_MODE DDR_CTL_CONFIG_CPU_DDR_SYNC_SET(1) + +#define CPU_PLL_CONFIG_NINT_VAL CPU_PLL_CONFIG_NINT_SET(17) +#define CPU_PLL_CONFIG_REF_DIV_VAL CPU_PLL_CONFIG_REFDIV_SET(1) +#define CPU_PLL_CONFIG_RANGE_VAL CPU_PLL_CONFIG_RANGE_SET(1) +#define CPU_PLL_CONFIG_OUT_DIV_VAL1 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_CONFIG_OUT_DIV_VAL2 CPU_PLL_CONFIG_OUTDIV_SET(0) +#define CPU_PLL_DITHER_VAL CPU_PLL_DITHER_DITHER_EN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_MAX_SET(0x3f) | \ + CPU_PLL_DITHER_NFRAC_MIN_SET(0) | \ + CPU_PLL_DITHER_NFRAC_STEP_SET(1) | \ + CPU_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define DDR_PLL_CONFIG_NINT_VAL DDR_PLL_CONFIG_NINT_SET(17) +#define DDR_PLL_CONFIG_REF_DIV_VAL DDR_PLL_CONFIG_REFDIV_SET(1) +#define DDR_PLL_CONFIG_RANGE_VAL DDR_PLL_CONFIG_RANGE_SET(1) +#define DDR_PLL_CONFIG_OUT_DIV_VAL1 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_CONFIG_OUT_DIV_VAL2 DDR_PLL_CONFIG_OUTDIV_SET(0) +#define DDR_PLL_DITHER_VAL DDR_PLL_DITHER_DITHER_EN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_MAX_SET(0x3ff) | \ + DDR_PLL_DITHER_NFRAC_MIN_SET(0) | \ + DDR_PLL_DITHER_NFRAC_STEP_SET(1) | \ + DDR_PLL_DITHER_UPDATE_COUNT_SET(0xf) + +#define CPU_DDR_CLOCK_CONTROL_AHB_DIV_VAL CPU_DDR_CLOCK_CONTROL_AHB_POST_DIV_SET(2) +#define AHB_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_AHBCLK_FROM_DDRPLL_SET(1) +#define CPU_AND_DDR_CLK_FROM_DDR CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_DDRPLL_SET(1) +#define CPU_AND_DDR_CLK_FROM_CPU CPU_DDR_CLOCK_CONTROL_CPU_DDR_CLK_FROM_CPUPLL_SET(0) +#define CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV CPU_DDR_CLOCK_CONTROL_DDR_POST_DIV_SET(0) +#define CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV CPU_DDR_CLOCK_CONTROL_CPU_POST_DIV_SET(0) + +#else +# error "CFG_PLL_FREQ not set" +#endif // CFG_PLL_FREQ + +#if CPU_AND_DDR_CLK_FROM_DDR && CPU_AND_DDR_CLK_FROM_CPU +# error "Incorrect settings. Both 'from CPU' and 'from DDR' set" +#endif + + + +#define __nint_to_mhz(n, ref) ((n) * (ref) * 1000000) +#define __cpu_hz_40(pll) (__nint_to_mhz(CPU_PLL_CONFIG_NINT_GET(pll), 40)) +#define __cpu_hz_25(pll) (__nint_to_mhz(CPU_PLL_CONFIG_NINT_GET(pll), 25)) + +/* Since the count is incremented every other tick, divide by 2 */ +#define CFG_HZ (__cpu_hz_40(CPU_PLL_CONFIG_NINT_VAL) / 2) + +/* SGMII DEFINES */ + +// 32'h18070034 (SGMII_CONFIG) +#define SGMII_CONFIG_BERT_ENABLE_MSB 14 +#define SGMII_CONFIG_BERT_ENABLE_LSB 14 +#define SGMII_CONFIG_BERT_ENABLE_MASK 0x00004000 +#define SGMII_CONFIG_BERT_ENABLE_GET(x) (((x) & SGMII_CONFIG_BERT_ENABLE_MASK) >> SGMII_CONFIG_BERT_ENABLE_LSB) +#define SGMII_CONFIG_BERT_ENABLE_SET(x) (((x) << SGMII_CONFIG_BERT_ENABLE_LSB) & SGMII_CONFIG_BERT_ENABLE_MASK) +#define SGMII_CONFIG_BERT_ENABLE_RESET 0x0 // 0 +#define SGMII_CONFIG_PRBS_ENABLE_MSB 13 +#define SGMII_CONFIG_PRBS_ENABLE_LSB 13 +#define SGMII_CONFIG_PRBS_ENABLE_MASK 0x00002000 +#define SGMII_CONFIG_PRBS_ENABLE_GET(x) (((x) & SGMII_CONFIG_PRBS_ENABLE_MASK) >> SGMII_CONFIG_PRBS_ENABLE_LSB) +#define SGMII_CONFIG_PRBS_ENABLE_SET(x) (((x) << SGMII_CONFIG_PRBS_ENABLE_LSB) & SGMII_CONFIG_PRBS_ENABLE_MASK) +#define SGMII_CONFIG_PRBS_ENABLE_RESET 0x0 // 0 +#define SGMII_CONFIG_MDIO_COMPLETE_MSB 12 +#define SGMII_CONFIG_MDIO_COMPLETE_LSB 12 +#define SGMII_CONFIG_MDIO_COMPLETE_MASK 0x00001000 +#define SGMII_CONFIG_MDIO_COMPLETE_GET(x) (((x) & SGMII_CONFIG_MDIO_COMPLETE_MASK) >> SGMII_CONFIG_MDIO_COMPLETE_LSB) +#define SGMII_CONFIG_MDIO_COMPLETE_SET(x) (((x) << SGMII_CONFIG_MDIO_COMPLETE_LSB) & SGMII_CONFIG_MDIO_COMPLETE_MASK) +#define SGMII_CONFIG_MDIO_COMPLETE_RESET 0x0 // 0 +#define SGMII_CONFIG_MDIO_PULSE_MSB 11 +#define SGMII_CONFIG_MDIO_PULSE_LSB 11 +#define SGMII_CONFIG_MDIO_PULSE_MASK 0x00000800 +#define SGMII_CONFIG_MDIO_PULSE_GET(x) (((x) & SGMII_CONFIG_MDIO_PULSE_MASK) >> SGMII_CONFIG_MDIO_PULSE_LSB) +#define SGMII_CONFIG_MDIO_PULSE_SET(x) (((x) << SGMII_CONFIG_MDIO_PULSE_LSB) & SGMII_CONFIG_MDIO_PULSE_MASK) +#define SGMII_CONFIG_MDIO_PULSE_RESET 0x0 // 0 +#define SGMII_CONFIG_MDIO_ENABLE_MSB 10 +#define SGMII_CONFIG_MDIO_ENABLE_LSB 10 +#define SGMII_CONFIG_MDIO_ENABLE_MASK 0x00000400 +#define SGMII_CONFIG_MDIO_ENABLE_GET(x) (((x) & SGMII_CONFIG_MDIO_ENABLE_MASK) >> SGMII_CONFIG_MDIO_ENABLE_LSB) +#define SGMII_CONFIG_MDIO_ENABLE_SET(x) (((x) << SGMII_CONFIG_MDIO_ENABLE_LSB) & SGMII_CONFIG_MDIO_ENABLE_MASK) +#define SGMII_CONFIG_MDIO_ENABLE_RESET 0x0 // 0 +#define SGMII_CONFIG_NEXT_PAGE_LOADED_MSB 9 +#define SGMII_CONFIG_NEXT_PAGE_LOADED_LSB 9 +#define SGMII_CONFIG_NEXT_PAGE_LOADED_MASK 0x00000200 +#define SGMII_CONFIG_NEXT_PAGE_LOADED_GET(x) (((x) & SGMII_CONFIG_NEXT_PAGE_LOADED_MASK) >> SGMII_CONFIG_NEXT_PAGE_LOADED_LSB) +#define SGMII_CONFIG_NEXT_PAGE_LOADED_SET(x) (((x) << SGMII_CONFIG_NEXT_PAGE_LOADED_LSB) & SGMII_CONFIG_NEXT_PAGE_LOADED_MASK) +#define SGMII_CONFIG_NEXT_PAGE_LOADED_RESET 0x0 // 0 +#define SGMII_CONFIG_REMOTE_PHY_LOOPBACK_MSB 8 +#define SGMII_CONFIG_REMOTE_PHY_LOOPBACK_LSB 8 +#define SGMII_CONFIG_REMOTE_PHY_LOOPBACK_MASK 0x00000100 +#define SGMII_CONFIG_REMOTE_PHY_LOOPBACK_GET(x) (((x) & SGMII_CONFIG_REMOTE_PHY_LOOPBACK_MASK) >> SGMII_CONFIG_REMOTE_PHY_LOOPBACK_LSB) +#define SGMII_CONFIG_REMOTE_PHY_LOOPBACK_SET(x) (((x) << SGMII_CONFIG_REMOTE_PHY_LOOPBACK_LSB) & SGMII_CONFIG_REMOTE_PHY_LOOPBACK_MASK) +#define SGMII_CONFIG_REMOTE_PHY_LOOPBACK_RESET 0x0 // 0 +#define SGMII_CONFIG_SPEED_MSB 7 +#define SGMII_CONFIG_SPEED_LSB 6 +#define SGMII_CONFIG_SPEED_MASK 0x000000c0 +#define SGMII_CONFIG_SPEED_GET(x) (((x) & SGMII_CONFIG_SPEED_MASK) >> SGMII_CONFIG_SPEED_LSB) +#define SGMII_CONFIG_SPEED_SET(x) (((x) << SGMII_CONFIG_SPEED_LSB) & SGMII_CONFIG_SPEED_MASK) +#define SGMII_CONFIG_SPEED_RESET 0x0 // 0 +#define SGMII_CONFIG_FORCE_SPEED_MSB 5 +#define SGMII_CONFIG_FORCE_SPEED_LSB 5 +#define SGMII_CONFIG_FORCE_SPEED_MASK 0x00000020 +#define SGMII_CONFIG_FORCE_SPEED_GET(x) (((x) & SGMII_CONFIG_FORCE_SPEED_MASK) >> SGMII_CONFIG_FORCE_SPEED_LSB) +#define SGMII_CONFIG_FORCE_SPEED_SET(x) (((x) << SGMII_CONFIG_FORCE_SPEED_LSB) & SGMII_CONFIG_FORCE_SPEED_MASK) +#define SGMII_CONFIG_FORCE_SPEED_RESET 0x0 // 0 +#define SGMII_CONFIG_MR_REG4_CHANGED_MSB 4 +#define SGMII_CONFIG_MR_REG4_CHANGED_LSB 4 +#define SGMII_CONFIG_MR_REG4_CHANGED_MASK 0x00000010 +#define SGMII_CONFIG_MR_REG4_CHANGED_GET(x) (((x) & SGMII_CONFIG_MR_REG4_CHANGED_MASK) >> SGMII_CONFIG_MR_REG4_CHANGED_LSB) +#define SGMII_CONFIG_MR_REG4_CHANGED_SET(x) (((x) << SGMII_CONFIG_MR_REG4_CHANGED_LSB) & SGMII_CONFIG_MR_REG4_CHANGED_MASK) +#define SGMII_CONFIG_MR_REG4_CHANGED_RESET 0x0 // 0 +#define SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_MSB 3 +#define SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_LSB 3 +#define SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_MASK 0x00000008 +#define SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_GET(x) (((x) & SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_MASK) >> SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_LSB) +#define SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_SET(x) (((x) << SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_LSB) & SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_MASK) +#define SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE_RESET 0x0 // 0 +#define SGMII_CONFIG_MODE_CTRL_MSB 2 +#define SGMII_CONFIG_MODE_CTRL_LSB 0 +#define SGMII_CONFIG_MODE_CTRL_MASK 0x00000007 +#define SGMII_CONFIG_MODE_CTRL_GET(x) (((x) & SGMII_CONFIG_MODE_CTRL_MASK) >> SGMII_CONFIG_MODE_CTRL_LSB) +#define SGMII_CONFIG_MODE_CTRL_SET(x) (((x) << SGMII_CONFIG_MODE_CTRL_LSB) & SGMII_CONFIG_MODE_CTRL_MASK) +#define SGMII_CONFIG_MODE_CTRL_RESET 0x0 // 0 +#define SGMII_CONFIG_ADDRESS 0x18070034 + + + +// 32'h1807001c (MR_AN_CONTROL) +#define MR_AN_CONTROL_PHY_RESET_MSB 15 +#define MR_AN_CONTROL_PHY_RESET_LSB 15 +#define MR_AN_CONTROL_PHY_RESET_MASK 0x00008000 +#define MR_AN_CONTROL_PHY_RESET_GET(x) (((x) & MR_AN_CONTROL_PHY_RESET_MASK) >> MR_AN_CONTROL_PHY_RESET_LSB) +#define MR_AN_CONTROL_PHY_RESET_SET(x) (((x) << MR_AN_CONTROL_PHY_RESET_LSB) & MR_AN_CONTROL_PHY_RESET_MASK) +#define MR_AN_CONTROL_PHY_RESET_RESET 0x0 // 0 +#define MR_AN_CONTROL_LOOPBACK_MSB 14 +#define MR_AN_CONTROL_LOOPBACK_LSB 14 +#define MR_AN_CONTROL_LOOPBACK_MASK 0x00004000 +#define MR_AN_CONTROL_LOOPBACK_GET(x) (((x) & MR_AN_CONTROL_LOOPBACK_MASK) >> MR_AN_CONTROL_LOOPBACK_LSB) +#define MR_AN_CONTROL_LOOPBACK_SET(x) (((x) << MR_AN_CONTROL_LOOPBACK_LSB) & MR_AN_CONTROL_LOOPBACK_MASK) +#define MR_AN_CONTROL_LOOPBACK_RESET 0x0 // 0 +#define MR_AN_CONTROL_SPEED_SEL0_MSB 13 +#define MR_AN_CONTROL_SPEED_SEL0_LSB 13 +#define MR_AN_CONTROL_SPEED_SEL0_MASK 0x00002000 +#define MR_AN_CONTROL_SPEED_SEL0_GET(x) (((x) & MR_AN_CONTROL_SPEED_SEL0_MASK) >> MR_AN_CONTROL_SPEED_SEL0_LSB) +#define MR_AN_CONTROL_SPEED_SEL0_SET(x) (((x) << MR_AN_CONTROL_SPEED_SEL0_LSB) & MR_AN_CONTROL_SPEED_SEL0_MASK) +#define MR_AN_CONTROL_SPEED_SEL0_RESET 0x0 // 0 +#define MR_AN_CONTROL_AN_ENABLE_MSB 12 +#define MR_AN_CONTROL_AN_ENABLE_LSB 12 +#define MR_AN_CONTROL_AN_ENABLE_MASK 0x00001000 +#define MR_AN_CONTROL_AN_ENABLE_GET(x) (((x) & MR_AN_CONTROL_AN_ENABLE_MASK) >> MR_AN_CONTROL_AN_ENABLE_LSB) +#define MR_AN_CONTROL_AN_ENABLE_SET(x) (((x) << MR_AN_CONTROL_AN_ENABLE_LSB) & MR_AN_CONTROL_AN_ENABLE_MASK) +#define MR_AN_CONTROL_AN_ENABLE_RESET 0x1 // 1 +#define MR_AN_CONTROL_POWER_DOWN_MSB 11 +#define MR_AN_CONTROL_POWER_DOWN_LSB 11 +#define MR_AN_CONTROL_POWER_DOWN_MASK 0x00000800 +#define MR_AN_CONTROL_POWER_DOWN_GET(x) (((x) & MR_AN_CONTROL_POWER_DOWN_MASK) >> MR_AN_CONTROL_POWER_DOWN_LSB) +#define MR_AN_CONTROL_POWER_DOWN_SET(x) (((x) << MR_AN_CONTROL_POWER_DOWN_LSB) & MR_AN_CONTROL_POWER_DOWN_MASK) +#define MR_AN_CONTROL_POWER_DOWN_RESET 0x0 // 0 +#define MR_AN_CONTROL_RESTART_AN_MSB 9 +#define MR_AN_CONTROL_RESTART_AN_LSB 9 +#define MR_AN_CONTROL_RESTART_AN_MASK 0x00000200 +#define MR_AN_CONTROL_RESTART_AN_GET(x) (((x) & MR_AN_CONTROL_RESTART_AN_MASK) >> MR_AN_CONTROL_RESTART_AN_LSB) +#define MR_AN_CONTROL_RESTART_AN_SET(x) (((x) << MR_AN_CONTROL_RESTART_AN_LSB) & MR_AN_CONTROL_RESTART_AN_MASK) +#define MR_AN_CONTROL_RESTART_AN_RESET 0x0 // 0 +#define MR_AN_CONTROL_DUPLEX_MODE_MSB 8 +#define MR_AN_CONTROL_DUPLEX_MODE_LSB 8 +#define MR_AN_CONTROL_DUPLEX_MODE_MASK 0x00000100 +#define MR_AN_CONTROL_DUPLEX_MODE_GET(x) (((x) & MR_AN_CONTROL_DUPLEX_MODE_MASK) >> MR_AN_CONTROL_DUPLEX_MODE_LSB) +#define MR_AN_CONTROL_DUPLEX_MODE_SET(x) (((x) << MR_AN_CONTROL_DUPLEX_MODE_LSB) & MR_AN_CONTROL_DUPLEX_MODE_MASK) +#define MR_AN_CONTROL_DUPLEX_MODE_RESET 0x1 // 1 +#define MR_AN_CONTROL_SPEED_SEL1_MSB 6 +#define MR_AN_CONTROL_SPEED_SEL1_LSB 6 +#define MR_AN_CONTROL_SPEED_SEL1_MASK 0x00000040 +#define MR_AN_CONTROL_SPEED_SEL1_GET(x) (((x) & MR_AN_CONTROL_SPEED_SEL1_MASK) >> MR_AN_CONTROL_SPEED_SEL1_LSB) +#define MR_AN_CONTROL_SPEED_SEL1_SET(x) (((x) << MR_AN_CONTROL_SPEED_SEL1_LSB) & MR_AN_CONTROL_SPEED_SEL1_MASK) +#define MR_AN_CONTROL_SPEED_SEL1_RESET 0x1 // 1 +#define MR_AN_CONTROL_ADDRESS 0x1807001c + + + + + +// 32'h18070014 (SGMII_RESET) +#define SGMII_RESET_HW_RX_125M_N_MSB 4 +#define SGMII_RESET_HW_RX_125M_N_LSB 4 +#define SGMII_RESET_HW_RX_125M_N_MASK 0x00000010 +#define SGMII_RESET_HW_RX_125M_N_GET(x) (((x) & SGMII_RESET_HW_RX_125M_N_MASK) >> SGMII_RESET_HW_RX_125M_N_LSB) +#define SGMII_RESET_HW_RX_125M_N_SET(x) (((x) << SGMII_RESET_HW_RX_125M_N_LSB) & SGMII_RESET_HW_RX_125M_N_MASK) +#define SGMII_RESET_HW_RX_125M_N_RESET 0x0 // 0 +#define SGMII_RESET_TX_125M_N_MSB 3 +#define SGMII_RESET_TX_125M_N_LSB 3 +#define SGMII_RESET_TX_125M_N_MASK 0x00000008 +#define SGMII_RESET_TX_125M_N_GET(x) (((x) & SGMII_RESET_TX_125M_N_MASK) >> SGMII_RESET_TX_125M_N_LSB) +#define SGMII_RESET_TX_125M_N_SET(x) (((x) << SGMII_RESET_TX_125M_N_LSB) & SGMII_RESET_TX_125M_N_MASK) +#define SGMII_RESET_TX_125M_N_RESET 0x0 // 0 +#define SGMII_RESET_RX_125M_N_MSB 2 +#define SGMII_RESET_RX_125M_N_LSB 2 +#define SGMII_RESET_RX_125M_N_MASK 0x00000004 +#define SGMII_RESET_RX_125M_N_GET(x) (((x) & SGMII_RESET_RX_125M_N_MASK) >> SGMII_RESET_RX_125M_N_LSB) +#define SGMII_RESET_RX_125M_N_SET(x) (((x) << SGMII_RESET_RX_125M_N_LSB) & SGMII_RESET_RX_125M_N_MASK) +#define SGMII_RESET_RX_125M_N_RESET 0x0 // 0 +#define SGMII_RESET_TX_CLK_N_MSB 1 +#define SGMII_RESET_TX_CLK_N_LSB 1 +#define SGMII_RESET_TX_CLK_N_MASK 0x00000002 +#define SGMII_RESET_TX_CLK_N_GET(x) (((x) & SGMII_RESET_TX_CLK_N_MASK) >> SGMII_RESET_TX_CLK_N_LSB) +#define SGMII_RESET_TX_CLK_N_SET(x) (((x) << SGMII_RESET_TX_CLK_N_LSB) & SGMII_RESET_TX_CLK_N_MASK) +#define SGMII_RESET_TX_CLK_N_RESET 0x0 // 0 +#define SGMII_RESET_RX_CLK_N_MSB 0 +#define SGMII_RESET_RX_CLK_N_LSB 0 +#define SGMII_RESET_RX_CLK_N_MASK 0x00000001 +#define SGMII_RESET_RX_CLK_N_GET(x) (((x) & SGMII_RESET_RX_CLK_N_MASK) >> SGMII_RESET_RX_CLK_N_LSB) +#define SGMII_RESET_RX_CLK_N_SET(x) (((x) << SGMII_RESET_RX_CLK_N_LSB) & SGMII_RESET_RX_CLK_N_MASK) +#define SGMII_RESET_RX_CLK_N_RESET 0x0 // 0 +#define SGMII_RESET_ADDRESS 0x18070014 + + + +// 32'h18070038 (SGMII_MAC_RX_CONFIG) +#define SGMII_MAC_RX_CONFIG_LINK_MSB 15 +#define SGMII_MAC_RX_CONFIG_LINK_LSB 15 +#define SGMII_MAC_RX_CONFIG_LINK_MASK 0x00008000 +#define SGMII_MAC_RX_CONFIG_LINK_GET(x) (((x) & SGMII_MAC_RX_CONFIG_LINK_MASK) >> SGMII_MAC_RX_CONFIG_LINK_LSB) +#define SGMII_MAC_RX_CONFIG_LINK_SET(x) (((x) << SGMII_MAC_RX_CONFIG_LINK_LSB) & SGMII_MAC_RX_CONFIG_LINK_MASK) +#define SGMII_MAC_RX_CONFIG_LINK_RESET 0x0 // 0 +#define SGMII_MAC_RX_CONFIG_ACK_MSB 14 +#define SGMII_MAC_RX_CONFIG_ACK_LSB 14 +#define SGMII_MAC_RX_CONFIG_ACK_MASK 0x00004000 +#define SGMII_MAC_RX_CONFIG_ACK_GET(x) (((x) & SGMII_MAC_RX_CONFIG_ACK_MASK) >> SGMII_MAC_RX_CONFIG_ACK_LSB) +#define SGMII_MAC_RX_CONFIG_ACK_SET(x) (((x) << SGMII_MAC_RX_CONFIG_ACK_LSB) & SGMII_MAC_RX_CONFIG_ACK_MASK) +#define SGMII_MAC_RX_CONFIG_ACK_RESET 0x0 // 0 +#define SGMII_MAC_RX_CONFIG_DUPLEX_MODE_MSB 12 +#define SGMII_MAC_RX_CONFIG_DUPLEX_MODE_LSB 12 +#define SGMII_MAC_RX_CONFIG_DUPLEX_MODE_MASK 0x00001000 +#define SGMII_MAC_RX_CONFIG_DUPLEX_MODE_GET(x) (((x) & SGMII_MAC_RX_CONFIG_DUPLEX_MODE_MASK) >> SGMII_MAC_RX_CONFIG_DUPLEX_MODE_LSB) +#define SGMII_MAC_RX_CONFIG_DUPLEX_MODE_SET(x) (((x) << SGMII_MAC_RX_CONFIG_DUPLEX_MODE_LSB) & SGMII_MAC_RX_CONFIG_DUPLEX_MODE_MASK) +#define SGMII_MAC_RX_CONFIG_DUPLEX_MODE_RESET 0x0 // 0 +#define SGMII_MAC_RX_CONFIG_SPEED_MODE_MSB 11 +#define SGMII_MAC_RX_CONFIG_SPEED_MODE_LSB 10 +#define SGMII_MAC_RX_CONFIG_SPEED_MODE_MASK 0x00000c00 +#define SGMII_MAC_RX_CONFIG_SPEED_MODE_GET(x) (((x) & SGMII_MAC_RX_CONFIG_SPEED_MODE_MASK) >> SGMII_MAC_RX_CONFIG_SPEED_MODE_LSB) +#define SGMII_MAC_RX_CONFIG_SPEED_MODE_SET(x) (((x) << SGMII_MAC_RX_CONFIG_SPEED_MODE_LSB) & SGMII_MAC_RX_CONFIG_SPEED_MODE_MASK) +#define SGMII_MAC_RX_CONFIG_SPEED_MODE_RESET 0x0 // 0 +#define SGMII_MAC_RX_CONFIG_ASM_PAUSE_MSB 8 +#define SGMII_MAC_RX_CONFIG_ASM_PAUSE_LSB 8 +#define SGMII_MAC_RX_CONFIG_ASM_PAUSE_MASK 0x00000100 +#define SGMII_MAC_RX_CONFIG_ASM_PAUSE_GET(x) (((x) & SGMII_MAC_RX_CONFIG_ASM_PAUSE_MASK) >> SGMII_MAC_RX_CONFIG_ASM_PAUSE_LSB) +#define SGMII_MAC_RX_CONFIG_ASM_PAUSE_SET(x) (((x) << SGMII_MAC_RX_CONFIG_ASM_PAUSE_LSB) & SGMII_MAC_RX_CONFIG_ASM_PAUSE_MASK) +#define SGMII_MAC_RX_CONFIG_ASM_PAUSE_RESET 0x0 // 0 +#define SGMII_MAC_RX_CONFIG_PAUSE_MSB 7 +#define SGMII_MAC_RX_CONFIG_PAUSE_LSB 7 +#define SGMII_MAC_RX_CONFIG_PAUSE_MASK 0x00000080 +#define SGMII_MAC_RX_CONFIG_PAUSE_GET(x) (((x) & SGMII_MAC_RX_CONFIG_PAUSE_MASK) >> SGMII_MAC_RX_CONFIG_PAUSE_LSB) +#define SGMII_MAC_RX_CONFIG_PAUSE_SET(x) (((x) << SGMII_MAC_RX_CONFIG_PAUSE_LSB) & SGMII_MAC_RX_CONFIG_PAUSE_MASK) +#define SGMII_MAC_RX_CONFIG_PAUSE_RESET 0x0 // 0 +#define SGMII_MAC_RX_CONFIG_RES0_MSB 0 +#define SGMII_MAC_RX_CONFIG_RES0_LSB 0 +#define SGMII_MAC_RX_CONFIG_RES0_MASK 0x00000001 +#define SGMII_MAC_RX_CONFIG_RES0_GET(x) (((x) & SGMII_MAC_RX_CONFIG_RES0_MASK) >> SGMII_MAC_RX_CONFIG_RES0_LSB) +#define SGMII_MAC_RX_CONFIG_RES0_SET(x) (((x) << SGMII_MAC_RX_CONFIG_RES0_LSB) & SGMII_MAC_RX_CONFIG_RES0_MASK) +#define SGMII_MAC_RX_CONFIG_RES0_RESET 0x1 // 1 +#define SGMII_MAC_RX_CONFIG_ADDRESS 0x18070038 + +// 32'h18070058 (SGMII_DEBUG) +#define SGMII_DEBUG_ARB_STATE_MSB 27 +#define SGMII_DEBUG_ARB_STATE_LSB 24 +#define SGMII_DEBUG_ARB_STATE_MASK 0x0f000000 +#define SGMII_DEBUG_ARB_STATE_GET(x) (((x) & SGMII_DEBUG_ARB_STATE_MASK) >> SGMII_DEBUG_ARB_STATE_LSB) +#define SGMII_DEBUG_ARB_STATE_SET(x) (((x) << SGMII_DEBUG_ARB_STATE_LSB) & SGMII_DEBUG_ARB_STATE_MASK) +#define SGMII_DEBUG_ARB_STATE_RESET 0x0 // 0 +#define SGMII_DEBUG_RX_SYNC_STATE_MSB 23 +#define SGMII_DEBUG_RX_SYNC_STATE_LSB 16 +#define SGMII_DEBUG_RX_SYNC_STATE_MASK 0x00ff0000 +#define SGMII_DEBUG_RX_SYNC_STATE_GET(x) (((x) & SGMII_DEBUG_RX_SYNC_STATE_MASK) >> SGMII_DEBUG_RX_SYNC_STATE_LSB) +#define SGMII_DEBUG_RX_SYNC_STATE_SET(x) (((x) << SGMII_DEBUG_RX_SYNC_STATE_LSB) & SGMII_DEBUG_RX_SYNC_STATE_MASK) +#define SGMII_DEBUG_RX_SYNC_STATE_RESET 0x0 // 0 +#define SGMII_DEBUG_RX_STATE_MSB 15 +#define SGMII_DEBUG_RX_STATE_LSB 8 +#define SGMII_DEBUG_RX_STATE_MASK 0x0000ff00 +#define SGMII_DEBUG_RX_STATE_GET(x) (((x) & SGMII_DEBUG_RX_STATE_MASK) >> SGMII_DEBUG_RX_STATE_LSB) +#define SGMII_DEBUG_RX_STATE_SET(x) (((x) << SGMII_DEBUG_RX_STATE_LSB) & SGMII_DEBUG_RX_STATE_MASK) +#define SGMII_DEBUG_RX_STATE_RESET 0x0 // 0 +#define SGMII_DEBUG_TX_STATE_MSB 7 +#define SGMII_DEBUG_TX_STATE_LSB 0 +#define SGMII_DEBUG_TX_STATE_MASK 0x000000ff +#define SGMII_DEBUG_TX_STATE_GET(x) (((x) & SGMII_DEBUG_TX_STATE_MASK) >> SGMII_DEBUG_TX_STATE_LSB) +#define SGMII_DEBUG_TX_STATE_SET(x) (((x) << SGMII_DEBUG_TX_STATE_LSB) & SGMII_DEBUG_TX_STATE_MASK) +#define SGMII_DEBUG_TX_STATE_RESET 0x0 // 0 +#define SGMII_DEBUG_ADDRESS 0x18070058 +#define SGMII_DEBUG_OFFSET 0x0058 + + + +// 32'h18070060 (SGMII_INTERRUPT_MASK) +#define SGMII_INTERRUPT_MASK_MASK_MSB 7 +#define SGMII_INTERRUPT_MASK_MASK_LSB 0 +#define SGMII_INTERRUPT_MASK_MASK_MASK 0x000000ff +#define SGMII_INTERRUPT_MASK_MASK_GET(x) (((x) & SGMII_INTERRUPT_MASK_MASK_MASK) >> SGMII_INTERRUPT_MASK_MASK_LSB) +#define SGMII_INTERRUPT_MASK_MASK_SET(x) (((x) << SGMII_INTERRUPT_MASK_MASK_LSB) & SGMII_INTERRUPT_MASK_MASK_MASK) +#define SGMII_INTERRUPT_MASK_MASK_RESET 0x0 // 0 +#define SGMII_INTERRUPT_MASK_ADDRESS 0x18070060 + + + + +// 32'h1807005c (SGMII_INTERRUPT) +#define SGMII_INTERRUPT_INTR_MSB 7 +#define SGMII_INTERRUPT_INTR_LSB 0 +#define SGMII_INTERRUPT_INTR_MASK 0x000000ff +#define SGMII_INTERRUPT_INTR_GET(x) (((x) & SGMII_INTERRUPT_INTR_MASK) >> SGMII_INTERRUPT_INTR_LSB) +#define SGMII_INTERRUPT_INTR_SET(x) (((x) << SGMII_INTERRUPT_INTR_LSB) & SGMII_INTERRUPT_INTR_MASK) +#define SGMII_INTERRUPT_INTR_RESET 0x0 // 0 +#define SGMII_INTERRUPT_ADDRESS 0x1807005c +#define SGMII_INTERRUPT_OFFSET 0x005c +// SW modifiable bits +#define SGMII_INTERRUPT_SW_MASK 0x000000ff +// bits defined at reset +#define SGMII_INTERRUPT_RSTMASK 0xffffffff +// reset value (ignore bits undefined at reset) +#define SGMII_INTERRUPT_RESET 0x00000000 + +// 32'h18070060 (SGMII_INTERRUPT_MASK) +#define SGMII_INTERRUPT_MASK_MASK_MSB 7 +#define SGMII_INTERRUPT_MASK_MASK_LSB 0 +#define SGMII_INTERRUPT_MASK_MASK_MASK 0x000000ff +#define SGMII_INTERRUPT_MASK_MASK_GET(x) (((x) & SGMII_INTERRUPT_MASK_MASK_MASK) >> SGMII_INTERRUPT_MASK_MASK_LSB) +#define SGMII_INTERRUPT_MASK_MASK_SET(x) (((x) << SGMII_INTERRUPT_MASK_MASK_LSB) & SGMII_INTERRUPT_MASK_MASK_MASK) +#define SGMII_INTERRUPT_MASK_MASK_RESET 0x0 // 0 +#define SGMII_INTERRUPT_MASK_ADDRESS 0x18070060 + + +#define SGMII_LINK_FAIL (1 << 0) +#define SGMII_DUPLEX_ERR (1 << 1) +#define SGMII_MR_AN_COMPLETE (1 << 2) +#define SGMII_LINK_MAC_CHANGE (1 << 3) +#define SGMII_DUPLEX_MODE_CHANGE (1 << 4) +#define SGMII_SPEED_MODE_MAC_CHANGE (1 << 5) +#define SGMII_RX_QUIET_CHANGE (1 << 6) +#define SGMII_RX_MDIO_COMP_CHANGE (1 << 7) + +#define SGMII_INTR SGMII_LINK_FAIL | \ + SGMII_LINK_MAC_CHANGE | \ + SGMII_DUPLEX_MODE_CHANGE | \ + SGMII_SPEED_MODE_MAC_CHANGE + + +// 32'h18050048 (ETH_SGMII) +#define ETH_SGMII_TX_INVERT_MSB 31 +#define ETH_SGMII_TX_INVERT_LSB 31 +#define ETH_SGMII_TX_INVERT_MASK 0x80000000 +#define ETH_SGMII_TX_INVERT_GET(x) (((x) & ETH_SGMII_TX_INVERT_MASK) >> ETH_SGMII_TX_INVERT_LSB) +#define ETH_SGMII_TX_INVERT_SET(x) (((x) << ETH_SGMII_TX_INVERT_LSB) & ETH_SGMII_TX_INVERT_MASK) +#define ETH_SGMII_TX_INVERT_RESET 0x0 // 0 +#define ETH_SGMII_GIGE_QUAD_MSB 30 +#define ETH_SGMII_GIGE_QUAD_LSB 30 +#define ETH_SGMII_GIGE_QUAD_MASK 0x40000000 +#define ETH_SGMII_GIGE_QUAD_GET(x) (((x) & ETH_SGMII_GIGE_QUAD_MASK) >> ETH_SGMII_GIGE_QUAD_LSB) +#define ETH_SGMII_GIGE_QUAD_SET(x) (((x) << ETH_SGMII_GIGE_QUAD_LSB) & ETH_SGMII_GIGE_QUAD_MASK) +#define ETH_SGMII_GIGE_QUAD_RESET 0x0 // 0 +#define ETH_SGMII_RX_DELAY_MSB 29 +#define ETH_SGMII_RX_DELAY_LSB 28 +#define ETH_SGMII_RX_DELAY_MASK 0x30000000 +#define ETH_SGMII_RX_DELAY_GET(x) (((x) & ETH_SGMII_RX_DELAY_MASK) >> ETH_SGMII_RX_DELAY_LSB) +#define ETH_SGMII_RX_DELAY_SET(x) (((x) << ETH_SGMII_RX_DELAY_LSB) & ETH_SGMII_RX_DELAY_MASK) +#define ETH_SGMII_RX_DELAY_RESET 0x0 // 0 +#define ETH_SGMII_TX_DELAY_MSB 27 +#define ETH_SGMII_TX_DELAY_LSB 26 +#define ETH_SGMII_TX_DELAY_MASK 0x0c000000 +#define ETH_SGMII_TX_DELAY_GET(x) (((x) & ETH_SGMII_TX_DELAY_MASK) >> ETH_SGMII_TX_DELAY_LSB) +#define ETH_SGMII_TX_DELAY_SET(x) (((x) << ETH_SGMII_TX_DELAY_LSB) & ETH_SGMII_TX_DELAY_MASK) +#define ETH_SGMII_TX_DELAY_RESET 0x0 // 0 +#define ETH_SGMII_CLK_SEL_MSB 25 +#define ETH_SGMII_CLK_SEL_LSB 25 +#define ETH_SGMII_CLK_SEL_MASK 0x02000000 +#define ETH_SGMII_CLK_SEL_GET(x) (((x) & ETH_SGMII_CLK_SEL_MASK) >> ETH_SGMII_CLK_SEL_LSB) +#define ETH_SGMII_CLK_SEL_SET(x) (((x) << ETH_SGMII_CLK_SEL_LSB) & ETH_SGMII_CLK_SEL_MASK) +#define ETH_SGMII_CLK_SEL_RESET 0x1 // 1 +#define ETH_SGMII_GIGE_MSB 24 +#define ETH_SGMII_GIGE_LSB 24 +#define ETH_SGMII_GIGE_MASK 0x01000000 +#define ETH_SGMII_GIGE_GET(x) (((x) & ETH_SGMII_GIGE_MASK) >> ETH_SGMII_GIGE_LSB) +#define ETH_SGMII_GIGE_SET(x) (((x) << ETH_SGMII_GIGE_LSB) & ETH_SGMII_GIGE_MASK) +#define ETH_SGMII_GIGE_RESET 0x1 // 1 +#define ETH_SGMII_PHASE1_COUNT_MSB 15 +#define ETH_SGMII_PHASE1_COUNT_LSB 8 +#define ETH_SGMII_PHASE1_COUNT_MASK 0x0000ff00 +#define ETH_SGMII_PHASE1_COUNT_GET(x) (((x) & ETH_SGMII_PHASE1_COUNT_MASK) >> ETH_SGMII_PHASE1_COUNT_LSB) +#define ETH_SGMII_PHASE1_COUNT_SET(x) (((x) << ETH_SGMII_PHASE1_COUNT_LSB) & ETH_SGMII_PHASE1_COUNT_MASK) +#define ETH_SGMII_PHASE1_COUNT_RESET 0x1 // 1 +#define ETH_SGMII_PHASE0_COUNT_MSB 7 +#define ETH_SGMII_PHASE0_COUNT_LSB 0 +#define ETH_SGMII_PHASE0_COUNT_MASK 0x000000ff +#define ETH_SGMII_PHASE0_COUNT_GET(x) (((x) & ETH_SGMII_PHASE0_COUNT_MASK) >> ETH_SGMII_PHASE0_COUNT_LSB) +#define ETH_SGMII_PHASE0_COUNT_SET(x) (((x) << ETH_SGMII_PHASE0_COUNT_LSB) & ETH_SGMII_PHASE0_COUNT_MASK) +#define ETH_SGMII_PHASE0_COUNT_RESET 0x1 // 1 +#define ETH_SGMII_ADDRESS 0x18050048 + + +#define OTP_INTF2_ADDRESS 0x18131008 +#define OTP_LDO_CONTROL_ADDRESS 0x18131024 + +#define OTP_LDO_STATUS_POWER_ON_MSB 0 +#define OTP_LDO_STATUS_POWER_ON_LSB 0 +#define OTP_LDO_STATUS_POWER_ON_MASK 0x00000001 +#define OTP_LDO_STATUS_POWER_ON_GET(x) (((x) & OTP_LDO_STATUS_POWER_ON_MASK) >> OTP_LDO_STATUS_POWER_ON_LSB) +#define OTP_LDO_STATUS_POWER_ON_SET(x) (((x) << OTP_LDO_STATUS_POWER_ON_LSB) & OTP_LDO_STATUS_POWER_ON_MASK) +#define OTP_LDO_STATUS_POWER_ON_RESET 0x0 // 0 +#define OTP_LDO_STATUS_ADDRESS 0x1813102c + +#define OTP_MEM_0_ADDRESS 0x18130000 + +#define OTP_STATUS0_EFUSE_READ_DATA_VALID_MSB 2 +#define OTP_STATUS0_EFUSE_READ_DATA_VALID_LSB 2 +#define OTP_STATUS0_EFUSE_READ_DATA_VALID_MASK 0x00000004 +#define OTP_STATUS0_EFUSE_READ_DATA_VALID_GET(x) (((x) & OTP_STATUS0_EFUSE_READ_DATA_VALID_MASK) >> OTP_STATUS0_EFUSE_READ_DATA_VALID_LSB) +#define OTP_STATUS0_EFUSE_READ_DATA_VALID_SET(x) (((x) << OTP_STATUS0_EFUSE_READ_DATA_VALID_LSB) & OTP_STATUS0_EFUSE_READ_DATA_VALID_MASK) +#define OTP_STATUS0_EFUSE_READ_DATA_VALID_RESET 0x0 // 0 +#define OTP_STATUS0_EFUSE_ACCESS_BUSY_MSB 1 +#define OTP_STATUS0_EFUSE_ACCESS_BUSY_LSB 1 +#define OTP_STATUS0_EFUSE_ACCESS_BUSY_MASK 0x00000002 +#define OTP_STATUS0_EFUSE_ACCESS_BUSY_GET(x) (((x) & OTP_STATUS0_EFUSE_ACCESS_BUSY_MASK) >> OTP_STATUS0_EFUSE_ACCESS_BUSY_LSB) +#define OTP_STATUS0_EFUSE_ACCESS_BUSY_SET(x) (((x) << OTP_STATUS0_EFUSE_ACCESS_BUSY_LSB) & OTP_STATUS0_EFUSE_ACCESS_BUSY_MASK) +#define OTP_STATUS0_EFUSE_ACCESS_BUSY_RESET 0x0 // 0 +#define OTP_STATUS0_OTP_SM_BUSY_MSB 0 +#define OTP_STATUS0_OTP_SM_BUSY_LSB 0 +#define OTP_STATUS0_OTP_SM_BUSY_MASK 0x00000001 +#define OTP_STATUS0_OTP_SM_BUSY_GET(x) (((x) & OTP_STATUS0_OTP_SM_BUSY_MASK) >> OTP_STATUS0_OTP_SM_BUSY_LSB) +#define OTP_STATUS0_OTP_SM_BUSY_SET(x) (((x) << OTP_STATUS0_OTP_SM_BUSY_LSB) & OTP_STATUS0_OTP_SM_BUSY_MASK) +#define OTP_STATUS0_OTP_SM_BUSY_RESET 0x0 // 0 +#define OTP_STATUS0_ADDRESS 0x18131018 + +#define OTP_STATUS1_ADDRESS 0x1813101c + + + + + +#endif /* _QCA955X_H */ diff --git a/include/configs/qca955x.h b/include/configs/qca955x.h new file mode 100644 index 0000000000..9e106239f3 --- /dev/null +++ b/include/configs/qca955x.h @@ -0,0 +1,185 @@ +#define CONFIG_MIPS32 1 /* MIPS32 CPU core */ +#define CONFIG_BOOTDELAY 2 /* autoboot after 4 seconds */ +#define CONFIG_TIMESTAMP /* Print image info with timestamp */ + +/* + * Console I/O configuration + */ +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {115200} + +/* Console I/O Buffer Size */ +#define CONFIG_SYS_CBSIZE 512 +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) + +#define CONFIG_SYS_HUSH_PARSER +#define CONFIG_SYS_PROMPT_HUSH_PS2 "hush>" + +/* + * FLASH and environment organization + */ +#ifndef FLASH_SIZE +#define FLASH_SIZE 16 +#endif + +#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ +#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */ + +#if (FLASH_SIZE == 16) +#define CFG_MAX_FLASH_SECT 256 /* max number of sectors on one chip */ +#define ATH_MTDPARTS_MIB0 "8256k(mib0)" +#elif (FLASH_SIZE == 8) +#define CFG_MAX_FLASH_SECT 128 /* max number of sectors on one chip */ +#define ATH_MTDPARTS_MIB0 "64k(mib0)" +#else +#define CFG_MAX_FLASH_SECT 64 /* max number of sectors on one chip */ +#define ATH_MTDPARTS_MIB0 "64k(mib0)" +#endif + +#define CFG_FLASH_SECTOR_SIZE (64*1024) +#if (FLASH_SIZE == 16) +#define CFG_FLASH_SIZE 0x01000000 /* Total flash size */ +#elif (FLASH_SIZE == 8) +#define CFG_FLASH_SIZE 0x00800000 /* max number of sectors on one chip */ +#else +#define CFG_FLASH_SIZE 0x00400000 /* Total flash size */ +#endif + +#ifndef COMPRESSED_UBOOT +#define ENABLE_DYNAMIC_CONF 1 +#endif + +#if (CFG_MAX_FLASH_SECT * CFG_FLASH_SECTOR_SIZE) != CFG_FLASH_SIZE +# error "Invalid flash configuration" +#endif + +#define CFG_FLASH_WORD_SIZE unsigned short + +#if defined(CONFIG_ATH_NAND_BR) && defined(COMPRESSED_UBOOT) +#define CFG_FLASH_BASE 0xa0100000 +#else +/* NOR Flash start address */ +#define CFG_FLASH_BASE 0x9f000000 +#define CONFIG_SYS_TEXT_BASE 0x9f000000 +#endif + +#ifdef COMPRESSED_UBOOT +#define BOOTSTRAP_TEXT_BASE CFG_FLASH_BASE +#define BOOTSTRAP_CFG_MONITOR_BASE BOOTSTRAP_TEXT_BASE +#endif + +#define CONFIG_PCI_CONFIG_DATA_IN_OTP + +/* + * Defines to change flash size on reboot + */ +#ifdef ENABLE_DYNAMIC_CONF +#define UBOOT_FLASH_SIZE (256 * 1024) +#define UBOOT_ENV_SEC_START (CFG_FLASH_BASE + UBOOT_FLASH_SIZE) + +#define CFG_FLASH_MAGIC 0xaabacada +#define CFG_FLASH_MAGIC_F (UBOOT_ENV_SEC_START + CFG_FLASH_SECTOR_SIZE - 0x20) +#define CFG_FLASH_SECTOR_SIZE_F *(volatile int *)(CFG_FLASH_MAGIC_F + 0x4) +#define CFG_FLASH_SIZE_F *(volatile int *)(CFG_FLASH_MAGIC_F + 0x8) /* Total flash size */ +#else +#define CFG_FLASH_SIZE_F CFG_FLASH_SIZE +#define CFG_FLASH_SECTOR_SIZE_F CFG_FLASH_SECTOR_SIZE +#endif + +/* +** Parameters defining the location of the calibration/initialization +** information for the two Merlin devices. +** NOTE: **This will change with different flash configurations** +*/ + +#define WLANCAL 0x9fff1000 +#define BOARDCAL 0x9fff0000 +#define ATHEROS_PRODUCT_ID 137 +#define CAL_SECTOR (CFG_MAX_FLASH_SECT - 1) + +/* For Merlin, both PCI, PCI-E interfaces are valid */ +#define ATH_ART_PCICFG_OFFSET 12 + +/* + * The following for ENV settings + */ + +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_FLASH_BASE 0x9f000000 +#define CONFIG_SYS_MAX_FLASH_SECT 256 + +#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_ENV_SIZE CFG_FLASH_SECTOR_SIZE //CFG_ENV_SIZE +#define CONFIG_ENV_ADDR 0x9f040000 + +/* Timer Specific */ +#define CONFIG_SYS_MHZ 720 +/* Since the count is incremented every other tick, divide by 2 -- CFG_HZ*/ +#define CONFIG_SYS_MIPS_TIMER_FREQ ((CONFIG_SYS_MHZ * 1000000)/2) + +#define CFG_DDR_REFRESH_VAL 0x4138 + +/* + * The following #defines are needed to get flash environment right + */ +#define CONFIG_SYS_MONITOR_BASE 0x9f000000 +#define CONFIG_SYS_MONITOR_LEN (192 << 10) +#define CONFIG_SYS_MALLOC_LEN (128*1024) +#define CONFIG_SYS_BOOTPARAMS_LEN (64*1024) +/* + * Cache Configuration + */ +#define CONFIG_SYS_CACHELINE_SIZE 32 +#define CONFIG_SYS_ICACHE_SIZE 65536 +#define CONFIG_SYS_DCACHE_SIZE 32768 + +#define CONFIG_PCI 1 +#define CONFIG_CMD_PCI +#define CONFIG_PCI_SCAN_SHOW + +/*#define CONFIG_USB 1*/ + +#define CONFIG_ATH_SOC 1 +#define CONFIG_ATHEROS 1 +#define CONFIG_MACH_QCA955x 1 +/*#define CFG_INIT_STACK_IN_SRAM 1 -- OBSOLETE.*/ +#define CONFIG_AP135 1 +#define __CONFIG_BOARD_NAME ap135 +#define CONFIG_BOARD_NAME "ap135" +#define CFG_PLL_FREQ CFG_PLL_720_600_200 +#define ATH_SGMII_FORCED 1 +#define CONFIG_ATHRS17_PHY 1 +#define CFG_ATH_GMAC_NMACS 2 +#define CFG_ATH_GE1_IS_CONNECTED 1 +#define CONFIG_ATHRS_GMAC_SGMII 1 +#define CONFIG_ATH_S17_WAN 1 +#define ATH_S17_MAC0_SGMII 1 +#define ATH_SGMII_FORCED_MODE 1 +#define ATH_RGMII_CAL 1 +#define CONFIG_LAST_STAGE_INIT + +#define CONFIG_SYS_SDRAM_BASE 0x80000000 +#define CONFIG_SYS_LOAD_ADDR 0x81000000 + +/* + * Cache lock for stack + */ +#define CONFIG_SYS_INIT_SP_OFFSET 0x1000 +#define CFG_INIT_SRAM_SP_OFFSET 0xbd007000 + +/* + * Image type + */ +#define CONFIG_LZMA 1 +#define CONFIG_IMAGE_FORMAT_LEGACY + +/* + * ethernet environment + */ +#define CONFIG_SYS_RX_ETH_BUFFER 8 +#define CONFIG_TFTP_BLOCKSIZE 512 +#define CONFIG_MII 1 +#define CFG_CMD_MII 1 +#define CONFIG_COMMANDS 1 +