15e0c8877SDylan Hung /* SPDX-License-Identifier: GPL-2.0+ */ 25e0c8877SDylan Hung /* 35e0c8877SDylan Hung * Copyright (c) 2016 Google, Inc 45e0c8877SDylan Hung */ 55e0c8877SDylan Hung #ifndef _ASM_ARCH_SCU_AST2500_H 65e0c8877SDylan Hung #define _ASM_ARCH_SCU_AST2500_H 75e0c8877SDylan Hung 85e0c8877SDylan Hung #define SCU_UNLOCK_VALUE 0x1688a8a8 95e0c8877SDylan Hung 105e0c8877SDylan Hung #define SCU_HWSTRAP_VGAMEM_SHIFT 2 115e0c8877SDylan Hung #define SCU_HWSTRAP_VGAMEM_MASK (3 << SCU_HWSTRAP_VGAMEM_SHIFT) 125e0c8877SDylan Hung #define SCU_HWSTRAP_MAC1_RGMII (1 << 6) 135e0c8877SDylan Hung #define SCU_HWSTRAP_MAC2_RGMII (1 << 7) 14*43e9f5a6SZev Weiss #define SCU_HWSTRAP_LPC_SIO_DEC_DIS (1 << 20) 155e0c8877SDylan Hung #define SCU_HWSTRAP_DDR4 (1 << 24) 165e0c8877SDylan Hung #define SCU_HWSTRAP_CLKIN_25MHZ (1 << 23) 175e0c8877SDylan Hung 185e0c8877SDylan Hung #define SCU_MPLL_DENUM_SHIFT 0 195e0c8877SDylan Hung #define SCU_MPLL_DENUM_MASK 0x1f 205e0c8877SDylan Hung #define SCU_MPLL_NUM_SHIFT 5 215e0c8877SDylan Hung #define SCU_MPLL_NUM_MASK (0xff << SCU_MPLL_NUM_SHIFT) 225e0c8877SDylan Hung #define SCU_MPLL_POST_SHIFT 13 235e0c8877SDylan Hung #define SCU_MPLL_POST_MASK (0x3f << SCU_MPLL_POST_SHIFT) 245e0c8877SDylan Hung #define SCU_PCLK_DIV_SHIFT 23 255e0c8877SDylan Hung #define SCU_PCLK_DIV_MASK (7 << SCU_PCLK_DIV_SHIFT) 265e0c8877SDylan Hung #define SCU_HPLL_DENUM_SHIFT 0 275e0c8877SDylan Hung #define SCU_HPLL_DENUM_MASK 0x1f 285e0c8877SDylan Hung #define SCU_HPLL_NUM_SHIFT 5 295e0c8877SDylan Hung #define SCU_HPLL_NUM_MASK (0xff << SCU_HPLL_NUM_SHIFT) 305e0c8877SDylan Hung #define SCU_HPLL_POST_SHIFT 13 315e0c8877SDylan Hung #define SCU_HPLL_POST_MASK (0x3f << SCU_HPLL_POST_SHIFT) 325e0c8877SDylan Hung 335e0c8877SDylan Hung #define SCU_MACCLK_SHIFT 16 345e0c8877SDylan Hung #define SCU_MACCLK_MASK (7 << SCU_MACCLK_SHIFT) 355e0c8877SDylan Hung 365e0c8877SDylan Hung #define SCU_MISC2_RGMII_HPLL (1 << 23) 375e0c8877SDylan Hung #define SCU_MISC2_RGMII_CLKDIV_SHIFT 20 385e0c8877SDylan Hung #define SCU_MISC2_RGMII_CLKDIV_MASK (3 << SCU_MISC2_RGMII_CLKDIV_SHIFT) 395e0c8877SDylan Hung #define SCU_MISC2_RMII_MPLL (1 << 19) 405e0c8877SDylan Hung #define SCU_MISC2_RMII_CLKDIV_SHIFT 16 415e0c8877SDylan Hung #define SCU_MISC2_RMII_CLKDIV_MASK (3 << SCU_MISC2_RMII_CLKDIV_SHIFT) 425e0c8877SDylan Hung #define SCU_MISC2_UARTCLK_SHIFT 24 435e0c8877SDylan Hung 445e0c8877SDylan Hung #define SCU_MISC_D2PLL_OFF (1 << 4) 455e0c8877SDylan Hung #define SCU_MISC_UARTCLK_DIV13 (1 << 12) 465e0c8877SDylan Hung #define SCU_MISC_GCRT_USB20CLK (1 << 21) 475e0c8877SDylan Hung 485e0c8877SDylan Hung #define SCU_MICDS_MAC1RGMII_TXDLY_SHIFT 0 495e0c8877SDylan Hung #define SCU_MICDS_MAC1RGMII_TXDLY_MASK (0x3f\ 505e0c8877SDylan Hung << SCU_MICDS_MAC1RGMII_TXDLY_SHIFT) 515e0c8877SDylan Hung #define SCU_MICDS_MAC2RGMII_TXDLY_SHIFT 6 525e0c8877SDylan Hung #define SCU_MICDS_MAC2RGMII_TXDLY_MASK (0x3f\ 535e0c8877SDylan Hung << SCU_MICDS_MAC2RGMII_TXDLY_SHIFT) 545e0c8877SDylan Hung #define SCU_MICDS_MAC1RMII_RDLY_SHIFT 12 555e0c8877SDylan Hung #define SCU_MICDS_MAC1RMII_RDLY_MASK (0x3f << SCU_MICDS_MAC1RMII_RDLY_SHIFT) 565e0c8877SDylan Hung #define SCU_MICDS_MAC2RMII_RDLY_SHIFT 18 575e0c8877SDylan Hung #define SCU_MICDS_MAC2RMII_RDLY_MASK (0x3f << SCU_MICDS_MAC2RMII_RDLY_SHIFT) 585e0c8877SDylan Hung #define SCU_MICDS_MAC1RMII_TXFALL (1 << 24) 595e0c8877SDylan Hung #define SCU_MICDS_MAC2RMII_TXFALL (1 << 25) 605e0c8877SDylan Hung #define SCU_MICDS_RMII1_RCLKEN (1 << 29) 615e0c8877SDylan Hung #define SCU_MICDS_RMII2_RCLKEN (1 << 30) 625e0c8877SDylan Hung #define SCU_MICDS_RGMIIPLL (1 << 31) 635e0c8877SDylan Hung 6439283ea7Sryan_chen 655e0c8877SDylan Hung 665e0c8877SDylan Hung /* Bits 16-27 in the register control pin functions for I2C devices 3-14 */ 675e0c8877SDylan Hung #define SCU_PINMUX_CTRL5_I2C (1 << 16) 685e0c8877SDylan Hung 695e0c8877SDylan Hung /* 705e0c8877SDylan Hung * The values are grouped by function, not by register. 715e0c8877SDylan Hung * They are actually scattered across multiple loosely related registers. 725e0c8877SDylan Hung */ 735e0c8877SDylan Hung #define SCU_PIN_FUN_MAC1_MDC (1 << 30) 745e0c8877SDylan Hung #define SCU_PIN_FUN_MAC1_MDIO (1 << 31) 755e0c8877SDylan Hung #define SCU_PIN_FUN_MAC1_PHY_LINK (1 << 0) 765e0c8877SDylan Hung #define SCU_PIN_FUN_MAC2_MDIO (1 << 2) 775e0c8877SDylan Hung #define SCU_PIN_FUN_MAC2_PHY_LINK (1 << 1) 785e0c8877SDylan Hung #define SCU_PIN_FUN_SCL1 (1 << 12) 795e0c8877SDylan Hung #define SCU_PIN_FUN_SCL2 (1 << 14) 805e0c8877SDylan Hung #define SCU_PIN_FUN_SDA1 (1 << 13) 815e0c8877SDylan Hung #define SCU_PIN_FUN_SDA2 (1 << 15) 825e0c8877SDylan Hung 835e0c8877SDylan Hung #define SCU_D2PLL_EXT1_OFF (1 << 0) 845e0c8877SDylan Hung #define SCU_D2PLL_EXT1_BYPASS (1 << 1) 855e0c8877SDylan Hung #define SCU_D2PLL_EXT1_RESET (1 << 2) 865e0c8877SDylan Hung #define SCU_D2PLL_EXT1_MODE_SHIFT 3 875e0c8877SDylan Hung #define SCU_D2PLL_EXT1_MODE_MASK (3 << SCU_D2PLL_EXT1_MODE_SHIFT) 885e0c8877SDylan Hung #define SCU_D2PLL_EXT1_PARAM_SHIFT 5 895e0c8877SDylan Hung #define SCU_D2PLL_EXT1_PARAM_MASK (0x1ff << SCU_D2PLL_EXT1_PARAM_SHIFT) 905e0c8877SDylan Hung 915e0c8877SDylan Hung #define SCU_D2PLL_NUM_SHIFT 0 925e0c8877SDylan Hung #define SCU_D2PLL_NUM_MASK (0xff << SCU_D2PLL_NUM_SHIFT) 935e0c8877SDylan Hung #define SCU_D2PLL_DENUM_SHIFT 8 945e0c8877SDylan Hung #define SCU_D2PLL_DENUM_MASK (0x1f << SCU_D2PLL_DENUM_SHIFT) 955e0c8877SDylan Hung #define SCU_D2PLL_POST_SHIFT 13 965e0c8877SDylan Hung #define SCU_D2PLL_POST_MASK (0x3f << SCU_D2PLL_POST_SHIFT) 975e0c8877SDylan Hung #define SCU_D2PLL_ODIV_SHIFT 19 985e0c8877SDylan Hung #define SCU_D2PLL_ODIV_MASK (7 << SCU_D2PLL_ODIV_SHIFT) 995e0c8877SDylan Hung #define SCU_D2PLL_SIC_SHIFT 22 1005e0c8877SDylan Hung #define SCU_D2PLL_SIC_MASK (0x1f << SCU_D2PLL_SIC_SHIFT) 1015e0c8877SDylan Hung #define SCU_D2PLL_SIP_SHIFT 27 1025e0c8877SDylan Hung #define SCU_D2PLL_SIP_MASK (0x1f << SCU_D2PLL_SIP_SHIFT) 1035e0c8877SDylan Hung 1045e0c8877SDylan Hung #define SCU_CLKDUTY_DCLK_SHIFT 0 1055e0c8877SDylan Hung #define SCU_CLKDUTY_DCLK_MASK (0x3f << SCU_CLKDUTY_DCLK_SHIFT) 1065e0c8877SDylan Hung #define SCU_CLKDUTY_RGMII1TXCK_SHIFT 8 1075e0c8877SDylan Hung #define SCU_CLKDUTY_RGMII1TXCK_MASK (0x7f << SCU_CLKDUTY_RGMII1TXCK_SHIFT) 1085e0c8877SDylan Hung #define SCU_CLKDUTY_RGMII2TXCK_SHIFT 16 1095e0c8877SDylan Hung #define SCU_CLKDUTY_RGMII2TXCK_MASK (0x7f << SCU_CLKDUTY_RGMII2TXCK_SHIFT) 1105e0c8877SDylan Hung 111*43e9f5a6SZev Weiss #define SCU_PCIE_CONFIG_SET_VGA_MMIO (1 << 1) 112*43e9f5a6SZev Weiss #define SCU_PCIE_CONFIG_SET_BMC_EN (1 << 8) 113*43e9f5a6SZev Weiss #define SCU_PCIE_CONFIG_SET_BMC_MMIO (1 << 9) 114*43e9f5a6SZev Weiss #define SCU_PCIE_CONFIG_SET_BMC_DMA (1 << 14) 115*43e9f5a6SZev Weiss 116*43e9f5a6SZev Weiss #define SCU_MISC_DEBUG_UART_DISABLE (1 << 10) 117*43e9f5a6SZev Weiss 1185e0c8877SDylan Hung struct ast2500_clk_priv { 1195e0c8877SDylan Hung struct ast2500_scu *scu; 1205e0c8877SDylan Hung }; 1215e0c8877SDylan Hung 1225e0c8877SDylan Hung struct ast2500_scu { 1235e0c8877SDylan Hung u32 protection_key; 1245e0c8877SDylan Hung u32 sysreset_ctrl1; 1255e0c8877SDylan Hung u32 clk_sel1; 1265e0c8877SDylan Hung u32 clk_stop_ctrl1; 1275e0c8877SDylan Hung u32 freq_counter_ctrl; 1285e0c8877SDylan Hung u32 freq_counter_cmp; 1295e0c8877SDylan Hung u32 intr_ctrl; 1305e0c8877SDylan Hung u32 d2_pll_param; 1315e0c8877SDylan Hung u32 m_pll_param; 1325e0c8877SDylan Hung u32 h_pll_param; 1335e0c8877SDylan Hung u32 d_pll_param; 1345e0c8877SDylan Hung u32 misc_ctrl1; 1355e0c8877SDylan Hung u32 pci_config[3]; 1365e0c8877SDylan Hung u32 sysreset_status; 1375e0c8877SDylan Hung u32 vga_handshake[2]; 1385e0c8877SDylan Hung u32 mac_clk_delay; 1395e0c8877SDylan Hung u32 misc_ctrl2; 1405e0c8877SDylan Hung u32 vga_scratch[8]; 1415e0c8877SDylan Hung u32 hwstrap; 1425e0c8877SDylan Hung u32 rng_ctrl; 1435e0c8877SDylan Hung u32 rng_data; 1445e0c8877SDylan Hung u32 rev_id; 1455e0c8877SDylan Hung u32 pinmux_ctrl[6]; 1465e0c8877SDylan Hung u32 reserved0; 1475e0c8877SDylan Hung u32 extrst_sel; 1485e0c8877SDylan Hung u32 pinmux_ctrl1[4]; 1495e0c8877SDylan Hung u32 reserved1[2]; 1505e0c8877SDylan Hung u32 mac_clk_delay_100M; 1515e0c8877SDylan Hung u32 mac_clk_delay_10M; 1525e0c8877SDylan Hung u32 wakeup_enable; 1535e0c8877SDylan Hung u32 wakeup_control; 1545e0c8877SDylan Hung u32 reserved2[3]; 1555e0c8877SDylan Hung u32 sysreset_ctrl2; 1565e0c8877SDylan Hung u32 clk_sel2; 1575e0c8877SDylan Hung u32 clk_stop_ctrl2; 1585e0c8877SDylan Hung u32 freerun_counter; 1595e0c8877SDylan Hung u32 freerun_counter_ext; 1605e0c8877SDylan Hung u32 clk_duty_meas_ctrl; 1615e0c8877SDylan Hung u32 clk_duty_meas_res; 1625e0c8877SDylan Hung u32 reserved3[4]; 1635e0c8877SDylan Hung /* The next registers are not key-protected */ 1645e0c8877SDylan Hung struct ast2500_cpu2 { 1655e0c8877SDylan Hung u32 ctrl; 1665e0c8877SDylan Hung u32 base_addr[9]; 1675e0c8877SDylan Hung u32 cache_ctrl; 1685e0c8877SDylan Hung } cpu2; 1695e0c8877SDylan Hung u32 reserved4; 1705e0c8877SDylan Hung u32 d_pll_ext_param[3]; 1715e0c8877SDylan Hung u32 d2_pll_ext_param[3]; 1725e0c8877SDylan Hung u32 mh_pll_ext_param; 1735e0c8877SDylan Hung u32 reserved5; 1745e0c8877SDylan Hung u32 chip_id[2]; 1755e0c8877SDylan Hung u32 reserved6[2]; 1765e0c8877SDylan Hung u32 uart_clk_ctrl; 1775e0c8877SDylan Hung u32 reserved7[7]; 1785e0c8877SDylan Hung u32 pcie_config; 1795e0c8877SDylan Hung u32 mmio_decode; 1805e0c8877SDylan Hung u32 reloc_ctrl_decode[2]; 1815e0c8877SDylan Hung u32 mailbox_addr; 1825e0c8877SDylan Hung u32 shared_sram_decode[2]; 1835e0c8877SDylan Hung u32 bmc_rev_id; 1845e0c8877SDylan Hung u32 reserved8; 1855e0c8877SDylan Hung u32 bmc_device_id; 1865e0c8877SDylan Hung u32 reserved9[13]; 1875e0c8877SDylan Hung u32 clk_duty_sel; 1885e0c8877SDylan Hung }; 1895e0c8877SDylan Hung 1905e0c8877SDylan Hung #endif /* _ASM_ARCH_SCU_AST2500_H */ 191