summaryrefslogtreecommitdiff
path: root/arch/arm/plat-aspeed
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-aspeed')
-rw-r--r--arch/arm/plat-aspeed/Makefile35
-rw-r--r--arch/arm/plat-aspeed/ast-scu.c1202
-rw-r--r--arch/arm/plat-aspeed/ast-sdmc.c100
-rw-r--r--arch/arm/plat-aspeed/ast1070-scu.c178
-rw-r--r--arch/arm/plat-aspeed/ast1070-uart-dma.c572
-rw-r--r--arch/arm/plat-aspeed/ast1070_irq.c220
-rw-r--r--arch/arm/plat-aspeed/dev-adc.c76
-rw-r--r--arch/arm/plat-aspeed/dev-ci2c.c521
-rw-r--r--arch/arm/plat-aspeed/dev-clpc.c240
-rw-r--r--arch/arm/plat-aspeed/dev-cuart.c197
-rw-r--r--arch/arm/plat-aspeed/dev-ehci.c73
-rw-r--r--arch/arm/plat-aspeed/dev-eth.c201
-rw-r--r--arch/arm/plat-aspeed/dev-fb.c80
-rw-r--r--arch/arm/plat-aspeed/dev-gpio.c68
-rw-r--r--arch/arm/plat-aspeed/dev-i2c.c669
-rw-r--r--arch/arm/plat-aspeed/dev-kcs.c129
-rw-r--r--arch/arm/plat-aspeed/dev-lpc.c105
-rw-r--r--arch/arm/plat-aspeed/dev-mbx.c79
-rw-r--r--arch/arm/plat-aspeed/dev-nand.c331
-rw-r--r--arch/arm/plat-aspeed/dev-nor.c219
-rw-r--r--arch/arm/plat-aspeed/dev-peci.c68
-rw-r--r--arch/arm/plat-aspeed/dev-pwm-fan.c80
-rw-r--r--arch/arm/plat-aspeed/dev-rtc.c65
-rw-r--r--arch/arm/plat-aspeed/dev-sdhci.c110
-rw-r--r--arch/arm/plat-aspeed/dev-sgpio.c68
-rw-r--r--arch/arm/plat-aspeed/dev-snoop.c94
-rw-r--r--arch/arm/plat-aspeed/dev-spi.c448
-rw-r--r--arch/arm/plat-aspeed/dev-uart.c144
-rw-r--r--arch/arm/plat-aspeed/dev-uhci.c82
-rw-r--r--arch/arm/plat-aspeed/dev-video.c102
-rw-r--r--arch/arm/plat-aspeed/dev-vuart.c100
-rw-r--r--arch/arm/plat-aspeed/dev-wdt.c76
-rw-r--r--arch/arm/plat-aspeed/devs.c69
-rw-r--r--arch/arm/plat-aspeed/i2c-slave-eeprom.c141
-rw-r--r--arch/arm/plat-aspeed/include/plat/aspeed.h44
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast-lpc.h34
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast-pcie.h28
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast-scu.h92
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast-sdmc.h26
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast-snoop.h37
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast1070-devs.h25
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast1070-scu.h34
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast1070-uart-dma.h27
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast_i2c.h64
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast_mctp.h31
-rw-r--r--arch/arm/plat-aspeed/include/plat/ast_sdhci.h290
-rw-r--r--arch/arm/plat-aspeed/include/plat/devs.h65
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-1070_lpc.h32
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-adc.h191
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-ast1070-intc.h42
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-ast1070-lpc.h117
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-ast1070-scu.h95
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-crt.h183
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-fmc.h112
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-gpio.h338
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-iic.h286
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-intr.h74
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-jtag.h65
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-lpc.h215
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-mbx.h48
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-mctp.h47
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-pcie.h68
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-peci.h106
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-pwm_fan.h250
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-rtc.h64
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-scu-g5.h702
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-scu.h740
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-sdmc.h31
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-smc.h54
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-spi.h51
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-uart-dma.h79
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-udc11.h98
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-video.h348
-rw-r--r--arch/arm/plat-aspeed/include/plat/regs-vuart.h39
-rw-r--r--arch/arm/plat-aspeed/irq.c136
-rw-r--r--arch/arm/plat-aspeed/timer.c137
76 files changed, 12487 insertions, 0 deletions
diff --git a/arch/arm/plat-aspeed/Makefile b/arch/arm/plat-aspeed/Makefile
new file mode 100644
index 000000000000..faba830357bd
--- /dev/null
+++ b/arch/arm/plat-aspeed/Makefile
@@ -0,0 +1,35 @@
+#
+# Makefile for the linux kernel.
+#
+
+obj-y += irq.o timer.o devs.o ast-scu.o ast-sdmc.o
+
+obj-$(CONFIG_ARCH_AST1070) += ast1070_irq.o ast1070-scu.o ast1070-uart-dma.o dev-ci2c.o dev-cuart.o dev-clpc.o
+
+obj-$(CONFIG_AST_I2C_SLAVE_MODE) += i2c-slave-eeprom.o
+
+obj-$(CONFIG_AST2400_BMC) += ast2400-irq.o ast2400-scu.o dev-ast2400-uart.o #dev-ast2400-i2c.o
+
+#obj-n := dummy.o
+#platform
+obj-y += dev-uart.o dev-vuart.o dev-wdt.o dev-rtc.o dev-gpio.o dev-sgpio.o
+
+#Storage
+obj-y += dev-nor.o dev-nand.o dev-sdhci.o
+
+#bus
+obj-y += dev-i2c.o dev-spi.o dev-ehci.o dev-uhci.o dev-lpc.o dev-peci.o dev-kcs.o dev-mbx.o dev-snoop.o
+
+#dev
+#obj-y += dev-udc11.o
+#net
+obj-y += dev-eth.o
+
+#hwmon
+obj-y += dev-pwm-fan.o dev-adc.o
+
+#video
+obj-y += dev-fb.o dev-video.o
+#obj-m :=
+#obj-n :=
+#obj- :=
diff --git a/arch/arm/plat-aspeed/ast-scu.c b/arch/arm/plat-aspeed/ast-scu.c
new file mode 100644
index 000000000000..1f1dde27608f
--- /dev/null
+++ b/arch/arm/plat-aspeed/ast-scu.c
@@ -0,0 +1,1202 @@
+/********************************************************************************
+* File Name : arch/arm/plat-aspeed/ast-scu.c
+* Author : Ryan Chen
+* Description : AST SCU
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+* 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.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+CLK24M
+ |
+ |--> H-PLL -->HCLK
+ |
+ |--> M-PLL -xx->MCLK
+ |
+ |--> V-PLL1 -xx->DCLK
+ |
+ |--> V-PLL2 -xx->D2CLK
+ |
+ |--> USB2PHY -->UTMICLK
+
+
+* History :
+* 1. 2012/08/15 Ryan Chen Create
+*
+********************************************************************************/
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+
+#include <mach/platform.h>
+#include <asm/io.h>
+
+#include <mach/hardware.h>
+
+#include <plat/ast-scu.h>
+#include <plat/regs-scu.h>
+
+//#define ASPEED_SCU_LOCK
+//#define ASPEED_SCU_DEBUG
+
+#ifdef ASPEED_SCU_DEBUG
+#define SCUDBUG(fmt, args...) printk("%s() " fmt, __FUNCTION__, ## args)
+#else
+#define SCUDBUG(fmt, args...)
+#endif
+
+#define SCUMSG(fmt, args...) printk(fmt, ## args)
+
+static u32 ast_scu_base = IO_ADDRESS(AST_SCU_BASE);
+
+static inline u32
+ast_scu_read(u32 reg)
+{
+ u32 val;
+
+ val = readl(ast_scu_base + reg);
+
+ SCUDBUG("ast_scu_read : reg = 0x%08x, val = 0x%08x\n", reg, val);
+
+ return val;
+}
+
+static inline void
+ast_scu_write(u32 val, u32 reg)
+{
+ SCUDBUG("ast_scu_write : reg = 0x%08x, val = 0x%08x\n", reg, val);
+#ifdef CONFIG_AST_SCU_LOCK
+ //unlock
+ writel(SCU_PROTECT_UNLOCK, ast_scu_base);
+ writel(val, ast_scu_base + reg);
+ //lock
+ writel(0xaa,ast_scu_base);
+#else
+ writel(val, ast_scu_base + reg);
+#endif
+}
+
+//SoC mapping Table
+struct soc_id {
+ const char * name;
+ u32 rev_id;
+};
+
+static struct soc_id soc_map_table[] = {
+ [0] = {
+ .name = "AST1100/AST2050-A0",
+ .rev_id = 0x00000200,
+ },
+ [1] = {
+ .name = "AST1100/AST2050-A1",
+ .rev_id = 0x00000201,
+ },
+ [2] = {
+ .name = "AST1100/AST2050-A2,3/AST2150-A0,1",
+ .rev_id = 0x00000202,
+ },
+ [3] = {
+ .name = "AST1510/AST2100-A0",
+ .rev_id = 0x00000300,
+ },
+ [4] = {
+ .name = "AST1510/AST2100-A1",
+ .rev_id = 0x00000301,
+ },
+ [5] = {
+ .name = "AST1510/AST2100-A2,3",
+ .rev_id = 0x00000302,
+ },
+ [6] = {
+ .name = "AST2200-A0,1",
+ .rev_id = 0x00000102,
+ },
+ [7] = {
+ .name = "AST2300-A0",
+ .rev_id = 0x01000003,
+ },
+ [8] = {
+ .name = "AST2300-A1",
+ .rev_id = 0x01010303,
+ },
+ [9] = {
+ .name = "AST1300-A1",
+ .rev_id = 0x01010003,
+ },
+ [10] = {
+ .name = "AST1050-A1",
+ .rev_id = 0x01010203,
+ },
+ [11] = {
+ .name = "AST2400-A0",
+ .rev_id = 0x02000303,
+ },
+ [12] = {
+ .name = "AST2400-A1",
+ .rev_id = 0x02010303,
+ },
+ [13] = {
+ .name = "AST1010-A0",
+ .rev_id = 0x03000003,
+ },
+ [14] = {
+ .name = "AST1010-A1",
+ .rev_id = 0x03010003,
+ },
+ [15] = {
+ .name = "AST1520-A0",
+ .rev_id = 0x03000003,
+ },
+ [16] = {
+ .name = "AST3200-A0",
+ .rev_id = 0x03000003,
+ },
+};
+
+//***********************************Initial control***********************************
+extern void
+ast_scu_reset_video(void)
+{
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_VIDEO, AST_SCU_RESET);
+ udelay(100);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_VIDEO, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_reset_video);
+
+extern void
+ast_scu_init_video(u8 dynamic_en)
+{
+ //Video Engine Clock Enable and Reset
+ // Enable Clock & ECLK = inverse of (M-PLL / 2)
+ if(dynamic_en)
+ ast_scu_write((ast_scu_read(AST_SCU_CLK_SEL) & ~SCU_CLK_VIDEO_SLOW_MASK) | SCU_CLK_VIDEO_SLOW_EN | SCU_CLK_VIDEO_SLOW_SET(0), AST_SCU_CLK_SEL);
+ else
+ ast_scu_write((ast_scu_read(AST_SCU_CLK_SEL) & ~SCU_ECLK_SOURCE_MASK) | SCU_ECLK_SOURCE(2), AST_SCU_CLK_SEL);
+
+ // Enable CLK
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_STOP) & ~(SCU_ECLK_STOP_EN | SCU_VCLK_STOP_EN), AST_SCU_CLK_STOP);
+ mdelay(10);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_VIDEO, AST_SCU_RESET);
+ udelay(100);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_VIDEO, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_init_video);
+
+extern void
+ast_scu_init_eth(u8 num)
+{
+ //AST2300 max clk to 125Mhz, AST2400 max clk to 198Mhz
+ if(ast_scu_read(AST_SCU_HW_STRAP1) && (SCU_HW_STRAP_MAC1_RGMII | SCU_HW_STRAP_MAC0_RGMII)) //RGMII --> H-PLL/6
+ ast_scu_write((ast_scu_read(AST_SCU_CLK_SEL) & ~SCU_CLK_MAC_MASK) | SCU_CLK_MAC_DIV(2), AST_SCU_CLK_SEL);
+ else //RMII --> H-PLL/10
+ ast_scu_write((ast_scu_read(AST_SCU_CLK_SEL) & ~SCU_CLK_MAC_MASK) | SCU_CLK_MAC_DIV(4), AST_SCU_CLK_SEL);
+
+ //Set MAC delay Timing
+ ast_scu_write(0x2255, AST_SCU_MAC_CLK);
+
+ switch(num) {
+ case 0:
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_MAC0,
+ AST_SCU_RESET);
+ udelay(100);
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_STOP) & ~SCU_MAC0CLK_STOP_EN,
+ AST_SCU_CLK_STOP);
+ udelay(1000);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_MAC0,
+ AST_SCU_RESET);
+
+ break;
+ case 1:
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_MAC1,
+ AST_SCU_RESET);
+ udelay(100);
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_STOP) & ~SCU_MAC1CLK_STOP_EN,
+ AST_SCU_CLK_STOP);
+ udelay(1000);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_MAC1,
+ AST_SCU_RESET);
+ break;
+
+ }
+}
+
+
+extern void
+ast_scu_init_usb20(void)
+{
+ /* EHCI controller engine init. Process similar to VHub. */
+ /* Following reset sequence can resolve "vhub dead on first power on" issue on V4 board. */
+ //reset USB20
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_USB20, AST_SCU_RESET);
+
+ //enable USB20 clock
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_STOP) | SCU_USB20_CLK_EN, AST_SCU_CLK_STOP);
+ mdelay(10);
+
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_USB20, AST_SCU_RESET);
+
+ udelay(500);
+
+// printk("%x \n",ast_scu_read(AST_SCU_RESET));
+
+
+}
+
+EXPORT_SYMBOL(ast_scu_init_usb20);
+
+extern void
+ast_scu_init_uhci(void)
+{
+ //USB1.1 Host's Clock Enable and Reset
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_STOP) & ~SCU_USB11CLK_STOP_EN, AST_SCU_CLK_STOP);
+ mdelay(10);
+
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_USB11, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_init_uhci);
+
+extern void
+ast_scu_init_udc11(void)
+{
+ //USB1.1 device Clock Enable and Reset
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_STOP) & ~SCU_UCLK_STOP_EN, AST_SCU_CLK_STOP);
+ mdelay(10);
+
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_USB11_HID, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_init_udc11);
+
+///
+extern void
+ast_scu_init_sdhci(void)
+{
+ //SDHCI Host's Clock Enable and Reset
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_SD, AST_SCU_RESET);
+
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_STOP) & ~SCU_SDCLK_STOP_EN, AST_SCU_CLK_STOP);
+ mdelay(10);
+
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_SEL) | SCU_CLK_SD_EN, AST_SCU_CLK_SEL);
+ mdelay(10);
+
+ // SDCLK = H-PLL / 4
+ ast_scu_write((ast_scu_read(AST_SCU_CLK_SEL) & ~SCU_CLK_SD_MASK) | SCU_CLK_SD_DIV(1),
+ AST_SCU_CLK_SEL);
+ mdelay(10);
+
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_SD, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_init_sdhci);
+
+extern void
+ast_scu_init_i2c(void)
+{
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_I2C, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_init_i2c);
+
+extern void
+ast_scu_init_pwm_tacho(void)
+{
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_PWM, AST_SCU_RESET);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_PWM, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_init_pwm_tacho);
+
+extern void
+ast_scu_init_adc(void)
+{
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_ADC, AST_SCU_RESET);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_ADC, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_init_adc);
+
+extern void
+ast_scu_init_peci(void)
+{
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_PECI, AST_SCU_RESET);
+ udelay(3);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_PECI, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_init_peci);
+
+extern void
+ast_scu_init_jtag(void)
+{
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_JTAG, AST_SCU_RESET);
+ udelay(3);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_JTAG, AST_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast_scu_init_jtag);
+
+extern void
+ast_scu_init_lpc(void)
+{
+ //Note .. It have been enable in U-boot.....
+// ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_LPC, AST_SCU_RESET);
+
+ //enable LPC clock LHCLK = H-PLL/8
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_STOP) |
+ SCU_SET_LHCLK_DIV(3) |
+ SCU_LHCLK_SOURCE_EN,
+ AST_SCU_CLK_STOP);
+
+}
+
+EXPORT_SYMBOL(ast_scu_init_lpc);
+
+//////1 : lpc plus modes
+extern u8
+ast_scu_get_lpc_plus_enable(void)
+{
+ if(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) & SCU_FUN_PIN_LPC_PLUS)
+ return 1;
+ else
+ return 0;
+}
+
+EXPORT_SYMBOL(ast_scu_get_lpc_plus_enable);
+
+extern void
+ast_scu_init_crt(void)
+{
+ //enable D2 pll , //enable DVO (bit18) is VGA , enable DAC (bit16) is CRT
+#if defined(CONFIG_AST_DAC) || defined(CONFIG_AST_DVO)
+ ast_scu_write((ast_scu_read(AST_SCU_MISC1_CTRL) & ~(SCU_MISC_D2_PLL_DIS | SCU_MISC_DAC_MASK))
+ | SCU_MISC_DAC_SOURCE_CRT | SCU_MISC_DVO_SOURCE_CRT | SCU_MISC_2D_CRT_EN , AST_SCU_MISC1_CTRL);
+#elif defined(CONFIG_AST_DVO)
+ ast_scu_write((ast_scu_read(AST_SCU_MISC1_CTRL) & ~(SCU_MISC_D2_PLL_DIS)) |
+ SCU_MISC_DVO_SOURCE_CRT| SCU_MISC_2D_CRT_EN, AST_SCU_MISC1_CTRL);
+#else //default(CONFIG_AST_DAC)
+ ast_scu_write((ast_scu_read(AST_SCU_MISC1_CTRL) & ~(SCU_MISC_D2_PLL_DIS | SCU_MISC_DAC_MASK))
+ | SCU_MISC_DAC_SOURCE_CRT | SCU_MISC_2D_CRT_EN, AST_SCU_MISC1_CTRL);
+#endif
+ /* Set Delay 5 Compensation TODO ...*/
+ ast_scu_write((ast_scu_read(AST_SCU_CLK_SEL) & ~SCU_CLK_VIDEO_DELAY_MASK) |
+ SCU_CLK_VIDEO_DELAY(5), AST_SCU_CLK_SEL);
+
+ /* Reset CRT */
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) | SCU_RESET_CRT, AST_SCU_RESET);
+
+ //enable D2 CLK
+ ast_scu_write(ast_scu_read(AST_SCU_CLK_STOP) & ~SCU_D2CLK_STOP_EN , AST_SCU_CLK_STOP);
+
+ udelay(10);
+ ast_scu_write(ast_scu_read(AST_SCU_RESET) & ~SCU_RESET_CRT, AST_SCU_RESET);
+
+}
+
+EXPORT_SYMBOL(ast_scu_init_crt);
+//***********************************CLK control***********************************
+extern void
+ast_scu_clk_stop(u32 clk_name,u8 stop_enable)
+{
+ switch(clk_name){
+ default:
+ SCUMSG("ERRO clk_name :%d \n",clk_name);
+ break;
+ }
+}
+
+EXPORT_SYMBOL(ast_scu_clk_stop);
+
+
+//***********************************CLK Information***********************************
+extern u32
+ast_get_clk_source(void)
+{
+ if(ast_scu_read(AST_SCU_HW_STRAP1) & CLK_25M_IN)
+ return AST_PLL_25MHZ;
+ else
+ return AST_PLL_24MHZ;
+}
+
+EXPORT_SYMBOL(ast_get_clk_source);
+
+
+extern u32
+ast_get_h_pll_clk(void)
+{
+ u32 speed,clk=0;
+ u32 h_pll_set = ast_scu_read(AST_SCU_H_PLL);
+
+ if(h_pll_set & SCU_H_PLL_OFF)
+ return 0;
+
+ if(h_pll_set & SCU_H_PLL_PARAMETER) {
+ // Programming
+ clk = ast_get_clk_source();
+ if(h_pll_set & SCU_H_PLL_BYPASS_EN) {
+ return clk;
+ } else {
+ //OD == SCU24[4]
+ //OD = SCU_H_PLL_GET_DIV(h_pll_set);
+ //Numerator == SCU24[10:5]
+ //num = SCU_H_PLL_GET_NUM(h_pll_set);
+ //Denumerator == SCU24[3:0]
+ //denum = SCU_H_PLL_GET_DENUM(h_pll_set);
+
+ //hpll = 24MHz * (2-OD) * ((Numerator+2)/(Denumerator+1))
+ clk = ((clk * (2-SCU_H_PLL_GET_DIV(h_pll_set)) * (SCU_H_PLL_GET_NUM(h_pll_set)+2))/(SCU_H_PLL_GET_DENUM(h_pll_set)+1));
+ }
+ } else {
+ // HW Trap
+ speed = SCU_HW_STRAP_GET_H_PLL_CLK(ast_scu_read(AST_SCU_HW_STRAP1));
+ switch (speed) {
+ case 0:
+ clk = 384000000;
+ break;
+ case 1:
+ clk = 360000000;
+ break;
+ case 2:
+ clk = 336000000;
+ break;
+ case 3:
+ clk = 408000000;
+ break;
+ default:
+ BUG();
+ break;
+ }
+ }
+ SCUDBUG("h_pll = %d\n",clk);
+ return clk;
+}
+
+EXPORT_SYMBOL(ast_get_h_pll_clk);
+
+extern u32
+ast_get_m_pll_clk(void)
+{
+ u32 clk=0;
+ u32 m_pll_set = ast_scu_read(AST_SCU_M_PLL);
+
+ if(m_pll_set & SCU_M_PLL_OFF)
+ return 0;
+
+ // Programming
+ clk = ast_get_clk_source();
+ if(m_pll_set & SCU_M_PLL_BYPASS_EN) {
+ return clk;
+ } else {
+ //OD == SCU24[4]
+ //OD = SCU_M_PLL_GET_DIV(h_pll_set);
+ //Numerator == SCU24[10:5]
+ //num = SCU_M_PLL_GET_NUM(h_pll_set);
+ //Denumerator == SCU24[3:0]
+ //denum = SCU_M_PLL_GET_DENUM(h_pll_set);
+
+ //hpll = 24MHz * (2-OD) * ((Numerator+2)/(Denumerator+1))
+ clk = (clk * (2-SCU_M_PLL_GET_DIV(m_pll_set)) * ((SCU_M_PLL_GET_NUM(m_pll_set)+2)/(SCU_M_PLL_GET_DENUM(m_pll_set)+1)));
+ }
+ SCUDBUG("m_pll = %d\n",clk);
+ return clk;
+}
+
+EXPORT_SYMBOL(ast_get_m_pll_clk);
+
+extern u32
+ast_get_ahbclk(void)
+{
+ unsigned int div, hpll;
+
+ hpll = ast_get_h_pll_clk();
+ div = SCU_HW_STRAP_GET_CPU_AHB_RATIO(ast_scu_read(AST_SCU_HW_STRAP1));
+ switch(div) {
+ case 0:
+ div = 1;
+ break;
+ case 1:
+ div = 2;
+ break;
+ case 2:
+ div = 3;
+ break;
+ case 3:
+ div = 4;
+ break;
+
+ }
+
+ SCUDBUG("HPLL=%d, Div=%d, AHB CLK=%d\n", hpll, div, hpll/div);
+ return (hpll/div);
+
+}
+EXPORT_SYMBOL(ast_get_ahbclk);
+
+extern u32
+ast_get_pclk(void)
+{
+ unsigned int div, hpll;
+
+ hpll = ast_get_h_pll_clk();
+ div = SCU_GET_PCLK_DIV(ast_scu_read(AST_SCU_CLK_SEL));
+ div = (div+1) << 1;
+
+ SCUDBUG("HPLL=%d, Div=%d, PCLK=%d\n", hpll, div, hpll/div);
+ return (hpll/div);
+
+}
+EXPORT_SYMBOL(ast_get_pclk);
+
+extern u32
+ast_get_lhclk(void)
+{
+ unsigned int div, hpll;
+ u32 clk_sel = ast_scu_read(AST_SCU_CLK_SEL);
+//FPGA AST1070 is default 100/2 Mhz input
+// return 50000000;
+ hpll = ast_get_h_pll_clk();
+ if(SCU_LHCLK_SOURCE_EN & clk_sel) {
+ div = SCU_GET_LHCLK_DIV(clk_sel);
+ switch(div) {
+ case 0:
+ div = 2;
+ break;
+ case 1:
+ div = 4;
+ break;
+ case 2:
+ div = 6;
+ break;
+ case 3:
+ div = 8;
+ break;
+ case 4:
+ div = 10;
+ break;
+ case 5:
+ div = 12;
+ break;
+ case 6:
+ div = 14;
+ break;
+ case 7:
+ div = 16;
+ break;
+ }
+
+ SCUDBUG("HPLL=%d, Div=%d, LHCLK = %d\n", hpll, div, hpll/div);
+ return (hpll/div);
+ } else {
+ SCUMSG("LPC CLK not enable \n");
+ return 0;
+ }
+
+}
+
+EXPORT_SYMBOL(ast_get_lhclk);
+
+extern u32
+ast_get_d2_pll_clk(void)
+{
+ u32 clk=0;
+ u32 d2_pll_set = ast_scu_read(AST_SCU_D2_PLL);
+ u32 OD,NUM,DENUM,PD,PD2;
+
+ if(d2_pll_set & SCU_D2_PLL_OFF)
+ return 0;
+
+ // Programming
+ clk = ast_get_clk_source();
+ if(d2_pll_set & SCU_D2_PLL_BYPASS_EN) {
+ return clk;
+ } else {
+ NUM = SCU_D2_PLL_GET_NUM(d2_pll_set);
+ DENUM = SCU_D2_PLL_GET_DENUM(d2_pll_set);
+ OD = SCU_D2_PLL_GET_OD(d2_pll_set);
+ OD = (1 << (OD - 1));
+ PD = SCU_D2_PLL_GET_PD(d2_pll_set);
+ switch(PD) {
+ case 0:
+ PD = 1;
+ break;
+ case 1:
+ PD = 2;
+ break;
+ case 2:
+ PD = 2;
+ break;
+ case 3:
+ PD = 4;
+ break;
+ }
+ PD2 = SCU_D2_PLL_GET_PD2(d2_pll_set);
+ PD2 = PD2+1;
+// printk("clk %d ,num %d ,denum %d ,od %d ,pd %d ,pd2 %d \n",clk, NUM , DENUM, OD, PD, PD2);
+ //hpll = 24MHz * (Numerator * 2) / (Denumerator * OD * PD * PD2)
+ clk = (clk * NUM * 2) / (DENUM* OD * PD * PD2);
+ }
+
+ SCUDBUG("d2_pll = %d\n",clk);
+ return clk;
+}
+
+EXPORT_SYMBOL(ast_get_d2_pll_clk);
+
+//Because value 0 is not allowed in SDIO12C D[15:8]: Host Control Settings #1 Register, we have to increase the maximum
+//host's clock in case that system will not ask host to set 1 in the sdhci_set_clock() function
+/*
+SCU7C: Silicon Revision ID Register
+D[31:24]: Chip ID
+0: AST2050/AST2100/AST2150/AST2200/AST3000
+1: AST2300
+
+D[23:16] Silicon revision ID for AST2300 generation and later
+0: A0
+1: A1
+2: A2
+.
+.
+.
+FPGA revision starts from 0x80
+
+
+D[11:8] Bounding option
+
+D[7:0] Silicon revision ID for AST2050/AST2100 generation (for software compatible)
+0: A0
+1: A1
+2: A2
+3: A3
+.
+.
+FPGA revision starts from 0x08, 8~10 means A0, 11+ means A1, AST2300 should be assigned to 3
+*/
+
+extern u32
+ast_get_sd_clock_src(void)
+{
+ u32 clk=0, sd_div;
+
+#if defined(FPGA)
+ clk = 100000000;
+#else
+ clk = ast_get_h_pll_clk();
+ //get div
+ sd_div = SCU_CLK_SD_GET_DIV(ast_scu_read(AST_SCU_CLK_SEL));
+ SCUDBUG("div %d, sdclk =%d \n",((sd_div + 1) * 2),clk/((sd_div + 1) * 2));
+ clk /= ((sd_div + 1) * 2);
+
+#endif
+ return clk;
+}
+
+EXPORT_SYMBOL(ast_get_sd_clock_src);
+
+extern void
+ast_scu_show_system_info (void)
+{
+ u32 h_pll, div;
+
+ h_pll = ast_get_h_pll_clk();
+
+ div = SCU_HW_STRAP_GET_CPU_AHB_RATIO(ast_scu_read(AST_SCU_HW_STRAP1));
+ switch(div) {
+ case 0:
+ div = 1;
+ break;
+ case 1:
+ div = 2;
+ break;
+ case 2:
+ div = 3;
+ break;
+ case 3:
+ div = 4;
+ break;
+
+ }
+
+ SCUMSG("CPU = %d MHz ,AHB = %d MHz (%d:1) \n", h_pll/1000000, h_pll/div/1000000,div);
+
+ return ;
+}
+
+EXPORT_SYMBOL(ast_scu_show_system_info);
+
+//*********************************** Multi-function pin control ***********************************
+extern void
+ast_scu_multi_func_uart(u8 uart)
+{
+ switch(uart) {
+ case 1:
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) |
+ SCU_FUN_PIN_UART1_RXD |
+ SCU_FUN_PIN_UART1_TXD |
+ SCU_FUN_PIN_UART1_NRTS |
+ SCU_FUN_PIN_UART1_NDTR |
+ SCU_FUN_PIN_UART1_NRI |
+ SCU_FUN_PIN_UART1_NDSR |
+ SCU_FUN_PIN_UART1_NDCD |
+ SCU_FUN_PIN_UART1_NCTS,
+ AST_SCU_FUN_PIN_CTRL1);
+ break;
+ case 2:
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) |
+ SCU_FUN_PIN_UART2_RXD |
+ SCU_FUN_PIN_UART2_TXD |
+ SCU_FUN_PIN_UART2_NRTS |
+ SCU_FUN_PIN_UART2_NDTR |
+ SCU_FUN_PIN_UART2_NRI |
+ SCU_FUN_PIN_UART2_NDSR |
+ SCU_FUN_PIN_UART2_NDCD |
+ SCU_FUN_PIN_UART2_NCTS,
+ AST_SCU_FUN_PIN_CTRL1);
+ break;
+ case 3:
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) |
+ SCU_FUN_PIN_UART3_RXD |
+ SCU_FUN_PIN_UART3_TXD |
+ SCU_FUN_PIN_UART3_NRTS |
+ SCU_FUN_PIN_UART3_NDTR |
+ SCU_FUN_PIN_UART3_NRI |
+ SCU_FUN_PIN_UART3_NDSR |
+ SCU_FUN_PIN_UART3_NDCD |
+ SCU_FUN_PIN_UART3_NCTS,
+ AST_SCU_FUN_PIN_CTRL1);
+ break;
+ case 4:
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) |
+ SCU_FUN_PIN_UART4_RXD |
+ SCU_FUN_PIN_UART4_TXD |
+ SCU_FUN_PIN_UART4_NRTS |
+ SCU_FUN_PIN_UART4_NDTR |
+ SCU_FUN_PIN_UART4_NRI |
+ SCU_FUN_PIN_UART4_NDSR |
+ SCU_FUN_PIN_UART4_NDCD |
+ SCU_FUN_PIN_UART4_NCTS,
+ AST_SCU_FUN_PIN_CTRL1);
+ break;
+ }
+
+
+}
+
+extern void
+ast_scu_multi_func_video()
+{
+#if defined(CONFIG_ARCH_2100) || defined(CONFIG_ARCH_2200)
+ ast_scu_write(ast_scu_read(AST_SCU_MULTI_FUNC_2) |
+ MULTI_FUNC_VIDEO_RGB18 |
+ MULTI_FUNC_VIDEO_SINGLE_EDGE,
+ AST_SCU_MULTI_FUNC_2);
+#elif defined(CONFIG_ARCH_1100) || defined(CONFIG_ARCH_2050)
+ ast_scu_write(ast_scu_read(AST_SCU_MULTI_FUNC_2) |
+ MULTI_FUNC_VIDEO_RGB18 |
+ MULTI_FUNC_VIDEO_SINGLE_EDGE,
+ AST_SCU_MULTI_FUNC_2);
+#else
+
+#endif
+}
+
+extern void
+ast_scu_multi_func_eth(u8 num)
+{
+ switch(num) {
+ case 0:
+ if(ast_scu_read(AST_SCU_HW_STRAP1) && SCU_HW_STRAP_MAC0_RGMII) {
+ SCUMSG("MAC0 : RGMII \n");
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) |
+ SCU_FUN_PIN_MAC0_PHY_LINK,
+ AST_SCU_FUN_PIN_CTRL1);
+ } else {
+ SCUMSG("MAC0 : RMII/NCSI \n");
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) &
+ ~SCU_FUN_PIN_MAC0_PHY_LINK,
+ AST_SCU_FUN_PIN_CTRL1);
+ }
+
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL3) |
+ SCU_FUN_PIN_MAC0_MDIO |
+ SCU_FUN_PIN_MAC0_MDC,
+ AST_SCU_FUN_PIN_CTRL3);
+
+ break;
+ case 1:
+ if(ast_scu_read(AST_SCU_HW_STRAP1) && SCU_HW_STRAP_MAC1_RGMII) {
+ SCUMSG("MAC1 : RGMII \n");
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) |
+ SCU_FUN_PIN_MAC1_PHY_LINK,
+ AST_SCU_FUN_PIN_CTRL1);
+ } else {
+ SCUMSG("MAC1 : RMII/NCSI \n");
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL1) &
+ ~SCU_FUN_PIN_MAC1_PHY_LINK,
+ AST_SCU_FUN_PIN_CTRL1);
+ }
+
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) |
+ SCU_FUC_PIN_MAC1_MDIO,
+ AST_SCU_FUN_PIN_CTRL5);
+
+ break;
+ }
+}
+
+extern void
+ast_scu_multi_func_nand(void)
+{
+ //enable NAND flash multipin FLBUSY and FLWP
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL2) |
+ SCU_FUN_PIN_NAND_FLBUSY | SCU_FUN_PIN_NAND_FLWP,
+ AST_SCU_FUN_PIN_CTRL2);
+
+}
+
+extern void
+ast_scu_multi_func_nor(void)
+{
+ //Address
+ //ROMA2~17
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL8) |
+ SCU_FUN_PIN_ROMA2 | SCU_FUN_PIN_ROMA3 |
+ SCU_FUN_PIN_ROMA4 | SCU_FUN_PIN_ROMA5 |
+ SCU_FUN_PIN_ROMA6 | SCU_FUN_PIN_ROMA7 |
+ SCU_FUN_PIN_ROMA8 | SCU_FUN_PIN_ROMA9 |
+ SCU_FUN_PIN_ROMA10 | SCU_FUN_PIN_ROMA11 |
+ SCU_FUN_PIN_ROMA12 | SCU_FUN_PIN_ROMA13 |
+ SCU_FUN_PIN_ROMA14 | SCU_FUN_PIN_ROMA15 |
+ SCU_FUN_PIN_ROMA16 | SCU_FUN_PIN_ROMA17,
+ AST_SCU_FUN_PIN_CTRL8);
+
+ //ROMA18~21
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL9) |
+ SCU_FUN_PIN_ROMA18 | SCU_FUN_PIN_ROMA19 |
+ SCU_FUN_PIN_ROMA20 | SCU_FUN_PIN_ROMA21,
+ AST_SCU_FUN_PIN_CTRL9);
+
+ //ROMA22,23
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL4) | SCU_FUN_PIN_ROMA22 | SCU_FUN_PIN_ROMA23,
+ AST_SCU_FUN_PIN_CTRL4);
+
+ //ROMA24,25
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL3) | SCU_FUN_PIN_ROMA24 | SCU_FUN_PIN_ROMA25,
+ AST_SCU_FUN_PIN_CTRL3);
+
+ //SCU94 [1] = 0
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL6) & SCU_VIDEO_OUT_MASK,
+ AST_SCU_FUN_PIN_CTRL6);
+
+
+ //data
+ //ROMD 4~7 //ROMWE#, OE#
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL4) |
+ SCU_FUN_PIN_ROMOE | SCU_FUN_PIN_ROMWE |
+ SCU_FUN_PIN_ROMD4 | SCU_FUN_PIN_ROMD5 |
+ SCU_FUN_PIN_ROMD6 | SCU_FUN_PIN_ROMD7,
+ AST_SCU_FUN_PIN_CTRL4);
+
+ //ROMD 8~15
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) |
+ SCU_FUC_PIN_ROM_16BIT,
+ AST_SCU_FUN_PIN_CTRL5);
+
+}
+
+extern void
+ast_scu_multi_func_romcs(u8 num)
+{
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL3) |
+ SCU_FUN_PIN_ROMCS(num),
+ AST_SCU_FUN_PIN_CTRL3);
+}
+
+extern void
+ast_scu_multi_func_i2c(void)
+{
+ //TODO check ... //In AST2400 Due to share pin with SD , please not enable I2C 10 ~14
+ // AST 2400 have 14 , AST 2300 9 ...
+#ifdef CONFIG_MMC_AST
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) |
+ SCU_FUC_PIN_I2C3 |
+ SCU_FUC_PIN_I2C4 |
+ SCU_FUC_PIN_I2C5 |
+ SCU_FUC_PIN_I2C6 |
+ SCU_FUC_PIN_I2C7 |
+ SCU_FUC_PIN_I2C8 |
+ SCU_FUC_PIN_I2C9,
+ AST_SCU_FUN_PIN_CTRL5);
+#else
+ ast_scu_write((ast_scu_read(AST_SCU_FUN_PIN_CTRL5) |
+ SCU_FUC_PIN_I2C3 |
+ SCU_FUC_PIN_I2C4 |
+ SCU_FUC_PIN_I2C5 |
+ SCU_FUC_PIN_I2C6 |
+ SCU_FUC_PIN_I2C7 |
+ SCU_FUC_PIN_I2C8 |
+ SCU_FUC_PIN_I2C9 |
+ SCU_FUC_PIN_I2C10 |
+ SCU_FUC_PIN_I2C11 |
+ SCU_FUC_PIN_I2C12 |
+ SCU_FUC_PIN_I2C13 |
+ SCU_FUC_PIN_I2C14) &
+ ~(SCU_FUC_PIN_SD1 | SCU_FUC_PIN_SD2),
+ AST_SCU_FUN_PIN_CTRL5);
+#endif
+}
+
+EXPORT_SYMBOL(ast_scu_multi_func_i2c);
+
+extern void
+ast_scu_multi_func_pwm_tacho(void)
+{
+ //TODO check
+ u32 sts = ast_scu_read(AST_SCU_FUN_PIN_CTRL3) &~0xcfffff;
+ ast_scu_write(sts | 0xc000ff, AST_SCU_FUN_PIN_CTRL3);
+}
+
+EXPORT_SYMBOL(ast_scu_multi_func_pwm_tacho);
+
+//0 : hub mode , 1: usb host mode
+extern void
+ast_scu_multi_func_usb20_host_hub(u8 mode)
+{
+ if(mode)
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) | SCU_FUC_PIN_USB20_HOST,
+ AST_SCU_FUN_PIN_CTRL5);
+ else
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) & ~SCU_FUC_PIN_USB20_HOST,
+ AST_SCU_FUN_PIN_CTRL5);
+}
+
+EXPORT_SYMBOL(ast_scu_multi_func_usb20_host_hub);
+
+//0 : gpioQ6,7 mode , 1: usb1.1 host port 4 mode
+extern void
+ast_scu_multi_func_usb11_host_port4(u8 mode)
+{
+ if(mode)
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) | SCU_FUC_PIN_USB11_PORT4,
+ AST_SCU_FUN_PIN_CTRL5);
+ else
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) & ~SCU_FUC_PIN_USB11_PORT4,
+ AST_SCU_FUN_PIN_CTRL5);
+}
+
+EXPORT_SYMBOL(ast_scu_multi_func_usb11_host_port4);
+
+//0 : USB 1.1 HID mode , 1: usb1.1 host port 2 mode
+extern void
+ast_scu_multi_func_usb11_host_port2(u8 mode)
+{
+ if(mode)
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) | SCU_FUC_PIN_USB11_PORT2,
+ AST_SCU_FUN_PIN_CTRL5);
+ else
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) & ~SCU_FUC_PIN_USB11_PORT2,
+ AST_SCU_FUN_PIN_CTRL5);
+}
+
+EXPORT_SYMBOL(ast_scu_multi_func_usb11_host_port2);
+
+//0 : 1: SD1 function
+extern void
+ast_scu_multi_func_sdhc_slot1(u8 mode)
+{
+ if(mode)
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) | SCU_FUC_PIN_SD1,
+ AST_SCU_FUN_PIN_CTRL5);
+ else
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) & ~SCU_FUC_PIN_SD1,
+ AST_SCU_FUN_PIN_CTRL5);
+}
+
+EXPORT_SYMBOL(ast_scu_multi_func_sdhc_slot1);
+
+extern void
+ast_scu_multi_func_sdhc_slot2(u8 mode)
+{
+ if(mode)
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) | SCU_FUC_PIN_SD2,
+ AST_SCU_FUN_PIN_CTRL5);
+ else
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL5) & ~SCU_FUC_PIN_SD2,
+ AST_SCU_FUN_PIN_CTRL5);
+
+}
+
+EXPORT_SYMBOL(ast_scu_multi_func_sdhc_slot2);
+
+extern void
+ast_scu_multi_func_crt(void)
+{
+ /* multi-pin for DVO */
+
+ //Digital vodeo input function pins : 00 disable, 10 24bits mode 888,
+ ast_scu_write((ast_scu_read(AST_SCU_FUN_PIN_CTRL5) &
+ ~SCU_FUC_PIN_DIGI_V_OUT_MASK) |
+ SCU_FUC_PIN_DIGI_V_OUT(VIDEO_24BITS),AST_SCU_FUN_PIN_CTRL5);
+
+ //VPI input
+#if 0
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL2) |
+ SCU_FUN_PIN_VPIB9 | SCU_FUN_PIN_VPIB8 |
+ SCU_FUN_PIN_VPIB7 | SCU_FUN_PIN_VPIB6 |
+ SCU_FUN_PIN_VPIB5 | SCU_FUN_PIN_VPIB4 |
+ SCU_FUN_PIN_VPIB3 | SCU_FUN_PIN_VPIB2 |
+ SCU_FUN_PIN_VPIB1 | SCU_FUN_PIN_VPIB0 |
+ SCU_FUN_PIN_VPICLK | SCU_FUN_PIN_VPIVS |
+ SCU_FUN_PIN_VPIHS | SCU_FUN_PIN_VPIODD |
+ SCU_FUN_PIN_VPIDE ,AST_SCU_FUN_PIN_CTRL2);
+
+ ast_scu_write(ast_scu_read(AST_SCU_FUN_PIN_CTRL3) |
+ SCU_FUN_PIN_VPIR9 | SCU_FUN_PIN_VPIR8 |
+ SCU_FUN_PIN_VPIR7 | SCU_FUN_PIN_VPIR6 |
+ SCU_FUN_PIN_VPIR5 | SCU_FUN_PIN_VPIR4 |
+ SCU_FUN_PIN_VPIR3 | SCU_FUN_PIN_VPIR2 |
+ SCU_FUN_PIN_VPIR1 | SCU_FUN_PIN_VPIR0 |
+ SCU_FUN_PIN_VPIG9 | SCU_FUN_PIN_VPIG8 |
+ SCU_FUN_PIN_VPIG7 | SCU_FUN_PIN_VPIG6 |
+ SCU_FUN_PIN_VPIG5 | SCU_FUN_PIN_VPIG4 |
+ SCU_FUN_PIN_VPIG3 | SCU_FUN_PIN_VPIG2 |
+ SCU_FUN_PIN_VPIG1 | SCU_FUN_PIN_VPIG0 ,AST_SCU_FUN_PIN_CTRL3);
+#endif
+}
+
+EXPORT_SYMBOL(ast_scu_multi_func_crt);
+//***********************************Information ***********************************
+extern u32
+ast_scu_revision_id(void)
+{
+ int i;
+ u32 rev_id = ast_scu_read(AST_SCU_REVISION_ID);
+ for(i=0;i<ARRAY_SIZE(soc_map_table);i++) {
+ if(rev_id == soc_map_table[i].rev_id)
+ break;
+ }
+ if(i == ARRAY_SIZE(soc_map_table))
+ SCUMSG("UnKnow-SOC : %x \n",rev_id);
+ else
+ SCUMSG("SOC : %4s \n",soc_map_table[i].name);
+
+ return rev_id;
+}
+
+EXPORT_SYMBOL(ast_scu_revision_id);
+
+/*
+* D[15:11] in 0x1E6E2040 is NCSI scratch from U-Boot. D[15:14] = MAC1, D[13:12] = MAC2
+* The meanings of the 2 bits are:
+* 00(0): Dedicated PHY
+* 01(1): ASPEED's EVA + INTEL's NC-SI PHY chip EVA
+* 10(2): ASPEED's MAC is connected to NC-SI PHY chip directly
+* 11: Reserved
+*/
+
+extern u32
+ast_scu_get_phy_config(u8 mac_num)
+{
+ u32 scatch = ast_scu_read(AST_SCU_SOC_SCRATCH0);
+
+ switch(mac_num) {
+ case 0:
+ return (SCU_MAC0_GET_PHY_MODE(scatch));
+ break;
+ case 1:
+ return (SCU_MAC1_GET_PHY_MODE(scatch));
+ break;
+ default:
+ SCUMSG("error mac number \n");
+ break;
+ }
+ return -1;
+}
+EXPORT_SYMBOL(ast_scu_get_phy_config);
+
+extern u32
+ast_scu_get_phy_interface(u8 mac_num)
+{
+ u32 trap1 = ast_scu_read(AST_SCU_HW_STRAP1);
+
+ switch(mac_num) {
+ case 0:
+ if(SCU_HW_STRAP_MAC0_RGMII & trap1)
+ return 1;
+ else
+ return 0;
+ break;
+ case 1:
+ if(SCU_HW_STRAP_MAC1_RGMII & trap1)
+ return 1;
+ else
+ return 0;
+ break;
+ default:
+ SCUMSG("error mac number \n");
+ break;
+ }
+ return -1;
+}
+EXPORT_SYMBOL(ast_scu_get_phy_interface);
+
+extern void
+ast_scu_set_vga_display(u8 enable)
+{
+ if(enable)
+ printk("111111");
+}
+
+EXPORT_SYMBOL(ast_scu_set_vga_display);
+
+extern u32
+ast_scu_get_vga_memsize(void)
+{
+ u32 size=0;
+
+ switch(SCU_HW_STRAP_VGA_SIZE_GET(ast_scu_read(AST_SCU_HW_STRAP1))) {
+ case 0:
+ size = 8*1024*1024;
+ break;
+ case 1:
+ size = 16*1024*1024;
+ break;
+ case 2:
+ size = 32*1024*1024;
+ break;
+ case 3:
+ size = 64*1024*1024;
+ break;
+ default:
+ SCUMSG("error vga size \n");
+ break;
+ }
+ return size;
+}
+
+EXPORT_SYMBOL(ast_scu_get_vga_memsize);
+
+extern void
+ast_scu_get_who_init_dram(void)
+{
+ switch(SCU_VGA_DRAM_INIT_MASK(ast_scu_read(AST_SCU_VGA0))) {
+ case 0:
+ SCUMSG("VBIOS init \n");
+ break;
+ case 1:
+ SCUMSG("SOC init \n");
+ break;
+ default:
+ SCUMSG("error vga size \n");
+ break;
+ }
+}
diff --git a/arch/arm/plat-aspeed/ast-sdmc.c b/arch/arm/plat-aspeed/ast-sdmc.c
new file mode 100644
index 000000000000..238cf79ea6da
--- /dev/null
+++ b/arch/arm/plat-aspeed/ast-sdmc.c
@@ -0,0 +1,100 @@
+/********************************************************************************
+* File Name : arch/arm/mach-aspeed/ast-sdmc.c
+* Author : Ryan Chen
+* Description : AST SDRAM Memory Ctrl
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+* 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.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+* History :
+* 1. 2013/03/15 Ryan Chen Create
+*
+********************************************************************************/
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <asm/io.h>
+
+#include <mach/platform.h>
+#include <mach/hardware.h>
+
+#include <plat/ast-sdmc.h>
+#include <plat/regs-sdmc.h>
+
+//#define AST_SDMC_LOCK
+//#define AST_SDMC_DEBUG
+
+#ifdef AST_SDMC_DEBUG
+#define SDMCDBUG(fmt, args...) printk("%s() " fmt, __FUNCTION__, ## args)
+#else
+#define SDMCDBUG(fmt, args...)
+#endif
+
+#define SDMCMSG(fmt, args...) printk(fmt, ## args)
+
+static u32 ast_sdmc_base = IO_ADDRESS(AST_SDMC_BASE);
+
+static inline u32
+ast_sdmc_read(u32 reg)
+{
+ u32 val;
+
+ val = readl(ast_sdmc_base + reg);
+
+ SDMCDBUG("ast_sdmc_read : reg = 0x%08x, val = 0x%08x\n", reg, val);
+
+ return val;
+}
+
+static inline void
+ast_sdmc_write(u32 val, u32 reg)
+{
+ SDMCDBUG("ast_sdmc_write : reg = 0x%08x, val = 0x%08x\n", reg, val);
+#ifdef CONFIG_AST_SDMC_LOCK
+ //unlock
+ writel(SDMC_PROTECT_UNLOCK, ast_sdmc_base);
+ writel(val, ast_sdmc_base + reg);
+ //lock
+ writel(0xaa,ast_sdmc_base);
+#else
+ writel(SDMC_PROTECT_UNLOCK, ast_sdmc_base);
+
+ writel(val, ast_sdmc_base + reg);
+#endif
+}
+
+//***********************************Information ***********************************
+extern u32
+ast_sdmc_get_mem_size(void)
+{
+ u32 size=0;
+ switch(SDMC_CONFIG_MEM_GET(ast_sdmc_read(AST_SDMC_CONFIG))) {
+ case 0:
+ size = 64*1024*1024;
+ break;
+ case 1:
+ size = 128*1024*1024;
+ break;
+ case 2:
+ size = 256*1024*1024;
+ break;
+ case 3:
+ size = 512*1024*1024;
+ break;
+
+ default:
+ SDMCMSG("error ddr size \n");
+ break;
+ }
+ return size;
+}
+
diff --git a/arch/arm/plat-aspeed/ast1070-scu.c b/arch/arm/plat-aspeed/ast1070-scu.c
new file mode 100644
index 000000000000..4ad12c74da28
--- /dev/null
+++ b/arch/arm/plat-aspeed/ast1070-scu.c
@@ -0,0 +1,178 @@
+/********************************************************************************
+* File Name : arch/arm/mach-aspeed/ast1070-scu.c
+* Author : Ryan Chen
+* Description : AST1070 SCU
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+* 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.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2013/05/15 Ryan Chen Create
+*
+********************************************************************************/
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+
+#include <mach/platform.h>
+#include <asm/io.h>
+
+#include <mach/hardware.h>
+
+#include <plat/ast1070-scu.h>
+#include <plat/regs-ast1070-scu.h>
+
+#define CONFIG_AST1070_SCU_LOCK
+//#define AST1070_SCU_DEBUG
+
+#ifdef AST1070_SCU_DEBUG
+#define SCUDBUG(fmt, args...) printk("%s() " fmt, __FUNCTION__, ## args)
+#else
+#define SCUDBUG(fmt, args...)
+#endif
+
+#define SCUMSG(fmt, args...) printk(fmt, ## args)
+
+static u32 ast1070_scu_base = IO_ADDRESS2(AST_C0_SCU_BASE);
+
+static inline u32
+ast1070_scu_read(u8 node, u32 reg)
+{
+ u32 val;
+
+ val = readl(ast1070_scu_base + (node * 0x10000) + reg);
+
+ SCUDBUG("ast1070_scu_read : reg = 0x%08x, val = 0x%08x\n", reg, val);
+
+ return val;
+}
+
+static inline void
+ast1070_scu_write(u8 node, u32 val, u32 reg)
+{
+ SCUDBUG("ast1070_scu_write : reg = 0x%08x, val = 0x%08x\n", reg, val);
+#ifdef CONFIG_AST1070_SCU_LOCK
+ //unlock
+ writel(AST1070_SCU_PROTECT_UNLOCK, ast1070_scu_base + (node * 0x10000));
+ writel(val, ast1070_scu_base + (node * 0x10000) + reg);
+ //lock
+// writel(0xaa,ast1070_scu_base + (node * 0x10000));
+#else
+ writel(val, ast1070_scu_base + (node * 0x10000) + reg);
+#endif
+}
+
+extern void
+ast1070_scu_init_uart(u8 node)
+{
+ //SCU UART Reset
+ ast1070_scu_write(node, ast1070_scu_read(node, AST1070_SCU_RESET) &
+ ~(SCU_RESET_N1_UART | SCU_RESET_N2_UART |
+ SCU_RESET_N3_UART | SCU_RESET_N4_UART),
+ AST1070_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast1070_scu_init_uart);
+
+extern void
+ast1070_scu_init_i2c(u8 node)
+{
+ //SCU I2C Reset
+ ast1070_scu_write(node, ast1070_scu_read(node, AST1070_SCU_RESET) & ~SCU_RESET_I2C, AST1070_SCU_RESET);
+}
+
+EXPORT_SYMBOL(ast1070_scu_init_i2c);
+
+extern void
+ast1070_dma_init(u8 node)
+{
+ u32 val =0;
+
+ //let the uart_dma engine leave the reset state
+ ast1070_scu_write(node, ast1070_scu_read(node, AST1070_SCU_RESET) & ~SCU_RESET_DMA, AST1070_SCU_RESET);
+
+ val = ast1070_scu_read(node, AST1070_SCU_MISC_CTRL) & ~SCU_DMA_M_S_MASK;
+
+ if(ast1070_scu_read(node, AST1070_SCU_TRAP) & TRAP_MULTI_MASTER) {
+ //AST1070 multi Initial DMA
+ if(ast1070_scu_read(node, AST1070_SCU_TRAP) & TRAP_DEVICE_SLAVE)
+ ast1070_scu_write(node, val | SCU_DMA_SLAVE_EN, AST1070_SCU_MISC_CTRL);
+ else
+ //Enable DMA master
+ ast1070_scu_write(node, val | SCU_DMA_MASTER_EN, AST1070_SCU_MISC_CTRL);
+
+ } else {
+ //AST1070 single
+ ast1070_scu_write(node, val, AST1070_SCU_MISC_CTRL);
+ }
+}
+EXPORT_SYMBOL(ast1070_dma_init);
+
+
+extern void
+ast1070_scu_init_lpc(void)
+{
+
+}
+
+EXPORT_SYMBOL(ast1070_scu_init_lpc);
+
+//***********************************Multi-function pin control***********************************
+
+extern void
+ast1070_multi_func_uart(u8 node, u8 uart)
+{
+ ast1070_scu_write(node, (ast1070_scu_read(node, AST1070_SCU_UART_MUX) &
+ ~UART_MUX_MASK(uart)) |
+ SET_UART_IO_PAD(uart,PAD_FROM_BMC) |
+ SET_NODE_UART_CTRL(uart, NODE_UART_FROM_NONE) |
+ SET_BMC_UART_CTRL(uart, BMC_UART_FROM_PAD1),
+ AST1070_SCU_UART_MUX);
+
+}
+
+EXPORT_SYMBOL(ast1070_multi_func_uart);
+
+
+//***********************************CLK control***********************************
+
+
+//***********************************CLK Information***********************************
+extern u32
+ast1070_get_clk_source(void)
+{
+
+}
+EXPORT_SYMBOL(ast1070_get_clk_source);
+
+//***********************************Information ***********************************
+extern void
+ast1070_scu_revision_id(u8 node)
+{
+ u32 rev_id;
+
+#if 0
+ if(gpio_get_value(PIN_GPIOI1))
+ printk("Use LPC+ Bus Access \n");
+ else
+ printk("Use LPC Bus Access \n");
+#endif
+
+ rev_id = ast1070_scu_read(node, AST1070_SCU_CHIP_ID);
+ if (ast1070_scu_read(node, AST1070_SCU_TRAP) & TRAP_LPC_PLUS_MODE) {
+ printk("LPC+ : ");
+ } else
+ printk("LPC : ");
+
+ printk("AST1070-[C%d] rev_id[%x] \n",node,rev_id);
+}
+
+EXPORT_SYMBOL(ast1070_scu_revision_id);
diff --git a/arch/arm/plat-aspeed/ast1070-uart-dma.c b/arch/arm/plat-aspeed/ast1070-uart-dma.c
new file mode 100644
index 000000000000..9da401ead6fa
--- /dev/null
+++ b/arch/arm/plat-aspeed/ast1070-uart-dma.c
@@ -0,0 +1,572 @@
+/*
+ * ast1070-uart-dma.c
+ *
+ * UART DMA for the AST1070 UART access.
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History:
+ * 2012.05.26: Initial version [Ryan Chen]
+ */
+
+#include <linux/sysdev.h>
+#include <linux/dma-mapping.h>
+#include <linux/interrupt.h>
+#include <asm/io.h>
+#include <mach/irqs.h>
+#include <mach/hardware.h>
+#include <mach/ast-uart-dma.h>
+#include <plat/regs-uart-dma.h>
+
+//#define AST_UART_DMA_DEBUG
+
+#ifdef AST_UART_DMA_DEBUG
+#define DMADUG(fmt, args...) printk("%s() " fmt, __FUNCTION__, ## args)
+#else
+#define DMADUG(fmt, args...)
+#endif
+
+//#define AST1070_FPGA 1
+
+struct ast1070_dma uart_dma[CONFIG_AST1070_NR];
+
+static inline void
+ast1070_uart_dma_write(struct ast1070_dma *dma, u32 val, u32 reg)
+{
+ //printk("uart dma write : val: %x , reg : %x \n",val,reg);
+ writel(val, dma->reg_base+ reg);
+}
+
+static inline u32
+ast1070_uart_dma_read(struct ast1070_dma *dma, u32 reg)
+{
+#if 0
+ u32 val = readl(i2c_dev->reg_base + reg);
+ printk("R : reg %x , val: %x \n",reg, val);
+ return val;
+#else
+ return readl(dma->reg_base + reg);
+#endif
+}
+
+/* *****************************************************************************/
+int ast_uart_rx_dma_enqueue(u8 node, u8 ch, dma_addr_t rx_buff, u16 len)
+{
+ unsigned long flags;
+ struct ast1070_dma *dma = &uart_dma[node];
+ struct ast1070_dma_ch *dma_ch = &(dma->dma_rx_ch[ch]);
+ struct uart_dma_desc *rx_desc = dma_ch->desc;
+
+ if(len > 4096)
+ printk("ERROR !!! Please Check ...\n");
+
+ local_irq_save(flags);
+
+ //fill to rx desc -->
+ rx_desc->desc0 = DESC0_END | DESC0_INT_EN | DESC0_HW_OWN;
+ rx_desc->desc1 = DESC1_LEN(len);
+ rx_desc->desc2 = rx_buff;
+ rx_desc->desc3 = 0;
+
+ DMADUG("[c%d]: ch = %d, rx buff = %x, len = %d \n",node, ch, rx_buff, len);
+
+ //fill in tx descriptor base register
+ DMADUG("desc_addr : %x, reg offset %x \n",dma_ch->desc_dma_addr, dma_ch->desc_offset);
+ ast1070_uart_dma_write(dma, dma_ch->desc_dma_addr, dma_ch->desc_offset);
+
+ local_irq_restore(flags);
+
+ return 0;
+}
+
+EXPORT_SYMBOL(ast_uart_rx_dma_enqueue);
+
+int ast_uart_tx_dma_enqueue(u8 node, u8 ch, dma_addr_t tx_buff, u16 len)
+{
+ unsigned long flags;
+ struct ast1070_dma *dma = &uart_dma[node];
+ struct ast1070_dma_ch *dma_ch = &(dma->dma_tx_ch[ch]);
+ struct uart_dma_desc *tx_desc = dma_ch->desc;
+
+ DMADUG("[c%d]: ch = %d, tx buff = %x, len = %d \n",node, ch, tx_buff, len);
+
+ local_irq_save(flags);
+
+ //fill to rx desc -->
+ tx_desc->desc0 = DESC0_END | DESC0_INT_EN | DESC0_HW_OWN;
+ tx_desc->desc1 = DESC1_LEN(len);
+ tx_desc->desc2 = tx_buff;
+ tx_desc->desc3 = 0;
+
+// DMADUG("desc vir = %x, tx desc = %x, %x, %x, %x ===\n",tx_desc, tx_desc->desc0 ,tx_desc->desc1,tx_desc->desc2,tx_desc->desc3);
+ //fill in tx descriptor base register
+ DMADUG("desc_addr : %x, in offset %x \n",dma_ch->desc_dma_addr, dma_ch->desc_offset);
+ ast1070_uart_dma_write(dma, dma_ch->desc_dma_addr, dma_ch->desc_offset);
+
+ local_irq_restore(flags);
+
+ return 0;
+}
+
+EXPORT_SYMBOL(ast_uart_tx_dma_enqueue);
+
+int ast_uart_rx_dma_ctrl(u8 node, u8 ch, enum ast_uart_chan_op op)
+{
+ unsigned long flags;
+ struct ast1070_dma *dma = &uart_dma[node];
+ struct ast1070_dma_ch *dma_ch = &(dma->dma_rx_ch[ch]);
+ DMADUG("[c%d]: ch = %d \n",node, ch);
+
+ local_irq_save(flags);
+
+ switch (op) {
+ case AST_UART_DMAOP_TRIGGER:
+ //trigger
+ DMADUG("Trigger \n");
+ dma_ch->enable = 1;
+// ast1070_uart_dma_write(dma, DMA_ENABLE, dma_ch->ctrl_offset);
+ ast1070_uart_dma_write(dma, DMA_TRIGGER | DMA_ENABLE, dma_ch->ctrl_offset);
+ break;
+
+ case AST_UART_DMAOP_STOP:
+ //disable engine
+ DMADUG("Stop \n");
+ dma_ch->enable = 0;
+ ast1070_uart_dma_write(dma, 0, dma_ch->ctrl_offset);
+ break;
+ }
+
+
+ return 0;
+}
+EXPORT_SYMBOL(ast_uart_rx_dma_ctrl);
+
+int ast_uart_tx_dma_ctrl(u8 node, u8 ch, enum ast_uart_chan_op op)
+{
+ unsigned long flags;
+ struct ast1070_dma *dma = &uart_dma[node];
+ struct ast1070_dma_ch *dma_ch = &(dma->dma_tx_ch[ch]);
+ DMADUG("TX DMA CTRL [c%d]: ch = %d \n",node, ch);
+
+ local_irq_save(flags);
+
+ switch (op) {
+ case AST_UART_DMAOP_TRIGGER:
+ //trigger
+ DMADUG("Trigger \n");
+ ast1070_uart_dma_write(dma, DMA_ENABLE, dma_ch->ctrl_offset);
+ ast1070_uart_dma_write(dma, DMA_TRIGGER | DMA_ENABLE, dma_ch->ctrl_offset);
+ break;
+
+ case AST_UART_DMAOP_STOP:
+ //disable engine
+ DMADUG("STOP \n");
+ ast1070_uart_dma_write(dma, 0, dma_ch->ctrl_offset);
+ break;
+ }
+
+
+ return 0;
+}
+EXPORT_SYMBOL(ast_uart_tx_dma_ctrl);
+
+int ast_uart_tx_dma_request(u8 node, u8 ch, ast_uart_dma_cbfn_t rtn, void *id)
+{
+ unsigned long flags;
+ struct ast1070_dma *dma = &uart_dma[node];
+ struct ast1070_dma_ch *dma_ch = &(dma->dma_tx_ch[ch]);
+
+ DMADUG("TX DMA REQUEST [c%d]: ch = %d \n",node, ch);
+
+ local_irq_save(flags);
+
+ if (dma_ch->enable) {
+ local_irq_restore(flags);
+ return -EBUSY;
+ }
+
+ dma_ch->priv = id;
+ dma_ch->enable = 1;
+ dma_ch->callback_fn = rtn;
+ //DMA IRQ En
+ ast1070_uart_dma_write(dma,
+ ast1070_uart_dma_read(dma, UART_DMA_IER) |
+ (1 << ch)
+ , UART_DMA_IER);
+
+ //enable engine
+// ast1070_uart_dma_write(dma, DMA_ENABLE, dma_ch->ctrl_offset);
+ local_irq_restore(flags);
+
+ return 0;
+
+}
+
+EXPORT_SYMBOL(ast_uart_tx_dma_request);
+
+int ast_uart_rx_dma_request(u8 node, u8 ch, ast_uart_dma_cbfn_t rtn, void *id)
+{
+ unsigned long flags;
+ struct ast1070_dma *dma = &uart_dma[node];
+ struct ast1070_dma_ch *dma_ch = &(dma->dma_rx_ch[ch]);
+
+ DMADUG("RX DMA REQUEST [c%d] : ch = %d \n",node, ch);
+
+ local_irq_save(flags);
+
+ if (dma->dma_rx_ch[ch].enable) {
+ local_irq_restore(flags);
+ return -EBUSY;
+ }
+ dma_ch->priv = id;
+// dma_ch->enable = 1;
+ dma_ch->callback_fn = rtn;
+// dma_ch->name
+ //DMA IRQ En
+ ast1070_uart_dma_write(dma,
+ ast1070_uart_dma_read(dma, UART_DMA_IER) |
+ (1 << (4+ch))
+ , UART_DMA_IER);
+
+ //enable engine
+// ast1070_uart_dma_write(dma, DMA_ENABLE, dma_ch->ctrl_offset);
+ local_irq_restore(flags);
+
+ return 0;
+
+}
+
+EXPORT_SYMBOL(ast_uart_rx_dma_request);
+/* *****************************************************************************/
+static inline void ast_dma_bufffdone(struct ast1070_dma_ch *dma_ch)
+{
+ ////TODO desc -- remove ......
+ //workaround : Issue RX dma can;t be stoped , close open close
+ if(dma_ch->enable == 0) {
+// printk("workaround \n");
+ return;
+ }
+
+// u32 sts = ast1070_uart_dma_read(dma, dma_ch->ctrl_offset);
+ DMADUG("dma dwn : ch[%d] : %s ,len : %d \n", dma_ch->ch_no, dma_ch->direction ? "tx" : "rx", DESC3_GET_LEN(dma_ch->desc->desc3));
+
+ DMADUG(" == desc = %x, %x, %x, %x ===\n",dma_ch->desc->desc0,dma_ch->desc->desc1,dma_ch->desc->desc2,dma_ch->desc->desc3);
+
+
+ if(dma_ch->desc->desc0 & DESC0_HW_OWN)
+ printk("ERROR ..... \n");
+
+ if (dma_ch->callback_fn != NULL)
+ (dma_ch->callback_fn)(dma_ch, dma_ch->priv, DESC3_GET_LEN(dma_ch->desc->desc3));
+}
+
+
+static irqreturn_t
+ast1070_c0_uart_dma_irq(int irq, void *dev_id)
+{
+// struct ast1070_dma *dma = dev_id;
+ int i;
+ struct ast1070_dma *dma = &uart_dma[0];
+ u32 sts = ast1070_uart_dma_read(dma, UART_DMA_ISR);
+ DMADUG("C0 int -- > \n");
+ DMADUG("isr sts = %x\n", sts);
+
+ for(i = 0;i < 17 ; i++)
+ DMADUG("offset : %x , val %x \n",i*4, ast1070_uart_dma_read(dma, i*4));
+
+ if (sts & UART_DMA3_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA3_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[3]));
+ } else if (sts & UART_DMA2_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA2_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[2]));
+ } else if (sts & UART_DMA1_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA1_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[1]));
+ } else if (sts & UART_DMA0_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA0_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[0]));
+ } else if (sts & UART_DMA3_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA3_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[3]));
+ } else if (sts & UART_DMA2_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA2_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[2]));
+ } else if (sts & UART_DMA1_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA1_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[1]));
+ } else if (sts & UART_DMA0_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA0_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[0]));
+ } else {
+ printk("No body .. !!! \n");
+ }
+
+ return IRQ_HANDLED;
+}
+
+#if (CONFIG_AST1070_NR >=2)
+static irqreturn_t
+ast1070_c1_uart_dma_irq(int irq, void *dev_id)
+{
+// struct ast1070_dma *dma = dev_id;
+ struct ast1070_dma *dma = &uart_dma[1];
+ u32 sts = ast1070_uart_dma_read(dma, UART_DMA_ISR);
+ DMADUG("C1 int -- > \n");
+
+// DMADUG("isr sts = %x\n", sts);
+ if (sts & UART_DMA3_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA3_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[3]));
+ } else if (sts & UART_DMA2_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA2_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[2]));
+ } else if (sts & UART_DMA1_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA1_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[1]));
+ } else if (sts & UART_DMA0_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA0_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[0]));
+ } else if (sts & UART_DMA3_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA3_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[3]));
+ } else if (sts & UART_DMA2_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA2_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[2]));
+ } else if (sts & UART_DMA1_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA1_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[1]));
+ } else if (sts & UART_DMA0_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA0_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[0]));
+ } else {
+ printk("No body .. !!! \n");
+ }
+
+ return IRQ_HANDLED;
+}
+#endif
+
+#if (CONFIG_AST1070_NR >=3)
+static irqreturn_t
+ast1070_c2_uart_dma_irq(int irq, void *dev_id)
+{
+ struct ast1070_dma *dma = dev_id;
+ u32 sts = ast1070_uart_dma_read(dma, UART_DMA_ISR);
+
+// DMADUG("isr sts = %x\n", sts);
+ if (sts & UART_DMA3_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA3_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[3]));
+ } else if (sts & UART_DMA2_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA2_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[2]));
+ } else if (sts & UART_DMA1_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA1_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[1]));
+ } else if (sts & UART_DMA0_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA0_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[0]));
+ } else if (sts & UART_DMA3_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA3_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[3]));
+ } else if (sts & UART_DMA2_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA2_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[2]));
+ } else if (sts & UART_DMA1_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA1_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[1]));
+ } else if (sts & UART_DMA0_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA0_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[0]));
+ } else {
+ printk("No body .. !!! \n");
+ }
+
+ return IRQ_HANDLED;
+}
+#endif
+
+#if (CONFIG_AST1070_NR >=4)
+static irqreturn_t
+ast1070_c3_uart_dma_irq(int irq, void *dev_id)
+{
+ struct ast1070_dma *dma = dev_id;
+ u32 sts = ast1070_uart_dma_read(dma, UART_DMA_ISR);
+
+// DMADUG("isr sts = %x\n", sts);
+ if (sts & UART_DMA3_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA3_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[3]));
+ } else if (sts & UART_DMA2_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA2_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[2]));
+ } else if (sts & UART_DMA1_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA1_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[1]));
+ } else if (sts & UART_DMA0_RX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA0_RX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_rx_ch[0]));
+ } else if (sts & UART_DMA3_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA3_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[3]));
+ } else if (sts & UART_DMA2_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA2_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[2]));
+ } else if (sts & UART_DMA1_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA1_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[1]));
+ } else if (sts & UART_DMA0_TX_INT) {
+ ast1070_uart_dma_write(dma, UART_DMA0_TX_INT, UART_DMA_ISR);
+ ast_dma_bufffdone(&(dma->dma_tx_ch[0]));
+ } else {
+ printk("No body .. !!! \n");
+ }
+
+ return IRQ_HANDLED;
+}
+#endif
+
+extern int
+ast1070_uart_dma_init(u8 node)
+{
+ int ret,i;
+ struct ast1070_dma *dma = &uart_dma[node];
+
+ DMADUG("ast1070 uart_dma_init [c%d]\n", node);
+
+ if(node == 0) {
+ dma->reg_base = ioremap(AST_C0_UART_DMA_BASE, 0x100);
+#if (CONFIG_AST1070_NR >=2)
+ } else if (node == 1) {
+ dma->reg_base = ioremap(AST_C1_UART_DMA_BASE, 0x100);
+#endif
+#if (CONFIG_AST1070_NR >=3)
+ } else if (node == 2) {
+ dma->reg_base = ioremap(AST_C2_UART_DMA_BASE, 0x100);
+#endif
+#if (CONFIG_AST1070_NR >=4)
+ } else if (node == 3) {
+ dma->reg_base = ioremap(AST_C3_UART_DMA_BASE, 0x100);
+#endif
+ } else {
+ printk("node out of range !! \n");
+ return 1;
+ }
+
+ if (!dma->reg_base) {
+ printk(KERN_ERR "%s: failed to ioremap()\n", __func__);
+ return -ENXIO;
+ }
+
+ ast1070_uart_dma_write(dma, 0xff, UART_DMA_ISR);
+ ast1070_uart_dma_write(dma, 0, UART_DMA_IER);
+
+ for(i=0;i<4;i++) {
+ //TX ------------------------
+ dma->dma_tx_ch[i].enable = 0;
+ dma->dma_tx_ch[i].ch_no = i;
+ dma->dma_tx_ch[i].direction = 1;
+ //tx descriptor allocation
+ dma->dma_tx_ch[i].desc = dma_alloc_coherent(NULL, sizeof(struct uart_dma_desc), &(dma->dma_tx_ch[i].desc_dma_addr), GFP_KERNEL);
+ if (dma->dma_tx_ch[i].desc == NULL) {
+ DMADUG("Can't allocate tx descriptor\n");
+ return 0;
+ }
+ memset(dma->dma_tx_ch[i].desc, 0, sizeof(struct uart_dma_desc));
+ DMADUG("tx_desc [%d] virt = %x, dma = %x\n", i, (u32)dma->dma_tx_ch[i].desc, dma->dma_tx_ch[i].desc_dma_addr);
+
+ ast1070_uart_dma_write(dma, 0, UART_DMA0_TX_CTRL + (i*8));
+ dma->dma_tx_ch[i].ctrl_offset = UART_DMA0_TX_CTRL + (i*8);
+ dma->dma_tx_ch[i].desc_offset = UART_DMA0_TX_DESCPT + (i*8);
+
+ //RX ------------------------
+ dma->dma_rx_ch[i].enable = 0;
+ dma->dma_rx_ch[i].ch_no = i;
+ dma->dma_rx_ch[i].direction = 0;
+ //rx descriptor allocation
+ dma->dma_rx_ch[i].desc = dma_alloc_coherent(NULL, sizeof(struct uart_dma_desc), &(dma->dma_rx_ch[i].desc_dma_addr), GFP_KERNEL);
+ if (dma->dma_rx_ch[i].desc == NULL) {
+ DMADUG("Can't allocate tx descriptor\n");
+ return 0;
+ }
+ memset(dma->dma_rx_ch[i].desc, 0, sizeof(struct uart_dma_desc));
+ DMADUG("rx_desc [%d] virt = %x, dma = %x\n", i, (u32)dma->dma_rx_ch[i].desc, dma->dma_rx_ch[i].desc_dma_addr);
+ ast1070_uart_dma_write(dma, 0, UART_DMA0_RX_CTRL + (i*8));
+ dma->dma_rx_ch[i].ctrl_offset = UART_DMA0_RX_CTRL + (i*8);
+ dma->dma_rx_ch[i].desc_offset = UART_DMA0_RX_DESCPT + (i*8);
+ }
+
+ DMADUG("reg base = %x \n", (u32)dma->reg_base);
+
+ if(node == 0) {
+ for(i=0;i<4;i++) {
+ ret = request_irq(IRQ_C0_N1_UART_DMA + i,
+ ast1070_c0_uart_dma_irq, IRQF_SHARED,
+ "ast1070_n1_uart_dma", dma);
+ if (ret)
+ printk ("Unable to get UART DMA IRQ !!!!!!!!!!!!!!!!!!!!\n");
+ }
+#if (CONFIG_AST1070_NR >=2)
+ } else if (node == 1) {
+ for(i=0;i<4;i++) {
+ ret = request_irq(IRQ_C1_N1_UART_DMA + i,
+ ast1070_c1_uart_dma_irq, IRQF_SHARED,
+ "ast1070_n1_uart_dma", dma);
+ if (ret)
+ printk ("Unable to get UART DMA IRQ !!!!!!!!!!!!!!!!!!!!\n");
+ }
+#endif
+#if (CONFIG_AST1070_NR >=3)
+ } else if (node == 2) {
+ for(i=0;i<4;i++) {
+ ret = request_irq(IRQ_C2_N1_UART_DMA + i,
+ ast1070_c2_uart_dma_irq, IRQF_SHARED,
+ "ast1070_n1_uart_dma", dma);
+ if (ret)
+ printk ("Unable to get UART DMA IRQ !!!!!!!!!!!!!!!!!!!!\n");
+ }
+#endif
+#if (CONFIG_AST1070_NR >=4)
+ } else if (node == 3) {
+ for(i=0;i<4;i++) {
+ ret = request_irq(IRQ_C3_N1_UART_DMA + i,
+ ast1070_c3_uart_dma_irq, IRQF_SHARED,
+ "ast1070_n1_uart_dma", dma);
+ if (ret)
+ printk ("Unable to get UART DMA IRQ !!!!!!!!!!!!!!!!!!!!\n");
+ }
+#endif
+ } else {
+ printk("ERROR !! \n");
+ }
+
+ //Limit : AST1070 4* SPI CLK < AST2400 HCLK
+
+#ifdef AST1070_FPGA
+ //Low SPI clk setting == PCLK/8 , set 11
+ ast1070_uart_dma_write(dma,
+ (ast1070_uart_dma_read(dma, UART_DMA_CTRL) & ~SPI_CLK_MASK) |
+ SPI_CLK_SET(0x3) |
+ DMA_RX_TIMEOUT(0xfff) |
+ TXDESC_AUTO_POLLING |
+ RXDESC_AUTO_POLLING
+ , UART_DMA_CTRL);
+#else
+ ast1070_uart_dma_write(dma,
+ (ast1070_uart_dma_read(dma, UART_DMA_CTRL) &
+ ~DMA_BURST_MASK) |
+ DMA_RX_TIMEOUT(0xfff) |
+ TXDESC_AUTO_POLLING |
+ RXDESC_AUTO_POLLING
+ , UART_DMA_CTRL);
+#endif
+
+ return 0;
+}
+
+EXPORT_SYMBOL(ast1070_uart_dma_init);
diff --git a/arch/arm/plat-aspeed/ast1070_irq.c b/arch/arm/plat-aspeed/ast1070_irq.c
new file mode 100644
index 000000000000..e859cd17458a
--- /dev/null
+++ b/arch/arm/plat-aspeed/ast1070_irq.c
@@ -0,0 +1,220 @@
+/*
+ * linux/arch/arm/plat-aspeed/ast1070_irq.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <linux/init.h>
+#include <linux/stddef.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/platform_device.h>
+#include <linux/sysdev.h>
+#include <linux/interrupt.h>
+#include <asm/system.h>
+#include <linux/irq.h>
+
+#include <mach/hardware.h>
+#include <asm/mach/irq.h>
+
+#include <asm/irq.h>
+#include <asm/io.h>
+
+#include <plat/regs-ast1070-intc.h>
+
+#define irq_to_c0_vic(irq_no) (irq_no-IRQ_C0_VIC_CHAIN_START)
+
+static void ast1070_c0_mask_irq(unsigned int irq)
+{
+ u32 regVal;
+// printk("ast_c0_mask_irq %d\n",irq);
+ irq = irq_to_c0_vic(irq);
+// printk("ast_c0_mask_irq cvic %d\n",irq);
+ regVal = readl(AST_INTR_DIS(0));
+ regVal |= (1 << irq);
+ writel(regVal, AST_INTR_DIS(0));
+
+}
+
+static void ast1070_c0_unmask_irq(unsigned int irq)
+{
+ u32 regVal;
+// printk("ast_c0_unmask_irq %d\n",irq);
+ irq = irq_to_c0_vic(irq);
+// printk("ast_c0_unmask_irq cvic %d\n",irq);
+ regVal = readl(AST_INTR_EN(0));
+ regVal |= (1 << irq);
+ writel(regVal, AST_INTR_EN(0));
+}
+
+static struct irq_chip ast1070_c0_irq_chip = {
+ .name = "ast1070_c0",
+ .ack = ast1070_c0_mask_irq,
+ .mask = ast1070_c0_mask_irq,
+ .unmask = ast1070_c0_unmask_irq,
+};
+
+static void
+ast1070_c0_handle_irq(unsigned int irq, struct irq_desc *desc)
+{
+ int i,cvic_irq=0;
+ unsigned long sts = readl(AST_IRQ_STS(0));
+
+ if(irq != IRQ_C0_VIC_CHAIN)
+ BUG();
+
+ desc->chip->ack(IRQ_C0_VIC_CHAIN);
+
+ if (sts == 0) {
+ do_bad_IRQ(irq, desc);
+ return;
+ }
+
+ do {
+ for(i=0; i<AST_CVIC_NUM; i++) {
+ if((1<<i)& readl(AST_IRQ_STS(0))) {
+ cvic_irq =i;
+ break;
+ }
+ }
+ cvic_irq += IRQ_C0_VIC_CHAIN_START;
+ //dispatch IRQ
+// printk("dispatch ast1070 IRQ %d\n",cvic_irq);
+ generic_handle_irq(cvic_irq);
+
+ } while (readl(AST_IRQ_STS(0)));
+
+ desc->chip->unmask(IRQ_C0_VIC_CHAIN);
+
+}
+
+static int __init ast1070_c0_init_irq(void)
+{
+ unsigned int i;
+// printk("ast1070_c0_init_irq **==== Start ---------------\n");
+ /* CVIC */
+ writel(0, AST_INTR_EN(0));
+ writel(0xFFFFFFFF, AST_INTR_DIS(0));
+
+ //AST1070 total IRQ# 25
+ for (i = 0; i < AST_CVIC_NUM; i++)
+ {
+ IRQ_SET_HIGH_LEVEL(0,i);
+ IRQ_SET_LEVEL_TRIGGER(0,i);
+ set_irq_chip(i + IRQ_C0_VIC_CHAIN_START, &ast1070_c0_irq_chip);
+ set_irq_handler(i + IRQ_C0_VIC_CHAIN_START, handle_level_irq);
+ set_irq_flags(i + IRQ_C0_VIC_CHAIN_START, IRQF_VALID);
+ }
+ set_irq_chained_handler(IRQ_C0_VIC_CHAIN, ast1070_c0_handle_irq);
+// printk("ast1070_init_irq **==== END ----------\n");
+ return 0;
+}
+
+arch_initcall(ast1070_c0_init_irq);
+
+#if (CONFIG_AST1070_NR >= 2)
+#define irq_to_c1_vic(irq_no) (irq_no-IRQ_C1_VIC_CHAIN_START)
+
+static void ast1070_c1_mask_irq(unsigned int irq)
+{
+ u32 regVal;
+// printk("ast_mask_irq %d\n",irq);
+ irq = irq_to_c1_vic(irq);
+// printk("ast_mask_irq cvic %d\n",irq);
+ regVal = readl(AST_INTR_DIS(1));
+ regVal |= (1 << irq);
+ writel(regVal, AST_INTR_DIS(1));
+
+}
+
+static void ast1070_c1_unmask_irq(unsigned int irq)
+{
+ u32 regVal;
+// printk("ast_unmask_irq %d\n",irq);
+ irq = irq_to_c1_vic(irq);
+// printk("ast_unmask_irq cvic %d\n",irq);
+ regVal = readl(AST_INTR_EN(1));
+ regVal |= (1 << irq);
+ writel(regVal, AST_INTR_EN(1));
+}
+
+static struct irq_chip ast1070_c1_irq_chip = {
+ .name = "ast1070_c1",
+ .ack = ast1070_c1_mask_irq,
+ .mask = ast1070_c1_mask_irq,
+ .unmask = ast1070_c1_unmask_irq,
+};
+
+static void
+ast1070_c1_handle_irq(unsigned int irq, struct irq_desc *desc)
+{
+ int i,cvic_irq=0;
+ unsigned long sts = readl(AST_IRQ_STS(1));
+
+ if(irq != IRQ_C1_VIC_CHAIN)
+ BUG();
+
+ desc->chip->ack(IRQ_C1_VIC_CHAIN);
+
+ if (sts == 0) {
+ do_bad_IRQ(irq, desc);
+ return;
+ }
+
+ do {
+ for(i=0; i<AST_CVIC_NUM; i++) {
+ if((1<<i)& readl(AST_IRQ_STS(1))) {
+ cvic_irq =i;
+ break;
+ }
+ }
+ cvic_irq += IRQ_C1_VIC_CHAIN_START;
+ //dispatch IRQ
+// printk("dispatch ast1070 IRQ %d\n",cvic_irq);
+ generic_handle_irq(cvic_irq);
+
+ } while (readl(AST_IRQ_STS(1)));
+
+ desc->chip->unmask(IRQ_C1_VIC_CHAIN);
+
+}
+
+static int __init ast1070_c1_init_irq(void)
+{
+ unsigned int i;
+// printk("ast1070_c1_init_irq **==== Start ---------------\n");
+ /* CVIC */
+ writel(0, AST_INTR_EN(1));
+ writel(0xFFFFFFFF, AST_INTR_DIS(1));
+
+ //AST1070 total IRQ# 25
+ for (i = 0; i < AST_CVIC_NUM; i++)
+ {
+ IRQ_SET_HIGH_LEVEL(1,i);
+ IRQ_SET_LEVEL_TRIGGER(1,i);
+ set_irq_chip(i + IRQ_C1_VIC_CHAIN_START, &ast1070_c1_irq_chip);
+ set_irq_handler(i + IRQ_C1_VIC_CHAIN_START, handle_level_irq);
+ set_irq_flags(i + IRQ_C1_VIC_CHAIN_START, IRQF_VALID);
+ }
+ set_irq_chained_handler(IRQ_C1_VIC_CHAIN, ast1070_c1_handle_irq);
+// printk("ast1070_init_irq **==== END ----------\n");
+ return 0;
+}
+
+arch_initcall(ast1070_c1_init_irq);
+
+#endif
diff --git a/arch/arm/plat-aspeed/dev-adc.c b/arch/arm/plat-aspeed/dev-adc.c
new file mode 100644
index 000000000000..e8d325aa303c
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-adc.c
@@ -0,0 +1,76 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-adc.c
+* Author : Ryan chen
+* Description : ASPEED ADC Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/06 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#if defined(CONFIG_COLDFIRE)
+#include <asm/sizes.h>
+
+#include <asm/arch/irqs.h>
+#include <asm/arch/platform.h>
+#include <asm/arch/devs.h>
+#include <asm/arch/ast-scu.h>
+#else
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+#endif
+
+/* --------------------------------------------------------------------
+ * ADC
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_SENSORS_AST_ADC) || defined(CONFIG_SENSORS_AST_ADC_MODULE) || defined(CONFIG_SENSORS_AST1010_ADC) || defined(CONFIG_SENSORS_AST1010_ADC_MODULE)
+static struct resource ast_adc_resources[] = {
+ [0] = {
+ .start = AST_ADC_BASE,
+ .end = AST_ADC_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_ADC,
+ .end = IRQ_ADC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_adc_device = {
+ .name = "ast_adc",
+ .id = 0,
+ .resource = ast_adc_resources,
+ .num_resources = ARRAY_SIZE(ast_adc_resources),
+};
+
+void __init ast_add_device_adc(void)
+{
+ //SCU ADC CTRL Reset
+ ast_scu_init_adc();
+
+ platform_device_register(&ast_adc_device);
+}
+#else
+void __init ast_add_device_adc(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-ci2c.c b/arch/arm/plat-aspeed/dev-ci2c.c
new file mode 100644
index 000000000000..875639f601f7
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-ci2c.c
@@ -0,0 +1,521 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-ci2c.c
+* Author : Ryan chen
+* Description : ASPEED I2C Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/07/30 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+
+#include <asm/io.h>
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/ast_i2c.h>
+
+#include <plat/devs.h>
+#include <plat/regs-iic.h>
+#include <plat/ast-scu.h>
+#include <plat/ast1070-scu.h>
+/* --------------------------------------------------------------------
+ * CI2C
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_I2C_AST1070) || defined(CONFIG_I2C_AST1070_MODULE)
+
+static struct ast_i2c_driver_data ast_ci2c_data = {
+ .bus_clk = 100000, //bus clock 100KHz
+ .master_dma = DMA_MODE,
+ .slave_dma = BYTE_MODE,
+#ifdef CONFIG_AST_I2C_SLAVE_MODE
+ .slave_xfer = i2c_slave_xfer,
+ .slave_init = i2c_slave_init,
+#endif
+#ifdef CONFIG_AST_LPC_PLUS
+ //use lpc+ clock
+ .get_i2c_clock = ast_get_lhclk,
+#else
+ .get_i2c_clock = ast_get_d2_pll_clk,
+#endif
+};
+
+static u64 ast_i2c_dma_mask = 0xffffffffUL;
+static struct resource ast_ci2c_dev1_resources[] = {
+ [0] = {
+ .start = AST_C0_I2C_BASE + AST_CI2C_DEVICE1,
+ .end = AST_C0_I2C_BASE + AST_CI2C_DEVICE1 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C0_I2C,
+ .end = IRQ_C0_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_ci2c_dev1_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 0,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_ci2c_data,
+ },
+ .resource = ast_ci2c_dev1_resources,
+ .num_resources = ARRAY_SIZE(ast_ci2c_dev1_resources),
+};
+
+static struct resource ast_ci2c_dev2_resources[] = {
+ [0] = {
+ .start = AST_C0_I2C_BASE + AST_CI2C_DEVICE2,
+ .end = AST_C0_I2C_BASE + AST_CI2C_DEVICE2 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C0_I2C,
+ .end = IRQ_C0_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_ci2c_dev2_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 1,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_ci2c_data,
+ },
+ .resource = ast_ci2c_dev2_resources,
+ .num_resources = ARRAY_SIZE(ast_ci2c_dev2_resources),
+};
+
+static struct resource ast_ci2c_dev3_resources[] = {
+ [0] = {
+ .start = AST_C0_I2C_BASE + AST_CI2C_DEVICE3,
+ .end = AST_C0_I2C_BASE + AST_CI2C_DEVICE3 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C0_I2C,
+ .end = IRQ_C0_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_ci2c_dev3_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 2,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_ci2c_data,
+ },
+ .resource = ast_ci2c_dev3_resources,
+ .num_resources = ARRAY_SIZE(ast_ci2c_dev3_resources),
+};
+
+static struct resource ast_ci2c_dev4_resources[] = {
+ [0] = {
+ .start = AST_C0_I2C_BASE + AST_CI2C_DEVICE4,
+ .end = AST_C0_I2C_BASE + AST_CI2C_DEVICE4 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C0_I2C,
+ .end = IRQ_C0_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_ci2c_dev4_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 3,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_ci2c_data,
+ },
+ .resource = ast_ci2c_dev4_resources,
+ .num_resources = ARRAY_SIZE(ast_ci2c_dev4_resources),
+};
+
+static struct resource ast_ci2c_dev5_resources[] = {
+ [0] = {
+ .start = AST_C0_I2C_BASE + AST_CI2C_DEVICE5,
+ .end = AST_C0_I2C_BASE + AST_CI2C_DEVICE5 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C0_I2C,
+ .end = IRQ_C0_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_ci2c_dev5_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 4,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_ci2c_data,
+ },
+ .resource = ast_ci2c_dev5_resources,
+ .num_resources = ARRAY_SIZE(ast_ci2c_dev5_resources),
+};
+
+static struct resource ast_ci2c_dev6_resources[] = {
+ [0] = {
+ .start = AST_C0_I2C_BASE + AST_CI2C_DEVICE6,
+ .end = AST_C0_I2C_BASE + AST_CI2C_DEVICE6 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C0_I2C,
+ .end = IRQ_C0_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_ci2c_dev6_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 5,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_ci2c_data,
+ },
+ .resource = ast_ci2c_dev6_resources,
+ .num_resources = ARRAY_SIZE(ast_ci2c_dev6_resources),
+};
+
+static struct resource ast_ci2c_dev7_resources[] = {
+ [0] = {
+ .start = AST_C0_I2C_BASE + AST_CI2C_DEVICE7,
+ .end = AST_C0_I2C_BASE + AST_CI2C_DEVICE7 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C0_I2C,
+ .end = IRQ_C0_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_ci2c_dev7_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 6,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_ci2c_data,
+ },
+ .resource = ast_ci2c_dev7_resources,
+ .num_resources = ARRAY_SIZE(ast_ci2c_dev7_resources),
+};
+
+static struct resource ast_ci2c_dev8_resources[] = {
+ [0] = {
+ .start = AST_C0_I2C_BASE + AST_CI2C_DEVICE8,
+ .end = AST_C0_I2C_BASE + AST_CI2C_DEVICE8 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C0_I2C,
+ .end = IRQ_C0_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_ci2c_dev8_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 7,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_ci2c_data,
+ },
+ .resource = ast_ci2c_dev8_resources,
+ .num_resources = ARRAY_SIZE(ast_ci2c_dev8_resources),
+};
+
+//
+#if (CONFIG_AST1070_NR >= 2)
+
+static struct ast_i2c_driver_data ast_c1_i2c_data = {
+ .bus_clk = 100000, //bus clock 100KHz
+ .master_dma = DMA_MODE,
+ .slave_dma = BYTE_MODE,
+#ifdef CONFIG_AST_I2C_SLAVE_MODE
+ .slave_xfer = i2c_slave_xfer,
+ .slave_init = i2c_slave_init,
+#endif
+#ifdef CONFIG_ARCH_AST2300
+ .get_i2c_clock = ast_get_d2_pll_clk,
+#else //AST2400 use lpc+ clock
+ .get_i2c_clock = ast_get_lhclk,
+#endif
+};
+
+static struct resource ast_c1_i2c_dev1_resources[] = {
+ [0] = {
+ .start = AST_C1_I2C_BASE + AST_CI2C_DEVICE1,
+ .end = AST_C1_I2C_BASE + AST_CI2C_DEVICE1 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C1_I2C,
+ .end = IRQ_C1_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_c1_i2c_dev1_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 8 + 0,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_c1_i2c_data,
+ },
+ .resource = ast_c1_i2c_dev1_resources,
+ .num_resources = ARRAY_SIZE(ast_c1_i2c_dev1_resources),
+};
+
+static struct resource ast_c1_i2c_dev2_resources[] = {
+ [0] = {
+ .start = AST_C1_I2C_BASE + AST_CI2C_DEVICE2,
+ .end = AST_C1_I2C_BASE + AST_CI2C_DEVICE2 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C1_I2C,
+ .end = IRQ_C1_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_c1_i2c_dev2_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 8 + 1,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_c1_i2c_data,
+ },
+ .resource = ast_c1_i2c_dev2_resources,
+ .num_resources = ARRAY_SIZE(ast_c1_i2c_dev2_resources),
+};
+
+static struct resource ast_c1_i2c_dev3_resources[] = {
+ [0] = {
+ .start = AST_C1_I2C_BASE + AST_CI2C_DEVICE3,
+ .end = AST_C1_I2C_BASE + AST_CI2C_DEVICE3 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C1_I2C,
+ .end = IRQ_C1_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_c1_i2c_dev3_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 8 + 2,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_c1_i2c_data,
+ },
+ .resource = ast_c1_i2c_dev3_resources,
+ .num_resources = ARRAY_SIZE(ast_c1_i2c_dev3_resources),
+};
+
+static struct resource ast_c1_i2c_dev4_resources[] = {
+ [0] = {
+ .start = AST_C1_I2C_BASE + AST_CI2C_DEVICE4,
+ .end = AST_C1_I2C_BASE + AST_CI2C_DEVICE4 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C1_I2C,
+ .end = IRQ_C1_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_c1_i2c_dev4_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 8 + 3,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_c1_i2c_data,
+ },
+ .resource = ast_c1_i2c_dev4_resources,
+ .num_resources = ARRAY_SIZE(ast_c1_i2c_dev4_resources),
+};
+
+static struct resource ast_c1_i2c_dev5_resources[] = {
+ [0] = {
+ .start = AST_C1_I2C_BASE + AST_CI2C_DEVICE5,
+ .end = AST_C1_I2C_BASE + AST_CI2C_DEVICE5 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C1_I2C,
+ .end = IRQ_C1_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_c1_i2c_dev5_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 8 + 4,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_c1_i2c_data,
+ },
+ .resource = ast_c1_i2c_dev5_resources,
+ .num_resources = ARRAY_SIZE(ast_c1_i2c_dev5_resources),
+};
+
+static struct resource ast_c1_i2c_dev6_resources[] = {
+ [0] = {
+ .start = AST_C1_I2C_BASE + AST_CI2C_DEVICE6,
+ .end = AST_C1_I2C_BASE + AST_CI2C_DEVICE6 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C1_I2C,
+ .end = IRQ_C1_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_c1_i2c_dev6_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 8 + 5,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_c1_i2c_data,
+ },
+ .resource = ast_c1_i2c_dev6_resources,
+ .num_resources = ARRAY_SIZE(ast_c1_i2c_dev6_resources),
+};
+
+static struct resource ast_c1_i2c_dev7_resources[] = {
+ [0] = {
+ .start = AST_C1_I2C_BASE + AST_CI2C_DEVICE7,
+ .end = AST_C1_I2C_BASE + AST_CI2C_DEVICE7 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C1_I2C,
+ .end = IRQ_C1_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_c1_i2c_dev7_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 8 + 6,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_c1_i2c_data,
+ },
+ .resource = ast_c1_i2c_dev7_resources,
+ .num_resources = ARRAY_SIZE(ast_c1_i2c_dev7_resources),
+};
+
+static struct resource ast_c1_i2c_dev8_resources[] = {
+ [0] = {
+ .start = AST_C1_I2C_BASE + AST_CI2C_DEVICE8,
+ .end = AST_C1_I2C_BASE + AST_CI2C_DEVICE8 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_C1_I2C,
+ .end = IRQ_C1_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_c1_i2c_dev8_device = {
+ .name = "ast-i2c",
+ .id = NUM_BUS + 8 + 7,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_c1_i2c_data,
+ },
+ .resource = ast_c1_i2c_dev8_resources,
+ .num_resources = ARRAY_SIZE(ast_c1_i2c_dev8_resources),
+};
+#endif
+//
+/*-------------------------------------*/
+void __init ast_add_device_ci2c(void)
+{
+ ast1070_scu_init_i2c(0);
+
+ ast_ci2c_data.reg_gr = IO_ADDRESS2(AST_C0_I2C_BASE);
+ if (!ast_ci2c_data.reg_gr) {
+ printk("ast_add_device_i2c ERROR \n");
+ return;
+ }
+ platform_device_register(&ast_ci2c_dev1_device);
+ platform_device_register(&ast_ci2c_dev2_device);
+ platform_device_register(&ast_ci2c_dev3_device);
+ platform_device_register(&ast_ci2c_dev4_device);
+ platform_device_register(&ast_ci2c_dev5_device);
+ platform_device_register(&ast_ci2c_dev6_device);
+ platform_device_register(&ast_ci2c_dev7_device);
+ platform_device_register(&ast_ci2c_dev8_device);
+
+
+#if (CONFIG_AST1070_NR >= 2)
+
+ ast1070_scu_init_i2c(1);
+
+ ast_c1_i2c_data.reg_gr = IO_ADDRESS2(AST_C1_I2C_BASE);
+ if (!ast_c1_i2c_data.reg_gr) {
+ printk("ast_add_device_i2c ERROR \n");
+ return;
+ }
+ platform_device_register(&ast_c1_i2c_dev1_device);
+ platform_device_register(&ast_c1_i2c_dev2_device);
+ platform_device_register(&ast_c1_i2c_dev3_device);
+ platform_device_register(&ast_c1_i2c_dev4_device);
+ platform_device_register(&ast_c1_i2c_dev5_device);
+ platform_device_register(&ast_c1_i2c_dev6_device);
+ platform_device_register(&ast_c1_i2c_dev7_device);
+ platform_device_register(&ast_c1_i2c_dev8_device);
+#endif
+
+}
+#else
+void __init ast_add_device_ci2c(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-clpc.c b/arch/arm/plat-aspeed/dev-clpc.c
new file mode 100644
index 000000000000..d9fde7a76aba
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-clpc.c
@@ -0,0 +1,240 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-clpc.c
+* Author : Ryan chen
+* Description : ASPEED LPC Controller
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/11/29 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+
+/* --------------------------------------------------------------------
+ * LPC
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_CLPC) || defined(CONFIG_CLPC_MODULE)
+static u64 aspeed_lpc_dma_mask = 0xffffffffUL;
+
+static struct resource aspeed_clpc0_resource[] = {
+ [0] = {
+ .start = AST_CLPC1_BASE,
+ .end = AST_CLPC1_BASE + SZ_4K,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_N1_KCS,
+ .end = IRQ_N1_KCS,
+ .flags = IORESOURCE_IRQ,
+ },
+ [2] = {
+ .start = IRQ_N1_UART,
+ .end = IRQ_N1_UART,
+ .flags = IORESOURCE_IRQ,
+ },
+ [3] = {
+ .start = IRQ_N1_MAILBOX,
+ .end = IRQ_N1_MAILBOX,
+ .flags = IORESOURCE_IRQ,
+ },
+ [4] = {
+ .start = IRQ_N1_PORT80,
+ .end = IRQ_N1_PORT80,
+ .flags = IORESOURCE_IRQ,
+ },
+ [4] = {
+ .start = IRQ_N1_RESET,
+ .end = IRQ_N1_RESET,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device aspeed_clpc0_device = {
+ .name = "aspeed_lpc",
+ .id = 0,
+ .dev = {
+ .dma_mask = &aspeed_lpc_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = aspeed_clpc0_resource,
+ .num_resources = ARRAY_SIZE(aspeed_clpc0_resource),
+};
+
+static struct resource aspeed_clpc1_resource[] = {
+ [0] = {
+ .start = AST_CLPC2_BASE,
+ .end = AST_CLPC2_BASE + SZ_4K,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_N2_KCS,
+ .end = IRQ_N2_KCS,
+ .flags = IORESOURCE_IRQ,
+ },
+ [2] = {
+ .start = IRQ_N2_UART,
+ .end = IRQ_N2_UART,
+ .flags = IORESOURCE_IRQ,
+ },
+ [3] = {
+ .start = IRQ_N2_MAILBOX,
+ .end = IRQ_N2_MAILBOX,
+ .flags = IORESOURCE_IRQ,
+ },
+ [4] = {
+ .start = IRQ_N2_PORT80,
+ .end = IRQ_N2_PORT80,
+ .flags = IORESOURCE_IRQ,
+ },
+ [4] = {
+ .start = IRQ_N2_RESET,
+ .end = IRQ_N2_RESET,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device aspeed_clpc1_device = {
+ .name = "aspeed_lpc",
+ .id = 1,
+ .dev = {
+ .dma_mask = &aspeed_lpc_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = aspeed_clpc1_resource,
+ .num_resources = ARRAY_SIZE(aspeed_clpc1_resource),
+};
+
+static struct resource aspeed_clpc2_resource[] = {
+ [0] = {
+ .start = AST_CLPC3_BASE,
+ .end = AST_CLPC3_BASE + SZ_4K,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_N3_KCS,
+ .end = IRQ_N3_KCS,
+ .flags = IORESOURCE_IRQ,
+ },
+ [2] = {
+ .start = IRQ_N3_UART,
+ .end = IRQ_N3_UART,
+ .flags = IORESOURCE_IRQ,
+ },
+ [3] = {
+ .start = IRQ_N3_MAILBOX,
+ .end = IRQ_N3_MAILBOX,
+ .flags = IORESOURCE_IRQ,
+ },
+ [4] = {
+ .start = IRQ_N3_PORT80,
+ .end = IRQ_N3_PORT80,
+ .flags = IORESOURCE_IRQ,
+ },
+ [4] = {
+ .start = IRQ_N3_RESET,
+ .end = IRQ_N3_RESET,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device aspeed_clpc2_device = {
+ .name = "aspeed_lpc",
+ .id = 2,
+ .dev = {
+ .dma_mask = &aspeed_lpc_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = aspeed_clpc2_resource,
+ .num_resources = ARRAY_SIZE(aspeed_clpc2_resource),
+};
+
+static struct resource aspeed_clpc3_resource[] = {
+ [0] = {
+ .start = AST_CLPC4_BASE,
+ .end = AST_CLPC4_BASE + SZ_4K,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_N4_KCS,
+ .end = IRQ_N4_KCS,
+ .flags = IORESOURCE_IRQ,
+ },
+ [2] = {
+ .start = IRQ_N4_UART,
+ .end = IRQ_N4_UART,
+ .flags = IORESOURCE_IRQ,
+ },
+ [3] = {
+ .start = IRQ_N4_MAILBOX,
+ .end = IRQ_N4_MAILBOX,
+ .flags = IORESOURCE_IRQ,
+ },
+ [4] = {
+ .start = IRQ_N4_PORT80,
+ .end = IRQ_N4_PORT80,
+ .flags = IORESOURCE_IRQ,
+ },
+ [4] = {
+ .start = IRQ_N4_RESET,
+ .end = IRQ_N4_RESET,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device aspeed_clpc3_device = {
+ .name = "aspeed_lpc",
+ .id = 3,
+ .dev = {
+ .dma_mask = &aspeed_lpc_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = aspeed_clpc3_resource,
+ .num_resources = ARRAY_SIZE(aspeed_clpc3_resource),
+};
+
+void __init aspeed_add_device_clpc(void)
+{
+// it should enable at u-boot
+// aspeed_scu_init_lpc();
+
+ platform_device_register(&aspeed_clpc0_device);
+ platform_device_register(&aspeed_clpc1_device);
+ platform_device_register(&aspeed_clpc2_device);
+ platform_device_register(&aspeed_clpc3_device);
+}
+#else
+void __init aspeed_add_device_clpc(void) {}
+#endif
+
diff --git a/arch/arm/plat-aspeed/dev-cuart.c b/arch/arm/plat-aspeed/dev-cuart.c
new file mode 100644
index 000000000000..8731f7c27e33
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-cuart.c
@@ -0,0 +1,197 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-cuart.c
+* Author : Ryan chen
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/09/15 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/serial.h>
+#include <linux/tty.h>
+#include <linux/serial_8250.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <mach/hardware.h>
+#include <mach/ast-uart-dma.h>
+
+#include <plat/ast1070-devs.h>
+#include <plat/ast1070-scu.h>
+
+/* --------------------------------------------------------------------
+ * UART
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_ARCH_AST1070)
+static struct ast_uart_dma_data c0_uart0_dma_data = {
+ .chip_no = 0,
+ .dma_ch = 0,
+};
+
+static struct ast_uart_dma_data c0_uart1_dma_data = {
+ .chip_no = 0,
+ .dma_ch = 1,
+};
+
+static struct ast_uart_dma_data c0_uart2_dma_data = {
+ .chip_no = 0,
+ .dma_ch = 2,
+};
+
+static struct ast_uart_dma_data c0_uart3_dma_data = {
+ .chip_no = 0,
+ .dma_ch = 3,
+};
+
+#if (CONFIG_AST1070_NR >=2)
+static struct ast_uart_dma_data c1_uart0_dma_data = {
+ .chip_no = 1,
+ .dma_ch = 0,
+};
+
+static struct ast_uart_dma_data c1_uart1_dma_data = {
+ .chip_no = 1,
+ .dma_ch = 1,
+};
+
+static struct ast_uart_dma_data c1_uart2_dma_data = {
+ .chip_no = 1,
+ .dma_ch = 2,
+};
+
+static struct ast_uart_dma_data c1_uart3_dma_data = {
+ .chip_no = 1,
+ .dma_ch = 3,
+};
+#endif
+
+static struct plat_serial8250_port ast1070_c_uart_data[] = {
+ {
+ .mapbase = AST_C0_UART0_BASE,
+ .membase = (char*)(IO_ADDRESS2(AST_C0_UART0_BASE)),
+ .irq = IRQ_C0_N1_UART,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ .private_data = &c0_uart0_dma_data,
+ },
+ {
+ .mapbase = AST_C0_UART1_BASE,
+ .membase = (char*)(IO_ADDRESS2(AST_C0_UART1_BASE)),
+ .irq = IRQ_C0_N2_UART,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ .private_data = &c0_uart1_dma_data,
+ },
+ {
+ .mapbase = AST_C0_UART2_BASE,
+ .membase = (char*)(IO_ADDRESS2(AST_C0_UART2_BASE)),
+ .irq = IRQ_C0_N3_UART,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ .private_data = &c0_uart2_dma_data,
+ },
+ {
+ .mapbase = AST_C0_UART3_BASE,
+ .membase = (char*)(IO_ADDRESS2(AST_C0_UART3_BASE)),
+ .irq = IRQ_C0_N4_UART,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ .private_data = &c0_uart3_dma_data,
+ },
+#if (CONFIG_AST1070_NR >=2)
+ {
+ .mapbase = AST_C1_UART0_BASE,
+ .membase = (char*)(IO_ADDRESS2(AST_C1_UART0_BASE)),
+ .irq = IRQ_C1_N1_UART,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ .private_data = &c1_uart0_dma_data,
+ },
+ {
+ .mapbase = AST_C1_UART1_BASE,
+ .membase = (char*)(IO_ADDRESS2(AST_C1_UART1_BASE)),
+ .irq = IRQ_C1_N2_UART,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ .private_data = &c1_uart1_dma_data,
+ },
+ {
+ .mapbase = AST_C1_UART2_BASE,
+ .membase = (char*)(IO_ADDRESS2(AST_C1_UART2_BASE)),
+ .irq = IRQ_C1_N3_UART,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ .private_data = &c1_uart2_dma_data,
+ },
+ {
+ .mapbase = AST_C1_UART3_BASE,
+ .membase = (char*)(IO_ADDRESS2(AST_C1_UART3_BASE)),
+ .irq = IRQ_C1_N4_UART,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ .private_data = &c1_uart3_dma_data,
+ },
+#endif
+ { },
+};
+
+struct platform_device ast1070_c_uart_device = {
+#ifdef CONFIG_SERIAL_AST_DMA_UART
+ .name = "ast-uart-dma",
+#else
+ .name = "serial8250",
+#endif
+ .id = PLAT8250_DEV_PLATFORM1,
+ .dev = {
+ .platform_data = ast1070_c_uart_data,
+ },
+};
+
+void __init ast_add_device_cuart(void)
+{
+ int i;//j;
+ for(i=0;i<CONFIG_AST1070_NR;i++) {
+ //reset 4 UART
+ ast1070_scu_init_uart(i);
+ //Please don't enable : Feature remove
+// for(j=0;j<4;j++)
+// ast1070_multi_func_uart(i, j);
+ }
+
+ platform_device_register(&ast1070_c_uart_device);
+}
+#else
+void __init ast_add_device_cuart(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-ehci.c b/arch/arm/plat-aspeed/dev-ehci.c
new file mode 100644
index 000000000000..8c34a6335142
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-ehci.c
@@ -0,0 +1,73 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-ehci.c
+* Author : Ryan chen
+* Description : ASPEED EHCI Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/07/30 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+
+/* --------------------------------------------------------------------
+ * EHCI
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_USB_EHCI_AST) || defined(CONFIG_USB_EHCI_AST_MODULE)
+static struct resource ast_echi_resource[] = {
+ [0] = {
+ .start = AST_EHCI_BASE,
+ .end = AST_EHCI_BASE + SZ_256,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_EHCI,
+ .end = IRQ_EHCI,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 ast_ehci_dma_mask = 0xffffffffUL;
+
+static struct platform_device ast_ehci_device = {
+ .name = "ehci-ast",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_ehci_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = ast_echi_resource,
+ .num_resources = ARRAY_SIZE(ast_echi_resource),
+};
+
+void __init ast_add_device_ehci(void)
+{
+ ast_scu_multi_func_usb20_host_hub(1);
+ ast_scu_init_usb20();
+
+ platform_device_register(&ast_ehci_device);
+}
+#else
+void __init ast_add_device_ehci(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-eth.c b/arch/arm/plat-aspeed/dev-eth.c
new file mode 100644
index 000000000000..5d33e3364810
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-eth.c
@@ -0,0 +1,201 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-eth.c
+* Author : Ryan Chen
+* Description : Aspeed Ethernet Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/24 Ryan Chen initial
+*
+********************************************************************************/
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <mach/ftgmac100_drv.h>
+
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+/* --------------------------------------------------------------------
+ * Ethernet
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_ASPEEDMAC) || defined(CONFIG_ASPEEDMAC_MODULE)
+#ifdef AST_MAC0_BASE
+static struct ftgmac100_eth_data ast_eth0_data = {
+ .dev_addr = { 0x00, 0x84, 0x14, 0xA0, 0xB0, 0x22},
+ .phy_id = 1,
+};
+
+static u64 ast_eth_dmamask = 0xffffffffUL;
+static struct resource ast_mac0_resources[] = {
+ [0] = {
+ .start = AST_MAC0_BASE,
+ .end = AST_MAC0_BASE + SZ_128K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_MAC0,
+ .end = IRQ_MAC0,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device ast_eth0_device = {
+ .name = "ast_gmac",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_eth_dmamask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_eth0_data,
+ },
+ .resource = ast_mac0_resources,
+ .num_resources = ARRAY_SIZE(ast_mac0_resources),
+};
+#endif
+#ifdef AST_MAC1_BASE
+static struct ftgmac100_eth_data ast_eth1_data = {
+ .dev_addr = { 0x00, 0x84, 0x14, 0xA0, 0xB0, 0x23},
+ .phy_id = 1,
+};
+
+static struct resource ast_mac1_resources[] = {
+ [0] = {
+ .start = AST_MAC1_BASE,
+ .end = AST_MAC1_BASE + SZ_128K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_MAC1,
+ .end = IRQ_MAC1,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device ast_eth1_device = {
+ .name = "ast_gmac",
+ .id = 1,
+ .dev = {
+ .dma_mask = &ast_eth_dmamask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_eth1_data,
+ },
+ .resource = ast_mac1_resources,
+ .num_resources = ARRAY_SIZE(ast_mac1_resources),
+};
+#endif
+
+/*
+ * MAC1 always has MII MDC+MDIO pins to access PHY registers. We assume MAC1
+ * always has a PHY chip, if MAC1 is enabled.
+ * U-Boot can enable MAC2 MDC+MDIO pins for a 2nd PHY, or MAC2 might be
+ * disabled (only one port), or it's sideband-RMII which has no PHY chip.
+ *
+ * Return miiPhyId==0 if the MAC cannot be accessed.
+ * Return miiPhyId==1 if the MAC registers are OK but it cannot carry traffic.
+ * Return miiPhyId==2 if the MAC can send/receive but it has no PHY chip.
+ * Else return the PHY 22-bit vendor ID, 6-bit model and 4-bit revision.
+ */
+
+void __init ast_add_device_gmac(void)
+{
+
+ u8 phy_mode,phy_inter;
+ u32 isRevA0;
+ u32 rev_id;
+
+ rev_id = ast_scu_revision_id() & 0xff;
+
+
+ if (rev_id >= 0x08 && rev_id <= 0x0f) {
+ // AST2100 FPGA board: up to 10 means rev.A0, 11 means rev.A1
+ isRevA0 = (rev_id < 11);
+ } else {
+ // Real silicon: rev.A0 has 0x00 in bits[7:0]. rev A2 = 0x02 in bits[7:0]
+ isRevA0 = 0; //((regVal & 0x00ff) == 0x00);
+// out->isRevA2 = 1; //((regVal & 0x00ff) == 0x02);
+ }
+
+ ast_eth0_data.DF_support = !isRevA0;
+
+ ast_scu_init_eth(0);
+ ast_scu_multi_func_eth(0);
+
+
+ /*
+ * D[15:11] in 0x1E6E2040 is NCSI scratch from U-Boot. D[15:14] = MAC1, D[13:12] = MAC2
+ * The meanings of the 2 bits are:
+ * 00(0): Dedicated PHY
+ * 01(1): ASPEED's EVA + INTEL's NC-SI PHY chip EVA
+ * 10(2): ASPEED's MAC is connected to NC-SI PHY chip directly
+ * 11: Reserved
+ */
+
+ phy_mode = ast_scu_get_phy_config(0);
+ switch(phy_mode) {
+ case 0:
+ ast_eth0_data.INTEL_NCSI_EVA_support = 0;
+ ast_eth0_data.NCSI_support = 0;
+ break;
+ case 1:
+ ast_eth0_data.NCSI_support = 1;
+ break;
+ case 2:
+ ast_eth0_data.INTEL_NCSI_EVA_support = 1;
+ break;
+
+ }
+
+ phy_inter = ast_scu_get_phy_interface(0);
+
+ // We assume the Clock Stop register does not disable the MAC1 or MAC2 clock
+ // unless Reset Control also holds the MAC in reset.
+
+
+ platform_device_register(&ast_eth0_device);
+
+#ifdef AST_MAC1_BASE
+ ast_scu_init_eth(1);
+ ast_scu_multi_func_eth(1);
+
+ ast_eth1_data.DF_support = !isRevA0;
+
+ phy_mode = ast_scu_get_phy_config(1);
+ switch(phy_mode) {
+ case 0:
+ ast_eth1_data.INTEL_NCSI_EVA_support = 0;
+ ast_eth1_data.NCSI_support = 0;
+ break;
+ case 1:
+ ast_eth1_data.NCSI_support = 1;
+ break;
+ case 2:
+ ast_eth1_data.INTEL_NCSI_EVA_support = 1;
+ break;
+
+ }
+ phy_inter = ast_scu_get_phy_interface(1);
+
+ platform_device_register(&ast_eth1_device);
+
+#endif
+
+}
+#else
+void __init ast_add_device_gmac(void) {}
+#endif
+
diff --git a/arch/arm/plat-aspeed/dev-fb.c b/arch/arm/plat-aspeed/dev-fb.c
new file mode 100644
index 000000000000..3673160db44e
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-fb.c
@@ -0,0 +1,80 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-fb.c
+* Author : Ryan Chen
+* Description : ASPEED Frambuffer Driver
+*
+* Copyright (C) ASPEED Tech. Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/12/15 Ryan Chen initial
+*
+********************************************************************************/
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+#include <mach/ast_lcd.h>
+
+/* --------------------------------------------------------------------
+ * ASPEED FB
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_FB_AST) || defined(CONFIG_FB_AST_MODULE)
+static struct ast_fb_plat_data fb_plat_data = {
+ .get_clk = ast_get_d2_pll_clk,
+};
+
+
+static struct resource ast_fb_resources[] = {
+ [0] = {
+ .start = AST_GRAPHIC_BASE,
+ .end = AST_GRAPHIC_BASE + SZ_1K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_CRT,
+ .end = IRQ_CRT,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 ast_device_fb_dmamask = 0xffffffffUL;
+struct platform_device ast_fb_device = {
+ .name = "ast-fb",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_device_fb_dmamask,
+ .coherent_dma_mask = 0xffffffffUL,
+ .platform_data= &fb_plat_data,
+ },
+ .resource = ast_fb_resources,
+ .num_resources = ARRAY_SIZE(ast_fb_resources),
+};
+
+void __init ast_add_device_fb(void)
+{
+ ast_scu_multi_func_crt();
+
+ ast_scu_init_crt();
+
+ platform_device_register(&ast_fb_device);
+}
+#else
+void __init ast_add_device_fb(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-gpio.c b/arch/arm/plat-aspeed/dev-gpio.c
new file mode 100644
index 000000000000..356fd5396a0a
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-gpio.c
@@ -0,0 +1,68 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-rtc.c
+* Author : Ryan chen
+* Description : Socle Real Time Clock Device (RTC)
+*
+* Copyright (C) Socle Tech. Corp.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2010/09/15 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/regs-gpio.h>
+
+#include <plat/devs.h>
+
+/* --------------------------------------------------------------------
+ * ASPEED GPIO
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_GPIO_AST) || defined(CONFIG_GPIO_AST_MODULE)
+static struct resource ast_gpio_resource[] = {
+ [0] = {
+ .start = AST_GPIO_BASE,
+ .end = AST_GPIO_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_GPIO,
+ .end = IRQ_GPIO,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device ast_device_gpio = {
+ .name = "ast-gpio",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(ast_gpio_resource),
+ .resource = ast_gpio_resource,
+};
+
+extern void __init
+ast_add_device_gpio(void)
+{
+ platform_device_register(&ast_device_gpio);
+}
+
+#else
+extern void __init ast_add_device_gpio(void) {}
+#endif
+
diff --git a/arch/arm/plat-aspeed/dev-i2c.c b/arch/arm/plat-aspeed/dev-i2c.c
new file mode 100644
index 000000000000..47cd15249b10
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-i2c.c
@@ -0,0 +1,669 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-i2c.c
+* Author : Ryan chen
+* Description : ASPEED I2C Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/07/30 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <asm/io.h>
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/ast_i2c.h>
+#include <plat/devs.h>
+#include <plat/regs-iic.h>
+#include <plat/ast-scu.h>
+
+/* --------------------------------------------------------------------
+ * I2C
+ * -------------------------------------------------------------------- */
+#ifdef AST_I2C_DEBUG
+#define I2CDBUG(fmt, args...) printk("%s() " fmt, __FUNCTION__, ## args)
+#else
+#define I2CDBUG(fmt, args...)
+#endif
+
+#if defined(CONFIG_I2C_AST) || defined(CONFIG_I2C_AST_MODULE)
+
+#if defined (CONFIG_ARCH_AST2400)
+#define I2C_PAGE_SIZE 8
+struct buf_page page_info[I2C_PAGE_SIZE] =
+{
+ [0] = {
+ .flag = 0,
+ .page_no = 0,
+ .page_size = 256,
+ .page_addr_point = 0,
+ },
+ [1] = {
+ .flag = 0,
+ .page_no = 1,
+ .page_size = 256,
+ .page_addr_point = 0,
+ },
+ [2] = {
+ .flag = 0,
+ .page_no = 2,
+ .page_size = 256,
+ .page_addr_point = 0,
+ },
+ [3] = {
+ .flag = 0,
+ .page_no = 3,
+ .page_size = 256,
+ .page_addr_point = 0,
+ },
+ [4] = {
+ .flag = 0,
+ .page_no = 4,
+ .page_size = 256,
+ .page_addr_point = 0,
+ },
+ [5] = {
+ .flag = 0,
+ .page_no = 5,
+ .page_size = 256,
+ .page_addr_point = 0,
+ },
+ [6] = {
+ .flag = 0,
+ .page_no = 6,
+ .page_size = 256,
+ .page_addr_point = 0,
+ },
+ [7] = {
+ .flag = 0,
+ .page_no = 7,
+ .page_size = 256,
+ .page_addr_point = 0,
+ },
+};
+
+static void pool_buff_page_init(u32 buf_pool_addr)
+{
+ u32 offset;
+ int i ,j;
+
+ for(i=0;i<I2C_PAGE_SIZE;i++) {
+ offset = 0;
+ for(j=0;j<i;j++)
+ offset += page_info[i].page_size;
+
+ page_info[i].page_addr = buf_pool_addr + offset;
+// I2CDBUG( "page[%d],addr :%x \n", i, page_info[i].page_addr);
+ }
+
+}
+
+static u8 request_pool_buff_page(struct buf_page **req_page)
+{
+ int i;
+ //TODO
+ spinlock_t lock;
+ spin_lock(&lock);
+ for(i=0;i<I2C_PAGE_SIZE;i++) {
+ if(page_info[i].flag ==0) {
+ page_info[i].flag = 1;
+ *req_page = &page_info[i];
+// I2CDBUG( "request page addr %x \n", page_info[i].page_addr);
+ break;
+ }
+ }
+ spin_unlock(&lock);
+ return 0;
+}
+
+static void free_pool_buff_page(struct buf_page *req_page)
+{
+ req_page->flag = 0;
+// I2CDBUG( "free page addr %x \n", req_page->page_addr);
+ req_page = NULL;
+}
+
+#elif defined (CONFIG_ARCH_AST2300)
+#define I2C_PAGE_SIZE 5
+
+struct buf_page page_info[I2C_PAGE_SIZE] =
+{
+ [0] = {
+ .flag = 0,
+ .page_size = 128,
+ },
+ [1] = {
+ .flag = 0,
+ .page_size = 32,
+ },
+ [2] = {
+ .flag = 0,
+ .page_size = 32,
+ },
+ [3] = {
+ .flag = 0,
+ .page_size = 32,
+ },
+ [4] = {
+ .flag = 0,
+ .page_size = 32,
+ },
+};
+
+static void pool_buff_page_init(u32 buf_pool_addr)
+{
+
+ u32 offset;
+ int i ,j;
+
+ for(i=0;i<I2C_PAGE_SIZE;i++) {
+ offset = 0;
+ for(j=0;j<i;j++)
+ offset += page_info[i].page_size;
+
+ page_info[i].page_addr = buf_pool_addr + offset;
+ page_info[i].page_addr_point = page_info[i].page_addr/4;
+// printk("page[%d],addr :%x , point : %d\n", i, page_info[i].page_addr, page_info[i].page_addr_point);
+ }
+}
+
+static u8 request_pool_buff_page(struct buf_page **req_page)
+{
+ int i;
+ //TODO
+ spinlock_t lock;
+ spin_lock(&lock);
+ for(i=0;i<I2C_PAGE_SIZE;i++) {
+ if(page_info[i].flag ==0) {
+ page_info[i].flag = 1;
+ *req_page = &page_info[i];
+ spin_unlock(&lock);
+ return 1;
+ }
+ }
+ spin_unlock(&lock);
+ return 0;
+
+}
+
+//TODO check free ?
+static void free_pool_buff_page(struct buf_page *req_page)
+{
+ req_page->flag = 0;
+ req_page = NULL;
+}
+
+#else
+//DO nothing
+static void pool_buff_page_init(void) {}
+static u8 request_pool_buff_page(struct buf_page **req_page) {return 0;}
+static void free_pool_buff_page(struct buf_page *req_page) {}
+#endif
+
+static struct ast_i2c_driver_data ast_i2c_data = {
+ .bus_clk = 100000, //bus clock 100KHz
+ .master_dma = BUFF_MODE,
+ .slave_dma = BYTE_MODE,
+ .request_pool_buff_page = request_pool_buff_page,
+ .free_pool_buff_page = free_pool_buff_page,
+#ifdef CONFIG_AST_I2C_SLAVE_MODE
+ .slave_xfer = i2c_slave_xfer,
+ .slave_init = i2c_slave_init,
+#endif
+ .get_i2c_clock = ast_get_pclk,
+};
+
+static u64 ast_i2c_dma_mask = 0xffffffffUL;
+static struct resource ast_i2c_dev1_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE1,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE1 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev1_device = {
+ .name = "ast-i2c",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev1_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev1_resources),
+};
+
+static struct resource ast_i2c_dev2_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE2,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE2 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev2_device = {
+ .name = "ast-i2c",
+ .id = 1,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev2_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev2_resources),
+};
+
+static struct resource ast_i2c_dev3_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE3,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE3 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev3_device = {
+ .name = "ast-i2c",
+ .id = 2,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev3_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev3_resources),
+};
+
+static struct resource ast_i2c_dev4_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE4,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE4 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev4_device = {
+ .name = "ast-i2c",
+ .id = 3,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev4_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev4_resources),
+};
+
+static struct resource ast_i2c_dev5_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE5,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE5 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev5_device = {
+ .name = "ast-i2c",
+ .id = 4,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev5_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev5_resources),
+};
+
+static struct resource ast_i2c_dev6_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE6,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE6 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev6_device = {
+ .name = "ast-i2c",
+ .id = 5,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev6_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev6_resources),
+};
+
+static struct resource ast_i2c_dev7_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE7,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE7 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev7_device = {
+ .name = "ast-i2c",
+ .id = 6,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev7_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev7_resources),
+};
+
+static struct resource ast_i2c_dev8_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE8,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE8 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev8_device = {
+ .name = "ast-i2c",
+ .id = 7,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev8_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev8_resources),
+};
+
+static struct resource ast_i2c_dev9_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE9,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE9 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev9_device = {
+ .name = "ast-i2c",
+ .id = 8,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev9_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev9_resources),
+};
+
+#if defined(CONFIG_ARCH_AST2400)
+static struct resource ast_i2c_dev10_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE10,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE10 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev10_device = {
+ .name = "ast-i2c",
+ .id = 9,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev10_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev10_resources),
+};
+
+static struct resource ast_i2c_dev11_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE11,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE11 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev11_device = {
+ .name = "ast-i2c",
+ .id = 10,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev11_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev11_resources),
+};
+
+static struct resource ast_i2c_dev12_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE12,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE12 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev12_device = {
+ .name = "ast-i2c",
+ .id = 11,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev12_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev12_resources),
+};
+
+static struct resource ast_i2c_dev13_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE13,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE13 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev13_device = {
+ .name = "ast-i2c",
+ .id = 12,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev13_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev13_resources),
+};
+
+static struct resource ast_i2c_dev14_resources[] = {
+ [0] = {
+ .start = AST_I2C_BASE + AST_I2C_DEVICE14,
+ .end = AST_I2C_BASE + AST_I2C_DEVICE14 + 4*SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_I2C,
+ .end = IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_i2c_dev14_device = {
+ .name = "ast-i2c",
+ .id = 13,
+ .dev = {
+ .dma_mask = &ast_i2c_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_i2c_data,
+ },
+ .resource = ast_i2c_dev14_resources,
+ .num_resources = ARRAY_SIZE(ast_i2c_dev14_resources),
+};
+#endif
+
+/*--------- I2C Board devices ------------*/
+//ASPEED AST2300 EVB I2C Device
+#if defined(CONFIG_ARCH_AST2300) || defined(CONFIG_ARCH_AST2400)
+//Under I2C Dev 1
+static struct i2c_board_info __initdata ast_i2c_board_info_1[] = {
+ {
+ I2C_BOARD_INFO("cat9883", 0x4d),
+ }
+};
+
+//Under I2C Dev 4
+static struct i2c_board_info __initdata ast_i2c_board_info_4[] = {
+ {
+ I2C_BOARD_INFO("24c128", 0x50),
+
+
+ }
+};
+//Under I2C Dev 8
+static struct i2c_board_info __initdata ast_i2c_board_info_8[] = {
+ {
+ I2C_BOARD_INFO("lm75b", 0x4a),
+ }
+};
+
+#endif
+
+/*-------------------------------------*/
+void __init ast_add_device_i2c(void)
+{
+ //I2C Multi-Pin
+ ast_scu_multi_func_i2c();
+
+ //SCU I2C Reset
+ ast_scu_init_i2c();
+
+ ast_i2c_data.reg_gr = ioremap(AST_I2C_BASE, 4*SZ_16);
+ if (!ast_i2c_data.reg_gr) {
+ printk("ast_add_device_i2c ERROR \n");
+ return;
+ }
+
+#if defined (CONFIG_ARCH_AST2400)
+ ast_i2c_data.buf_pool= ioremap(AST_I2C_BASE+0x800, 2048);
+ if (!ast_i2c_data.buf_pool) {
+ printk("ast_add_device_i2c ERROR \n");
+ return;
+ }
+#else
+ ast_i2c_data.buf_pool = ioremap(AST_I2C_BASE+0x200, 256);
+ if (!ast_i2c_data.buf_pool) {
+ printk("ast_add_device_i2c ERROR \n");
+ return;
+ }
+#endif
+ //TODO
+ pool_buff_page_init(ast_i2c_data.buf_pool);
+ platform_device_register(&ast_i2c_dev1_device);
+ i2c_register_board_info(0, ast_i2c_board_info_1, ARRAY_SIZE(ast_i2c_board_info_1));
+ platform_device_register(&ast_i2c_dev2_device);
+ platform_device_register(&ast_i2c_dev3_device);
+ platform_device_register(&ast_i2c_dev4_device);
+ i2c_register_board_info(3, ast_i2c_board_info_4, ARRAY_SIZE(ast_i2c_board_info_4));
+ platform_device_register(&ast_i2c_dev5_device);
+ platform_device_register(&ast_i2c_dev6_device);
+ platform_device_register(&ast_i2c_dev7_device);
+ platform_device_register(&ast_i2c_dev8_device);
+ i2c_register_board_info(7, ast_i2c_board_info_8, ARRAY_SIZE(ast_i2c_board_info_8));
+ platform_device_register(&ast_i2c_dev9_device);
+
+#if defined(CONFIG_ARCH_AST2400)
+ platform_device_register(&ast_i2c_dev10_device);
+#if defined(CONFIG_MMC_AST)
+ //Due to share pin with SD
+#else
+ platform_device_register(&ast_i2c_dev11_device);
+ platform_device_register(&ast_i2c_dev12_device);
+ platform_device_register(&ast_i2c_dev13_device);
+ platform_device_register(&ast_i2c_dev14_device);
+#endif
+#endif
+}
+#else
+void __init ast_add_device_i2c(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-kcs.c b/arch/arm/plat-aspeed/dev-kcs.c
new file mode 100644
index 000000000000..726dbf7551fc
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-kcs.c
@@ -0,0 +1,129 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-kcs.c
+* Author : Ryan chen
+* Description : ASPEED KCS
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/11/29 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+/* --------------------------------------------------------------------
+ * KCS
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_AST_KCS) || defined(CONFIG_AST_KCS_MODULE)
+static u64 ast_kcs_dma_mask = 0xffffffffUL;
+
+static struct resource ast_kcs0_resource[] = {
+ [0] = {
+ .start = AST_LPC_BASE,
+ .end = AST_LPC_BASE + SZ_256,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_LPC,
+ .end = IRQ_LPC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device ast_kcs0_device = {
+ .name = "ast-kcs",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_kcs_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = ast_kcs0_resource,
+ .num_resources = ARRAY_SIZE(ast_kcs0_resource),
+};
+
+static struct resource ast_kcs1_resource[] = {
+ [0] = {
+ .start = AST_LPC_BASE,
+ .end = AST_LPC_BASE + SZ_256,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_LPC,
+ .end = IRQ_LPC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device ast_kcs1_device = {
+ .name = "ast-kcs",
+ .id = 1,
+ .dev = {
+ .dma_mask = &ast_kcs_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = ast_kcs1_resource,
+ .num_resources = ARRAY_SIZE(ast_kcs1_resource),
+};
+
+static struct resource ast_kcs2_resource[] = {
+ [0] = {
+ .start = AST_LPC_BASE,
+ .end = AST_LPC_BASE + SZ_256,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_LPC,
+ .end = IRQ_LPC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device ast_kcs2_device = {
+ .name = "ast-kcs",
+ .id = 2,
+ .dev = {
+ .dma_mask = &ast_kcs_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = ast_kcs2_resource,
+ .num_resources = ARRAY_SIZE(ast_kcs2_resource),
+};
+
+void __init ast_add_device_kcs(void)
+{
+// platform_device_register(&ast_kcs0_device);
+// platform_device_register(&ast_kcs1_device);
+ platform_device_register(&ast_kcs2_device);
+}
+#else
+void __init ast_add_device_kcs(void) {}
+#endif
+
diff --git a/arch/arm/plat-aspeed/dev-lpc.c b/arch/arm/plat-aspeed/dev-lpc.c
new file mode 100644
index 000000000000..50eb4e6b9a03
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-lpc.c
@@ -0,0 +1,105 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-lpc.c
+* Author : Ryan chen
+* Description : ASPEED LPC Controller
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/11/29 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+
+/* --------------------------------------------------------------------
+ * LPC
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_LPC) || defined(CONFIG_LPC_MODULE)
+static struct resource ast_lpc_resource[] = {
+ [0] = {
+ .start = AST_LPC_BASE,
+ .end = AST_LPC_BASE + SZ_4K,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_LPC,
+ .end = IRQ_LPC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 ast_lpc_dma_mask = 0xffffffffUL;
+
+static struct platform_device ast_lpc_device = {
+ .name = "ast_lpc",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_lpc_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = ast_lpc_resource,
+ .num_resources = ARRAY_SIZE(ast_lpc_resource),
+};
+
+static struct resource ast_lpc_plus_resource[] = {
+ [0] = {
+ .start = AST_LPC_PLUS_BASE,
+ .end = AST_LPC_PLUS_BASE + SZ_4K,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_lpc_plus_device = {
+ .name = "ast_lpc_plus",
+ .id = 1,
+ .dev = {
+ .dma_mask = &ast_lpc_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = ast_lpc_plus_resource,
+ .num_resources = ARRAY_SIZE(ast_lpc_plus_resource),
+};
+
+void __init ast_add_device_lpc(void)
+{
+// it should enable at u-boot
+// ast_scu_init_lpc();
+
+ platform_device_register(&ast_lpc_device);
+ platform_device_register(&ast_lpc_plus_device);
+}
+#else
+void __init ast_add_device_lpc(void) {}
+#endif
+
diff --git a/arch/arm/plat-aspeed/dev-mbx.c b/arch/arm/plat-aspeed/dev-mbx.c
new file mode 100644
index 000000000000..75baf87b62ec
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-mbx.c
@@ -0,0 +1,79 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-mbx.c
+* Author : Ryan chen
+* Description : ASPEED MailBox Controller
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/11/29 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+/* --------------------------------------------------------------------
+ * MailBox
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_AST_MBX) || defined(CONFIG_AST_MBX_MODULE)
+static struct resource ast_mbx_resource[] = {
+ [0] = {
+ .start = AST_MBX_BASE,
+ .end = AST_MBX_BASE + SZ_256,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_MAILBOX,
+ .end = IRQ_MAILBOX,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 ast_mbx_dma_mask = 0xffffffffUL;
+
+static struct platform_device ast_mbx_device = {
+ .name = "ast-mailbox",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_mbx_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = ast_mbx_resource,
+ .num_resources = ARRAY_SIZE(ast_mbx_resource),
+};
+
+void __init ast_add_device_mailbox(void)
+{
+ platform_device_register(&ast_mbx_device);
+}
+#else
+void __init ast_add_device_mailbox(void) {}
+#endif
+
diff --git a/arch/arm/plat-aspeed/dev-nand.c b/arch/arm/plat-aspeed/dev-nand.c
new file mode 100644
index 000000000000..f11ff3147f39
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-nand.c
@@ -0,0 +1,331 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-nand.c
+* Author : Ryan chen
+* Description : ASPEED NAND Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/10/15 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <asm/mach/flash.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/regs-fmc.h>
+#include <asm/io.h>
+
+#include <linux/mtd/nand.h>
+
+#include <plat/ast-scu.h>
+#include <linux/mtd/mtd.h>
+
+
+
+/* --------------------------------------------------------------------
+ * NAND Flash
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_MTD_NAND_AST) || defined(CONFIG_MTD_NAND_AST_MODULE)
+static void __iomem *fmc_regs;
+
+/* returns 0 if the nand is busy, returns 1 if the nand is ready */
+static int
+ast_nand_dev_ready(struct mtd_info *mtd)
+{
+ int status;
+ status = (readl(fmc_regs + FMC_MISC_CTRL1) & READ_BUSY_PIN_STS) >> 3;
+ return status;
+}
+
+/* We use 2 256bytes as ECC's data length in sample code */
+static void
+ast_enable_hwecc(struct mtd_info *mtd, int cmd)
+{
+ writel(NAND_ECC_DATA_BLK_256 | NAND_ECC_ENABLE , fmc_regs + FMC_NAND_ECC);
+
+ writel(NAND_ECC_RESET , fmc_regs + FMC_NAND_ECC);
+
+ writel(NAND_ECC_DATA_BLK_256 | NAND_ECC_ENABLE , fmc_regs + FMC_NAND_ECC);
+}
+
+static int
+ast_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
+{
+ uint32_t ecc_1, ecc_2, ecc_3;
+
+ ecc_1 = readl(fmc_regs + FMC_NAND_ECC_GEN1);
+ ecc_2 = readl(fmc_regs + FMC_NAND_ECC_GEN2);
+ ecc_3 = readl(fmc_regs + FMC_NAND_ECC_GEN3);
+
+ ecc_code[0] = ecc_1;
+ ecc_code[1] = ecc_1 >> 8;
+ ecc_code[2] = ecc_1 >> 16;
+ ecc_code[3] = ecc_1 >> 24;
+ ecc_code[4] = ecc_2;
+ ecc_code[5] = (((ecc_2 >> 8) & 0x0F) | 0xF0); //Becase flash's data value will be 0xff after flash is erased. The 256bytes mode will use 44bits to do ECC, the software needs to add 0xF0 for the last 4 bits.
+
+ return 0;
+}
+
+static int
+ast_nand_correct_data(struct mtd_info *mtd, u_char *dat,
+ u_char *read_ecc, u_char *calc_ecc)
+{
+ unsigned int dw_read_data[3], dw_calc_data[3];
+ unsigned int data1_check_status, data2_check_status;
+ unsigned int i, ecc_position, ecc_bit;
+
+ for (i = 0; i < 3; i++) {
+ dw_read_data[i] = 0;
+ dw_calc_data[i] = 0;
+ }
+ memcpy (dw_read_data, read_ecc, 6);
+ memcpy (dw_calc_data, calc_ecc, 6);
+ for (i = 0; i < 2; i++) {
+ writel(dw_read_data[i], fmc_regs + FMC_NAND_ECC_CK1 + (i*4));
+ writel(dw_calc_data[i], fmc_regs + FMC_NAND_ECC_GEN1 + (i*4));
+ }
+
+ data1_check_status = readl(fmc_regs + FMC_NAND_ECC_CK_R1) & 0xffff;
+ data2_check_status = (readl(fmc_regs + FMC_NAND_ECC_CK_R1) & 0xffff0000) >> 16;
+
+ if ((data1_check_status & 0x1000) && (data2_check_status & 0x1000)) {
+ return 0;
+ }
+
+ if ((data1_check_status & 0x8000) || (data2_check_status & 0x8000)) {
+ printk(KERN_ERR "uncorrectable error : ");
+ return -1;
+ }
+
+ if ((data1_check_status & 0x4000) || (data2_check_status & 0x4000)) {
+ printk ("error in ecc data\n");
+ return 1; /* error in ecc data; no action needed */
+ }
+
+//Correctable
+ if (data1_check_status & 0x2000) {
+ printk ("correctable in data area 1\n");
+ ecc_position = (data1_check_status & 0xff8) >> 3;
+ ecc_bit = (data1_check_status & 0x07);
+ dat[ecc_position] ^= (1 << ecc_bit);
+ }
+ if (data2_check_status & 0x2000) {
+ printk ("correctable in data area 2\n");
+ ecc_position = (data2_check_status & 0xff8) >> 3;
+ ecc_bit = (data2_check_status & 0x07);
+ dat[128 + ecc_position] ^= (1 << ecc_bit);
+ }
+
+ return 1;
+}
+
+/*---------------------------------------------------------
+ * AST2300 1 NAND * 128MB
+ *--------------------------------------------------------*/
+
+static struct mtd_partition ast_nand_partition_info[] = {
+ [0] = {
+ .name = "ASPEED NAND Flash 0",
+ .offset = 0,
+ .size = SZ_64M,
+ },
+ [1] = {
+ .name = "ASPEED NAND Flash 1",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL
+ },
+};
+
+static const char *ast_nand_part_probes[] = { "cmdlinepart", NULL };
+
+struct platform_nand_data ast_nand_platdata = {
+ .chip = {
+ .nr_chips = 1,
+ .chip_offset = 0,
+ .nr_partitions = ARRAY_SIZE(ast_nand_partition_info),
+ .partitions = ast_nand_partition_info,
+ /* 50 us command delay time */
+ .chip_delay = 50,
+ .options = NAND_NO_AUTOINCR,
+ .part_probe_types = ast_nand_part_probes,
+ },
+ .ctrl = {
+ .hwcontrol = ast_enable_hwecc,
+ .dev_ready = ast_nand_dev_ready,
+ .select_chip = 0,
+ .calculate = ast_calculate_ecc,
+ .correct = ast_nand_correct_data,
+ },
+};
+
+#if defined(CONFIG_AST_CS0_NAND)
+static struct resource ast_nand_resource0[] = {
+ {
+ .start = AST_CS0_DEF_BASE,
+ .end = AST_CS0_DEF_BASE + 0x10000,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nand_device0 = {
+ .name = "ast-nand",
+ .id = 0,
+ .dev = {
+ .platform_data = &ast_nand_platdata,
+ },
+ .num_resources = ARRAY_SIZE(ast_nand_resource0),
+ .resource = ast_nand_resource0,
+};
+#endif
+
+#if defined(CONFIG_AST_CS1_NAND)
+static struct resource ast_nand_resource1[] = {
+ {
+ .start = AST_CS1_DEF_BASE,
+ .end = AST_CS1_DEF_BASE + 0x10000,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nand_device1 = {
+ .name = "ast-nand",
+ .id = 1,
+ .dev = {
+ .platform_data = &ast_nand_platdata,
+ },
+ .num_resources = ARRAY_SIZE(ast_nand_resource1),
+ .resource = ast_nand_resource1,
+};
+#endif
+
+#if defined(CONFIG_AST_CS2_NAND)
+static struct resource ast_nand_resource2[] = {
+ {
+ .start = AST_CS2_DEF_BASE,
+ .end = AST_CS2_DEF_BASE + 0x10000,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nand_device2 = {
+ .name = "ast-nand",
+ .id = 2,
+ .dev = {
+ .platform_data = &ast_nand_platdata,
+ },
+ .num_resources = ARRAY_SIZE(ast_nand_resource2),
+ .resource = ast_nand_resource2,
+};
+#endif
+
+#if defined(CONFIG_AST_CS3_NAND)
+static struct resource ast_nand_resource3[] = {
+ {
+ .start = AST_CS3_DEF_BASE,
+ .end = AST_CS3_DEF_BASE + 0x10000,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nand_device3 = {
+ .name = "ast-nand",
+ .id = 3,
+ .dev = {
+ .platform_data = &ast_nand_platdata,
+ },
+ .num_resources = ARRAY_SIZE(ast_nand_resource3),
+ .resource = ast_nand_resource3,
+};
+#endif
+
+#if defined(CONFIG_AST_CS4_NAND)
+static struct resource ast_nand_resource4[] = {
+ {
+ .start = AST_CS4_DEF_BASE,
+ .end = AST_CS4_DEF_BASE + 0x10000,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nand_device4 = {
+ .name = "ast-nand",
+ .id = 4,
+ .dev = {
+ .platform_data = &ast_nand_platdata,
+ },
+ .num_resources = ARRAY_SIZE(ast_nand_resource4),
+ .resource = ast_nand_resource4,
+};
+#endif
+
+/*-------------------------------------*/
+void __init ast_add_device_nand(void)
+{
+ u32 tmp;
+ fmc_regs = ioremap(AST_FMC_BASE, 4*SZ_16);
+
+ ast_scu_multi_func_nand();
+ writel(0x31 , fmc_regs + FMC_MISC_CTRL1);
+
+#if defined(CONFIG_AST_CS0_NAND)
+ platform_device_register(&ast_nand_device0);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(0)) & FMC_MASK_TYPE_CS(0);
+ writel( tmp | FMC_SET_TYPE_NAND_CS(0), fmc_regs);
+ writel(0x9 , fmc_regs + FMC_CE0_CTRL);
+#endif
+
+#if defined(CONFIG_AST_CS1_NAND)
+ ast_scu_multi_func_romcs(1);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(1)) & FMC_MASK_TYPE_CS(1);
+ writel( tmp | FMC_SET_TYPE_NAND_CS(1), fmc_regs);
+ writel(0x9 , fmc_regs + FMC_CE1_CTRL);
+ platform_device_register(&ast_nand_device1);
+#endif
+#if defined(CONFIG_AST_CS2_NAND)
+ ast_scu_multi_func_romcs(2);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(2)) & FMC_MASK_TYPE_CS(2);
+ writel( tmp | FMC_SET_TYPE_NAND_CS(2), fmc_regs);
+ writel(0x9 , fmc_regs + FMC_CE2_CTRL);
+ platform_device_register(&ast_nand_device2);
+#endif
+#if defined(CONFIG_AST_CS3_NAND)
+ ast_scu_multi_func_romcs(3);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(3)) & FMC_MASK_TYPE_CS(3);
+ writel( tmp | FMC_SET_TYPE_NAND_CS(3), fmc_regs);
+ writel(0x9 , fmc_regs + FMC_CE3_CTRL);
+ platform_device_register(&ast_nand_device3);
+#endif
+#if defined(CONFIG_AST_CS4_NAND)
+ ast_scu_multi_func_romcs(4);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(4)) & FMC_MASK_TYPE_CS(4);
+ writel( tmp | FMC_SET_TYPE_NAND_CS(4), fmc_regs);
+ writel(0x9 , fmc_regs + FMC_CE4_CTRL);
+ platform_device_register(&ast_nand_device4);
+#endif
+ iounmap(fmc_regs);
+
+}
+#else
+void __init ast_add_device_nand(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-nor.c b/arch/arm/plat-aspeed/dev-nor.c
new file mode 100644
index 000000000000..abf49c0df827
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-nor.c
@@ -0,0 +1,219 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-nor.c
+* Author : Ryan chen
+* Description : ASPEED NOR Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/01 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <asm/mach/flash.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/regs-fmc.h>
+#include <asm/io.h>
+#include <plat/ast-scu.h>
+
+
+/* --------------------------------------------------------------------
+ * NOR Flash
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_MTD_AST) || defined(CONFIG_MTD_AST_MODULE)
+/*---------------------------------------------------------
+ * AST2300 1 NOR * 16MB
+ *--------------------------------------------------------*/
+static struct mtd_partition nor_partitions[] = {
+ /* bootloader (U-Boot, etc) in first sector */
+ {
+ .name = "u-boot",
+ .offset = 0,
+ .size = 0x80000,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ },
+ /* kernel */
+ {
+ .name = "kernel",
+ .offset = MTDPART_OFS_APPEND,
+ .size = 0x300000,
+ },
+ /* file system */
+ {
+ .name = "ramdisk",
+ .offset = MTDPART_OFS_APPEND,
+ .size = 0x500000,
+ },
+ {
+ .name = "data",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
+ }
+};
+
+static struct flash_platform_data ast_nor_data = {
+ .map_name = "cfi_probe",
+ .width = 2,
+ .parts = nor_partitions,
+ .nr_parts = ARRAY_SIZE(nor_partitions),
+};
+
+#if defined(CONFIG_AST_CS0_NOR)
+static struct resource ast_nor_resource0[] = {
+ {
+ .start = AST_CS0_DEF_BASE,
+ .end = AST_CS0_DEF_BASE + AST_NOR_SIZE- 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nor_device0 = {
+ .name = "ast-nor",
+ .id = 0,
+ .dev = {
+ .platform_data = &ast_nor_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_nor_resource0),
+ .resource = ast_nor_resource0,
+};
+#endif
+
+#if defined(CONFIG_AST_CS1_NOR)
+static struct resource ast_nor_resource1[] = {
+ {
+ .start = AST_CS1_DEF_BASE,
+ .end = AST_CS1_DEF_BASE + AST_NOR_SIZE- 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nor_device1 = {
+ .name = "ast-nor",
+ .id = 1,
+ .dev = {
+ .platform_data = &ast_nor_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_nor_resource1),
+ .resource = ast_nor_resource1,
+};
+#endif
+
+#if defined(CONFIG_AST_CS2_NOR)
+static struct resource ast_nor_resource2[] = {
+ {
+ .start = AST_CS2_DEF_BASE,
+ .end = AST_CS2_DEF_BASE + AST_NOR_SIZE- 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nor_device2 = {
+ .name = "ast-nor",
+ .id = 2,
+ .dev = {
+ .platform_data = &ast_nor_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_nor_resource2),
+ .resource = ast_nor_resource2,
+};
+#endif
+
+#if defined(CONFIG_AST_CS3_NOR)
+static struct resource ast_nor_resource3[] = {
+ {
+ .start = AST_CS3_DEF_BASE,
+ .end = AST_CS3_DEF_BASE + AST_NOR_SIZE- 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nor_device3 = {
+ .name = "ast-nor",
+ .id = 3,
+ .dev = {
+ .platform_data = &ast_nor_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_nor_resource3),
+ .resource = ast_nor_resource3,
+};
+#endif
+
+#if defined(CONFIG_AST_CS4_NOR)
+static struct resource ast_nor_resource4[] = {
+ {
+ .start = AST_CS4_DEF_BASE,
+ .end = AST_CS4_DEF_BASE + AST_NOR_SIZE- 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ast_nor_device4 = {
+ .name = "ast-nor",
+ .id = 4,
+ .dev = {
+ .platform_data = &ast_nor_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_nor_resource4),
+ .resource = ast_nor_resource4,
+};
+#endif
+
+/*-------------------------------------*/
+void __init ast_add_device_flash(void)
+{
+ void __iomem *fmc_regs = ioremap(AST_FMC_BASE, 4*SZ_16);
+
+ ast_scu_multi_func_nor();
+
+#if defined(CONFIG_AST_CS0_NOR)
+ //Enable NOR ACK
+ ast_scu_multi_func_romcs(0);
+ platform_device_register(&ast_nor_device0);
+ writel((readl(fmc_regs) | FMC_SET_WRITE_CS(0)) & FMC_MASK_TYPE_CS(0), fmc_regs);
+#endif
+#if defined(CONFIG_AST_CS1_NOR)
+ ast_scu_multi_func_romcs(1);
+ writel((readl(fmc_regs) | FMC_SET_WRITE_CS(1)) & FMC_MASK_TYPE_CS(1), fmc_regs);
+ platform_device_register(&ast_nor_device1);
+#endif
+#if defined(CONFIG_AST_CS2_NOR)
+ ast_scu_multi_func_romcs(2);
+ writel((readl(fmc_regs) | FMC_SET_WRITE_CS(2)) & FMC_MASK_TYPE_CS(2), fmc_regs);
+ platform_device_register(&ast_nor_device2);
+#endif
+#if defined(CONFIG_AST_CS3_NOR)
+ ast_scu_multi_func_romcs(3);
+ writel((readl(fmc_regs) | FMC_SET_WRITE_CS(3)) & FMC_MASK_TYPE_CS(3), fmc_regs);
+ platform_device_register(&ast_nor_device3);
+#endif
+#if defined(CONFIG_AST_CS4_NOR)
+ ast_scu_multi_func_romcs(4);
+ writel((readl(fmc_regs) | FMC_SET_WRITE_CS(4)) & FMC_MASK_TYPE_CS(4), fmc_regs);
+ platform_device_register(&ast_nor_device4);
+#endif
+ iounmap(fmc_regs);
+
+}
+#else
+void __init ast_add_device_flash(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-peci.c b/arch/arm/plat-aspeed/dev-peci.c
new file mode 100644
index 000000000000..28ad1a5f119d
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-peci.c
@@ -0,0 +1,68 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-peci.c
+* Author : Ryan chen
+* Description : ASPEED PECI Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/06 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+
+/* --------------------------------------------------------------------
+ * PECI
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_AST_PECI) || defined(CONFIG_AST_PECI_MODULE)
+static struct resource ast_peci_resources[] = {
+ [0] = {
+ .start = AST_PECI_BASE,
+ .end = AST_PECI_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_PECI,
+ .end = IRQ_PECI,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device ast_peci_device = {
+ .name = "ast_peci",
+ .id = 0,
+ .resource = ast_peci_resources,
+ .num_resources = ARRAY_SIZE(ast_peci_resources),
+};
+
+void __init ast_add_device_peci(void)
+{
+ //SCU PECI CTRL Reset
+ ast_scu_init_peci();
+
+ platform_device_register(&ast_peci_device);
+}
+#else
+void __init ast_add_device_peci(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-pwm-fan.c b/arch/arm/plat-aspeed/dev-pwm-fan.c
new file mode 100644
index 000000000000..85570bb6196c
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-pwm-fan.c
@@ -0,0 +1,80 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-pwm-fan.c
+* Author : Ryan chen
+* Description : ASPEED PWM-FAN Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/06 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+#include <mach/ast_pwm_techo.h>
+
+/* --------------------------------------------------------------------
+ * PWM-FAN
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_SENSORS_AST_PWM_FAN) || defined(CONFIG_SENSORS_AST_PWM_FAN_MODULE)
+static struct resource ast_pwm_fan_resources[] = {
+ [0] = {
+ .start = AST_PWM_BASE,
+ .end = AST_PWM_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_TACHO,
+ .end = IRQ_TACHO,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct ast_pwm_driver_data ast_pwm_data = {
+ .get_pwm_clock = ast_get_h_pll_clk,
+};
+
+struct platform_device ast_pwm_fan_device = {
+ .name = "ast_pwm_tacho",
+ .id = 0,
+ .dev = {
+ .platform_data = &ast_pwm_data,
+ },
+ .resource = ast_pwm_fan_resources,
+ .num_resources = ARRAY_SIZE(ast_pwm_fan_resources),
+};
+
+void __init ast_add_device_pwm_fan(void)
+{
+ //SCU Initial
+
+ //SCU Pin-MUX //PWM & TACHO
+ ast_scu_multi_func_pwm_tacho();
+
+ //SCU PWM CTRL Reset
+ ast_scu_init_pwm_tacho();
+
+ platform_device_register(&ast_pwm_fan_device);
+}
+#else
+void __init ast_add_device_pwm_fan(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-rtc.c b/arch/arm/plat-aspeed/dev-rtc.c
new file mode 100644
index 000000000000..214aa686dcd5
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-rtc.c
@@ -0,0 +1,65 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-wdt.c
+* Author : Ryan Chen
+* Description : AST WDT Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/09/15 Ryan Chen initial
+*
+********************************************************************************/
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+
+#include <plat/devs.h>
+
+
+/* --------------------------------------------------------------------
+ * Watchdog
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_RTC_DRV_AST) || defined(CONFIG_RTC_DRV_AST_MODULE)
+
+static struct resource ast_rtc_resource[] = {
+ [0] = {
+ .start = AST_RTC_BASE,
+ .end = AST_RTC_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_RTC,
+ .end = IRQ_RTC,
+ .flags = IORESOURCE_IRQ,
+ },
+
+};
+
+static struct platform_device ast_device_rtc = {
+ .name = "ast_rtc",
+ .id = -1,
+ .resource = ast_rtc_resource,
+ .num_resources = ARRAY_SIZE(ast_rtc_resource),
+};
+
+void __init ast_add_device_rtc(void)
+{
+ platform_device_register(&ast_device_rtc);
+}
+#else
+void __init ast_add_device_rtc(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-sdhci.c b/arch/arm/plat-aspeed/dev-sdhci.c
new file mode 100644
index 000000000000..bcc8cce49a93
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-sdhci.c
@@ -0,0 +1,110 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-sdhc.c
+* Author : Ryan chen
+* Description : ASPEED SDHC Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/07/30 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast_sdhci.h>
+#include <plat/ast-scu.h>
+
+
+/* --------------------------------------------------------------------
+ * SDHC
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_MMC_AST) || defined(CONFIG_MMC_AST_MODULE)
+static struct ast_sdhc_platform_data ast_sdhc_info = {
+ .sd_clock_src_get = ast_get_sd_clock_src,
+};
+
+static struct resource ast_sdhci0_resource[] = {
+ [0] = {
+ .start = AST_SDHC_BASE + 0x100,
+ .end = AST_SDHC_BASE + 0x100 + 0xFF,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_SDHC,
+ .end = IRQ_SDHC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct resource ast_sdhci1_resource[] = {
+ [0] = {
+ .start = AST_SDHC_BASE + 0x200,
+ .end = AST_SDHC_BASE + 0x200 + 0xFF,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_SDHC,
+ .end = IRQ_SDHC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 ast_sdhc_dma_mask = 0xffffffffUL;
+
+static struct platform_device ast_sdhci_device0 = {
+ .name = "ast_sdhci",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_sdhc_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_sdhc_info,
+ },
+ .resource = ast_sdhci0_resource,
+ .num_resources = ARRAY_SIZE(ast_sdhci0_resource),
+};
+
+static struct platform_device ast_sdhci_device1 = {
+ .name = "ast_sdhci",
+ .id = 1,
+ .dev = {
+ .dma_mask = &ast_sdhc_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &ast_sdhc_info,
+ },
+ .resource = ast_sdhci1_resource,
+ .num_resources = ARRAY_SIZE(ast_sdhci1_resource),
+};
+
+void __init ast_add_device_sdhci(void)
+{
+ ast_scu_init_sdhci();
+ //multipin. Remind: AST2300FPGA only supports one port at a time
+
+ ast_scu_multi_func_sdhc_slot1(1);
+
+ platform_device_register(&ast_sdhci_device0);
+
+ ast_scu_multi_func_sdhc_slot2(1);
+
+ platform_device_register(&ast_sdhci_device1);
+}
+#else
+void __init ast_add_device_sdhci(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-sgpio.c b/arch/arm/plat-aspeed/dev-sgpio.c
new file mode 100644
index 000000000000..c6ca2c44c1f4
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-sgpio.c
@@ -0,0 +1,68 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-rtc.c
+* Author : Ryan chen
+* Description : Socle Real Time Clock Device (RTC)
+*
+* Copyright (C) Socle Tech. Corp.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2010/09/15 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+//#include <plat/regs-sgpio.h>
+
+#include <plat/devs.h>
+
+/* --------------------------------------------------------------------
+ * ASPEED SGPIO
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_SGPIO_AST) || defined(CONFIG_SGPIO_AST_MODULE)
+static struct resource ast_sgpio_resource[] = {
+ [0] = {
+ .start = AST_SGPIO_BASE,
+ .end = AST_SGPIO_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_SGPIO,
+ .end = IRQ_SGPIO,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device ast_device_sgpio = {
+ .name = "ast-sgpio",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(ast_sgpio_resource),
+ .resource = ast_sgpio_resource,
+};
+
+extern void __init
+ast_add_device_sgpio(void)
+{
+ platform_device_register(&ast_device_sgpio);
+}
+
+#else
+extern void __init ast_add_device_sgpio(void) {}
+#endif
+
diff --git a/arch/arm/plat-aspeed/dev-snoop.c b/arch/arm/plat-aspeed/dev-snoop.c
new file mode 100644
index 000000000000..9e286bc3f899
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-snoop.c
@@ -0,0 +1,94 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-snoop.c
+* Author : Ryan chen
+* Description : ASPEED SNOOP Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/11/29 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-snoop.h>
+
+/* --------------------------------------------------------------------
+ * AST SNOOP -- DMA or 80Port SNOOP
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_SNOOP_AST) || defined(CONFIG_SNOOP_AST_MODULE)
+static u64 ast_snoop_dma_mask = 0xffffffffUL;
+
+static struct ast_snoop_channel snoop_ch0 = {
+ .snoop_ch = 0,
+ .snoop_port = 0x80,
+};
+
+static struct ast_snoop_channel snoop_ch1 = {
+ .snoop_ch = 1,
+ .snoop_port = 0x81,
+};
+
+static struct ast_snoop snoop = {
+ .snoop_ch0 = &snoop_ch0,
+ .snoop_ch1 = &snoop_ch1,
+};
+
+static struct platform_device ast_snoop_device = {
+ .name = "ast_snoop",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_snoop_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &snoop,
+ },
+};
+
+struct ast_snoop_dma_channel snoop_dma_ch0 = {
+ .snoop_ch = 0,
+ .snoop_port = 0x3f8,
+ .snoop_mask = 7,
+};
+
+static struct platform_device ast_snoop_dma_device = {
+ .name = "ast_snoop_dma",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_snoop_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ .platform_data = &snoop_dma_ch0,
+ },
+};
+
+void __init ast_add_device_snoop(void)
+{
+ platform_device_register(&ast_snoop_device);
+ platform_device_register(&ast_snoop_dma_device);
+}
+#else
+void __init ast_add_device_snoop(void) {}
+#endif
+
diff --git a/arch/arm/plat-aspeed/dev-spi.c b/arch/arm/plat-aspeed/dev-spi.c
new file mode 100644
index 000000000000..7ddd2e437212
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-spi.c
@@ -0,0 +1,448 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-spi.c
+* Author : Ryan chen
+* Description : ASPEED SPI device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/01 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/spi/flash.h>
+
+#include <linux/spi/spi.h>
+
+
+#include <asm/io.h>
+#if defined(CONFIG_COLDFIRE)
+#include <asm/sizes.h>
+#include <asm/arch/ast_spi.h>
+#include <asm/arch/ast-scu.h>
+#include <asm/arch/irqs.h>
+#include <asm/arch/platform.h>
+#include <asm/arch/devs.h>
+#else
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/regs-fmc.h>
+#include <plat/ast-scu.h>
+#include <mach/ast_spi.h>
+#endif
+
+/* --------------------------------------------------------------------
+ * SPI Ctrl, (AST SPI + FMC SPI)
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_SPI_FMC) || defined(CONFIG_SPI_FMC_MODULE) || defined(CONFIG_SPI_AST) || defined(CONFIG_SPI_AST_MODULE)
+static u32 ast_spi_calculate_divisor(u32 max_speed_hz)
+{
+ // [0] ->15 : HCLK , HCLK/16
+ u8 SPI_DIV[16] = {16, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 0};
+ u32 i, hclk, spi_cdvr=0;
+
+ hclk = ast_get_h_pll_clk();
+ for(i=1;i<17;i++) {
+ if(max_speed_hz >= (hclk/i)) {
+ spi_cdvr = SPI_DIV[i-1];
+ break;
+ }
+ }
+
+// printk("hclk is %d, divisor is %d, target :%d , cal speed %d\n", hclk, spi_cdvr, spi->max_speed_hz, hclk/i);
+ return spi_cdvr;
+}
+#endif
+
+#if defined(CONFIG_SPI_FMC) || defined(CONFIG_SPI_FMC_MODULE)
+static struct ast_spi_driver_data fmc_spi_data = {
+ .get_div = ast_spi_calculate_divisor,
+ .num_chipselect = 1,
+};
+
+#if defined(CONFIG_AST_CS0_SPI)
+static struct resource ast_fmc_spi_resource0[] = {
+ {
+ .start = AST_FMC_BASE + 0x10,
+ .end = AST_FMC_BASE + 0x10 + SZ_16,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = AST_CS0_DEF_BASE,
+ .end = AST_CS0_DEF_BASE + SZ_16,
+ .flags = IORESOURCE_IO,
+ },
+};
+static struct platform_device ast_fmc_spi_device0 = {
+ .name = "fmc-spi",
+ .id = 0,
+ .dev = {
+ .platform_data = &fmc_spi_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_fmc_spi_resource0),
+ .resource = ast_fmc_spi_resource0,
+};
+#endif
+
+#if defined(CONFIG_AST_CS1_SPI)
+static struct resource ast_fmc_spi_resource1[] = {
+ {
+ .start = AST_FMC_BASE + 0x14,
+ .end = AST_FMC_BASE + 0x14 + SZ_16,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = AST_CS1_DEF_BASE,
+ .end = AST_CS1_DEF_BASE + SZ_16,
+ .flags = IORESOURCE_IO,
+ },
+};
+static struct platform_device ast_fmc_spi_device1 = {
+ .name = "fmc-spi",
+ .id = 1,
+ .dev = {
+ .platform_data = &fmc_spi_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_fmc_spi_resource1),
+ .resource = ast_fmc_spi_resource1,
+};
+#endif
+
+#if defined(CONFIG_AST_CS2_SPI)
+static struct resource ast_fmc_spi_resource2[] = {
+ {
+ .start = AST_FMC_BASE + 0x18,
+ .end = AST_FMC_BASE + 0x18 + SZ_16,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = AST_CS2_DEF_BASE,
+ .end = AST_CS2_DEF_BASE + SZ_16,
+ .flags = IORESOURCE_IO,
+ },
+};
+
+static struct platform_device ast_fmc_spi_device2 = {
+ .name = "fmc-spi",
+ .id = 2,
+ .dev = {
+ .platform_data = &fmc_spi_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_fmc_spi_resource2),
+ .resource = ast_fmc_spi_resource2,
+};
+#endif
+
+#if defined(CONFIG_AST_CS3_SPI)
+static struct resource ast_fmc_spi_resource3[] = {
+ {
+ .start = AST_FMC_BASE + 0x1c,
+ .end = AST_FMC_BASE + 0x1c + SZ_16,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = AST_CS3_DEF_BASE,
+ .end = AST_CS3_DEF_BASE + SZ_16,
+ .flags = IORESOURCE_IO,
+ },
+};
+
+static struct platform_device ast_fmc_spi_device3 = {
+ .name = "fmc-spi",
+ .id = 3,
+ .dev = {
+ .platform_data = &fmc_spi_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_fmc_spi_resource3),
+ .resource = ast_fmc_spi_resource3,
+};
+#endif
+
+#if defined(CONFIG_AST_CS4_SPI)
+static struct resource ast_fmc_spi_resource4[] = {
+ {
+ .start = AST_FMC_BASE + 0x20,
+ .end = AST_FMC_BASE + 0x20 + SZ_16,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = AST_CS4_DEF_BASE,
+ .end = AST_CS4_DEF_BASE + SZ_16,
+ .flags = IORESOURCE_IO,
+ },
+};
+
+static struct platform_device ast_fmc_spi_device4 = {
+ .name = "fmc-spi",
+ .id = 4,
+ .dev = {
+ .platform_data = &fmc_spi_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_fmc_spi_resource4),
+ .resource = ast_fmc_spi_resource4,
+};
+#endif
+
+#endif //CONFIG_SPI_FMC
+
+#if defined(CONFIG_SPI_AST) || defined(CONFIG_SPI_AST_MODULE)
+static struct ast_spi_driver_data ast_spi0_data = {
+ .get_div = ast_spi_calculate_divisor,
+ .num_chipselect = 1,
+};
+
+static struct resource ast_spi_resource0[] = {
+ {
+ .start = AST_SPI0_BASE,
+ .end = AST_SPI0_BASE + SZ_16,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = AST_SPI0_MEM + 0x04,
+ .end = AST_SPI0_MEM + SZ_16,
+ .flags = IORESOURCE_IO,
+ },
+};
+
+static struct platform_device ast_spi_device0 = {
+ .name = "ast-spi",
+#if defined(CONFIG_ARCH_AST1010)
+ .id = 0,
+#else
+ .id = 5,
+#endif
+ .dev = {
+ .platform_data = &ast_spi0_data,
+ },
+ .num_resources = ARRAY_SIZE(ast_spi_resource0),
+ .resource = ast_spi_resource0,
+};
+
+#if defined(AST_SPI1_BASE)
+static struct ast_spi_driver_data ast_spi1_data = {
+ .get_div = ast_spi_calculate_divisor,
+ .num_chipselect = 1,
+};
+
+static struct resource aspeed_spi1_resource[] = {
+ {
+ .start = AST_SPI1_BASE,
+ .end = AST_SPI1_BASE + SZ_16,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = AST_SPI1_MEM,
+ .end = AST_SPI1_MEM + SZ_16,
+ .flags = IORESOURCE_IO,
+ },
+};
+
+static struct platform_device aspeed_spi_device1 = {
+ .name = "ast-spi",
+ .id = 1,
+ .dev = {
+ .platform_data = &ast_spi1_data,
+ },
+ .num_resources = ARRAY_SIZE(aspeed_spi1_resource),
+ .resource = aspeed_spi1_resource,
+};
+
+#endif
+
+#endif //CONFIG_SPI_AST
+
+#if defined(CONFIG_ARCH_AST1010)
+static struct mtd_partition ast_spi_flash_partitions[] = {
+ {
+ .name = "uboot",
+ .offset = 0,
+ .size = 0x00030000,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ {
+ .name = "uboot-env",
+ .offset = MTDPART_OFS_APPEND,
+ .size = 0x00010000,
+// .mask_flags = MTD_WRITEABLE,
+ },
+ {
+ .name = "uCLinux",
+ .offset = MTDPART_OFS_APPEND,
+ .size = 0x003c0000,
+// .mask_flags = MTD_CAP_NORFLASH,
+ },
+ {
+ .name = "data",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
+// .mask_flags = MTD_CAP_NORFLASH,
+ }
+};
+#else
+static struct mtd_partition ast_spi_flash_partitions[] = {
+ {
+ .name = "u-boot",
+ .offset = 0,
+ .size = 0x80000,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "kernel",
+ .offset = 0x80000,
+ .size = 0x200000,
+ }, {
+ .name = "rootfs",
+ .offset = 0x300000,
+ .size = 0x4F0000,
+ }, {
+ .name = "env",
+ .offset = 0x7f0000,
+ .size = 0x10000,
+ }, {
+ .name = "data0",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
+ },
+};
+#endif
+
+static struct flash_platform_data ast_spi_flash_data = {
+#if defined(CONFIG_ARCH_AST2400)
+ .type = "mx25l25635e", //AST2400 A1
+#elif defined(CONFIG_ARCH_AST1010)
+ .type = "mx25l6405d",
+#else
+ .type = "mx25l12805d", //old AST2300
+#endif
+ .nr_parts = ARRAY_SIZE(ast_spi_flash_partitions),
+ .parts = ast_spi_flash_partitions,
+};
+
+static struct spi_board_info ast_spi_devices[] = {
+ {
+ .modalias = "m25p80",
+ .platform_data = &ast_spi_flash_data,
+ .chip_select = 0, //.chip_select This tells your device driver which chipselect to use.
+ .max_speed_hz = 50 * 1000 * 1000,
+ .bus_num = 0, // This chooses if SPI0 or SPI1 of the SoC is used.
+ .mode = SPI_MODE_0,
+ },
+ {
+ .modalias = "spidev",
+ .chip_select = 0,
+ .max_speed_hz = 30 * 1000 * 1000,
+ .bus_num = 1,
+ .mode = SPI_MODE_0,
+ },
+};
+
+#if defined(AST_SPI1_BASE)
+static struct mtd_partition ast_spi_flash1_partitions[] = {
+ {
+ .name = "bios",
+ .offset = 0,
+ .size = MTDPART_SIZ_FULL,
+ }
+};
+
+static struct flash_platform_data ast_spi_flash1_data = {
+ .type = "mx25l6405d",
+// .type = "w25q64",
+ .nr_parts = ARRAY_SIZE(ast_spi_flash1_partitions),
+ .parts = ast_spi_flash1_partitions,
+};
+
+
+static struct spi_board_info ast_spi1_devices[] = {
+ {
+ .modalias = "m25p80",
+ .platform_data = &ast_spi_flash1_data,
+ .chip_select = 0, //.chip_select This tells your device driver which chipselect to use.
+ .max_speed_hz = 100 * 1000 * 1000,
+ .bus_num = 1, // This chooses if SPI0 or SPI1 of the SoC is used.
+ .mode = SPI_MODE_0,
+ },
+};
+#endif
+
+#if defined(CONFIG_SPI_FMC) || defined(CONFIG_SPI_FMC_MODULE) || defined(CONFIG_SPI_AST) || defined(CONFIG_SPI_AST_MODULE)
+
+/*-------------------------------------*/
+void __init ast_add_device_spi(void)
+{
+#if defined(CONFIG_SPI_FMC) || defined(CONFIG_SPI_FMC_MODULE)
+ void __iomem *fmc_regs = ioremap(AST_FMC_BASE, 4*SZ_16);
+ u32 tmp = 0;
+
+#if defined(CONFIG_AST_CS0_SPI)
+ platform_device_register(&ast_fmc_spi_device0);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(0)) & FMC_MASK_TYPE_CS(0);
+ writel( tmp | FMC_SET_TYPE_SPI_CS(0), fmc_regs);
+#endif
+
+#if defined(CONFIG_AST_CS1_SPI)
+ ast_scu_multi_func_romcs(1);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(1)) & FMC_MASK_TYPE_CS(1);
+ writel( tmp | FMC_SET_TYPE_SPI_CS(1), fmc_regs);
+ platform_device_register(&ast_fmc_spi_device1);
+#endif
+
+#if defined(CONFIG_AST_CS2_SPI)
+ ast_scu_multi_func_romcs(2);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(2)) & FMC_MASK_TYPE_CS(2);
+ writel( tmp | FMC_SET_TYPE_SPI_CS(2), fmc_regs);
+ platform_device_register(&ast_fmc_spi_device2);
+#endif
+#if defined(CONFIG_AST_CS3_SPI)
+ ast_scu_multi_func_romcs(3);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(3)) & FMC_MASK_TYPE_CS(3);
+ writel( tmp | FMC_SET_TYPE_SPI_CS(3), fmc_regs);
+ platform_device_register(&ast_fmc_spi_device3);
+#endif
+#if defined(CONFIG_AST_CS4_SPI)
+ ast_scu_multi_func_romcs(4);
+ tmp = (readl(fmc_regs) | FMC_SET_WRITE_CS(4)) & FMC_MASK_TYPE_CS(4);
+ writel( tmp | FMC_SET_TYPE_SPI_CS(4), fmc_regs);
+ platform_device_register(&ast_fmc_spi_device4);
+#endif
+
+ iounmap(fmc_regs);
+
+#endif
+
+#if defined(CONFIG_SPI_AST) || defined(CONFIG_SPI_AST_MODULE)
+ //pin switch by trap[13:12]
+ platform_device_register(&ast_spi_device0);
+#endif
+
+ spi_register_board_info(ast_spi_devices, ARRAY_SIZE(ast_spi_devices));
+
+#if defined(AST_SPI1_BASE)
+ //AST1010 SCU CONFIG TODO .......
+ writel(readl(AST_SCU_BASE + 0x70) | 0x10,AST_SCU_BASE + 0x70);
+ platform_device_register(&aspeed_spi_device1);
+ spi_register_board_info(ast_spi1_devices, ARRAY_SIZE(ast_spi1_devices));
+#endif
+
+}
+#else
+void __init ast_add_device_spi(void) {}
+#endif
+
+
diff --git a/arch/arm/plat-aspeed/dev-uart.c b/arch/arm/plat-aspeed/dev-uart.c
new file mode 100644
index 000000000000..592ef4fdadd5
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-uart.c
@@ -0,0 +1,144 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-uart.c
+* Author : Ryan chen
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/09/15 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/serial.h>
+#include <linux/tty.h>
+#include <linux/serial_8250.h>
+
+#if defined(CONFIG_COLDFIRE)
+#include <asm/sizes.h>
+#include <asm/arch/devs.h>
+#include <asm/arch/platform.h>
+#include <asm/arch/irqs.h>
+#else
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <mach/hardware.h>
+#include <plat/ast-scu.h>
+#include <plat/devs.h>
+#endif
+
+/* --------------------------------------------------------------------
+ * UART
+ * -------------------------------------------------------------------- */
+#ifdef CONFIG_SERIAL_8250
+static struct plat_serial8250_port ast_uart_data[] = {
+ {
+ .mapbase = AST_UART0_BASE,
+ .irq = IRQ_UART0,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+#if defined(CONFIG_COLDFIRE)
+ .iotype = UPIO_MEM32,
+#else
+ .iotype = UPIO_MEM,
+#endif
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ },
+#if defined(CONFIG_ARCH_AST1010)
+ {
+ .mapbase = AST_UART1_BASE,
+ .irq = IRQ_UART1,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM32,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ },
+ {
+ .mapbase = AST_UART2_BASE,
+ .irq = IRQ_UART2,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM32,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ },
+#else
+//BMC UART 1 ,2 default to LPC
+#ifdef CONFIG_ARCH_AST1070
+#ifdef AST_UART1_BASE
+ {
+ .mapbase = AST_UART1_BASE,
+ .irq = IRQ_UART1,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ },
+#endif
+#ifdef AST_UART2_BASE
+ {
+ .mapbase = AST_UART2_BASE,
+ .irq = IRQ_UART2,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ },
+#endif
+#endif
+#ifdef AST_UART3_BASE
+ {
+ .mapbase = AST_UART3_BASE,
+ .irq = IRQ_UART3,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ },
+#endif
+#ifdef AST_UART4_BASE
+ {
+ .mapbase = AST_UART4_BASE,
+ .irq = IRQ_UART4,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+ },
+#endif
+#endif
+ { },
+};
+
+struct platform_device ast_uart_device = {
+ .name = "serial8250",
+ .id = PLAT8250_DEV_PLATFORM,
+ .dev = {
+ .platform_data = ast_uart_data,
+ },
+};
+
+void __init ast_add_device_uart(void)
+{
+#if defined(CONFIG_ARCH_AST1010)
+#else
+ ast_scu_multi_func_uart(3);
+ ast_scu_multi_func_uart(4);
+#endif
+ platform_device_register(&ast_uart_device);
+}
+#else
+void __init ast_add_device_uart(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-uhci.c b/arch/arm/plat-aspeed/dev-uhci.c
new file mode 100644
index 000000000000..961ec9b19ee5
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-uhci.c
@@ -0,0 +1,82 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-uhci.c
+* Author : Ryan chen
+* Description : ASPEED EHCI Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/07/30 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+
+/* --------------------------------------------------------------------
+ * UHCI
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_AST_USB_UHCI_HCD) || defined(CONFIG_AST_USB_UHCI_HCD_MODULE)
+static struct resource ast_uchi_resource[] = {
+ [0] = {
+ .start = AST_UHCI_BASE,
+ .end = AST_UHCI_BASE + SZ_256,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_UHCI,
+ .end = IRQ_UHCI,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 ast_uhci_dma_mask = 0xffffffffUL;
+
+static struct platform_device ast_uhci_device = {
+ .name = "ast_uhci",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_uhci_dma_mask,
+ .coherent_dma_mask = 0xffffffff,
+ },
+ .resource = ast_uchi_resource,
+ .num_resources = ARRAY_SIZE(ast_uchi_resource),
+};
+
+void __init ast_add_device_uhci(void)
+{
+
+#if defined (CONFIG_AST_USB_UHCI_MULTIPORT_2)
+ ast_scu_multi_func_usb11_host_port2(1);
+#elif defined (CONFIG_AST_USB_UHCI_MULTIPORT_4)
+ ast_scu_multi_func_usb11_host_port2(1);
+ ast_scu_multi_func_usb11_host_port4(1);
+#else
+ ast_scu_multi_func_usb11_host_port2(0);
+ ast_scu_multi_func_usb11_host_port4(0);
+#endif
+
+ ast_scu_init_uhci();
+
+ platform_device_register(&ast_uhci_device);
+}
+#else
+void __init ast_add_device_uhci(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-video.c b/arch/arm/plat-aspeed/dev-video.c
new file mode 100644
index 000000000000..3d66effb307f
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-video.c
@@ -0,0 +1,102 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-video.c
+* Author : Ryan Chen
+* Description : ASPEED Video Driver
+*
+* Copyright (C) ASPEED Tech. Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2013/04/15 Ryan Chen initial
+*
+********************************************************************************/
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+
+#include <plat/devs.h>
+#include <plat/ast-scu.h>
+#include <plat/ast-sdmc.h>
+
+#include <mach/ast_video.h>
+
+/* --------------------------------------------------------------------
+ * AST VIDEO
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_AST_VIDEO) || defined(CONFIG_AST_VIDEO_MODULE)
+
+#define ASR_VIDEO_MEM AST_DRAM_BASE + SZ_8M*10
+static u32 get_vga_mem_base(void)
+{
+ u32 vga_mem_size, mem_size;
+ mem_size = ast_sdmc_get_mem_size();
+ vga_mem_size = ast_scu_get_vga_memsize();
+ printk("VGA Info : MEM Size %d, VGA Mem Size %d \n",mem_size, vga_mem_size);
+ return (mem_size - vga_mem_size);
+}
+
+static struct ast_video_plat_data video_plat_data = {
+ .get_clk = ast_get_m_pll_clk,
+ .ctrl_reset = ast_scu_reset_video,
+ .vga_display = ast_scu_set_vga_display,
+ .get_vga_base = get_vga_mem_base,
+ .input_source = VIDEO_SOURCE_INTERNAL,
+ .mode = VIDEO_FRAME_MODE,
+ .rc4_enable = 0,
+ .compress = VIDEO_YUV444,
+ .scaling = 0,
+};
+
+
+static struct resource ast_video_resources[] = {
+ [0] = {
+ .start = AST_VIDEO_BASE,
+ .end = AST_VIDEO_BASE + SZ_1K*2 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_VIDEO,
+ .end = IRQ_VIDEO,
+ .flags = IORESOURCE_IRQ,
+ },
+ [2] = {
+ .start = ASR_VIDEO_MEM,
+ .end = ASR_VIDEO_MEM + SZ_32M,
+ .flags = IORESOURCE_DMA,
+ },
+};
+
+static u64 ast_device_video_dmamask = 0xffffffffUL;
+struct platform_device ast_video_device = {
+ .name = "ast-video",
+ .id = 0,
+ .dev = {
+ .dma_mask = &ast_device_video_dmamask,
+ .coherent_dma_mask = 0xffffffffUL,
+ .platform_data= &video_plat_data,
+ },
+ .resource = ast_video_resources,
+ .num_resources = ARRAY_SIZE(ast_video_resources),
+};
+
+void __init ast_add_device_video(void)
+{
+ ast_scu_init_video(0);
+ ast_scu_multi_func_video();
+ platform_device_register(&ast_video_device);
+}
+#else
+void __init ast_add_device_video(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-vuart.c b/arch/arm/plat-aspeed/dev-vuart.c
new file mode 100644
index 000000000000..0e2ab8a1bb7e
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-vuart.c
@@ -0,0 +1,100 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-uart.c
+* Author : Ryan chen
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/09/15 ryan chen create this file
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+#include <linux/serial.h>
+#include <linux/tty.h>
+#include <linux/serial_8250.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+#include <mach/hardware.h>
+#include <asm/io.h>
+
+#include <plat/ast-scu.h>
+#include <plat/devs.h>
+
+#include <plat/regs-vuart.h>
+
+#define AST_COM_PORT PORT_3F8
+#define AST_SIRQ SIRQ4
+
+#define PORT_2F8 0x2f8
+#define PORT_3F8 0x3f8
+
+typedef enum SIO_serial_irq {
+ SIRQ0 = 0,
+ SIRQ1,
+ SIRQ2,
+ SIRQ3,
+ SIRQ4,
+ SIRQ5,
+ SIRQ6,
+ SIRQ7,
+ SIRQ8,
+ SIRQ9,
+};
+
+/* --------------------------------------------------------------------
+ * UART
+ * -------------------------------------------------------------------- */
+#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_AST_VUART)
+static struct plat_serial8250_port ast_vuart_data[] = {
+ {
+ .mapbase = AST_VUART0_BASE,
+ .membase = (char*)(IO_ADDRESS(AST_VUART0_BASE)),
+ .irq = IRQ_LPC,
+ .uartclk = (24*1000000L),
+ .regshift = 2,
+ .iotype = UPIO_MEM,
+ .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ,
+ },
+ { },
+};
+
+struct platform_device ast_vuart_device = {
+ .name = "serial8250",
+ .id = PLAT8250_DEV_PLATFORM1,
+ .dev = {
+ .platform_data = ast_vuart_data,
+ },
+};
+
+void __init ast_add_device_vuart(void)
+{
+ u32 vuart_base = ioremap(AST_VUART0_BASE, SZ_256);
+
+ writel(0x0, vuart_base + AST_VUART_CTRLA);
+ writel(SET_SIRQ_NUM(AST_SIRQ) |0x3, vuart_base + AST_VUART_CTRLB);
+ writel(AST_COM_PORT & 0xff, vuart_base + AST_VUART_ADDRL);
+ writel(AST_COM_PORT >> 8, vuart_base + AST_VUART_ADDRH);
+ writel(0x0, vuart_base + AST_VUART_CTRLF);
+ writel(VUART_ENABLE | VUART_SIRQ_POLARITY | VUART_DISABLE_H_TX_DISCARD, vuart_base + AST_VUART_CTRLA);
+
+ iounmap(vuart_base);
+ platform_device_register(&ast_vuart_device);
+}
+#else
+void __init ast_add_device_vuart(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/dev-wdt.c b/arch/arm/plat-aspeed/dev-wdt.c
new file mode 100644
index 000000000000..079d1a904a9e
--- /dev/null
+++ b/arch/arm/plat-aspeed/dev-wdt.c
@@ -0,0 +1,76 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/dev-wdt.c
+* Author : Ryan Chen
+* Description : AST WDT Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/09/15 Ryan Chen initial
+*
+********************************************************************************/
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/platform.h>
+
+#include <plat/devs.h>
+
+/* --------------------------------------------------------------------
+ * Watchdog
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_AST_WATCHDOG) || defined(CONFIG_AST_WATCHDOG_MODULE)
+
+static struct resource ast_wdt_resource0[] = {
+ [0] = {
+ .start = AST_WDT_BASE,
+ .end = AST_WDT_BASE + (SZ_16*2) - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_WDT,
+ .end = IRQ_WDT,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct resource ast_wdt_resource1[] = {
+ [0] = {
+ .start = AST_WDT_BASE + (SZ_16*2),
+ .end = AST_WDT_BASE + (SZ_16*4) - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_WDT,
+ .end = IRQ_WDT,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device ast_device_wdt = {
+ .name = "ast-wdt",
+ .id = -1,
+ .resource = ast_wdt_resource0,
+ .num_resources = ARRAY_SIZE(ast_wdt_resource0),
+};
+
+void __init ast_add_device_watchdog(void)
+{
+ platform_device_register(&ast_device_wdt);
+}
+#else
+void __init ast_add_device_watchdog(void) {}
+#endif
diff --git a/arch/arm/plat-aspeed/devs.c b/arch/arm/plat-aspeed/devs.c
new file mode 100644
index 000000000000..7906b9cbbce8
--- /dev/null
+++ b/arch/arm/plat-aspeed/devs.c
@@ -0,0 +1,69 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/devs.c
+* Author : Ryan chen
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/10 create this file [Ryan Chen]
+*
+********************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/platform.h>
+
+#include <plat/devs.h>
+
+typedef void (init_fnc_t) (void);
+
+init_fnc_t __initdata *init_all_device[] = {
+ ast_add_device_uart,
+ ast_add_device_vuart,
+ ast_add_device_watchdog,
+ ast_add_device_rtc,
+ ast_add_device_i2c,
+ ast_add_device_spi,
+ ast_add_device_ehci,
+ ast_add_device_nand,
+ ast_add_device_flash,
+ ast_add_device_pwm_fan,
+ ast_add_device_adc,
+ ast_add_device_gpio,
+ ast_add_device_sgpio,
+ ast_add_device_peci,
+ ast_add_device_fb,
+ ast_add_device_sdhci,
+ ast_add_device_uhci,
+ ast_add_device_video,
+ ast_add_device_kcs,
+ ast_add_device_mailbox,
+ ast_add_device_snoop,
+ ast_add_device_gmac,
+// ast_add_device_nand,
+ NULL,
+};
+
+void __init ast_add_all_devices(void)
+{
+ init_fnc_t **init_fnc_ptr;
+
+ for (init_fnc_ptr = init_all_device; *init_fnc_ptr; ++init_fnc_ptr) {
+ (*init_fnc_ptr)();
+ }
+
+ return;
+}
diff --git a/arch/arm/plat-aspeed/i2c-slave-eeprom.c b/arch/arm/plat-aspeed/i2c-slave-eeprom.c
new file mode 100644
index 000000000000..fd53f1a664ae
--- /dev/null
+++ b/arch/arm/plat-aspeed/i2c-slave-eeprom.c
@@ -0,0 +1,141 @@
+/********************************************************************************
+* File Name : linux/arch/arm/plat-aspeed/i2c-slave-eeprom.c
+* Author : Ryan chen
+* Description : ASPEED I2C Device
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2013/05/30 ryan chen create this file
+*
+********************************************************************************/
+#include <linux/i2c.h>
+#if defined(CONFIG_COLDFIRE)
+#include <asm/arch/ast_i2c.h>
+#else
+#include <plat/ast_i2c.h>
+#endif
+
+#ifdef I2C_EEPROM
+#define EEPROM_DBUG(fmt, args...) printk("%s() " fmt, __FUNCTION__, ## args)
+#else
+#define EEPROM_DBUG(fmt, args...)
+#endif
+
+static u8 cmd_buf[1] = {0};
+static struct i2c_msg cmd_msg = {
+ .addr = 0x04,
+ .len = 1,
+ .buf = cmd_buf,
+};
+
+//Note 10 byte data memory share for all bus slave device ...........
+#define BUF_SIZE 10
+
+static u8 store_memory[BUF_SIZE] = {0x03,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09};
+ // RO, RW, .................
+static struct i2c_msg data_msg = {
+ .addr = 0x04,
+ .len = BUF_SIZE,
+ .buf = store_memory,
+};
+static u8 mem_index = 0;
+static u8 slave_stage = INIT_STAGE;
+
+extern void i2c_slave_init(struct i2c_msg **msgs)
+{
+ *msgs = &cmd_msg;
+}
+
+extern void i2c_slave_xfer(i2c_slave_event_t event, struct i2c_msg **msgs)
+{
+ EEPROM_DBUG("[event %d] \n",event);
+ switch(event) {
+ case I2C_SLAVE_EVENT_START_READ:
+ cmd_msg.flags = I2C_M_RD;
+ data_msg.flags = I2C_M_RD;
+ if(slave_stage == INIT_STAGE) {
+ EEPROM_DBUG("Rt DATA_MSG [%x]\n",data_msg.buf[0]);
+ slave_stage = DATA_STAGE;
+ *msgs = &data_msg;
+ } else {
+ //CMD_STAGE
+ if(cmd_msg.buf[0] != ((cmd_msg.addr << 1)|1))
+ printk("START READ ADDR Error %x\n",cmd_msg.buf[0]);
+
+ EEPROM_DBUG("Rt CMD_DATA_MSG data [%x]\n",store_memory[mem_index]);
+ cmd_msg.buf[0] = store_memory[mem_index];
+ mem_index++;
+ mem_index %=BUF_SIZE;
+ slave_stage = CMD_DATA_STAGE;
+ *msgs = &cmd_msg;
+ }
+ break;
+ case I2C_SLAVE_EVENT_START_WRITE:
+ EEPROM_DBUG("Rt CMD_MSG START_WRITE %x\n",cmd_msg.buf[0]);
+ cmd_msg.flags = 0;
+ if(cmd_msg.buf[0] != cmd_msg.addr <<1)
+ printk("ERROR ADDRESS Match [%x] \n", cmd_msg.buf[0]);
+ slave_stage = CMD_STAGE;
+
+ *msgs = &cmd_msg;
+
+ break;
+
+ case I2C_SLAVE_EVENT_WRITE:
+ cmd_msg.flags = 0;
+ if(slave_stage == CMD_STAGE) {
+ EEPROM_DBUG("w CMD = [index %x] \n",cmd_msg.buf[0]);
+ mem_index = cmd_msg.buf[0];
+ mem_index %= BUF_SIZE;
+ slave_stage = CMD_DATA_STAGE;
+ *msgs = &cmd_msg;
+ } else {
+ EEPROM_DBUG("w index %d CMD_DATA [%x] \n",mem_index, cmd_msg.buf[0]);
+ if(mem_index !=0)
+ store_memory[mem_index] = cmd_msg.buf[0];
+ mem_index++;
+ mem_index %=BUF_SIZE;
+ EEPROM_DBUG("Rt CMD_DATA_MSG \n");
+ *msgs = &cmd_msg;
+ }
+ break;
+ case I2C_SLAVE_EVENT_READ:
+ cmd_msg.flags = I2C_M_RD;
+ if(slave_stage == CMD_DATA_STAGE) {
+ cmd_msg.buf[0] = store_memory[mem_index];
+ mem_index++;
+ mem_index %=BUF_SIZE;
+ EEPROM_DBUG("Rt CMD_DATA_MSG [%x]\n",cmd_msg.buf[0]);
+ *msgs = &cmd_msg;
+ } else {
+ EEPROM_DBUG("Rt DATA_MSG [%x]\n",data_msg.buf[0]);
+ *msgs = &data_msg;
+ }
+ break;
+ case I2C_SLAVE_EVENT_NACK:
+ cmd_msg.flags = I2C_M_RD;
+ slave_stage = INIT_STAGE;
+ *msgs = &cmd_msg;
+
+ break;
+
+ case I2C_SLAVE_EVENT_STOP:
+ cmd_msg.flags = I2C_M_RD;
+ slave_stage = INIT_STAGE;
+ *msgs = &cmd_msg;
+ break;
+ }
+
+}
diff --git a/arch/arm/plat-aspeed/include/plat/aspeed.h b/arch/arm/plat-aspeed/include/plat/aspeed.h
new file mode 100644
index 000000000000..4f7c2400d0ce
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/aspeed.h
@@ -0,0 +1,44 @@
+/*
+ * arch/arm/plat-aspeed/include/plat/aspeed.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if defined(CONFIG_ARCH_AST3200) || defined(CONFIG_ARCH_AST2500) || defined(CONFIG_ARCH_AST1520)
+#define AST_SOC_G5
+#define NEW_VIC
+#define SRAM_SIZE SZ_32K
+#elif defined(CONFIG_ARCH_AST1400) || defined(CONFIG_ARCH_AST2400) || defined(CONFIG_ARCH_AST3100)
+#define AST_SOC_G4
+#define NEW_VIC
+#define SRAM_SIZE SZ_32K
+#elif defined(CONFIG_ARCH_AST1300) || defined(CONFIG_ARCH_AST2300) || defined(CONFIG_ARCH_AST1510)
+#define AST_SOC_G3
+#define NEW_VIC
+#define SRAM_SIZE SZ_16K
+#elif defined(CONFIG_ARCH_AST2150) || defined(CONFIG_ARCH_AST2200)
+#define AST_SOC_G2_5
+#elif defined(CONFIG_ARCH_AST1100) || defined(CONFIG_ARCH_AST2050) || defined(CONFIG_ARCH_AST2100)
+#define AST_SOC_G2
+#elif defined(CONFIG_ARCH_AST2000) || defined(CONFIG_ARCH_AST1000)
+#define AST_SOC_G1
+#else
+#error "Not define SoC generation"
+#endif
+
+
+
diff --git a/arch/arm/plat-aspeed/include/plat/ast-lpc.h b/arch/arm/plat-aspeed/include/plat/ast-lpc.h
new file mode 100644
index 000000000000..1bf2befcf2fc
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast-lpc.h
@@ -0,0 +1,34 @@
+/*
+ * Platform data for AST LPC .
+ *
+ * Copyright (C) ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+struct ast_lpc_bus_info
+{
+ u8 lpc_dev_mode; /* 0: host mode , 1: dev mode*/
+ u8 bus_scan;
+ u8 scan_node;
+ u8 lpc_mode; /* 0: lpc , 1: lpc+ */
+ u32 bridge_phy_addr;
+};
+
+struct ast_lpc_driver_data
+{
+ struct platform_device *pdev;
+ void __iomem *reg_base; /* virtual */
+ int irq; //I2C IRQ number
+ u32 bus_id; //for i2c dev# IRQ number check
+ struct ast_lpc_bus_info *bus_info;
+};
+
+extern struct ast_lpc_info *ast_get_lpc_info(void);
diff --git a/arch/arm/plat-aspeed/include/plat/ast-pcie.h b/arch/arm/plat-aspeed/include/plat/ast-pcie.h
new file mode 100644
index 000000000000..d099c577ff72
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast-pcie.h
@@ -0,0 +1,28 @@
+/*
+ * Platform data for AST PCIe Root Complex module.
+ *
+ * Copyright (C) ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __AST_PCIE_H_
+#define __AST_PCIE_H_
+
+struct ast_pcie_data {
+ int msi_irq_base;
+ int msi_irq_num;
+ int force_x1;
+ int msi_inv; /* 1 = MSI ack requires "write 0 to clear" */
+ unsigned short int device_id;
+};
+
+#endif
+
diff --git a/arch/arm/plat-aspeed/include/plat/ast-scu.h b/arch/arm/plat-aspeed/include/plat/ast-scu.h
new file mode 100644
index 000000000000..77169ee3279c
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast-scu.h
@@ -0,0 +1,92 @@
+/********************************************************************************
+* File Name : arch/arm/mach-aspeed/include/plat/ast-scu.h
+* Author : Ryan Chen
+* Description : AST SCU Service Header
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+* 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.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/03 Ryan Chen create this file
+*
+********************************************************************************/
+
+#ifndef __AST_SCU_H_INCLUDED
+#define __AST_SCU_H_INCLUDED
+
+//information
+extern void ast_scu_show_system_info (void);
+extern u32 ast_scu_revision_id(void);
+extern u32 ast_scu_get_phy_interface(u8 mac_num);
+extern u32 ast_scu_get_phy_config(u8 mac_num);
+
+
+//CLK
+extern u32 ast_get_clk_source(void);
+extern u32 ast_get_h_pll_clk(void);
+extern u32 ast_get_m_pll_clk(void);
+extern u32 ast_get_pclk(void);
+extern u32 ast_get_sd_clock_src(void);
+extern u32 ast_get_d2_pll_clk(void);
+extern u32 ast_get_lhclk(void);
+
+extern void ast_scu_set_vga_display(u8 enable);
+extern u32 ast_scu_get_vga_memsize(void);
+
+//Ctrl Initial
+extern void ast_scu_init_video(u8 dynamic_en);
+extern void ast_scu_reset_video(void);
+extern void ast_scu_init_eth(u8 num);
+extern void ast_scu_init_lpc(void);
+extern u8 ast_scu_get_lpc_plus_enable(void);
+extern void ast_scu_init_udc11(void);
+extern void ast_scu_init_usb20(void);
+extern void ast_scu_init_uhci(void);
+extern void ast_scu_init_sdhci(void);
+extern void ast_scu_init_i2c(void);
+extern void ast_scu_init_pwm_tacho(void);
+extern void ast_scu_init_adc(void);
+extern void ast_scu_init_peci(void);
+extern void ast_scu_init_jtag(void);
+extern void ast_scu_init_crt(void);
+
+
+
+//Share pin
+extern void ast_scu_multi_func_uart(u8 uart);
+extern void ast_scu_multi_func_video(void);
+
+extern void ast_scu_multi_func_eth(u8 num);
+
+extern void ast_scu_multi_func_nand(void);
+
+extern void ast_scu_multi_func_nor(void);
+
+extern void ast_scu_multi_func_romcs(u8 num);
+
+extern void ast_scu_multi_func_i2c(void);
+extern void ast_scu_multi_func_pwm_tacho(void);
+//0 : hub mode , 1: usb host mode
+extern void ast_scu_multi_func_usb20_host_hub(u8 mode);
+//0 : gpioQ6,7 mode , 1: usb1.1 host port 4 mode
+extern void ast_scu_multi_func_usb11_host_port4(u8 mode);
+//0 : USB 1.1 HID mode , 1: usb1.1 host port 2 mode
+extern void ast_scu_multi_func_usb11_host_port2(u8 mode);
+
+extern void ast_scu_multi_func_sdhc_slot1(u8 mode);
+extern void ast_scu_multi_func_sdhc_slot2(u8 mode);
+extern void ast_scu_multi_func_crt(void);
+
+
+
+
+
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/ast-sdmc.h b/arch/arm/plat-aspeed/include/plat/ast-sdmc.h
new file mode 100644
index 000000000000..72d8d724363a
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast-sdmc.h
@@ -0,0 +1,26 @@
+/********************************************************************************
+* File Name : arch/arm/mach-aspeed/include/plat/ast-scu.h
+* Author : Ryan Chen
+* Description : AST SCU Service Header
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+* 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.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/03 Ryan Chen create this file
+*
+********************************************************************************/
+
+#ifndef __AST_SDMC_H_INCLUDED
+#define __AST_SDMC_H_INCLUDED
+
+extern u32 ast_sdmc_get_mem_size(void);
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/ast-snoop.h b/arch/arm/plat-aspeed/include/plat/ast-snoop.h
new file mode 100644
index 000000000000..76ea76110da8
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast-snoop.h
@@ -0,0 +1,37 @@
+/*
+ * ast-snoop_h
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+struct ast_snoop_channel {
+ u8 snoop_ch;
+ u8 snoop_port;
+ u8 snoop_data;
+};
+
+struct ast_snoop {
+ struct ast_snoop_channel *snoop_ch0;
+ struct ast_snoop_channel *snoop_ch1;
+};
+
+struct ast_snoop_dma_channel {
+ u8 snoop_ch;
+ u8 snoop_port;
+ u8 snoop_mask;
+ u8 snoop_mode;
+ u8 snoop_index;
+ u32 dma_virt;
+ dma_addr_t dma_addr;
+ u16 dma_size;
+};
+
+extern int ast_snoop_init(struct ast_snoop *snoop);
+extern void ast_snoop_dma_init(struct ast_snoop_dma_channel *ast_dma_ch);
+
+
+
diff --git a/arch/arm/plat-aspeed/include/plat/ast1070-devs.h b/arch/arm/plat-aspeed/include/plat/ast1070-devs.h
new file mode 100644
index 000000000000..b3aa799f4b14
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast1070-devs.h
@@ -0,0 +1,25 @@
+/********************************************************************************
+* arch/arm/plat-aspeed/include/plat/devs.h
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+********************************************************************************/
+#ifndef __ASM_PLAT_AST1070_H
+#define __ASM_PLAT_AST1070_H
+
+//ast1070
+extern void __init ast_add_device_cuart(u8 chip, u32 lpc_base);
+extern void __init ast_add_device_clpc(u8 chip, u32 lpc_base);
+extern void __init ast_add_device_ci2c(u8 chip, u32 lpc_base);
+
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/ast1070-scu.h b/arch/arm/plat-aspeed/include/plat/ast1070-scu.h
new file mode 100644
index 000000000000..70c63e24888f
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast1070-scu.h
@@ -0,0 +1,34 @@
+/********************************************************************************
+* File Name : arch/arm/mach-aspeed/include/plat/ast1070-scu.h
+* Author : Ryan Chen
+* Description : AST1070 SCU Service Header
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+* 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.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2013/05/03 Ryan Chen create this file
+*
+********************************************************************************/
+
+#ifndef __AST1070_SCU_H_INCLUDED
+#define __AST1070_SCU_H_INCLUDED
+
+extern void ast1070_scu_init_i2c(u8 node);
+extern void ast1070_scu_init_uart(u8 node);
+extern void ast1070_scu_revision_id(u8 node);
+extern void ast1070_dma_init(u8 node);
+extern void ast1070_multi_func_uart(u8 node, u8 uart);
+
+
+
+
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/ast1070-uart-dma.h b/arch/arm/plat-aspeed/include/plat/ast1070-uart-dma.h
new file mode 100644
index 000000000000..c4edd7528dc0
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast1070-uart-dma.h
@@ -0,0 +1,27 @@
+/********************************************************************************
+* File Name : arch/arm/mach-aspeed/include/plat/ast1070-scu.h
+* Author : Ryan Chen
+* Description : AST1070 SCU Service Header
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+* 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.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2013/05/03 Ryan Chen create this file
+*
+********************************************************************************/
+
+#ifndef __AST1070_UART_DMA_H_INCLUDED
+#define __AST1070_UART_DMA_H_INCLUDED
+
+extern void ast1070_uart_dma_init(u8 node);
+
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/ast_i2c.h b/arch/arm/plat-aspeed/include/plat/ast_i2c.h
new file mode 100644
index 000000000000..b0ff995c2b24
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast_i2c.h
@@ -0,0 +1,64 @@
+/*
+ * ast_i2c_h
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+//I2C MEMORY Device state machine
+typedef enum i2c_slave_stage {
+ INIT_STAGE,
+ CMD_STAGE,
+ CMD_DATA_STAGE,
+ DATA_STAGE
+} stage;
+
+typedef enum i2c_xfer_mode {
+ BYTE_XFER,
+ BUFF_XFER,
+ DMA_XFER
+} i2c_xfer_mode_t;
+
+//1. usage flag , 2 size, 3. request address
+struct buf_page
+{
+ u8 flag; //0:free to usage, 1: used
+ u8 page_no; //for AST2400 usage
+ u16 page_size;
+ u32 page_addr;
+ u32 page_addr_point;
+};
+
+typedef enum i2c_slave_event_e {
+ I2C_SLAVE_EVENT_START_READ,
+ I2C_SLAVE_EVENT_READ,
+ I2C_SLAVE_EVENT_START_WRITE,
+ I2C_SLAVE_EVENT_WRITE,
+ I2C_SLAVE_EVENT_NACK,
+ I2C_SLAVE_EVENT_STOP
+} i2c_slave_event_t;
+
+#define BYTE_MODE 0
+#define BUFF_MODE 1
+#define DMA_MODE 2
+
+struct ast_i2c_driver_data {
+ void __iomem *reg_gr;
+ u32 bus_clk;
+ u8 master_dma; //0,byte mode 1,Buffer pool mode 256 , or 2048 , 2: DMA mode
+ u8 slave_dma; //0,byte mode 1,Buffer pool mode 256 , or 2048 , 2: DMA mode
+ u8 (*request_pool_buff_page)(struct buf_page **page);
+ void (*free_pool_buff_page)(struct buf_page *page);
+ unsigned char *buf_pool;
+ void (*slave_xfer)(i2c_slave_event_t event, struct i2c_msg **msgs);
+ void (*slave_init)(struct i2c_msg **msgs);
+ u32 (*get_i2c_clock)(void);
+};
+
+#ifdef CONFIG_AST_I2C_SLAVE_MODE
+extern void i2c_slave_init(struct i2c_msg **msgs);
+extern void i2c_slave_xfer(i2c_slave_event_t event, struct i2c_msg **msgs);
+#endif \ No newline at end of file
diff --git a/arch/arm/plat-aspeed/include/plat/ast_mctp.h b/arch/arm/plat-aspeed/include/plat/ast_mctp.h
new file mode 100644
index 000000000000..51396ff4d0ab
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast_mctp.h
@@ -0,0 +1,31 @@
+/********************************************************************************
+* File Name : arch/arm/mach-aspeed/include/plat/ast-scu.h
+* Author : Ryan Chen
+* Description : AST SCU Service Header
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+* 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.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+* History :
+* 1. 2012/08/03 Ryan Chen create this file
+*
+********************************************************************************/
+
+#ifndef __AST_P2X_H_INCLUDED
+#define __AST_P2X_H_INCLUDED
+
+extern void ast_pcie_cfg_read(u8 type, u32 bdf_offset, u32 *value);
+//extern void ast_pcie_cfg_write(u8 type, u32 bdf_offset, u32 data);
+extern void ast_pcie_cfg_write(u8 type, u8 byte_en, u32 bdf_offset, u32 data);
+extern void ast_mctp_addr_map(u32 mask, u32 addr);
+
+#endif
+
diff --git a/arch/arm/plat-aspeed/include/plat/ast_sdhci.h b/arch/arm/plat-aspeed/include/plat/ast_sdhci.h
new file mode 100644
index 000000000000..13547af85f91
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/ast_sdhci.h
@@ -0,0 +1,290 @@
+/*
+ * sdhci.h - Secure Digital Host Controller Interface driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+#include <linux/scatterlist.h>
+#include <linux/leds.h>
+#include <linux/interrupt.h>
+
+
+/*
+ * Controller registers
+ */
+
+#define SDHCI_DMA_ADDRESS 0x00
+
+#define SDHCI_BLOCK_SIZE 0x04
+#define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF))
+
+#define SDHCI_BLOCK_COUNT 0x06
+
+#define SDHCI_ARGUMENT 0x08
+
+#define SDHCI_TRANSFER_MODE 0x0C
+#define SDHCI_TRNS_DMA 0x01
+#define SDHCI_TRNS_BLK_CNT_EN 0x02
+#define SDHCI_TRNS_ACMD12 0x04
+#define SDHCI_TRNS_READ 0x10
+#define SDHCI_TRNS_MULTI 0x20
+
+#define SDHCI_COMMAND 0x0E
+#define SDHCI_CMD_RESP_MASK 0x03
+#define SDHCI_CMD_CRC 0x08
+#define SDHCI_CMD_INDEX 0x10
+#define SDHCI_CMD_DATA 0x20
+
+#define SDHCI_CMD_RESP_NONE 0x00
+#define SDHCI_CMD_RESP_LONG 0x01
+#define SDHCI_CMD_RESP_SHORT 0x02
+#define SDHCI_CMD_RESP_SHORT_BUSY 0x03
+
+#define SDHCI_MAKE_CMD(c, f) (((c & 0xff) << 8) | (f & 0xff))
+
+#define SDHCI_RESPONSE 0x10
+
+#define SDHCI_BUFFER 0x20
+
+#define SDHCI_PRESENT_STATE 0x24
+#define SDHCI_CMD_INHIBIT 0x00000001
+#define SDHCI_DATA_INHIBIT 0x00000002
+#define SDHCI_DOING_WRITE 0x00000100
+#define SDHCI_DOING_READ 0x00000200
+#define SDHCI_SPACE_AVAILABLE 0x00000400
+#define SDHCI_DATA_AVAILABLE 0x00000800
+#define SDHCI_CARD_PRESENT 0x00010000
+#define SDHCI_WRITE_PROTECT 0x00080000
+
+#define SDHCI_HOST_CONTROL 0x28
+#define SDHCI_CTRL_LED 0x01
+#define SDHCI_CTRL_4BITBUS 0x02
+#define SDHCI_CTRL_HISPD 0x04
+#define SDHCI_CTRL_DMA_MASK 0x18
+#define SDHCI_CTRL_SDMA 0x00
+#define SDHCI_CTRL_ADMA1 0x08
+#define SDHCI_CTRL_ADMA32 0x10
+#define SDHCI_CTRL_ADMA64 0x18
+
+#define SDHCI_POWER_CONTROL 0x29
+#define SDHCI_POWER_ON 0x01
+#define SDHCI_POWER_180 0x0A
+#define SDHCI_POWER_300 0x0C
+#define SDHCI_POWER_330 0x0E
+
+#define SDHCI_BLOCK_GAP_CONTROL 0x2A
+
+#define SDHCI_WAKE_UP_CONTROL 0x2B
+
+#define SDHCI_CLOCK_CONTROL 0x2C
+#define SDHCI_DIVIDER_SHIFT 8
+#define SDHCI_CLOCK_CARD_EN 0x0004
+#define SDHCI_CLOCK_INT_STABLE 0x0002
+#define SDHCI_CLOCK_INT_EN 0x0001
+
+#define SDHCI_TIMEOUT_CONTROL 0x2E
+
+#define SDHCI_SOFTWARE_RESET 0x2F
+#define SDHCI_RESET_ALL 0x01
+#define SDHCI_RESET_CMD 0x02
+#define SDHCI_RESET_DATA 0x04
+
+#define SDHCI_INT_STATUS 0x30
+#define SDHCI_INT_ENABLE 0x34
+#define SDHCI_SIGNAL_ENABLE 0x38
+#define SDHCI_INT_RESPONSE 0x00000001
+#define SDHCI_INT_DATA_END 0x00000002
+#define SDHCI_INT_DMA_END 0x00000008
+#define SDHCI_INT_SPACE_AVAIL 0x00000010
+#define SDHCI_INT_DATA_AVAIL 0x00000020
+#define SDHCI_INT_CARD_INSERT 0x00000040
+#define SDHCI_INT_CARD_REMOVE 0x00000080
+#define SDHCI_INT_CARD_INT 0x00000100
+#define SDHCI_INT_ERROR 0x00008000
+#define SDHCI_INT_TIMEOUT 0x00010000
+#define SDHCI_INT_CRC 0x00020000
+#define SDHCI_INT_END_BIT 0x00040000
+#define SDHCI_INT_INDEX 0x00080000
+#define SDHCI_INT_DATA_TIMEOUT 0x00100000
+#define SDHCI_INT_DATA_CRC 0x00200000
+#define SDHCI_INT_DATA_END_BIT 0x00400000
+#define SDHCI_INT_BUS_POWER 0x00800000
+#define SDHCI_INT_ACMD12ERR 0x01000000
+#define SDHCI_INT_ADMA_ERROR 0x02000000
+
+#define SDHCI_INT_NORMAL_MASK 0x00007FFF
+#define SDHCI_INT_ERROR_MASK 0xFFFF8000
+
+#define SDHCI_INT_CMD_MASK (SDHCI_INT_RESPONSE | SDHCI_INT_TIMEOUT | \
+ SDHCI_INT_CRC | SDHCI_INT_END_BIT | SDHCI_INT_INDEX)
+#define SDHCI_INT_DATA_MASK (SDHCI_INT_DATA_END | SDHCI_INT_DMA_END | \
+ SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | \
+ SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \
+ SDHCI_INT_DATA_END_BIT)
+
+#define SDHCI_ACMD12_ERR 0x3C
+
+/* 3E-3F reserved */
+
+#define SDHCI_CAPABILITIES 0x40
+#define SDHCI_TIMEOUT_CLK_MASK 0x0000003F
+#define SDHCI_TIMEOUT_CLK_SHIFT 0
+#define SDHCI_TIMEOUT_CLK_UNIT 0x00000080
+#define SDHCI_CLOCK_BASE_MASK 0x00003F00
+#define SDHCI_CLOCK_BASE_SHIFT 8
+#define SDHCI_MAX_BLOCK_MASK 0x00030000
+#define SDHCI_MAX_BLOCK_SHIFT 16
+#define SDHCI_CAN_DO_ADMA2 0x00080000
+#define SDHCI_CAN_DO_ADMA1 0x00100000
+#define SDHCI_CAN_DO_HISPD 0x00200000
+#define SDHCI_CAN_DO_DMA 0x00400000
+#define SDHCI_CAN_VDD_330 0x01000000
+#define SDHCI_CAN_VDD_300 0x02000000
+#define SDHCI_CAN_VDD_180 0x04000000
+#define SDHCI_CAN_64BIT 0x10000000
+
+/* 44-47 reserved for more caps */
+
+#define SDHCI_MAX_CURRENT 0x48
+
+/* 4C-4F reserved for more max current */
+
+#define SDHCI_SET_ACMD12_ERROR 0x50
+#define SDHCI_SET_INT_ERROR 0x52
+
+#define SDHCI_ADMA_ERROR 0x54
+
+/* 55-57 reserved */
+
+#define SDHCI_ADMA_ADDRESS 0x58
+
+/* 60-FB reserved */
+
+#define SDHCI_SLOT_INT_STATUS 0xFC
+
+#define SDHCI_HOST_VERSION 0xFE
+#define SDHCI_VENDOR_VER_MASK 0xFF00
+#define SDHCI_VENDOR_VER_SHIFT 8
+#define SDHCI_SPEC_VER_MASK 0x00FF
+#define SDHCI_SPEC_VER_SHIFT 0
+#define SDHCI_SPEC_100 0
+#define SDHCI_SPEC_200 1
+
+struct sdhci_ops;
+
+struct sdhci_host {
+ /* Data set by hardware interface driver */
+ const char *hw_name; /* Hardware bus name */
+
+ unsigned int quirks; /* Deviations from spec. */
+
+/* Controller doesn't honor resets unless we touch the clock register */
+#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0)
+/* Controller has bad caps bits, but really supports DMA */
+#define SDHCI_QUIRK_FORCE_DMA (1<<1)
+/* Controller doesn't like to be reset when there is no card inserted. */
+#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2)
+/* Controller doesn't like clearing the power reg before a change */
+#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3)
+/* Controller has flaky internal state so reset it on each ios change */
+#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4)
+/* Controller has an unusable DMA engine */
+#define SDHCI_QUIRK_BROKEN_DMA (1<<5)
+/* Controller has an unusable ADMA engine */
+#define SDHCI_QUIRK_BROKEN_ADMA (1<<6)
+/* Controller can only DMA from 32-bit aligned addresses */
+#define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<7)
+/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
+#define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<8)
+/* Controller can only ADMA chunks that are a multiple of 32 bits */
+#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1<<9)
+/* Controller needs to be reset after each request to stay stable */
+#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<10)
+/* Controller needs voltage and power writes to happen separately */
+#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11)
+/* Controller provides an incorrect timeout value for transfers */
+#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12)
+/* Controller has an issue with buffer bits for small transfers */
+#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13)
+/* Controller supports high speed but doesn't have the caps bit set */
+#define SDHCI_QUIRK_FORCE_HIGHSPEED (1<<14)
+/* Controller does not provide transfer-complete interrupt when not busy */
+#define SDHCI_QUIRK_NO_BUSY_IRQ (1<<15)
+
+ int irq; /* Device IRQ */
+ void __iomem * ioaddr; /* Mapped address */
+
+ const struct sdhci_ops *ops; /* Low level hw interface */
+
+ /* Internal data */
+ struct mmc_host *mmc; /* MMC structure */
+ u64 dma_mask; /* custom DMA mask */
+
+#ifdef CONFIG_LEDS_CLASS
+ struct led_classdev led; /* LED control */
+ char led_name[32];
+#endif
+
+ spinlock_t lock; /* Mutex */
+
+ int flags; /* Host attributes */
+#define SDHCI_USE_DMA (1<<0) /* Host is DMA capable */
+#define SDHCI_USE_ADMA (1<<1) /* Host is ADMA capable */
+#define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */
+#define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */
+
+ unsigned int version; /* SDHCI spec. version */
+
+ unsigned int max_clk; /* Max possible freq (MHz) */
+ unsigned int timeout_clk; /* Timeout freq (KHz) */
+
+ unsigned int clock; /* Current clock (MHz) */
+ unsigned short power; /* Current voltage */
+
+ struct mmc_request *mrq; /* Current request */
+ struct mmc_command *cmd; /* Current command */
+ struct mmc_data *data; /* Current data request */
+ unsigned int data_early:1; /* Data finished before cmd */
+
+ struct sg_mapping_iter sg_miter; /* SG state for PIO */
+ unsigned int blocks; /* remaining PIO blocks */
+
+ int sg_count; /* Mapped sg entries */
+
+ u8 *adma_desc; /* ADMA descriptor table */
+ u8 *align_buffer; /* Bounce buffer */
+
+ dma_addr_t adma_addr; /* Mapped ADMA descr. table */
+ dma_addr_t align_addr; /* Mapped bounce buffer */
+
+ struct tasklet_struct card_tasklet; /* Tasklet structures */
+ struct tasklet_struct finish_tasklet;
+
+ struct timer_list timer; /* Timer for timeouts */
+
+ unsigned long private[0] ____cacheline_aligned;
+};
+
+struct ast_sdhc_platform_data {
+ u32 (*sd_clock_src_get)(void);
+};
+
+extern struct sdhci_host *sdhci_alloc_host(struct device *dev,
+ size_t priv_size);
+extern void sdhci_free_host(struct sdhci_host *host);
+
+static inline void *sdhci_priv(struct sdhci_host *host)
+{
+ return (void *)host->private;
+}
+
+extern int sdhci_add_host(struct sdhci_host *host);
+extern void sdhci_remove_host(struct sdhci_host *host, int dead);
+
+#ifdef CONFIG_PM
+extern int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state);
+extern int sdhci_resume_host(struct sdhci_host *host);
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/devs.h b/arch/arm/plat-aspeed/include/plat/devs.h
new file mode 100644
index 000000000000..41cbea934421
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/devs.h
@@ -0,0 +1,65 @@
+/********************************************************************************
+* arch/arm/plat-aspeed/include/plat/devs.h
+*
+* Copyright (C) ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+*
+* 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.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+********************************************************************************/
+#ifndef __ASM_PLAT_ASPEED_H
+#define __ASM_PLAT_ASPEED_H
+
+extern void __init ast_add_all_devices(void);
+
+//platform
+extern void __init ast_add_device_uart(void);
+extern void __init ast_add_device_vuart(void);
+extern void __init ast_add_device_watchdog(void);
+extern void __init ast_add_device_rtc(void);
+extern void __init ast_add_device_gpio(void);
+extern void __init ast_add_device_sgpio(void);
+
+//ADC
+
+//Bus
+extern void __init ast_add_device_lpc(void);
+extern void __init ast_add_device_snoop(void);
+extern void __init ast_add_device_kcs(void);
+extern void __init ast_add_device_mailbox(void);
+extern void __init ast_add_device_i2c(void);
+extern void __init ast_add_device_spi(void);
+extern void __init ast_add_device_ehci(void);
+extern void __init ast_add_device_uhci(void);
+extern void __init ast_add_device_gmac(void);
+extern void __init ast_add_device_udc11(void);
+extern void __init ast_add_device_hid(void);
+
+extern void __init ast_add_device_pcie(void);
+
+extern void __init ast_add_device_peci(void);
+extern void __init ast_add_device_jtag(void);
+
+//hwmon
+extern void __init ast_add_device_pwm_fan(void);
+extern void __init ast_add_device_adc(void);
+
+
+//Storage
+extern void __init ast_add_device_nand(void);
+extern void __init ast_add_device_flash(void);
+extern void __init ast_add_device_sdhci(void);
+extern void __init ast_add_device_nand(void);
+
+//video
+extern void __init ast_add_device_fb(void);
+extern void __init ast_add_device_video(void);
+
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/regs-1070_lpc.h b/arch/arm/plat-aspeed/include/plat/regs-1070_lpc.h
new file mode 100644
index 000000000000..ef8cd8c04973
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-1070_lpc.h
@@ -0,0 +1,32 @@
+/* arch/arm/plat-aspeed/include/mach/regs-1070_lpc.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED AST1070 LPC Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_LPC_H
+#define __ASM_ARCH_REGS_LPC_H __FILE__
+
+#define AST1070_LPC_HICR0 0x00
+#define AST1070_LPC_HICR1 0x04
+#define AST1070_LPC_HICR2 0x08
+#define AST1070_LPC_HICR3 0x0c
+#define AST1070_LPC_HICR4 0x10
+
+//for snoop driver
+#define AST1070_LPC_L_80H_ADDR 0x220
+#define AST1070_LPC_H_80H_ADDR 0x224
+#define AST1070_LPC_80H_DATA 0x228
+#define AST1070_LPC_80H_CTRL 0x22c
+
+
+#define AST1070_LPC_80H_CLR (0x1 << 4)
+
+#define AST1070_LPC_80H_EN 0x1
+#endif /* __ASM_ARCH_REGS_LPC_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-adc.h b/arch/arm/plat-aspeed/include/plat/regs-adc.h
new file mode 100644
index 000000000000..97f5919036be
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-adc.h
@@ -0,0 +1,191 @@
+/* arch/arm/plat-aspeed/include/mach/regs-adc.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED ADC Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_ADC_H
+#define __ASM_ARCH_REGS_ADC_H __FILE__
+
+#if defined(CONFIG_ARCH_AST2300)
+#define MAX_CH_NO 12
+#elif defined(CONFIG_ARCH_AST2400) || defined(CONFIG_ARCH_AST2500)
+#define MAX_CH_NO 16
+#elif defined(CONFIG_ARCH_AST1010)
+#define MAX_CH_NO 8
+#else
+#err "ADC NO define MAX CHANNEL NO"
+#endif
+
+#if defined(CONFIG_ARCH_AST2500)
+#define TEMPER_CH_NO 2
+#endif
+
+/*AST ADC Register Definition */
+#define AST_ADC_CTRL 0x00
+#define AST_ADC_IER 0x04
+#define AST_ADC_VGA 0x08
+#if defined(CONFIG_ARCH_AST1010)
+#define AST_ADC_TRIM 0x08
+#endif
+#define AST_ADC_CLK 0x0c
+#define AST_ADC_CH0_1 0x10
+#define AST_ADC_CH2_3 0x14
+#define AST_ADC_CH4_5 0x18
+#define AST_ADC_CH6_7 0x1c
+#define AST_ADC_CH8_9 0x20
+#define AST_ADC_CH10_11 0x24
+#define AST_ADC_CH12_13 0x28
+#define AST_ADC_CH14_15 0x2c
+#define AST_ADC_BOUND0 0x30
+#define AST_ADC_BOUND1 0x34
+#define AST_ADC_BOUND2 0x38
+#define AST_ADC_BOUND3 0x3c
+#define AST_ADC_BOUND4 0x40
+#define AST_ADC_BOUND5 0x44
+#define AST_ADC_BOUND6 0x48
+#define AST_ADC_BOUND7 0x4c
+#define AST_ADC_BOUND8 0x50
+#define AST_ADC_BOUND9 0x54
+#define AST_ADC_BOUND10 0x58
+#define AST_ADC_BOUND11 0x5c
+#define AST_ADC_BOUND12 0x60
+#define AST_ADC_BOUND13 0x64
+#define AST_ADC_BOUND14 0x68
+#define AST_ADC_BOUND15 0x6c
+#define AST_ADC_HYSTER0 0x70
+#define AST_ADC_HYSTER1 0x74
+#define AST_ADC_HYSTER2 0x78
+#define AST_ADC_HYSTER3 0x7c
+#define AST_ADC_HYSTER4 0x80
+#define AST_ADC_HYSTER5 0x84
+#define AST_ADC_HYSTER6 0x88
+#define AST_ADC_HYSTER7 0x8c
+#define AST_ADC_HYSTER8 0x90
+#define AST_ADC_HYSTER9 0x94
+#define AST_ADC_HYSTER10 0x98
+#define AST_ADC_HYSTER11 0x9c
+#define AST_ADC_HYSTER12 0xa0
+#define AST_ADC_HYSTER13 0xa4
+#define AST_ADC_HYSTER14 0xa8
+#define AST_ADC_HYSTER15 0xac
+#define AST_ADC_INTR_SEL 0xC0
+#if defined(CONFIG_ARCH_AST2500)
+#define AST_ADC_CH16 0xD0
+#define AST_ADC_CH17 0xD4
+#endif
+
+
+#define AST_ADC_TRIM 0xC4
+
+// AST_ADC_CTRL:0x00 - ADC Engine Control Register
+#define AST_ADC_CTRL_CH15_EN (0x1 << 31)
+#define AST_ADC_CTRL_CH14_EN (0x1 << 30)
+#define AST_ADC_CTRL_CH13_EN (0x1 << 29)
+#define AST_ADC_CTRL_CH12_EN (0x1 << 28)
+#define AST_ADC_CTRL_CH11_EN (0x1 << 27)
+#define AST_ADC_CTRL_CH10_EN (0x1 << 26)
+#define AST_ADC_CTRL_CH9_EN (0x1 << 25)
+#define AST_ADC_CTRL_CH8_EN (0x1 << 24)
+#define AST_ADC_CTRL_CH7_EN (0x1 << 23)
+#define AST_ADC_CTRL_CH6_EN (0x1 << 22)
+#define AST_ADC_CTRL_CH5_EN (0x1 << 21)
+#define AST_ADC_CTRL_CH4_EN (0x1 << 20)
+#define AST_ADC_CTRL_CH3_EN (0x1 << 19)
+#define AST_ADC_CTRL_CH2_EN (0x1 << 18)
+#define AST_ADC_CTRL_CH1_EN (0x1 << 17)
+#define AST_ADC_CTRL_CH0_EN (0x1 << 16)
+
+#if defined(CONFIG_ARCH_AST2300)
+#define AST_ADC_CTRL_COMPEN_CLR (0x1 << 6)
+#define AST_ADC_CTRL_COMPEN (0x1 << 5)
+#elif defined(CONFIG_ARCH_AST2400)
+#define AST_ADC_CTRL_COMPEN (0x1 << 4)
+#elif defined(CONFIG_ARCH_AST2500)
+#define AST_ADC_CTRL_INIT_RDY (0x1 << 8)
+#define AST_ADC_CTRL_COMPEN (0x1 << 5)
+#else
+#err "ERROR define COMPEN ADC"
+#endif
+
+#if defined(CONFIG_ARCH_AST1010)
+#define AST_ADC_CTRL_OTP (0x1 << 3)
+#define AST_ADC_CTRL_PWR_DWN (0x1 << 2)
+#define AST_ADC_CTRL_TEST (0x1 << 1)
+#endif
+
+#define AST_ADC_CTRL_NORMAL (0x7 << 1)
+
+#define AST_ADC_CTRL_EN (0x1)
+
+
+/* AST_ADC_IER : 0x04 - Interrupt Enable and Interrupt status */
+#define AST_ADC_IER_CH15 (0x1 << 31)
+#define AST_ADC_IER_CH14 (0x1 << 30)
+#define AST_ADC_IER_CH13 (0x1 << 29)
+#define AST_ADC_IER_CH12 (0x1 << 28)
+#define AST_ADC_IER_CH11 (0x1 << 27)
+#define AST_ADC_IER_CH10 (0x1 << 26)
+#define AST_ADC_IER_CH9 (0x1 << 25)
+#define AST_ADC_IER_CH8 (0x1 << 24)
+#define AST_ADC_IER_CH7 (0x1 << 23)
+#define AST_ADC_IER_CH6 (0x1 << 22)
+#define AST_ADC_IER_CH5 (0x1 << 21)
+#define AST_ADC_IER_CH4 (0x1 << 20)
+#define AST_ADC_IER_CH3 (0x1 << 19)
+#define AST_ADC_IER_CH2 (0x1 << 18)
+#define AST_ADC_IER_CH1 (0x1 << 17)
+#define AST_ADC_IER_CH0 (0x1 << 16)
+#define AST_ADC_STS_CH15 (0x1 << 15)
+#define AST_ADC_STS_CH14 (0x1 << 14)
+#define AST_ADC_STS_CH13 (0x1 << 13)
+#define AST_ADC_STS_CH12 (0x1 << 12)
+#define AST_ADC_STS_CH11 (0x1 << 11)
+#define AST_ADC_STS_CH10 (0x1 << 10)
+#define AST_ADC_STS_CH9 (0x1 << 9)
+#define AST_ADC_STS_CH8 (0x1 << 8)
+#define AST_ADC_STS_CH7 (0x1 << 7)
+#define AST_ADC_STS_CH6 (0x1 << 6)
+#define AST_ADC_STS_CH5 (0x1 << 5)
+#define AST_ADC_STS_CH4 (0x1 << 4)
+#define AST_ADC_STS_CH3 (0x1 << 3)
+#define AST_ADC_STS_CH2 (0x1 << 2)
+#define AST_ADC_STS_CH1 (0x1 << 1)
+#define AST_ADC_STS_CH0 (0x1)
+
+/* AST_ADC_VGA : 0x08 - VGA Detect Control */
+#define AST_ADC_VGA_EN (0x1 << 16)
+#define AST_ADC_VGA_DIV_MASK (0x3ff)
+
+/* AST_ADC_CLK : 0x0c - ADC CLK Control */
+#define AST_ADC_CLK_PRE_DIV_MASK (0x7fff << 17)
+#define AST_ADC_CLK_PRE_DIV (0x1 << 17)
+#define AST_ADC_CLK_INVERT (0x1 << 16) //only for ast2300
+#define AST_ADC_CLK_DIV_MASK (0x3ff)
+
+#define AST_ADC_H_CH_MASK (0x3ff << 16)
+#define AST_ADC_L_CH_MASK (0x3ff)
+
+#define AST_ADC_H_BOUND (0x3ff << 16)
+#define AST_ADC_L_BOUND (0x3ff)
+
+#define AST_ADC_HYSTER_EN (0x1 << 31)
+
+#if defined(CONFIG_ARCH_AST2500)
+/* AST_ADC_CH16 : 0xD0 - */
+/* AST_ADC_CH17 : 0xD4 - */
+#define AST_TEMP_CH_RDY (0x1 << 31)
+#define AST_GET_TEMP_A_MASK(x) ((x >>16) & 0xfff)
+#define AST_TEMP_CH_EN (0x1 << 15)
+#define AST_GET_TEMP_B_MASK(x) (x & 0xfff)
+
+
+#endif
+
+#endif /* __ASM_ARCH_REGS_ADC_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-ast1070-intc.h b/arch/arm/plat-aspeed/include/plat/regs-ast1070-intc.h
new file mode 100644
index 000000000000..00dd1cba2c9f
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-ast1070-intc.h
@@ -0,0 +1,42 @@
+/* arch/arm/mach-aspeed/include/mach/regs-intr.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2012/08/15 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __ASPEED_AST1070_INTR_H
+#define __ASPEED_AST1070_INTR_H 1
+
+#include <asm/io.h>
+#include <mach/platform.h>
+#include <mach/irqs.h>
+
+/*
+ * VIC Register (VA)
+ */
+
+#define VIC_BASE_VA(x) IO_ADDRESS2(AST_C0_VIC_BASE + (0x10000*x))
+
+#define AST_IRQ_STS(x) (VIC_BASE_VA(x) + 0x00)
+#define AST_RAW_STS(x) (VIC_BASE_VA(x) + 0x08)
+#define AST_INTR_EN(x) (VIC_BASE_VA(x) + 0x10)
+#define AST_INTR_DIS(x) (VIC_BASE_VA(x) + 0x14)
+#define AST_INTR_SENSE(x) (VIC_BASE_VA(x) + 0x24)
+#define AST_INTR_BOTH_EDGE(x) (VIC_BASE_VA(x) + 0x28)
+#define AST_INTR_EVENT(x) (VIC_BASE_VA(x) + 0x2C)
+
+#define IRQ_SET_LEVEL_TRIGGER(x,irq_no) *((volatile unsigned long*)AST_INTR_SENSE(x)) |= 1 << (irq_no)
+#define IRQ_SET_EDGE_TRIGGER(x,irq_no) *((volatile unsigned long*)AST_INTR_SENSE(x)) &= ~(1 << (irq_no))
+#define IRQ_SET_RISING_EDGE(x,irq_no) *((volatile unsigned long*)AST_INTR_EVENT(x)) |= 1 << (irq_no)
+#define IRQ_SET_FALLING_EDGE(x,irq_no) *((volatile unsigned long*)AST_INTR_EVENT(x)) &= ~(1 << (irq_no))
+#define IRQ_SET_HIGH_LEVEL(x,irq_no) *((volatile unsigned long*)AST_INTR_EVENT(x)) |= 1 << (irq_no)
+#define IRQ_SET_LOW_LEVEL(x,irq_no) *((volatile unsigned long*)AST_INTR_EVENT(x)) &= ~(1 << (irq_no))
+
+
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/regs-ast1070-lpc.h b/arch/arm/plat-aspeed/include/plat/regs-ast1070-lpc.h
new file mode 100644
index 000000000000..22f84756d5eb
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-ast1070-lpc.h
@@ -0,0 +1,117 @@
+/* arch/arm/plat-aspeed/include/mach/regs-lpc.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED LPC Controller
+*/
+
+#ifndef __AST1070_LPC_H_
+#define __AST1070_LPC_H_
+
+#define AST_LPC_HICR0 0x000
+#define AST_LPC_HICR1 0x004
+#define AST_LPC_HICR2 0x008
+#define AST_LPC_HICR3 0x00C
+#define AST_LPC_HICR4 0x010
+#define AST_LPC_LADR3H 0x014
+#define AST_LPC_LADR3L 0x018
+#define AST_LPC_LADR12H 0x01C
+#define AST_LPC_LADR12L 0x020
+#define AST_LPC_IDR1 0x024
+#define AST_LPC_IDR2 0x028
+#define AST_LPC_IDR3 0x02C
+#define AST_LPC_ODR1 0x030
+#define AST_LPC_ODR2 0x034
+#define AST_LPC_ODR3 0x038
+#define AST_LPC_STR1 0x03C
+#define AST_LPC_STR2 0x040
+#define AST_LPC_STR3 0x044
+////
+#define AST_LPC_SIRQCR0 0x048
+#define AST_LPC_SIRQCR1 0x04C
+#define AST_LPC_SIRQCR2 0x050
+#define AST_LPC_SIRQCR3 0x06C
+////
+#define AST_LPC_ADR1 0x070
+#define AST_LPC_IRQ1 0x074
+#define AST_LPC_ADR2 0x078
+#define AST_LPC_IRQ2 0x07C
+#define AST_LPC_ADR3 0x080
+#define AST_LPC_IRQ3 0x084
+
+#define AST_LPC_DEV_ADDRM0 0x100
+#define AST_LPC_DEV_ADDRM1 0x104
+#define AST_LPC_DEV_ADDRM2 0x108
+#define AST_LPC_DEV_ADDRM3 0x10C
+#define AST_LPC_DEV_ADDR0 0x110
+#define AST_LPC_DEV_ADDR1 0x114
+#define AST_LPC_DEV_ADDR2 0x118
+#define AST_LPC_DEV_ADDR3 0x11C
+#define AST_LPC_DEC_ADDR0 0x120
+#define AST_LPC_DEC_ADDR1 0x124
+#define AST_LPC_DEC_RANGE0 0x128
+#define AST_LPC_DEC_RANGE1 0x12C
+
+#define AST_LPC_MBXDAT0 0x180
+#define AST_LPC_MBXDAT1 0x184
+#define AST_LPC_MBXDAT2 0x188
+#define AST_LPC_MBXDAT3 0x18C
+#define AST_LPC_MBXDAT4 0x190
+#define AST_LPC_MBXDAT5 0x194
+#define AST_LPC_MBXDAT6 0x198
+#define AST_LPC_MBXDAT7 0x19C
+#define AST_LPC_MBXDAT8 0x1A0
+#define AST_LPC_MBXDAT9 0x1A4
+#define AST_LPC_MBXDATA 0x1A8
+#define AST_LPC_MBXDATB 0x1AC
+#define AST_LPC_MBXDATC 0x1B0
+#define AST_LPC_MBXDATD 0x1B4
+#define AST_LPC_MBXDATE 0x1B8
+#define AST_LPC_MBXDATF 0x1BC
+
+#define AST_LPC_MBXSTS0 0x1C0
+#define AST_LPC_MBXSTS1 0x1C4
+
+#define AST_LPC_MBXBICR 0x1C8
+#define AST_LPC_MBXHICR 0x1CC
+#define AST_LPC_MBXBIE0 0x1D0
+#define AST_LPC_MBXBIE1 0x1D4
+#define AST_LPC_MBXHIE0 0x1D8
+#define AST_LPC_MBXHIE1 0x1DC
+
+#define AST_LPC_PIN_MON 0x200
+#define AST_LPC_SIRQ_CTRL 0x208
+#define AST_LPC_INT_STS 0x20C
+#define AST_LPC_CTRL_STS 0x210
+#define AST_LPC_PME 0x218
+#define AST_LPC_SMI 0x21C
+#define AST_LPC_80H_ADDR0 0x220
+#define AST_LPC_80H_ADDR1 0x224
+#define AST_LPC_80H_DATA 0x228
+#define AST_LPC_80H_CTRL 0x22C
+
+#define AST_LPC_CHIP_VER 0x240
+#define AST_LPC_CHIP_REVER 0x244
+#define AST_LPC_BMC_SCH0 0x248
+#define AST_LPC_BMC_SCH1 0x24C
+#define AST_LPC_NODE_SCH0 0x250
+#define AST_LPC_NODE_SCH1 0x254
+#define AST_LPC_NODE_SCH2 0x258
+#define AST_LPC_NODE_SCH3 0x25C
+
+
+
+
+
+
+
+
+
+
+
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/regs-ast1070-scu.h b/arch/arm/plat-aspeed/include/plat/regs-ast1070-scu.h
new file mode 100644
index 000000000000..a5a4f95eaf25
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-ast1070-scu.h
@@ -0,0 +1,95 @@
+/* arch/arm/mach-aspeed/include/mach/regs-ast1070-scu.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2013/05/15 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __AST1070_SCU_H
+#define __AST1070_SCU_H 1
+
+/*
+ * Register for SCU
+ * */
+#define AST1070_SCU_PROTECT 0x00 /* protection key register */
+#define AST1070_SCU_RESET 0x04 /* system reset control register */
+#define AST1070_SCU_MISC_CTRL 0x08 /* misc control register */
+#define AST1070_SCU_UART_MUX 0x0C /* UART Mux control register */
+#define AST1070_SCU_SPI_USB_MUX 0x10 /* SPI/USB Mux control register */
+#define AST1070_SCU_IO_DRIVING 0x14 /* I/O Driving Strength control register */
+#define AST1070_SCU_IO_PULL 0x18 /* I/O Internal Pull control register */
+#define AST1070_SCU_IO_SLEW 0x1C /* I/O Slew Rate control register */
+#define AST1070_SCU_IO_SCHMITT 0x20 /* I/O Schmitt Trigger Control register */
+#define AST1070_SCU_IO_SELECT 0x24 /* I/O Port Selection register */
+#define AST1070_SCU_TRAP 0x30 /* HW TRAPPING register */
+#define AST1070_SCU_CHIP_ID 0x34 /* CHIP ID register */
+
+
+/* AST1070_SCU_PROTECT: 0x00 - protection key register */
+#define AST1070_SCU_PROTECT_UNLOCK 0x16881A78
+
+/* AST1070_SCU_RESET :0x04 - system reset control register */
+#define SCU_RESET_DMA (0x1 << 11)
+#define SCU_RESET_SPI_M (0x1 << 10)
+#define SCU_RESET_SPI_S (0x1 << 9)
+#define SCU_RESET_N4_LPC (0x1 << 8)
+#define SCU_RESET_N3_LPC (0x1 << 7)
+#define SCU_RESET_N2_LPC (0x1 << 6)
+#define SCU_RESET_N1_LPC (0x1 << 5)
+#define SCU_RESET_I2C (0x1 << 4)
+#define SCU_RESET_N4_UART (0x1 << 3)
+#define SCU_RESET_N3_UART (0x1 << 2)
+#define SCU_RESET_N2_UART (0x1 << 1)
+#define SCU_RESET_N1_UART (0x1 << 0)
+
+/* AST1070_SCU_MISC_CTRL 0x08 misc control register */
+#define SCU_DMA_M_S_MASK (0x3 << 9)
+
+#define SCU_DMA_SLAVE_EN (0x1 << 10)
+#define SCU_DMA_MASTER_EN (0x1 << 9)
+
+/* AST1070_SCU_UART_MUX 0x0C UART Mux control register */
+#define UART_MUX_MASK(x) (0xff << (x*8))
+
+#define BMC_UART_CTRL(x) (6 + (x*8))
+#define BMC_UART_CTRL_MASK(x) (0x3 << (6 + (x*8)))
+#define SET_BMC_UART_CTRL(x,v) ((v) << (6 + (x*8)))
+#define BMC_UART_FROM_N1 0
+#define BMC_UART_FROM_PAD1 1
+#define BMC_UART_FROM_NONE 2
+
+#define NODE_UART_CTRL(x) (3 + (x*8))
+#define NODE_UART_CTRL_MASK(x) (0x7 << (3 + (x*8)))
+#define SET_NODE_UART_CTRL(x,v) ((v) << (3 + (x*8)))
+#define NODE_UART_FROM_BMC 0
+#define NODE_UART_FROM_PAD1 1
+#define NODE_UART_FROM_PAD2 2
+#define NODE_UART_FROM_PAD3 3
+#define NODE_UART_FROM_PAD4 4
+#define NODE_UART_FROM_NONE 5
+#define NODE_UART_FROM_N2 6
+#define NODE_UART_FROM_N3 7
+
+
+#define SCU_UART_IO_PAD(x) (x*8)
+#define UART_IO_PAD_MASK(x) (0x7 << (x*8))
+#define SET_UART_IO_PAD(x,v) ((v) << (x*8))
+#define PAD_FROM_NONE 0
+#define PAD_FROM_N1_UART 1
+#define PAD_FROM_N2_UART 2
+#define PAD_FROM_N3_UART 3
+#define PAD_FROM_N4_UART 4
+#define PAD_FROM_BMC 5
+
+/* AST1070_SCU_TRAP 0x30 HW TRAPPING register */
+#define TRAP_DEVICE_SLAVE (0x1 << 2)
+#define TRAP_MULTI_MASTER (0x1 << 1)
+#define TRAP_LPC_PLUS_MODE (0x1 << 0)
+
+#endif
+
diff --git a/arch/arm/plat-aspeed/include/plat/regs-crt.h b/arch/arm/plat-aspeed/include/plat/regs-crt.h
new file mode 100644
index 000000000000..674928500766
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-crt.h
@@ -0,0 +1,183 @@
+/* linux/include/asm-arm/arch-aspeed/regs-crt.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef ___ASM_ARCH_REGS_CRT_H
+#define ___ASM_ARCH_REGS_CRT_H
+
+/* CRT control registers */
+
+
+//////////////////////////////////////////////////////////////////
+#define AST3000_VGA1_CTLREG 0x00
+#define AST3000_VGA1_CTLREG2 0x04
+#define AST3000_VGA1_STATUSREG 0x08
+#define AST3000_VGA1_PLL 0x0C
+#define AST3000_VGA1_HTREG 0x10
+#define AST3000_VGA1_HRREG 0x14
+#define AST3000_VGA1_VTREG 0x18
+#define AST3000_VGA1_VRREG 0x1C
+#define AST3000_VGA1_STARTADDR 0x20
+#define AST3000_VGA1_OFFSETREG 0x24
+#define AST3000_VGA1_THRESHOLD 0x28
+
+#define AST3000_VGA2_CTLREG 0x60
+#define AST3000_VGA2_CTLREG2 0x64
+#define AST3000_VGA2_STATUSREG 0x68
+#define AST3000_VGA2_PLL 0x6C
+#define AST3000_VGA2_HTREG 0x70
+#define AST3000_VGA2_HRREG 0x74
+#define AST3000_VGA2_VTREG 0x78
+#define AST3000_VGA2_VRREG 0x7C
+#define AST3000_VGA2_STARTADDR 0x80
+#define AST3000_VGA2_OFFSETREG 0x84
+#define AST3000_VGA2_THRESHOLD 0x88
+//////////////////////////////////////////////////////////////////
+
+//0x00 ~ 0x5F Reserved - FB0
+//0x60 ~ 90 FB1
+#define AST_CRT_CTRL1 0x60
+#define AST_CRT_CTRL2 0x64
+#define AST_CRT_STS 0x68
+#define AST_CRT_PLL 0x6C
+#define AST_CRT_HORIZ0 0x70
+#define AST_CRT_HORIZ1 0x74
+#define AST_CRT_VERTI0 0x78
+#define AST_CRT_VERTI1 0x7C
+#define AST_CRT_ADDR 0x80
+#define AST_CRT_OFFSET 0x84
+#define AST_CRT_THROD 0x88
+#define AST_CRT_XSCALING 0x8C
+//0x8c Reserved
+//0x90 ~ Cursor
+#define AST_CRT_CURSOR0 0x90
+#define AST_CRT_CURSOR1 0x94
+#define AST_CRT_CURSOR2 0x98
+#define AST_CRT_UADDR 0x9C
+//0x9c Reserved
+//0xA0 ~ OSD
+#define AST_CRT_OSDH 0xA0
+#define AST_CRT_OSDV 0xA4
+#define AST_CRT_OSDADDR 0xA8
+#define AST_CRT_OSDDISP 0xAC
+#define AST_CRT_OSDTHROD 0xB0
+#define AST_CRT_VADDR 0xB4
+
+//0xb4 Reserved
+#define AST_CRT_STS_V 0xB8
+#define AST_CRT_SCRATCH 0xBC
+#define AST_CRT_X 0xC0
+//0xC4
+#define AST_CRT_OSD_COLOR 0xE0
+
+/* AST_CRT_CTRL1 - 0x60 : CRT Control Register I */
+#define CRT_CTRL_VERTICAL_INTR_STS (0x1 << 31)
+#define CRT_CTRL_VERTICAL_INTR_EN (0x1 << 30)
+//24~28 reserved
+#define CRT_CTRL_DESK_OFF (0x1 << 23)
+#define CRT_CTRL_FSYNC_OFF (0x1 << 22)
+#define CRT_CTRL_FSYNC_POLARITY (0x1 << 21)
+#define CRT_CTRL_SCREEN_OFF (0x1 << 20)
+#define CRT_CTRL_VSYNC_OFF (0x1 << 19)
+#define CRT_CTRL_HSYNC_OFF (0x1 << 18)
+#define CRT_CTRL_VSYNC_POLARITY (0x1 << 17)
+#define CRT_CTRL_HSYNC_POLARITY (0x1 << 16)
+#define CRT_CTRL_TILE_EN (0x1 << 15)
+#define CRT_CTRL_HDTVYUV_EN (0x1 << 14)
+#define CRT_CTRL_YUV_FORMAT(x) (x << 12)
+#define YUV_MODE0 0
+#define YUV_MODE1 1
+#define YUV_MODE2 2
+// bit 11 reserved
+#define CRT_CTRL_HW_CURSOR_FORMAT (0x1 << 10) // 0: XRGB4444, 1:ARGB4444
+#define CRT_CTRL_FORMAT_MASK (0x7 << 7)
+#define CRT_CTRL_FORMAT(x) (x << 7)
+#define COLOR_RGB565 (0)
+#define COLOR_YUV444 (1)
+#define COLOR_XRGB8888 (2)
+#define COLOR_YUV444_2RGB (5)
+#define CRT_CTRL_ENVEFLIP (0x1 << 6)
+//bit 5
+#define CRT_CTRL_SCALING_X (0x1 << 4)
+#define CRT_CTRL_INTER_TIMING (0x1 << 3)
+#define CRT_CTRL_OSD_EN (0x1 << 2)
+#define CRT_CTRL_HW_CURSOR_EN (0x1 << 1)
+#define CRT_CTRL_GRAPHIC_EN (0x1)
+
+/*AST_CRT_CTRL2 - 0x64 : CRT Control Register II */
+#define CRT_CTRL_VLINE_NUM_MASK (0xfff << 20)
+#define CRT_CTRL_VLINE_NUM(x) (x << 20)
+#define CRT_CTRL_TESTDVO_MASK (0xfff << 8)
+#define CRT_CTRL_TESTDVO(x) (x << 8)
+#define CRT_CTRL_DVO_EN (0x1 << 7)
+#define CRT_CTRL_DVO_DUAL (0x1 << 6)
+#define CRT_CTRL_FIFO_FULL (0x1 << 5)
+#define CRT_CTRL_TEST_EN (0x1 << 4)
+#define CRT_CTRL_SIGN_DON (0x1 << 3)
+#define CRT_CTRL_SIGN_TRIGGER (0x1 << 2)
+#define CRT_CTRL_DAC_TEST_EN (0x1 << 1)
+#define CRT_CTRL_DAC_PWR_EN (0x1)
+
+/* AST_CRT_STS - 0x68 : CRT Status Register */
+#define CRT_STS_RED_RB(x) (x << 24)
+#define CRT_STS_GREEN_RB(x) (x << 16)
+#define CRT_STS_BLUE_RB(x) (x << 8)
+#define CRT_STS_DAC_SENSE_EN (0x1 << 7)
+//6 reserved
+#define CRT_STS_ODDFIELD_SYNC (0x1 << 5)
+#define CRT_STS_ODDFIELD (0x1 << 4)
+#define CRT_STS_HDISPLAY_RB (0x1 << 3)
+#define CRT_STS_HRETRACE_RB (0x1 << 2)
+#define CRT_STS_VDISPLAY_RB (0x1 << 1)
+#define CRT_STS_VRETRACE_RB (0x1)
+
+/* AST_CRT_PLL - 0x6C : CRT Video PLL Setting Register */
+#define CRT_PLL_DAC_MODE_SENSE(x) (x << 30)
+#define CRT_PLL_DAC_SENSE(x) (x << 28)
+#define CRT_PLL_BYPASS (0x1 << 17)
+#define CRT_PLL_PWR_DWN (0x1 << 16)
+#define CRT_PLL_POST_DIVIDER(x) (((x & 0x3) << 13) | (((x >> 2) & 0xf) << 18) | (((x >> 6) & 0x1) << 23) | (((x >> 7) & 0x1) << 22))
+#define CRT_PLL_DENUM(x) (x << 8)
+#define CRT_PLL_NUM(x) (x)
+
+/* AST_CRT_HORIZ0 - 0x70 : CRT Horizontal Total & Display Enable End Register */
+#define CRT_H_TOTAL(x) (x)
+#define CRT_H_DE(x) (x << 16)
+
+/* AST_ 0x74 : CRT Horizontal Retrace Start & End Register */
+#define CRT_H_RS_START(x) (x)
+#define CRT_H_RS_END(x) (x << 16)
+
+/* AST_CRT_ - 0x78 : CRT Horizontal Total & Display Enable End Register */
+#define CRT_V_TOTAL(x) (x)
+#define CRT_V_DE(x) (x << 16)
+
+/* AST_ 0x7C : CRT Horizontal Retrace Start & End Register */
+#define CRT_V_RS_START(x) (x)
+#define CRT_V_RS_END(x) (x << 16)
+
+/* AST_CRT_OFFSET - 0x84 : CRT Display Offset & Terminal Count Register */
+#define CRT_DISP_OFFSET(x) (x)
+#define CRT_TERM_COUNT(x) (x << 16)
+
+/* AST_CRT_THROD - 0x88 : CRT Threadhold Register */
+#define CRT_THROD_LOW(x) (x)
+#define CRT_THROD_HIGH(x) (x << 8)
+#define CRT_THROD_X_SCALING(x) (x << 16)
+#define CRT_THROD_CRT2Y (0x1 << 20)
+
+/* AST_CRT_XSCALING - 0x8C : CRT X Scaling-up Factor Register */
+
+
+/* AST_CRT_CURSOR0 : 0x90 - CRT Hardware Cursor X & Y Offset Register */
+#define CRT_HW_CURSOR_X_OFFSET(x) (x)
+#define CRT_HW_CURSOR_Y_OFFSET(x) (x << 16)
+
+/* AST_CRT_CURSOR1 : 0x94 - CRT Hardware Cursor X & Y Position Register */
+#define CRT_HW_CURSOR_X_POSITION(x) (x)
+#define CRT_HW_CURSOR_Y_POSITION(x) (x << 16)
+
+#endif /* ___ASM_ARCH_REGS_CRT_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-fmc.h b/arch/arm/plat-aspeed/include/plat/regs-fmc.h
new file mode 100644
index 000000000000..25c3046fe064
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-fmc.h
@@ -0,0 +1,112 @@
+/* arch/arm/plat-aspeed/include/mach/regs-smc.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED Static memory ctrol
+*/
+
+#ifndef __ASM_ARCH_REGS_FMC_H
+#define __ASM_ARCH_REGS_FMC_H __FILE__
+
+#define FMC_CE_TYPE 0x00
+#define FMC_CE_CTRL 0x04
+#define FMC_INTR_CTRL 0x08
+#define FMC_CE0_CTRL 0x10
+#define FMC_CE1_CTRL 0x14
+#define FMC_CE2_CTRL 0x18
+#define FMC_CE3_CTRL 0x1c
+#define FMC_CE4_CTRL 0x20
+
+#define FMC_CE0_ADDR 0x30
+#define FMC_CE1_ADDR 0x34
+#define FMC_CE2_ADDR 0x38
+#define FMC_CE3_ADDR 0x3c
+#define FMC_CE4_ADDR 0x40
+
+#define FMC_MISC_CTRL1 0x50
+#define FMC_MISC_CTRL2 0x54
+#define FMC_NAND_CTRL 0x58
+#define FMC_NAND_ECC 0x5c
+#define FMC_NAND_ECC_CK1 0x60
+#define FMC_NAND_ECC_CK2 0x64
+#define FMC_NAND_ECC_CK3 0x68
+#define FMC_NAND_ECC_GEN1 0x6c
+#define FMC_NAND_ECC_GEN2 0x70
+#define FMC_NAND_ECC_GEN3 0x74
+#define FMC_NAND_ECC_CK_R1 0x78
+#define FMC_NAND_ECC_CK_R2 0x7c
+#define FMC_DMA_CTRL 0x80
+#define FMC_DMA_FLASH_ADDR 0x84
+#define FMC_DMA_DRAM_ADDR 0x88
+#define FMC_DMA_LEN 0x8C
+#define FMC_CHECK_SUM 0x90
+#define FMC_SPI_TIMING 0x94
+
+/* FMC_CE_TYPE 0x00 */
+#define FMC_SET_WRITE_CS(x) (0x1 << (x+16))
+#define FMC_MASK_TYPE_CS(x) (~(0x3 << (2*x)))
+#define FMC_SET_TYPE_NAND_CS(x) (0x1 << (2*x))
+#define FMC_SET_TYPE_SPI_CS(x) (0x2 << (2*x))
+
+#define FMC_TYPE_NOR 0
+#define FMC_TYPE_NAND 1
+#define FMC_TYPE_SPI 2
+
+
+/* FMC_CE0_CTRL for NAND 0x10, 0x14, 0x18, 0x1c, 0x20 */
+#define NAND_T_WEH(x) (x << 28)
+#define NAND_T_WEL(x) (x << 24)
+#define NAND_T_REH(x) (x << 20)
+#define NAND_T_REL(x) (x << 16)
+#define NAND_T_CESH(x) (x << 12)
+#define NAND_T_WTR(x) (x << 10)
+#define NAND_T_R(x) (x << 4)
+#define NAND_ADDR_CYCLE (1 << 3)
+#define NAND_CE_ACTIVE (1 << 2)
+#define NAND_OP_MODE (1 << 0)
+
+/* FMC_CE0_CTRL for SPI 0x10, 0x14, 0x18, 0x1c, 0x20 */
+#define SPI_IO_MODE(x) (x << 28)
+#define SPI_CE_WIDTH(x) (x << 24)
+#define SPI_CMD_DATA(x) (x << 16)
+#define SPI_DUMMY_CMD (1 << 15)
+#define SPI_DUMMY_HIGH (1 << 14)
+#define SPI_CLK_DIV (1 << 13)
+#define SPI_ADDR_CYCLE (1 << 13)
+#define SPI_CMD_MERGE_DIS (1 << 12)
+#define SPI_T_CLK (x << 8)
+#define SPI_DUMMY_LOW (x << 6)
+#define SPI_LSB_FIRST_CTRL (1 << 5)
+#define SPI_CPOL_1 (1 << 4)
+#define SPI_DUAL_DATA (1 << 3)
+#define SPI_CE_INACTIVE (1 << 2)
+#define SPI_CMD_MODE (x)
+#define SPI_CMD_NOR_R_MODE 0
+#define SPI_CMD_FAST_R_MODE 1
+#define SPI_CMD_NOR_W_MODE 2
+#define SPI_CMD_USER_MODE 3
+
+
+/* FMC_CE0_ADDR 0x30 0x34 0x38 0x3c 0x40*/
+#define FMC_END_ADDR(x) (x << 24)
+#define FMC_START_ADDR(x) (x << 16)
+
+
+/* FMC_MISC_CTRL1 0x50 */
+#define READ_BUSY_PIN_STS (1 << 3)
+
+/* FMC_NAND_ECC 0x5c */
+#define NAND_ECC_RESET (1 << 3)
+#define NAND_ECC_ENABLE (1 << 2)
+#define NAND_ECC_DATA_BLK_512 2
+#define NAND_ECC_DATA_BLK_256 1
+#define NAND_ECC_DATA_BLK_128 0
+
+
+
+#endif /* __ASM_ARCH_REGS_FMC_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-gpio.h b/arch/arm/plat-aspeed/include/plat/regs-gpio.h
new file mode 100644
index 000000000000..d6e7de02c19d
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-gpio.h
@@ -0,0 +1,338 @@
+/* arch/arm/plat-aspeed/include/mach/regs-gpio.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED I2C Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_GPIO_H
+#define __ASM_ARCH_REGS_GPIO_H __FILE__
+
+/*AST GPIO Register Definition */
+#define AST_GPIO_DATA 0x000
+#define AST_GPIO_DIR 0x004
+#define AST_GPIO_INT_EN 0x008
+#define AST_GPIO_INT_SEN_T0 0x00c
+#define AST_GPIO_INT_SEN_T1 0x010
+#define AST_GPIO_INT_SEN_T2 0x014
+#define AST_GPIO_INT_STS 0x018
+#define AST_GPIO_RST_TOR 0x01c
+#define AST_EXT_GPIO_DATA 0x020
+#define AST_EXT_GPIO_DIR 0x024
+#define AST_EXT_GPIO_INT_EN 0x028
+#define AST_EXT_GPIO_INT_SEN_T0 0x02c
+#define AST_EXT_GPIO_INT_SEN_T1 0x030
+#define AST_EXT_GPIO_INT_SEN_T2 0x034
+#define AST_EXT_GPIO_INT_STS 0x038
+#define AST_EXT_GPIO_RST_TOR 0x03c
+#define AST_GPIO_DEBOUNCE_SET1 0x040 //A/B/C/D
+#define AST_GPIO_DEBOUNCE_SET2 0x044 //A/B/C/D
+#define AST_EXT_GPIO_DEBOUNCE_SET1 0x048 //E/F/G/H
+#define AST_EXT_GPIO_DEBOUNCE_SET2 0x04C //E/F/G/H
+#define AST_DEBOUNCE_TIME_SET1 0x050
+#define AST_DEBOUNCE_TIME_SET2 0x054
+#define AST_DEBOUNCE_TIME_SET3 0x058
+#define AST_GPIO_CMD_S0 0x060
+#define AST_GPIO_CMD_S1 0x064
+#define AST_EXT_GPIO_CMD_S0 0x068
+#define AST_EXT_GPIO_CMD_S1 0x06C
+#define AST_SIMPLE_GPIO_DATA0 0x070
+#define AST_SIMPLE_GPIO_DIR0 0x074
+#define AST_SIMPLE_GPIO_DATA1 0x078
+#define AST_SIMPLE_GPIO_DIR1 0x07C
+#define AST_SIMPLE_GPIO_DATA2 0x080
+#define AST_SIMPLE_GPIO_DIR2 0x084
+#define AST_SIMPLE_GPIO_DATA3 0x088
+#define AST_SIMPLE_GPIO_DIR3 0x08C
+#define AST_SIMPLE_GPIO0_CMD_S0 0x090
+#define AST_SIMPLE_GPIO0_CMD_S1 0x094
+#define AST_SIMPLE_GPIO0_INT_EN 0x098
+#define AST_SIMPLE_GPIO0_INT_SEN_T0 0x09c
+#define AST_SIMPLE_GPIO0_INT_SEN_T1 0x0a0
+#define AST_SIMPLE_GPIO0_INT_SEN_T2 0x0a4
+#define AST_SIMPLE_GPIO0_INT_STS 0x0a8
+#define AST_SIMPLE_GPIO0_RST_TOR 0x0ac
+#define AST_SIMPLE_GPIO0_DEBOUNCE_SET1 0x0b0
+#define AST_SIMPLE_GPIO0_DEBOUNCE_SET2 0x0b4
+#define AST_SIMPLE_GPIO0_INT_MASK 0x0b8
+#define AST_GPIO_DATA_READ 0x0c0
+#define AST_EXT_GPIO_DATA_READ 0x0c4
+#define AST_SIMPLE_GPIO0_DATA_READ 0x0c8
+#define AST_SIMPLE_GPIO1_DATA_READ 0x0cc
+#define AST_SIMPLE_GPIO2_DATA_READ 0x0d0
+#define AST_SIMPLE_GPIO3_DATA_READ 0x0d4
+#define AST_SIMPLE_GPIO4_DATA_READ 0x0d8
+#define AST_SIMPLE_GPIO1_CMD_S0 0x0e0
+#define AST_SIMPLE_GPIO1_CMD_S1 0x0e4
+#define AST_SIMPLE_GPIO1_INT_EN 0x0e8
+#define AST_SIMPLE_GPIO1_INT_SEN_T0 0x0ec
+#define AST_SIMPLE_GPIO1_INT_SEN_T1 0x0f0
+#define AST_SIMPLE_GPIO1_INT_SEN_T2 0x0f4
+#define AST_SIMPLE_GPIO1_INT_STS 0x0f8
+#define AST_SIMPLE_GPIO1_RST_TOR 0x0fc
+#define AST_SIMPLE_GPIO1_DEBOUNCE_SET1 0x100
+#define AST_SIMPLE_GPIO1_DEBOUNCE_SET2 0x104
+#define AST_SIMPLE_GPIO1_INT_MASK 0x108
+#define AST_SIMPLE_GPIO2_CMD_S0 0x110
+#define AST_SIMPLE_GPIO2_CMD_S1 0x114
+#define AST_SIMPLE_GPIO2_INT_EN 0x118
+#define AST_SIMPLE_GPIO2_INT_SEN_T0 0x11c
+#define AST_SIMPLE_GPIO2_INT_SEN_T1 0x120
+#define AST_SIMPLE_GPIO2_INT_SEN_T2 0x124
+#define AST_SIMPLE_GPIO2_INT_STS 0x128
+#define AST_SIMPLE_GPIO2_RST_TOR 0x12c
+#define AST_SIMPLE_GPIO2_DEBOUNCE_SET1 0x130
+#define AST_SIMPLE_GPIO2_DEBOUNCE_SET2 0x134
+#define AST_SIMPLE_GPIO2_INT_MASK 0x138
+#define AST_SIMPLE_GPIO3_CMD_S0 0x140
+#define AST_SIMPLE_GPIO3_CMD_S1 0x144
+#define AST_SIMPLE_GPIO3_INT_EN 0x148
+#define AST_SIMPLE_GPIO3_INT_SEN_T0 0x14c
+#define AST_SIMPLE_GPIO3_INT_SEN_T1 0x150
+#define AST_SIMPLE_GPIO3_INT_SEN_T2 0x154
+#define AST_SIMPLE_GPIO3_INT_STS 0x158
+#define AST_SIMPLE_GPIO3_RST_TOR 0x15c
+#define AST_SIMPLE_GPIO3_DEBOUNCE_SET1 0x160
+#define AST_SIMPLE_GPIO3_DEBOUNCE_SET2 0x164
+#define AST_SIMPLE_GPIO3_INT_MASK 0x168
+#define AST_SIMPLE_GPIO4_CMD_S0 0x170
+#define AST_SIMPLE_GPIO4_CMD_S1 0x174
+#define AST_SIMPLE_GPIO4_INT_EN 0x178
+#define AST_SIMPLE_GPIO4_INT_SEN_T0 0x17c
+#define AST_SIMPLE_GPIO4_INT_SEN_T1 0x180
+#define AST_SIMPLE_GPIO4_INT_SEN_T2 0x184
+#define AST_SIMPLE_GPIO4_INT_STS 0x188
+#define AST_SIMPLE_GPIO4_RST_TOR 0x18c
+#define AST_SIMPLE_GPIO4_DEBOUNCE_SET1 0x190
+#define AST_SIMPLE_GPIO4_DEBOUNCE_SET2 0x194
+#define AST_SIMPLE_GPIO4_INT_MASK 0x198
+#define AST_GPIO_INT_MASK 0x1d0
+#define AST_EXT_GPIO_INT_MASK 0x1d4
+#ifdef CONFIG_ARCH_AST1010
+#else
+#define AST_SIMPLE_GPIO_DATA4 0x1e0
+#define AST_SIMPLE_GPIO_DIR4 0x1e4
+#endif
+
+//Serial GPIO
+#define AST_SGPIO_DATA 0x200
+#define AST_SGPIO_INT_EN 0x204
+#define AST_SGPIO_INT_SEN_T0 0x208
+#define AST_SGPIO_INT_SEN_T1 0x20c
+#define AST_SGPIO_INT_SEN_T2 0x210
+#define AST_SGPIO_INT_STS 0x214
+#define AST_SGPIO_RST_TOR 0x218
+#define AST_EXT_SGPIO_DATA 0x21c
+#define AST_EXT_SGPIO_INT_EN 0x220
+#define AST_EXT_SGPIO_INT_SEN_T0 0x224
+#define AST_EXT_SGPIO_INT_SEN_T1 0x228
+#define AST_EXT_SGPIO_INT_SEN_T2 0x22c
+#define AST_EXT_SGPIO_INT_STS 0x230
+#define AST_EXT_SGPIO_RST_TOR 0x234
+#define AST_SGPIO_CTRL 0x254
+#define AST_SGPIO_DATA_READ 0x270
+#define AST_EXT_SGPIO_DAT 0x274
+
+//Serial GPIO Slave Monitor
+#define AST_SGPIO_SLAVE_DATA_INIT 0x300
+#define AST_SGPIO_SLAVE_DATA_TARGET 0x304
+#define AST_SGPIO_SLAVE_DATA_LOAD 0x308
+#define AST_SGPIO_SLAVE_INT_EN0 0x30c
+#define AST_SGPIO_SLAVE_INT_EN1 0x310
+#define AST_SGPIO_SLAVE_INT_EN2 0x314
+#define AST_SGPIO_SLAVE_INT_STS0 0x318
+#define AST_SGPIO_SLAVE_INT_STS1 0x31c
+#define AST_SGPIO_SLAVE_INT_STS2 0x320
+
+/**********************************************************************************/
+/* AST_GPIO_DATA - 0x000 : A/B/C/D Data Vale */
+#define GET_GPIOD_DATA(x) ((x&0xff000000) >> 24)
+#define SET_GPIOD_DATA(x) (x << 24)
+#define GET_GPIOD_PIN_DATA(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIOD_PIN_DATA(pin) (1<<(pin + 24))
+#define GET_GPIOC_DATA(x) ((x&0xff0000) >> 16)
+#define SET_GPIOC_DATA(x) (x << 16)
+#define GET_GPIOC_PIN_DATA(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIOC_PIN_DATA(pin) (1<<(pin + 16))
+#define GET_GPIOB_DATA(x) ((x&0xff00) >> 8)
+#define SET_GPIOB_DATA(x) (x << 8)
+#define GET_GPIOB_PIN_DATA(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIOB_PIN_DATA(pin) (1<<(pin + 8))
+#define GET_GPIOA_DATA(x) (x&0xff)
+#define SET_GPIOA_DATA(x) (x)
+#define GET_GPIOA_PIN_DATA(x,pin) ((x >> pin) & 1)
+#define SET_GPIOA_PIN_DATA(pin) (1<<pin)
+
+/* AST_GPIO_DIR - 0x004 : Direction */
+#define GET_GPIOD_DIR(x) ((x&0xff000000) >> 24)
+#define SET_GPIOD_DIR(x) (x << 24)
+#define GET_GPIOD_PIN_DIR(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIOD_PIN_DIR(pin) (1<<(pin + 24))
+#define GET_GPIOC_DIR(x) ((x&0xff0000) >> 16)
+#define SET_GPIOC_DIR(x) (x << 16)
+#define GET_GPIOC_PIN_DIR(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIOC_PIN_DIR(pin) (1<<(pin + 16))
+#define GET_GPIOB_DIR(x) ((x&0xff00) >> 8)
+#define SET_GPIOB_DIR(x) (x << 8)
+#define GET_GPIOB_PIN_DIR(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIOB_PIN_DIR(pin) (1<<(pin + 8))
+#define GET_GPIOA_DIR(x) (x&0xff)
+#define SET_GPIOA_DIR(x) (x)
+#define GET_GPIOA_PIN_DIR(x,pin) ((x >> pin) & 1)
+#define SET_GPIOA_PIN_DIR(pin) (1<<pin)
+
+/* AST_GPIO_INT_EN - 0x008 : Interrupt Enable */
+#define GET_GPIOD_INT_EN(x) ((x&0xff000000) >> 24)
+#define SET_GPIOD_INT_EN(x) (x << 24)
+#define GET_GPIOD_PIN_INT_EN(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIOD_PIN_INT_EN(pin) (1<<(pin + 24))
+#define GET_GPIOC_INT_EN(x) ((x&0xff0000) >> 16)
+#define SET_GPIOC_INT_EN(x) (x << 16)
+#define GET_GPIOC_PIN_INT_EN(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIOC_PIN_INT_EN(pin) (1<<(pin + 16))
+#define GET_GPIOB_INT_EN(x) ((x&0xff00) >> 8)
+#define SET_GPIOB_INT_EN(x) (x << 8)
+#define GET_GPIOB_PIN_INT_EN(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIOB_PIN_INT_EN(pin) (1<<(pin + 8))
+#define GET_GPIOA_INT_EN(x) (x&0xff)
+#define SET_GPIOA_INT_EN(x) (x)
+#define GET_GPIOA_PIN_INT_EN(x,pin) ((x >> pin) & 1)
+#define SET_GPIOA_PIN_INT_EN(pin) (1<<pin)
+
+/* AST_GPIO_INT_SEN_T0/1/2 - 0x00c/0x010/0x014 : Interrupt Sensitivity Type 0/1/2 */
+#define GET_GPIOD_INT_MODE(x) ((x&0xff000000) >> 24)
+#define SET_GPIOD_INT_MODE(x) (x << 24)
+#define GET_GPIOD_PIN_INT_MODE(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIOD_PIN_INT_MODE(pin) (1<<(pin + 24))
+#define GET_GPIOC_INT_MODE(x) ((x&0xff0000) >> 16)
+#define SET_GPIOC_INT_MODE(x) (x << 16)
+#define GET_GPIOC_PIN_INT_MODE(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIOC_PIN_INT_MODE(pin) (1<<(pin + 16))
+#define GET_GPIOB_INT_MODE(x) ((x&0xff00) >> 8)
+#define SET_GPIOB_INT_MODE(x) (x << 16)
+#define GET_GPIOB_PIN_INT_MODE(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIOB_PIN_INT_MODE(pin) (1<<(pin + 8))
+#define GET_GPIOA_INT_MODE(x) (x&0xff)
+#define SET_GPIOA_INT_MODE(x) (x)
+#define GET_GPIOA_PIN_INT_MODE(x,pin) ((x >> pin) & 1)
+#define SET_GPIOA_PIN_INT_MODE(pin) (1 << pin)
+
+/* AST_GPIO_INT_STS - 0x018 : Interrupt Status */
+#define GET_GPIOD_INT_STS(x) ((x&0xff000000) >> 24)
+#define SET_GPIOD_INT_STS(x) (x << 24)
+#define GET_GPIOD_PIN_INT_STS(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIOD_PIN_INT_STS(pin) (1<<(pin + 24))
+#define GET_GPIOC_INT_STS(x) ((x&0xff0000) >> 16)
+#define SET_GPIOC_INT_STS(x) (x << 16)
+#define GET_GPIOC_PIN_INT_STS(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIOC_PIN_INT_STS(pin) (1<<(pin + 16))
+#define GET_GPIOB_INT_STS(x) ((x&0xff00) >> 8)
+#define SET_GPIOB_INT_STS(x) (x << 16)
+#define GET_GPIOB_PIN_INT_STS(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIOB_PIN_INT_STS(pin) (1<<(pin + 8))
+#define GET_GPIOA_INT_STS(x) (x&0xff)
+#define SET_GPIOA_INT_STS(x) (x)
+#define GET_GPIOA_PIN_INT_STS(x,pin) ((x >> pin) & 1)
+#define SET_GPIOA_PIN_INT_STS(pin) (1 << pin)
+
+/* AST_GPIO_RST_TOR - 0x01c : Reset Tolerant */
+#define GET_GPIOD_RST_EN(x) ((x&0xff000000) >> 24)
+#define SET_GPIOD_RST_EN(x) (x << 24)
+#define GET_GPIOD_PIN_RST_EN(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIOD_PIN_RST_EN(pin) (1<<(pin + 24))
+#define GET_GPIOC_RST_EN(x) ((x&0xff0000) >> 16)
+#define SET_GPIOC_RST_EN(x) (x << 16)
+#define GET_GPIOC_PIN_RST_EN(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIOC_PIN_RST_EN(pin) (1<<(pin + 16))
+#define GET_GPIOB_RST_EN(x) ((x&0xff00) >> 8)
+#define SET_GPIOB_RST_EN(x) (x << 16)
+#define GET_GPIOB_PIN_RST_EN(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIOB_PIN_RST_EN(pin) (1<<(pin + 8))
+#define GET_GPIOA_RST_EN(x) (x&0xff)
+#define SET_GPIOA_RST_EN(x) (x)
+#define GET_GPIOA_PIN_RST_EN(x,pin) ((x >> pin) & 1)
+#define SET_GPIOA_PIN_RST_EN(pin) (1 << pin)
+
+/* AST_EXT_GPIO_DATA - 0x020 : E/F/G/H Data Vale */
+#define GET_GPIOH_DATA(x) ((x&0xff000000) >> 24)
+#define SET_GPIOH_DATA(x) (x << 24)
+#define GET_GPIOH_PIN_DATA(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIOH_PIN_DATA(pin) (1<<(pin + 24))
+#define GET_GPIOG_DATA(x) ((x&0xff0000) >> 16)
+#define SET_GPIOG_DATA(x) (x << 16)
+#define GET_GPIOG_PIN_DATA(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIOG_PIN_DATA(pin) (1<<(pin + 16))
+#define GET_GPIOF_DATA(x) ((x&0xff00) >> 8)
+#define SET_GPIOF_DATA(x) (x << 8)
+#define GET_GPIOF_PIN_DATA(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIOF_PIN_DATA(pin) (1<<(pin + 8))
+#define GET_GPIOE_DATA(x) (x&0xff)
+#define SET_GPIOE_DATA(x) (x)
+#define GET_GPIOE_PIN_DATA(x,pin) ((x >> pin) & 1)
+#define SET_GPIOE_PIN_DATA(pin) (1<<pin)
+
+/* AST_EXT_GPIO_DIR - 0x024 : */
+#define GET_GPIOH_DIR(x) ((x&0xff000000) >> 24)
+#define SET_GPIOH_DIR(x) (x << 24)
+#define GET_GPIOH_PIN_DIR(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIOH_PIN_DIR(pin) (1<<(pin + 24))
+#define GET_GPIOG_DIR(x) ((x&0xff0000) >> 16)
+#define SET_GPIOG_DIR(x) (x << 16)
+#define GET_GPIOG_PIN_DIR(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIOG_PIN_DIR(pin) (1<<(pin + 16))
+#define GET_GPIOF_DIR(x) ((x&0xff00) >> 8)
+#define SET_GPIOF_DIR(x) (x << 8)
+#define GET_GPIOF_PIN_DIR(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIOF_PIN_DIR(pin) (1<<(pin + 8))
+#define GET_GPIOE_DIR(x) (x&0xff)
+#define SET_GPIOE_DIR(x) (x)
+#define GET_GPIOE_PIN_DIR(x,pin) ((x >> pin) & 1)
+#define SET_GPIOE_PIN_DIR(pin) (1<<pin)
+
+/* AST_EXT_GPIO_INT_EN - 0x028 */
+#define GET_GPIOH_INT_EN(x) ((x&0xff000000) >> 24)
+#define SET_GPIOH_INT_EN(x) (x << 24)
+#define GET_GPIOH_PIN_INT_EN(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIOH_PIN_INT_EN(pin) (1<<(pin + 24))
+#define GET_GPIOG_INT_EN(x) ((x&0xff0000) >> 16)
+#define SET_GPIOG_INT_EN(x) (x << 16)
+#define GET_GPIOG_PIN_INT_EN(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIOG_PIN_INT_EN(pin) (1<<(pin + 16))
+#define GET_GPIOF_INT_EN(x) ((x&0xff00) >> 8)
+#define SET_GPIOF_INT_EN(x) (x << 8)
+#define GET_GPIOF_PIN_INT_EN(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIOF_PIN_INT_EN(pin) (1<<(pin + 8))
+#define GET_GPIOE_INT_EN(x) (x&0xff)
+#define SET_GPIOE_INT_EN(x) (x)
+#define GET_GPIOE_PIN_INT_EN(x,pin) ((x >> pin) & 1)
+#define SET_GPIOE_PIN_INT_EN(pin) (1<<pin)
+
+/* AST_EXT_GPIO_INT_SEN_T0/1/2 - 0x02c/0x30/0x34 : */
+/* AST_EXT_GPIO_INT_STS 0x038 */
+/* AST_EXT_GPIO_RST_TOR 0x03c */
+
+/* AST_GPIO_DEBOUNCE_SET1 - 0x040 : Debounce Setting #1 */
+#define GET_GPIO3_DEBOUNCE(x) ((x&0xff000000) >> 24)
+#define SET_GPIO3_DEBOUNCE(x) (x << 24)
+#define GET_GPIO3_PIN_DEBOUNCE(x,pin) ((x >> (pin + 24)) & 1)
+#define SET_GPIO3_PIN_DEBOUNCE(pin) (1<<(pin + 24))
+#define GET_GPIO2_DEBOUNCE(x) ((x&0xff0000) >> 16)
+#define SET_GPIO2_DEBOUNCE(x) (x << 16)
+#define GET_GPIO2_PIN_DEBOUNCE(x,pin) ((x >> (pin + 16)) & 1)
+#define SET_GPIO2_PIN_DEBOUNCE(pin) (1<<(pin + 16))
+#define GET_GPIO1_DEBOUNCE(x) ((x&0xff00) >> 8)
+#define SET_GPIO1_DEBOUNCE(x) (x << 8)
+#define GET_GPIO1_PIN_DEBOUNCE(x,pin) ((x >> (pin + 8)) & 1)
+#define SET_GPIO1_PIN_DEBOUNCE(pin) (1<<(pin + 8))
+#define GET_GPIO0_DEBOUNCE(x) (x&0xff)
+#define SET_GPIO0_DEBOUNCE(x) (x)
+#define GET_GPIO0_PIN_DEBOUNCE(x,pin) ((x >> pin) & 1)
+#define SET_GPIO0_PIN_DEBOUNCE(pin) (1<<pin)
+
+
+#endif /* __ASM_ARCH_REGS_GPIO_H */ \ No newline at end of file
diff --git a/arch/arm/plat-aspeed/include/plat/regs-iic.h b/arch/arm/plat-aspeed/include/plat/regs-iic.h
new file mode 100644
index 000000000000..14db73ca177b
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-iic.h
@@ -0,0 +1,286 @@
+/* arch/arm/plat-aspeed/include/mach/regs-iic.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED I2C Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_IIC_H
+#define __ASM_ARCH_REGS_IIC_H __FILE__
+
+#ifdef CONFIG_ARCH_AST1010
+#define AST_I2C_DMA_SIZE 512
+#else
+#define AST_I2C_DMA_SIZE 4096
+#endif
+
+#define AST_I2C_PAGE_SIZE 256
+
+#if defined(CONFIG_ARCH_AST2300)
+#define MASTER_XFER_MODE BUFF_MODE
+#define SLAVE_XFER_MODE BYTE_MODE
+#define NUM_BUS 9
+#elif defined(CONFIG_ARCH_AST2400)
+#define MASTER_XFER_MODE BUFF_MODE
+#define SLAVE_XFER_MODE BYTE_MODE
+#define NUM_BUS 14
+#elif defined(CONFIG_ARCH_AST1010)
+#define MASTER_XFER_MODE BYTE_MODE
+#define SLAVE_XFER_MODE BYTE_MODE
+#define NUM_BUS 15
+#elif defined(CONFIG_ARCH_AST1520) || defined(CONFIG_ARCH_AST3200) || defined(CONFIG_ARCH_AST2500)
+#define MASTER_XFER_MODE BYTE_MODE
+#define SLAVE_XFER_MODE BYTE_MODE
+#define NUM_BUS 4
+#else
+#err "NO define NUM_BUS"
+#endif
+
+#if defined(CONFIG_ARCH_AST1070)
+#define AST_CI2C_GLOBAL_REG 0x00
+#define AST_CI2C_DEVICE1 0x40
+#define AST_CI2C_DEVICE2 0x80
+#define AST_CI2C_DEVICE3 0xc0
+#define AST_CI2C_DEVICE4 0x100
+#define AST_CI2C_DEVICE5 0x140
+#define AST_CI2C_DEVICE6 0x180
+#define AST_CI2C_DEVICE7 0x1c0
+#define AST_CI2C_DEVICE8 0x200
+#endif
+
+/*AST I2C Register Definition */
+#if defined(CONFIG_ARCH_AST2400) || defined(CONFIG_AST2400_BMC)
+#define AST_I2C_POOL_BUFF_2048
+#define AST_I2C_GLOBAL_REG 0x00
+#define AST_I2C_DEVICE1 0x40
+#define AST_I2C_DEVICE2 0x80
+#define AST_I2C_DEVICE3 0xc0
+#define AST_I2C_DEVICE4 0x100
+#define AST_I2C_DEVICE5 0x140
+#define AST_I2C_DEVICE6 0x180
+#define AST_I2C_DEVICE7 0x1c0
+#define AST_I2C_BUFFER_POOL2 0x200
+#define AST_I2C_DEVICE8 0x300
+#define AST_I2C_DEVICE9 0x340
+#define AST_I2C_DEVICE10 0x380
+#define AST_I2C_DEVICE11 0x3c0
+#define AST_I2C_DEVICE12 0x400
+#define AST_I2C_DEVICE13 0x440
+#define AST_I2C_DEVICE14 0x480
+#define AST_I2C_BUFFER_POOL1 0x800
+
+#elif defined(CONFIG_ARCH_AST2300)
+#define AST_I2C_POOL_BUFF_256
+#define AST_I2C_GLOBAL_REG 0x00
+#define AST_I2C_DEVICE1 0x40
+#define AST_I2C_DEVICE2 0x80
+#define AST_I2C_DEVICE3 0xc0
+#define AST_I2C_DEVICE4 0x100
+#define AST_I2C_DEVICE5 0x140
+#define AST_I2C_DEVICE6 0x180
+#define AST_I2C_DEVICE7 0x1c0
+#define AST_I2C_BUFFER_POOL2 0x200
+#define AST_I2C_DEVICE8 0x300
+#define AST_I2C_DEVICE9 0x340
+#elif defined(CONFIG_ARCH_AST1010)
+#define AST_I2C_GLOBAL_REG 0x00
+#define AST_I2C_DEVICE1 0x40
+#define AST_I2C_DEVICE2 0x80
+#define AST_I2C_DEVICE3 0xc0
+#define AST_I2C_DEVICE4 0x100
+#define AST_I2C_DEVICE5 0x140
+#define AST_I2C_DEVICE6 0x180
+#define AST_I2C_DEVICE7 0x1c0
+#define AST_I2C_DEVICE8 0x200
+#define AST_I2C_DEVICE9 0x240
+#define AST_I2C_DEVICE10 0x280
+#define AST_I2C_DEVICE11 0x2c0
+#define AST_I2C_DEVICE12 0x300
+#define AST_I2C_DEVICE13 0x340
+#define AST_I2C_DEVICE14 0x380
+#define AST_I2C_DEVICE15 0x3c0
+#elif defined(CONFIG_ARCH_AST1520) || defined(CONFIG_ARCH_AST3200) || defined(CONFIG_ARCH_AST2500)
+#define AST_I2C_GLOBAL_REG 0x00
+#define AST_I2C_DEVICE1 0x40
+#define AST_I2C_DEVICE2 0x80
+#define AST_I2C_DEVICE3 0xc0
+#define AST_I2C_DEVICE4 0x100
+#else
+#err "NO define for I2C"
+#endif
+
+
+
+/* I2C Register */
+#define I2C_FUN_CTRL_REG 0x00
+#define I2C_AC_TIMING_REG1 0x04
+#define I2C_AC_TIMING_REG2 0x08
+#define I2C_INTR_CTRL_REG 0x0c
+#define I2C_INTR_STS_REG 0x10
+#define I2C_CMD_REG 0x14
+#define I2C_DEV_ADDR_REG 0x18
+#define I2C_BUF_CTRL_REG 0x1c
+#define I2C_BYTE_BUF_REG 0x20
+#define I2C_DMA_BASE_REG 0x24
+#define I2C_DMA_LEN_REG 0x28
+
+
+/* Gloable Register Definition */
+/* 0x00 : I2C Interrupt Status Register */
+/* 0x08 : I2C Interrupt Target Assignment */
+#if defined(CONFIG_ARCH_AST2400)
+#define AST_I2CG_INTR14 (0x1 << 13)
+#define AST_I2CG_INTR13 (0x1 << 12)
+#define AST_I2CG_INTR12 (0x1 << 11)
+#define AST_I2CG_INTR11 (0x1 << 10)
+#define AST_I2CG_INTR10 (0x1 << 9)
+#elif defined(CONFIG_ARCH_AST1010)
+#define AST_I2CG_INTR14 (0x1 << 13)
+#define AST_I2CG_INTR13 (0x1 << 12)
+#define AST_I2CG_INTR12 (0x1 << 11)
+#define AST_I2CG_INTR11 (0x1 << 10)
+#define AST_I2CG_INTR10 (0x1 << 9)
+#endif
+#define AST_I2CG_INTR09 (0x1 << 8)
+#define AST_I2CG_INTR08 (0x1 << 7)
+#define AST_I2CG_INTR07 (0x1 << 6)
+#define AST_I2CG_INTR06 (0x1 << 5)
+#define AST_I2CG_INTR05 (0x1 << 4)
+#define AST_I2CG_INTR04 (0x1 << 3)
+#define AST_I2CG_INTR03 (0x1 << 2)
+#define AST_I2CG_INTR02 (0x1 << 1)
+#define AST_I2CG_INTR01 (0x1 )
+
+/* Device Register Definition */
+/* 0x00 : I2CD Function Control Register */
+#define AST_I2CD_BUFF_SEL_MASK (0x7 << 20)
+#define AST_I2CD_BUFF_SEL(x) (x << 20) // page 0 ~ 7
+#define AST_I2CD_M_SDA_LOCK_EN (0x1 << 16)
+#define AST_I2CD_MULTI_MASTER_DIS (0x1 << 15)
+#define AST_I2CD_M_SCL_DRIVE_EN (0x1 << 14)
+#define AST_I2CD_MSB_STS (0x1 << 9)
+#define AST_I2CD_SDA_DRIVE_1T_EN (0x1 << 8)
+#define AST_I2CD_M_SDA_DRIVE_1T_EN (0x1 << 7)
+#define AST_I2CD_M_HIGH_SPEED_EN (0x1 << 6)
+#define AST_I2CD_DEF_ADDR_EN (0x1 << 5)
+#define AST_I2CD_DEF_ALERT_EN (0x1 << 4)
+#define AST_I2CD_DEF_ARP_EN (0x1 << 3)
+#define AST_I2CD_DEF_GCALL_EN (0x1 << 2)
+#define AST_I2CD_SLAVE_EN (0x1 << 1)
+#define AST_I2CD_MASTER_EN (0x1 )
+
+/* 0x04 : I2CD Clock and AC Timing Control Register #1 */
+#define AST_I2CD_tBUF (0x1 << 28) // 0~7
+#define AST_I2CD_tHDSTA (0x1 << 24) // 0~7
+#define AST_I2CD_tACST (0x1 << 20) // 0~7
+#define AST_I2CD_tCKHIGH (0x1 << 16) // 0~7
+#define AST_I2CD_tCKLOW (0x1 << 12) // 0~7
+#define AST_I2CD_tHDDAT (0x1 << 10) // 0~7
+#define AST_I2CD_CLK_TO_BASE_DIV (0x1 << 8) // 0~3
+#define AST_I2CD_CLK_BASE_DIV (0x1 ) // 0~0xf
+
+/* 0x08 : I2CD Clock and AC Timing Control Register #2 */
+#define AST_I2CD_tTIMEOUT (0x1 ) // 0~7
+#define AST_NO_TIMEOUT_CTRL 0x0
+
+
+/* 0x0c : I2CD Interrupt Control Register */
+#define AST_I2CD_SDA_DL_TO_INTR_EN (0x1 << 14)
+#define AST_I2CD_BUS_RECOVER_INTR_EN (0x1 << 13)
+#define AST_I2CD_SMBUS_ALT_INTR_EN (0x1 << 12)
+#define AST_I2CD_SLAVE_MATCH_INTR_EN (0x1 << 7)
+#define AST_I2CD_SCL_TO_INTR_EN (0x1 << 6)
+#define AST_I2CD_ABNORMAL_INTR_EN (0x1 << 5)
+#define AST_I2CD_NORMAL_STOP_INTR_EN (0x1 << 4)
+#define AST_I2CD_ARBIT_LOSS_INTR_EN (0x1 << 3)
+#define AST_I2CD_RX_DOWN_INTR_EN (0x1 << 2)
+#define AST_I2CD_TX_NAK_INTR_EN (0x1 << 1)
+#define AST_I2CD_TX_ACK_INTR_EN (0x1 )
+
+/* 0x10 : I2CD Interrupt Status Register : WC */
+#define AST_I2CD_INTR_STS_SDA_DL_TO (0x1 << 14)
+#define AST_I2CD_INTR_STS_BUS_RECOVER (0x1 << 13)
+#define AST_I2CD_INTR_STS_SMBUS_ALT (0x1 << 12)
+#define AST_I2CD_INTR_STS_SMBUS_ARP_ADDR (0x1 << 11)
+#define AST_I2CD_INTR_STS_SMBUS_DEV_ALT (0x1 << 10)
+#define AST_I2CD_INTR_STS_SMBUS_DEF_ADDR (0x1 << 9)
+#define AST_I2CD_INTR_STS_GCALL_ADDR (0x1 << 8)
+#define AST_I2CD_INTR_STS_SLAVE_MATCH (0x1 << 7)
+#define AST_I2CD_INTR_STS_SCL_TO (0x1 << 6)
+#define AST_I2CD_INTR_STS_ABNORMAL (0x1 << 5)
+#define AST_I2CD_INTR_STS_NORMAL_STOP (0x1 << 4)
+#define AST_I2CD_INTR_STS_ARBIT_LOSS (0x1 << 3)
+#define AST_I2CD_INTR_STS_RX_DOWN (0x1 << 2)
+#define AST_I2CD_INTR_STS_TX_NAK (0x1 << 1)
+#define AST_I2CD_INTR_STS_TX_ACK (0x1 )
+
+/* 0x14 : I2CD Command/Status Register */
+#define AST_I2CD_SDA_OE (0x1 << 28)
+#define AST_I2CD_SDA_O (0x1 << 27)
+#define AST_I2CD_SCL_OE (0x1 << 26)
+#define AST_I2CD_SCL_O (0x1 << 25)
+#define AST_I2CD_TX_TIMING (0x1 << 24) // 0 ~3
+#define AST_I2CD_TX_STATUS (0x1 << 23)
+// Tx State Machine
+#define AST_I2CD_IDLE 0x0
+#define AST_I2CD_MACTIVE 0x8
+#define AST_I2CD_MSTART 0x9
+#define AST_I2CD_MSTARTR 0xa
+#define AST_I2CD_MSTOP 0xb
+#define AST_I2CD_MTXD 0xc
+#define AST_I2CD_MRXACK 0xd
+#define AST_I2CD_MRXD 0xe
+#define AST_I2CD_MTXACK 0xf
+#define AST_I2CD_SWAIT 0x1
+#define AST_I2CD_SRXD 0x4
+#define AST_I2CD_STXACK 0x5
+#define AST_I2CD_STXD 0x6
+#define AST_I2CD_SRXACK 0x7
+#define AST_I2CD_RECOVER 0x3
+
+#define AST_I2CD_SCL_LINE_STS (0x1 << 18)
+#define AST_I2CD_SDA_LINE_STS (0x1 << 17)
+#define AST_I2CD_BUS_BUSY_STS (0x1 << 16)
+#define AST_I2CD_SDA_OE_OUT_DIR (0x1 << 15)
+#define AST_I2CD_SDA_O_OUT_DIR (0x1 << 14)
+#define AST_I2CD_SCL_OE_OUT_DIR (0x1 << 13)
+#define AST_I2CD_SCL_O_OUT_DIR (0x1 << 12)
+#define AST_I2CD_BUS_RECOVER_CMD_EN (0x1 << 11)
+#define AST_I2CD_S_ALT_EN (0x1 << 10)
+// 0 : DMA Buffer, 1: Pool Buffer
+//AST1070 DMA register
+#define AST_I2CD_RX_DMA_ENABLE (0x1 << 9)
+#define AST_I2CD_TX_DMA_ENABLE (0x1 << 8)
+
+/* Command Bit */
+#define AST_I2CD_RX_BUFF_ENABLE (0x1 << 7)
+#define AST_I2CD_TX_BUFF_ENABLE (0x1 << 6)
+#define AST_I2CD_M_STOP_CMD (0x1 << 5)
+#define AST_I2CD_M_S_RX_CMD_LAST (0x1 << 4)
+#define AST_I2CD_M_RX_CMD (0x1 << 3)
+#define AST_I2CD_S_TX_CMD (0x1 << 2)
+#define AST_I2CD_M_TX_CMD (0x1 << 1)
+#define AST_I2CD_M_START_CMD (0x1 )
+
+/* 0x18 : I2CD Slave Device Address Register */
+
+/* 0x1C : I2CD Pool Buffer Control Register */
+#define AST_I2CD_RX_BUF_ADDR_GET(x) ((x>> 24)& 0xff)
+#define AST_I2CD_RX_BUF_END_ADDR_SET(x) (x << 16)
+#define AST_I2CD_TX_DATA_BUF_END_SET(x) ((x&0xff) << 8)
+#define AST_I2CD_TX_DATA_BUF_GET(x) ((x >>8) & 0xff)
+#define AST_I2CD_BUF_BASE_ADDR_SET(x) (x & 0x3f)
+
+/* 0x20 : I2CD Transmit/Receive Byte Buffer Register */
+#define AST_I2CD_GET_MODE(x) ((x >> 8) & 0x1)
+
+#define AST_I2CD_RX_BYTE_BUFFER (0xff << 8)
+#define AST_I2CD_TX_BYTE_BUFFER (0xff )
+
+
+#endif /* __ASM_ARCH_REGS_IIC_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-intr.h b/arch/arm/plat-aspeed/include/plat/regs-intr.h
new file mode 100644
index 000000000000..cea0132d08f6
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-intr.h
@@ -0,0 +1,74 @@
+/* arch/arm/mach-aspeed/include/mach/regs-intr.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2012/08/15 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __ASPEED_AST_INTR_H
+#define __ASPEED_AST_INTR_H 1
+
+#ifndef __ASSEMBLY__
+#include <asm/io.h>
+#endif
+//============== INTERRUPT========================================
+#include <mach/platform.h>
+#include <mach/irqs.h>
+#include <plat/aspeed.h>
+
+/*
+ * VIC Register (VA)
+ */
+
+#define VIC_BASE_VA IO_ADDRESS(AST_VIC_BASE)
+
+#if defined(NEW_VIC)
+//New Mappling
+
+#define AST_IRQ_STS(x) (VIC_BASE_VA + 0x80 + (x*0x04))
+#define AST_FIQ_STS(x) (VIC_BASE_VA + 0x88 + (x*0x04))
+#define AST_RAW_STS(x) (VIC_BASE_VA + 0x90 + (x*0x04))
+#define AST_INTR_SEL(x) (VIC_BASE_VA + 0x98 + (x*0x04))
+#define AST_INTR_EN(x) (VIC_BASE_VA + 0xA0 + (x*0x04))
+#define AST_INTR_DIS(x) (VIC_BASE_VA + 0xA8 + (x*0x04))
+#define AST_INTR_SW_EN(x) (VIC_BASE_VA + 0xB0 + (x*0x04))
+#define AST_INTR_SW_CLR(x) (VIC_BASE_VA + 0xB8 + (x*0x04))
+#define AST_INTR_SENSE(x) (VIC_BASE_VA + 0xC0 + (x*0x04))
+#define AST_INTR_BOTH_EDGE(x) (VIC_BASE_VA + 0xC8 + (x*0x04))
+#define AST_INTR_EVENT(x) (VIC_BASE_VA + 0xD0 + (x*0x04))
+#define AST_INTR_EDGE_CLR(x) (VIC_BASE_VA + 0xD8 + (x*0x04))
+#define AST_INTR_EDGE_STS(x) (VIC_BASE_VA + 0xE0 + (x*0x04))
+
+#else
+
+//Legacy Maping
+
+#define AST_IRQ_STS(x) (VIC_BASE_VA + 0x00)
+#define AST_FIQ_STS(x) (VIC_BASE_VA + 0x04)
+#define AST_RAW_STS(x) (VIC_BASE_VA + 0x08)
+#define AST_INTR_SEL(x) (VIC_BASE_VA + 0x0C)
+#define AST_INTR_EN(x) (VIC_BASE_VA + 0x10)
+#define AST_INTR_DIS(x) (VIC_BASE_VA + 0x14)
+#define AST_INTR_SW_EN(x) (VIC_BASE_VA + 0x18)
+#define AST_INTR_SW_CLR(x) (VIC_BASE_VA + 0x1C)
+#define AST_INTR_SENSE(x) (VIC_BASE_VA + 0x24)
+#define AST_INTR_BOTH_EDGE(x) (VIC_BASE_VA + 0x28)
+#define AST_INTR_EVENT(x) (VIC_BASE_VA + 0x2C)
+#define AST_INTR_EDGE_CLR(x) (VIC_BASE_VA + 0x38)
+#endif
+
+#define IRQ_SET_LEVEL_TRIGGER(x, irq_no) *((volatile unsigned long*)AST_INTR_SENSE(x)) |= 1 << (irq_no)
+#define IRQ_SET_EDGE_TRIGGER(x, irq_no) *((volatile unsigned long*)AST_INTR_SENSE(x)) &= ~(1 << (irq_no))
+#define IRQ_SET_RISING_EDGE(x, irq_no) *((volatile unsigned long*)AST_INTR_EVENT(x)) |= 1 << (irq_no)
+#define IRQ_SET_FALLING_EDGE(x, irq_no) *((volatile unsigned long*)AST_INTR_EVENT(x)) &= ~(1 << (irq_no))
+#define IRQ_SET_HIGH_LEVEL(x,irq_no) *((volatile unsigned long*)AST_INTR_EVENT(x)) |= 1 << (irq_no)
+#define IRQ_SET_LOW_LEVEL(x, irq_no) *((volatile unsigned long*)AST_INTR_EVENT(x)) &= ~(1 << (irq_no))
+#define IRQ_EDGE_CLEAR(x, irq_no) *((volatile unsigned long*)AST_INTR_EDGE_CLR(x)) |= 1 << (irq_no)
+
+#endif
+
diff --git a/arch/arm/plat-aspeed/include/plat/regs-jtag.h b/arch/arm/plat-aspeed/include/plat/regs-jtag.h
new file mode 100644
index 000000000000..7df385d18512
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-jtag.h
@@ -0,0 +1,65 @@
+/* arch/arm/plat-aspeed/include/mach/regs-jtag.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED JTAG Controller
+*/
+
+#define AST_JTAG_DATA 0x00
+#define AST_JTAG_INST 0x04
+#define AST_JTAG_CTRL 0x08
+#define AST_JTAG_ISR 0x0C
+#define AST_JTAG_SW 0x10
+#define AST_JTAG_TCK 0x14
+#define AST_JTAG_IDLE 0x18
+
+/* AST_JTAG_CTRL - 0x08 : Engine Control */
+#define JTAG_ENG_EN (0x1 << 31)
+#define JTAG_ENG_OUT_EN (0x1 << 30)
+#define JTAG_FORCE_TMS (0x1 << 29)
+
+#define JTAG_IR_UPDATE (0x1 << 26) //AST2500 only
+#define JTAG_INST_LEN_MASK (0x3f << 20)
+#define JTAG_SET_INST_LEN(x) (x << 20)
+#define JTAG_SET_INST_MSB (0x1 << 19)
+#define JTAG_TERMINATE_INST (0x1 << 18)
+#define JTAG_LAST_INST (0x1 << 17)
+#define JTAG_INST_EN (0x1 << 16)
+#define JTAG_DATA_LEN_MASK (0x3f << 4)
+
+#define JTAG_DR_UPDATE (0x1 << 10) //AST2500 only
+#define JTAG_DATA_LEN(x) (x << 4)
+#define JTAG_SET_DATA_MSB (0x1 << 3)
+#define JTAG_TERMINATE_DATA (0x1 << 2)
+#define JTAG_LAST_DATA (0x1 << 1)
+#define JTAG_DATA_EN (0x1)
+
+/* AST_JTAG_ISR - 0x0C : INterrupt status and enable */
+#define JTAG_INST_PAUSE (0x1 << 19)
+#define JTAG_INST_COMPLETE (0x1 << 18)
+#define JTAG_DATA_PAUSE (0x1 << 17)
+#define JTAG_DATA_COMPLETE (0x1 << 16)
+
+#define JTAG_INST_PAUSE_EN (0x1 << 3)
+#define JTAG_INST_COMPLETE_EN (0x1 << 2)
+#define JTAG_DATA_PAUSE_EN (0x1 << 1)
+#define JTAG_DATA_COMPLETE_EN (0x1)
+
+
+/* AST_JTAG_SW - 0x10 : Software Mode and Status */
+#define JTAG_SW_MODE_EN (0x1 << 19)
+#define JTAG_SW_MODE_TCK (0x1 << 18)
+#define JTAG_SW_MODE_TMS (0x1 << 17)
+#define JTAG_SW_MODE_TDIO (0x1 << 16)
+//
+#define JTAG_STS_INST_PAUSE (0x1 << 2)
+#define JTAG_STS_DATA_PAUSE (0x1 << 1)
+#define JTAG_STS_ENG_IDLE (0x1)
+
+/* AST_JTAG_IDLE - 0x18 : Ctroller set for go to IDLE */
+#define JTAG_GO_IDLE (0x1)
diff --git a/arch/arm/plat-aspeed/include/plat/regs-lpc.h b/arch/arm/plat-aspeed/include/plat/regs-lpc.h
new file mode 100644
index 000000000000..f4523d7eaeb0
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-lpc.h
@@ -0,0 +1,215 @@
+/* arch/arm/plat-aspeed/include/mach/regs-lpc.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED LPC Controller
+*/
+
+#ifndef __AST_LPC_H_
+#define __AST_LPC_H_
+
+#define AST_LPC_HICR0 0x000
+#define AST_LPC_HICR1 0x004
+#define AST_LPC_HICR2 0x008 /* Host Interface Control Register 2 */
+#define AST_LPC_HICR3 0x00C
+#define AST_LPC_HICR4 0x010
+#define AST_LPC_LADR3H 0x014
+#define AST_LPC_LADR3L 0x018
+#define AST_LPC_LADR12H 0x01C
+#define AST_LPC_LADR12L 0x020
+#define AST_LPC_IDR1 0x024
+#define AST_LPC_IDR2 0x028
+#define AST_LPC_IDR3 0x02C
+#define AST_LPC_ODR1 0x030
+#define AST_LPC_ODR2 0x034
+#define AST_LPC_ODR3 0x038
+#define AST_LPC_STR1 0x03C
+#define AST_LPC_STR2 0x040
+#define AST_LPC_STR3 0x044
+#define AST_LPC_BTR0 0x048
+#define AST_LPC_BTR1 0x04C
+#define AST_LPC_BTCSR0 0x050
+#define AST_LPC_BTCSR1 0x054
+#define AST_LPC_BTCR 0x058
+#define AST_LPC_BTDTR 0x05C
+#define AST_LPC_BTIMSR 0x060
+#define AST_LPC_BTFVSR0 0x064
+#define AST_LPC_BTFVSR1 0x068
+#define AST_LPC_SIRQCR0 0x06C
+#define AST_LPC_SIRQCR1 0x070
+#define AST_LPC_SIRQCR2 0x074
+#define AST_LPC_SIRQCR3 0x078
+
+//////
+#define AST_LPC_HICR5 0x080 /* LPC Host interface Control Register 5 */
+#define AST_LPC_HICR6 0x084 /* LPC Host Interface Control Register 6 */
+#define AST_LPC_HICR7 0x088
+#define AST_LPC_HICR8 0x08C
+#define AST_LPC_SNPWADR 0x090 /* LPC Snoop Address Register */
+#define AST_LPC_SNPWDR 0x094 /* LPC SNoop Data Register */
+#define AST_LPC_HICR9 0x098
+#define AST_LPC_HICRA 0x09C
+#define AST_LPC_LHCR0 0x0A0
+#define AST_LPC_LHCR1 0x0A4
+#define AST_LPC_LHCR2 0x0A8
+#define AST_LPC_LHCR3 0x0AC
+#define AST_LPC_LHCR4 0x0B0
+#define AST_LPC_LHCR5 0x0B4
+#define AST_LPC_LHCR6 0x0B8
+#define AST_LPC_LHCR7 0x0BC
+#define AST_LPC_LHCR8 0x0C0
+#define AST_LPC_PCCR6 0x0C4
+#define AST_LPC_LHCRA 0x0C8
+#define AST_LPC_LHCRB 0x0CC
+
+
+#define AST_LPC_PCCR4 0x0D0 /* Post Code Control Regiter 4 */
+#define AST_LPC_PCCR5 0x0D4 /* Post Code Control Regiter 5 */
+
+#define AST_LPC_HICRB 0x0D8
+#define AST_LPC_HICRC 0x0DC
+#define AST_LPC_HISR0 0x0E0
+#define AST_LPC_HISR1 0x0E4
+#define AST_LPC_LADR4 0x0E8
+#define AST_LPC_IDR4 0x0EC
+#define AST_LPC_ODR4 0x0F0
+#define AST_LPC_STR4 0x0F4
+#define AST_LPC_LSADR12 0x0F8
+#define AST_LPC_IDR5 0x0FC
+#define AST_LPC_ODR5 0x100
+#define AST_LPC_STR5 0x104
+
+
+
+#define AST_LPC_PCCR0 0x130 /*Post Code Contol Register 0 */
+#define AST_LPC_PCCR1 0x134 /*Post Code Contol Register 1 */
+#define AST_LPC_PCCR2 0x138 /*Post Code Contol Register 2 */
+#define AST_LPC_PCCR3 0x13C /*Post Code Contol Register 3 */
+
+
+#define AST_LPC_IBTCR0 0x140
+#define AST_LPC_IBTCR1 0x144
+#define AST_LPC_IBTCR2 0x148
+#define AST_LPC_IBTCR3 0x14C
+#define AST_LPC_IBTCR4 0x150
+#define AST_LPC_IBTCR5 0x154
+#define AST_LPC_IBTCR6 0x158
+#define AST_LPC_SRUART1 0x15C
+#define AST_LPC_SRUART2 0x160
+#define AST_LPC_SRUART3 0x164
+#define AST_LPC_SRUART4 0x168
+#define AST_LPC_SCR0SIO 0x16C
+#define AST_LPC_SCR0SI1 0x170
+#define AST_LPC_SCR0SI2 0x174
+#define AST_LPC_SCR0SI3 0x17C
+
+#define AST_LPC_SWCR0300 0x180
+#define AST_LPC_SWCR0704 0x184
+#define AST_LPC_SWCR0B08 0x188
+#define AST_LPC_SWCR0F0C 0x18C
+#define AST_LPC_SWCR1310 0x190
+#define AST_LPC_SWCR1714 0x194
+#define AST_LPC_SWCR1B18 0x198
+#define AST_LPC_SWCR1F1C 0x19C
+#define AST_LPC_ACPIE3E0 0x1A0
+#define AST_LPC_ACPIC1C0 0x1A4
+#define AST_LPC_ACPIB3B0 0x1A8
+#define AST_LPC_ACPIB7B4 0x1AC
+
+/* AST_LPC_HICR0 0x000 */
+#define LPC_LPC3_EN (1 << 7)
+#define LPC_LPC2_EN (1 << 6)
+#define LPC_LPC1_EN (1 << 5)
+
+#define LPC_SDWNE (1 << 3)
+#define LPC_PMEE (1 << 2)
+
+/* AST_LPC_HICR2 0x008 */
+#define LPC_LRST (1 << 6)
+#define LPC_SDWN (1 << 5)
+#define LPC_ABRT (1 << 4)
+#define LPC_IBFIF3 (1 << 3)
+#define LPC_IBFIF2 (1 << 2)
+#define LPC_IBFIF1 (1 << 1)
+#define LPC_EERIE (1)
+
+
+
+
+
+
+
+/* AST_LPC_HICR4 0x010 */
+#define LPC_HICS_LADR12AS (1 << 7)
+#define LPC_HICS_CLRINTLRSTR (1 << 6)
+#define LPC_HICS_STSINTLRSTR (1 << 5)
+#define LPC_HICS_ENINTLRSTR (1 << 4)
+/* bit 3 reserved */
+#define LPC_HICS_KCSENBL (1 << 2)
+/* bit 1 reserved */
+#define LPC_HICS_BTENBL (1)
+
+
+/* AST_LPC_STR1 0: 0x03C, 1: 0x40, 2 : 0x44, 3: 4: */
+#define LPC_STR_DBU4 (1 << 7)
+#define LPC_STR_DBU3 (1 << 6)
+#define LPC_STR_DBU2 (1 << 5)
+#define LPC_STR_DBU1 (1 << 4)
+#define LPC_STR_CMD_DAT (1 << 3)
+#define LPC_STR_DBU0 (1 << 2)
+#define LPC_STR_IBF (1 << 1)
+#define LPC_STR_OBF (1)
+
+
+/* AST_LPC_HICR5 0x080 - LPC Host interface Control Register */
+#define LPC_HICR5_SNP1INT_EN (1 << 3)
+#define LPC_HICR5_SNP1W_EN (1 << 2)
+#define LPC_HICR5_SNP0INT_EN (1 << 1)
+#define LPC_HICR5_SNP0W_EN (1)
+
+/* AST_LPC_HICR6 0x084 - LPC Host Interface Control Register 6 */
+#define LPC_HICR6_STR_BAUD (1 << 3)
+#define LPC_HICR6_STR_PME (1 << 2)
+#define LPC_HICR6_STR_SNP1W (1 << 1)
+#define LPC_HICR6_STR_SNP0W (1)
+
+/* AST_LPC_SNPWADR 0x090 - LPC Snoop Address Register*/
+#define LPC_SNOOP_ADDR1_MASK (0xffff << 16)
+#define LPC_SNOOP_ADDR0_MASK (0xffff)
+
+/* AST_LPC_SNPWDR 0x094 - LPC SNoop Data Register */
+#define GET_LPC_SNPD1(x) ((x >> 7) & 0xff)
+#define GET_LPC_SNPD0(x) (x & 0xff)
+
+/*AST_LPC_PCCR0 0x130 - Post Code Contol Register 0 */
+#define LPC_POST_DMA_INT_EN (1 << 31)
+#define LPC_POST_DMA_MODE_EN (1 << 14)
+#define LPC_RX_FIFO_CLR (1 << 7)
+#define LPC_POST_
+#define LPC_POST_CODE_MODE_MASK (0x3 << 4)
+#define LPC_POST_CODE_MODE(x) (x << 4)
+#define BYTE_MODE 0
+#define WORD_MODE 1
+#define DWORD_MODE 2
+#define FULL_MODE 3
+
+#define LPC_POST_CODE_RXOVR (1 << 3)
+#define LPC_POST_CODE_RXTO (1 << 2)
+#define LPC_POST_CODE_RXAVA (1 << 1)
+#define LPC_POST_CODE_EN (1)
+
+/*AST_LPC_PCCR1 0x134 Post Code Contol Register 1 */
+#define LPC_POST_ADDR_MASK 0x3fffff
+#define LPC_CAPTURE_ADDR_MASK(x) (x << 16)
+#define LPC_CAPTURE_BASE_ADDR(x) (x)
+
+/*AST_LPC_PCCR2 0x138 Post Code Contol Register 2 */
+#define LPC_POST_CODE_DMA_RDY (1 << 4)
+#define LPC_POST_CODE_STS (1)
+
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/regs-mbx.h b/arch/arm/plat-aspeed/include/plat/regs-mbx.h
new file mode 100644
index 000000000000..636207fb91dd
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-mbx.h
@@ -0,0 +1,48 @@
+/* arch/arm/plat-aspeed/include/mach/regs-lpc.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED LPC Controller
+*/
+
+#ifndef __AST_MBX_H_
+#define __AST_MBX_H_
+
+#define AST_MBX_DAT0 0x00
+#define AST_MBX_DAT1 0x04
+#define AST_MBX_DAT2 0x08
+#define AST_MBX_DAT3 0x0C
+#define AST_MBX_DAT4 0x10
+#define AST_MBX_DAT5 0x14
+#define AST_MBX_DAT6 0x18
+#define AST_MBX_DAT7 0x1C
+#define AST_MBX_DAT8 0x20
+#define AST_MBX_DAT9 0x24
+#define AST_MBX_DATA 0x28
+#define AST_MBX_DATB 0x2C
+#define AST_MBX_DATC 0x30
+#define AST_MBX_DATD 0x34
+#define AST_MBX_DATE 0x38
+#define AST_MBX_DATF 0x3C
+#define AST_MBX_STS0 0x40
+#define AST_MBX_STS1 0x44
+#define AST_MBX_BCR 0x48
+#define AST_MBX_HCR 0x4C
+#define AST_MBX_BIE0 0x50
+#define AST_MBX_BIE1 0x54
+#define AST_MBX_HIE0 0x58
+#define AST_MBX_HIE1 0x5C
+
+/* AST_MBX_BCR 0x48 */
+#define MBHIST (1 << 7)
+#define MBHMK (1 << 1)
+#define MBBINT (1)
+
+
+
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/regs-mctp.h b/arch/arm/plat-aspeed/include/plat/regs-mctp.h
new file mode 100644
index 000000000000..2237cfebd0ab
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-mctp.h
@@ -0,0 +1,47 @@
+/* arch/arm/mach-aspeed/include/mach/regs-ast1010-scu.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2012/12/29 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __AST_MCTP_H
+#define __AST_MCTP_H 1
+
+/*
+ * Register for MCTP
+ * */
+#define AST_MCTP_CTRL 0x00 /* Engine Status and Engine Control */
+#define AST_MCTP_INT 0x04 /* Interrupt Enable and Status Register */
+#define AST_MCTP_ID 0x08 /* Target ID and Mask */
+#define AST_MCTP_TX_DESC3 0x10 /* Sending Descriptor [127:96] */
+#define AST_MCTP_TX_DESC2 0x14 /* Sending Descriptor [95:64] */
+#define AST_MCTP_TX_DESC1 0x18 /* Sending Descriptor [63:32] */
+#define AST_MCTP_TX_DESC0 0x1C /* Sending Descriptor [31:0] */
+#define AST_MCTP_TX_DATA 0x20 /* Sending Data Port */
+#define AST_MCTP_RX_DESC3 0x40 /* Received Descriptor [127:96] */
+#define AST_MCTP_RX_DESC2 0x44 /* Received Descriptor [95:64] */
+#define AST_MCTP_RX_DESC1 0x48 /* Received Descriptor [63:32] */
+#define AST_MCTP_RX_DESC0 0x4C /* Received Descriptor [31:0] */
+#define AST_MCTP_RX_DATA 0x50 /* Received Data Port */
+
+#define AST_MCTP_DEC_ADDR 0x80 /* ADDR */
+#define AST_MCTP_DEC_MASK 0x84 /* MASK */
+#define AST_MCTP_DEC_TAG 0x88 /* TAG */
+
+/* AST_MCTP_CTRL 0x00 Engine Status and Engine Control */
+
+/* AST_MCTP_INT 0x04 Interrupt Enable and Status Register */
+#define MCTP_RX_INT_EN (1 << 17)
+#define MCTP_TX_INT_EN (1 << 16)
+
+#define MCTP_RX_COMPLETE (1 << 1)
+#define MCTP_TX_COMPLETE (1)
+
+#endif
+
diff --git a/arch/arm/plat-aspeed/include/plat/regs-pcie.h b/arch/arm/plat-aspeed/include/plat/regs-pcie.h
new file mode 100644
index 000000000000..bd699fc82f5a
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-pcie.h
@@ -0,0 +1,68 @@
+/* arch/arm/mach-aspeed/include/mach/regs-ast1010-scu.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2012/12/29 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __AST_PCIE_H
+#define __AST_PCIE_H 1
+
+/*
+ * Register for PCIE
+ * */
+#define AST_PCIE_CFG2 0x04
+#define AST_PCIE_SSID 0x28
+#define AST_PCIE_GLOBAL 0x30
+#define AST_PCIE_LOCK 0x7C
+
+#define AST_PCIE_LINK 0xC0
+#define AST_PCIE_INT 0xC4
+
+/* AST_PCIE_CFG2 0x04 */
+#define PCIE_CFG_CLASS_CODE(x) (x << 8)
+#define PCIE_CFG_REV_ID(x) (x)
+
+
+/*SSID: 1E6ED028h[19:4]*/
+/*SSVID: 1E6ED028h[3:0], 1E6ED024h[31:20]*/
+
+/* AST_PCIE_SSID_A 0x24 */
+/* 31:20 */
+#define PCIE_SSVID_H(x) (x)
+
+/* AST_PCIE_SSID_B 0x28 */
+/* 19:14 */
+#define PCIE_SSID(x) (x << 4)
+/* 3:0 */
+#define PCIE_SSVID_L(x) (x)
+
+
+/* AST_PCIE_GLOBAL 0x30 */
+#define ROOT_COMPLEX_ID(x) (x << 4)
+
+
+/* AST_PCIE_LOCK 0x7C */
+#define PCIE_UNLOCK 0xa8
+
+/* AST_PCIE_LINK 0xC0 */
+#define PCIE_LINK_STS (1 << 5)
+
+/* AST_PCIE_INT 0xC4 */
+#define PCIE_INTD (1 << 16)
+#define PCIE_INTC (1 << 15)
+#define PCIE_INTB (1 << 14)
+#define PCIE_INTA (1 << 13)
+
+#define AST_PCIE_NONP_MEM_BASE AST_PCIE0_WIN_BASE0
+#define AST_PCIE_NONP_MEM_SIZE AST_PCIE0_WIN_SIZE0
+#define AST_PCIE_PREF_MEM_BASE 0x0
+#define AST_PCIE_PREF_MEM_SIZE 0x0
+
+#endif
+
diff --git a/arch/arm/plat-aspeed/include/plat/regs-peci.h b/arch/arm/plat-aspeed/include/plat/regs-peci.h
new file mode 100644
index 000000000000..266dacab5a2f
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-peci.h
@@ -0,0 +1,106 @@
+/* arch/arm/plat-aspeed/include/mach/regs-peci.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED PECI Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_PECI_H
+#define __ASM_ARCH_REGS_PECI_H __FILE__
+
+/*AST PECI Register Definition */
+#define AST_PECI_CTRL 0x00
+#define AST_PECI_TIMING 0x04
+#define AST_PECI_CMD 0x08
+#define AST_PECI_CMD_CTRL 0x0C
+#define AST_PECI_EXP_FCS 0x10
+#define AST_PECI_CAP_FCS 0x14
+#define AST_PECI_INT_CTRL 0x18
+#define AST_PECI_INT_STS 0x1C
+#define AST_PECI_W_DATA0 0x20
+#define AST_PECI_W_DATA1 0x24
+#define AST_PECI_W_DATA2 0x28
+#define AST_PECI_W_DATA3 0x2c
+#define AST_PECI_R_DATA0 0x30
+#define AST_PECI_R_DATA1 0x34
+#define AST_PECI_R_DATA2 0x38
+#define AST_PECI_R_DATA3 0x3c
+#define AST_PECI_W_DATA4 0x40
+#define AST_PECI_W_DATA5 0x44
+#define AST_PECI_W_DATA6 0x48
+#define AST_PECI_W_DATA7 0x4c
+#define AST_PECI_R_DATA4 0x50
+#define AST_PECI_R_DATA5 0x54
+#define AST_PECI_R_DATA6 0x58
+#define AST_PECI_R_DATA7 0x5c
+
+
+/* AST_PECI_CTRL - 0x00 : Control Register */
+#define PECI_CTRL_SAMPLING_MASK (0xf << 16)
+#define PECI_CTRL_SAMPLING(x) (x << 16)
+#define PECI_CTRL_READ_MODE_MASK (0xf << 12)
+#define PECI_CTRL_CONT_MODE (1 << 16)
+#define PECI_CTRL_DBG_MODE (2 << 16)
+#define PECI_CTRL_CLK_SOURCE (0x1 << 11) //0: 24Mhz, 1: MCLK
+#define PECI_CTRL_CLK_DIV_MASK (0x3 << 8)
+#define PECI_CTRL_CLK_DIV(x) (x << 8)
+#define PECI_CTRL_INVERT_OUT (0x1 << 7)
+#define PECI_CTRL_INVERT_IN (0x1 << 6)
+#define PECI_CTRL_BUS_CONTENT_EN (0x1 << 5)
+#define PECI_CTRL_PECI_EN (0x1 << 4)
+#define PECI_CTRL_PECI_CLK_EN (0x1)
+
+/* AST_PECI_TIMING - 0x04 : Timing Negotiation */
+#define PECI_TIMING_MESSAGE_GET(x) ((x & 0xff00) >> 8)
+#define PECI_TIMING_MESSAGE(x) (x << 8)
+#define PECI_TIMING_ADDRESS_GET(x) (x & 0xff)
+#define PECI_TIMING_ADDRESS(x) (x)
+
+/* AST_PECI_CMD - 0x08 : Command Register */
+#define PECI_CMD_PIN_MON (0x1 << 31)
+#define PECI_CMD_STS (0xf << 24)
+#define PECI_CMD_FIRE (0x1)
+
+/* AST_PECI_LEN - 0x0C : Read/Write Length Register */
+#define PECI_AW_FCS_EN (0x1 << 31)
+#define PECI_READ_LEN_MASK (0xff << 16)
+#define PECI_READ_LEN(x) (x << 16)
+#define PECI_WRITE_LEN_MASK (0xff << 8)
+#define PECI_WRITE_LEN(x) (x << 8)
+#define PECI_TAGET_ADDR_MASK (0xff)
+#define PECI_TAGET_ADDR(x) (x)
+
+
+/* AST_PECI_EXP_FCS - 0x10 : Expected FCS Data Register */
+#define PECI_PROGRAM_AW_FCS (0xf << 24)
+#define PECI_EXPECT_READ_FCS (0xf << 16)
+#define PECI_EXPECT_AW_FCS_AUTO (0xf << 8)
+#define PECI_EXPECT_WRITE_FCS (0xf)
+
+/* AST_PECI_CAP_FCS - 0x14 : Captured FCS Data Register */
+#define PECI_CAPTURE_READ_FCS(x) ((x & 0xff) >> 16)
+#define PECI_CAPTURE_WRITE_FCS (0xff)
+
+/* AST_PECI_INT_CTRL/ STS - 0x18/0x1c : Interrupt Register */
+#define PECI_INT_TIMING_RESULT_MASK (0x3 << 30)
+#define PECI_INT_TIMEOUT (0x1 << 4)
+#define PECI_INT_CONNECT (0x1 << 3)
+#define PECI_INT_W_FCS_BAD (0x1 << 2)
+#define PECI_INT_W_FCS_ABORT (0x1 << 1)
+#define PECI_INT_CMD_DONE (0x1)
+
+#define AUTO_GEN_AWFCS 1
+//#define ENABLE_BUS_CONTENTION 0x20
+
+#define DISABLE_ENGINE 0
+#define ENABLE_RX_ENGINE (1 << 0)
+#define ENABLE_TX_ENGINE (1 << 1)
+#define LEFT_CHANNEL_HIGH (1 << 16)
+#define DELAY_CLOCK_CYCLE (1 << 17)
+
+#endif /* __ASM_ARCH_REGS_PECI_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-pwm_fan.h b/arch/arm/plat-aspeed/include/plat/regs-pwm_fan.h
new file mode 100644
index 000000000000..23d5b77ed524
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-pwm_fan.h
@@ -0,0 +1,250 @@
+/* arch/arm/plat-aspeed/include/mach/regs-pwm-fan.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED PWM & Fan Tacho Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_PWM_FAN_H
+#define __ASM_ARCH_REGS_PWM_FAN_H __FILE__
+
+/*AST PWM & FAN Register Definition */
+#define AST_PTCR_CTRL 0x00
+#define AST_PTCR_CLK_CTRL 0x04
+#define AST_PTCR_DUTY0_CTRL 0x08
+#define AST_PTCR_DUTY1_CTRL 0x0c
+#define AST_PTCR_TYPEM_CTRL0 0x10
+#define AST_PTCR_TYPEM_CTRL1 0x14
+#define AST_PTCR_TYPEN_CTRL0 0x18
+#define AST_PTCR_TYPEN_CTRL1 0x1c
+#define AST_PTCR_TACH_SOURCE 0x20
+// no 0x24
+#define AST_PTCR_TRIGGER 0x28
+#define AST_PTCR_RESULT 0x2c
+#define AST_PTCR_INTR_CTRL 0x30
+#define AST_PTCR_INTR_STS 0x34
+#define AST_PTCR_TYPEM_LIMIT 0x38
+#define AST_PTCR_TYPEN_LIMIT 0x3C
+#define AST_PTCR_CTRL_EXT 0x40
+#define AST_PTCR_CLK_EXT_CTRL 0x44
+#define AST_PTCR_DUTY2_CTRL 0x48
+#define AST_PTCR_DUTY3_CTRL 0x4c
+#define AST_PTCR_TYPEO_CTRL0 0x50
+#define AST_PTCR_TYPEO_CTRL1 0x54
+#define AST_PTCR_TACH_SOURCE_EXT 0x60
+#define AST_PTCR_TYPEO_LIMIT 0x78
+
+//COMMON Definition
+#define FALL_EDGE (0)
+#define RISE_EDGE (0x1)
+#define BOTH_EDGE (0x2)
+
+#ifdef CONFIG_ARCH_AST1010
+#define PWM_TYPE_NUM 2
+#define PWM_TYPE_M 0x0
+#define PWM_TYPE_N 0x1
+#define PWM_TYPE_MASK 0x1
+#else
+#define PWM_TYPE_NUM 3
+#define PWM_TYPE_M 0x0
+#define PWM_TYPE_N 0x1
+#define PWM_TYPE_O 0x2
+#define PWM_TYPE_MASK 0x3
+
+#endif
+
+#define TACHO_NUM 16
+#define PWM_CH_NUM 8
+#define PWMA 0x0
+#define PWMB 0x1
+#define PWMC 0x2
+#define PWMD 0x3
+#define PWME 0x4
+#define PWMF 0x5
+#define PWMG 0x6
+#define PWMH 0x7
+
+
+// AST_PTCR_CTRL:0x00 - PWM-FAN General Control Register
+#define AST_PTCR_CTRL_SET_PWMD_TYPE(x) ((x&0x1)<<15 | (x&0x2) <<6)
+#define AST_PTCR_CTRL_GET_PWMD_TYPE(x) (((x&(0x1<<7))>>6) | ((x&(0x1<<15))>>15))
+#define AST_PTCR_CTRL_SET_PWMD_TYPE_MASK ((0x1<<7) | (0x1<<15))
+
+#define AST_PTCR_CTRL_SET_PWMC_TYPE(x) ((x&0x1)<<14 | (x&0x2) <<5)
+#define AST_PTCR_CTRL_GET_PWMC_TYPE(x) (((x&(0x1<<6))>>5) | ((x&(0x1<<14))>>14))
+#define AST_PTCR_CTRL_SET_PWMC_TYPE_MASK ((0x1<<6) | (0x1<<14))
+
+#define AST_PTCR_CTRL_SET_PWMB_TYPE(x) ((x&0x1)<<13 | (x&0x2) <<4)
+#define AST_PTCR_CTRL_GET_PWMB_TYPE(x) (((x&(0x1<<5))>>4) | ((x&(0x1<<13))>>13))
+#define AST_PTCR_CTRL_SET_PWMB_TYPE_MASK ((0x1<<5) | (0x1<<13))
+
+
+#define AST_PTCR_CTRL_SET_PWMA_TYPE(x) ((x&0x1)<<12 | (x&0x2) <<3)
+#define AST_PTCR_CTRL_GET_PWMA_TYPE(x) (((x&(0x1<<4))>>3) | ((x&(0x1<<12))>>12))
+#define AST_PTCR_CTRL_SET_PWMA_TYPE_MASK ((0x1<<4) | (0x1<<12))
+
+#define AST_PTCR_CTRL_FAN_NUM_EN(x) (0x1 << (16+x))
+
+#define AST_PTCR_CTRL_PMWD (11)
+#define AST_PTCR_CTRL_PMWD_EN (0x1 << 11)
+#define AST_PTCR_CTRL_PMWC (10)
+#define AST_PTCR_CTRL_PMWC_EN (0x1 << 10)
+#define AST_PTCR_CTRL_PMWB (9)
+#define AST_PTCR_CTRL_PMWB_EN (0x1 << 9)
+#define AST_PTCR_CTRL_PMWA (8)
+#define AST_PTCR_CTRL_PMWA_EN (0x1 << 8)
+
+#define AST_PTCR_CTRL_CLK_MCLK 0x2 //0:24Mhz, 1:MCLK
+#define AST_PTCR_CTRL_CLK_EN 0x1
+
+// AST_PTCR_CLK_CTRL:0x04 - PWM-FAN Clock Control Register
+//TYPE N
+#define AST_PTCR_CLK_CTRL_TYPEN_UNIT (24)
+#define AST_PTCR_CLK_CTRL_TYPEN_UNIT_MASK (0xff<<24)
+#define AST_PTCR_CLK_CTRL_TYPEN_H (20)
+#define AST_PTCR_CLK_CTRL_TYPEN_H_MASK (0xf<<20)
+#define AST_PTCR_CLK_CTRL_TYPEN_L (16)
+#define AST_PTCR_CLK_CTRL_TYPEN_L_MASK (0xf<<16)
+//TYPE M
+#define AST_PTCR_CLK_CTRL_TYPEM_UNIT (8)
+#define AST_PTCR_CLK_CTRL_TYPEM_UNIT_MASK (0xff<<8)
+#define AST_PTCR_CLK_CTRL_TYPEM_H (4)
+#define AST_PTCR_CLK_CTRL_TYPEM_H_MASK (0xf<<4)
+#define AST_PTCR_CLK_CTRL_TYPEM_L (0)
+#define AST_PTCR_CLK_CTRL_TYPEM_L_MASK (0xf)
+
+
+// AST_PTCR_DUTY_CTRL0:0x08 - PWM-FAN duty control 0 register
+#define DUTY_CTRL0_PWMB_FALL_POINT (24)
+#define DUTY_CTRL0_PWMB_FALL_POINT_MASK (0xff<<24)
+#define DUTY_CTRL0_PWMB_RISE_POINT (16)
+#define DUTY_CTRL0_PWMB_RISE_POINT_MASK (0xff<<16)
+#define DUTY_CTRL0_PWMA_FALL_POINT (8)
+#define DUTY_CTRL0_PWMA_FALL_POINT_MASK (0xff<<8)
+#define DUTY_CTRL0_PWMA_RISE_POINT (0)
+#define DUTY_CTRL0_PWMA_RISE_POINT_MASK (0xff)
+
+
+// AST_PTCR_DUTY_CTRL1 : 0x0c - PWM-FAN duty control 1 register
+#define DUTY_CTRL1_PWMD_FALL_POINT (24)
+#define DUTY_CTRL1_PWMD_FALL_POINT_MASK (0xff<<24)
+#define DUTY_CTRL1_PWMD_RISE_POINT (16)
+#define DUTY_CTRL1_PWMD_RISE_POINT_MASK (0xff<<16)
+#define DUTY_CTRL1_PWMC_FALL_POINT (8)
+#define DUTY_CTRL1_PWMC_FALL_POINT_MASK (0xff<<8)
+#define DUTY_CTRL1_PWMC_RISE_POINT (0)
+#define DUTY_CTRL1_PWMC_RISE_POINT_MASK (0xff)
+
+
+// AST_PTCR_TYPEM_CTRL0 : 0x10/0x18/0x50 - Type M/N/O Ctrl 0 Register
+#define TYPE_CTRL0_FAN_PERIOD (16)
+#define TYPE_CTRL0_FAN_PERIOD_MASK (0xffff<<16)
+//Type O not have this
+#define TYPE_CTRL0_FLAT_EN (0x1<<7)
+
+
+// 0 : FALL_EDGE, 0x1 : RISE_EDGE , 0x2 :BOTH_EDGE
+#define TYPE_CTRL0_FAN_MODE (4)
+#define TYPE_CTRL0_FAN_MODE_MASK (0x3<<4)
+
+
+
+#define TYPE_CTRL0_CLK_DIVISION (1)
+#define TYPE_CTRL0_CLK_DIVISION_MASK (0x7<<1)
+
+#define TYPE_CTRL0_FAN_TYPE_EN (1)
+
+
+// AST_PTCR_TYPEM_CTRL1 : 0x14/0x1c/0x54 - Type M/N/O Ctrl 1 Register
+#define TYPE_CTRL1_FALL_POINT (16)
+#define TYPE_CTRL1_FALL_POINT_MASK (0xff<<16)
+#define TYPE_CTRL1_RISE_POINT (0)
+#define TYPE_CTRL1_RISE_POINT_MASK (0xff)
+
+
+// AST_PTCR_TACH_SOURCE : 0x20/0x60 - Tach Source Register
+//bit [0,1] at 0x20, bit [2] at 0x60
+#define TACH_PWM_SOURCE_BIT01(x) (x*2)
+#define TACH_PWM_SOURCE_BIT2(x) (x*2)
+
+#define TACH_PWM_SOURCE_MASK_BIT01(x) (0x3<<(x*2))
+#define TACH_PWM_SOURCE_MASK_BIT2(x) (0x1<<(x*2))
+
+// AST_PTCR_TRIGGER : 0x28 - Trigger Register
+#define TRIGGER_READ_FAN_NUM(x) (0x1<<x)
+
+// AST_PTCR_RESULT : 0x2c - Result Register
+#define RESULT_STATUS (31)
+
+#define RESULT_VALUE_MASK (0xfffff)
+
+// AST_PTCR_INTR_CTRL : 0x30 - Interrupt Ctrl Register
+#define INTR_CTRL_EN_NUM(x) (0x1<<x)
+
+// AST_PTCR_INTR_STS : 0x34 - Interrupt Status Register
+#define INTR_CTRL_NUM(x) (0x1<<x)
+
+//AST_PTCR_TYPEM_LIMIT, AST_PTCR_TYPEN_LIMIT,AST_PTCR_TYPEO_LIMIT : 0x38/0x3C/0x78 - Type M / N / O Limit Register
+#define FAN_LIMIT_MASK (0xfffff)
+
+// AST_PTCR_CTRL_EXT : 0x40 - General Ctrl Extension #1
+#define AST_PTCR_CTRL_SET_PWMH_TYPE(x) ((x&0x1)<<15 | (x&0x2) <<6)
+#define AST_PTCR_CTRL_GET_PWMH_TYPE(x) (((x&(0x1<<7))>>6) | ((x&(0x1<<15))>>15))
+#define AST_PTCR_CTRL_SET_PWMH_TYPE_MASK ((0x1<<7) | (0x1<<15))
+
+#define AST_PTCR_CTRL_SET_PWMG_TYPE(x) ((x&0x1)<<14 | (x&0x2) <<5)
+#define AST_PTCR_CTRL_GET_PWMG_TYPE(x) (((x&(0x1<<6))>>5) | ((x&(0x1<<14))>>14))
+#define AST_PTCR_CTRL_SET_PWMG_TYPE_MASK ((0x1<<6) | (0x1<<14))
+
+#define AST_PTCR_CTRL_SET_PWMF_TYPE(x) ((x&0x1)<<13 | (x&0x2) <<4)
+#define AST_PTCR_CTRL_GET_PWMF_TYPE(x) (((x&(0x1<<5))>>4) | ((x&(0x1<<13))>>13))
+#define AST_PTCR_CTRL_SET_PWMF_TYPE_MASK ((0x1<<5) | (0x1<<13))
+
+#define AST_PTCR_CTRL_SET_PWME_TYPE(x) ((x&0x1)<<12 | (x&0x2) <<3)
+#define AST_PTCR_CTRL_GET_PWME_TYPE(x) (((x&(0x1<<4))>>3) | ((x&(0x1<<12))>>12))
+#define AST_PTCR_CTRL_SET_PWME_TYPE_MASK ((0x1<<4) | (0x1<<12))
+
+#define AST_PTCR_CTRL_PMWH (11)
+#define AST_PTCR_CTRL_PMWH_EN (0x1 << 11)
+#define AST_PTCR_CTRL_PMWG (10)
+#define AST_PTCR_CTRL_PMWG_EN (0x1 << 10)
+#define AST_PTCR_CTRL_PMWF (9)
+#define AST_PTCR_CTRL_PMWF_EN (0x1 << 9)
+#define AST_PTCR_CTRL_PMWE (8)
+#define AST_PTCR_CTRL_PMWE_EN (0x1 << 8)
+
+// AST_PTCR_CLK_EXT_CTRL : 0x44 - Clock Control Extension #1
+//TYPE O
+#define AST_PTCR_CLK_CTRL_TYPEO_UNIT (8)
+#define AST_PTCR_CLK_CTRL_TYPEO_UNIT_MASK (0xff<<8)
+#define AST_PTCR_CLK_CTRL_TYPEO_H (4)
+#define AST_PTCR_CLK_CTRL_TYPEO_H_MASK (0xf<<4)
+#define AST_PTCR_CLK_CTRL_TYPEO_L (0)
+#define AST_PTCR_CLK_CTRL_TYPEO_L_MASK (0xf)
+
+// AST_PTCR_DUTY2_CTRL : 0x48 - Duty Control 2 Register
+#define DUTY_CTRL2_PWMF_FALL_POINT (24)
+#define DUTY_CTRL2_PWMF_FALL_POINT_MASK (0xff<<24)
+#define DUTY_CTRL2_PWMF_RISE_POINT (16)
+#define DUTY_CTRL2_PWMF_RISE_POINT_MASK (0xff<<16)
+#define DUTY_CTRL2_PWME_FALL_POINT (8)
+#define DUTY_CTRL2_PWME_FALL_POINT_MASK (0xff<<8)
+#define DUTY_CTRL2_PWME_RISE_POINT (0)
+#define DUTY_CTRL2_PWME_RISE_POINT_MASK (0xff)
+
+// AST_PTCR_DUTY3_CTRL : 0x4c - Duty Control 3 Register
+#define DUTY_CTRL3_PWMH_FALL_POINT (24)
+#define DUTY_CTRL3_PWMH_FALL_POINT_MASK (0xff<<24)
+#define DUTY_CTRL3_PWMH_RISE_POINT (16)
+#define DUTY_CTRL3_PWMH_RISE_POINT_MASK (0xff<<16)
+#define DUTY_CTRL3_PWMG_FALL_POINT (8)
+#define DUTY_CTRL3_PWMG_FALL_POINT_MASK (0xff<<8)
+#define DUTY_CTRL3_PWMG_RISE_POINT (0)
+#define DUTY_CTRL3_PWMG_RISE_POINT_MASK (0xff)
+
+#endif /* __ASM_ARCH_REGS_PWM_FAN_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-rtc.h b/arch/arm/plat-aspeed/include/plat/regs-rtc.h
new file mode 100644
index 000000000000..8a09a4b8dfea
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-rtc.h
@@ -0,0 +1,64 @@
+/* arch/arm/plat-aspeed/include/mach/regs-iic.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED I2C Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_RTC_H
+#define __ASM_ARCH_REGS_RTC_H __FILE__
+
+#define RTC_CNTR_STS_1 0x00
+#define RTC_CNTR_STS_2 0x04
+#define RTC_ALARM 0x08
+#define RTC_CONTROL 0x10
+#define RTC_ALARM_STS 0x14
+
+/* RTC_CNTR_STS_1 0x00 */
+/* RTC_ALARM 0x08 */
+#define GET_DAY_VAL(x) ((x >> 24)&0x1f)
+#define GET_HOUR_VAL(x) ((x >> 16)&0x1f)
+#define GET_MIN_VAL(x) ((x >> 8)&0x3f)
+#define GET_SEC_VAL(x) (x & 0x3f)
+
+#define SET_DAY_VAL(x) ((x&0x1f) << 24)
+#define SET_HOUR_VAL(x) ((x&0x1f) << 16)
+#define SET_MIN_VAL(x) ((x&0x3f) << 8)
+#define SET_SEC_VAL(x) (x & 0x3f)
+
+/* RTC_CNTR_STS_2 0x04 */
+#define GET_CENT_VAL(x) ((x >> 16)&0x1f)
+#define GET_YEAR_VAL(x) ((x >> 8)&0x7f)
+#define GET_MON_VAL(x) (x & 0xf)
+
+#define SET_CENT_VAL(x) ((x &0x1f) << 16)
+#define SET_YEAR_VAL(x) ((x &0x7f) << 8)
+#define SET_MON_VAL(x) (x & 0xf)
+
+/* RTC_CONTROL 0x10 */
+#define ENABLE_SEC_INTERRUPT (1 << 7)
+#define ENABLE_DAY_ALARM (1 << 6)
+#define ENABLE_HOUR_ALARM (1 << 5)
+#define ENABLE_MIN_ALARM (1 << 4)
+#define ENABLE_SEC_ALARM (1 << 3)
+#define ALARM_MODE_SELECT (1 << 2)
+#define RTC_LOCK (1 << 1)
+#define RTC_ENABLE (1 << 0)
+#define ENABLE_ALL_ALARM 0x0000007c
+
+
+/* RTC_ALARM_STS 0x14 */
+#define SEC_INTERRUPT_STATUS (1 << 4)
+#define DAY_ALARM_STATUS (1 << 3)
+#define HOUR_ALARM_STATUS (1 << 2)
+#define MIN_ALARM_STATUS (1 << 1)
+#define SEC_ALARM_STATUS (1 << 0)
+
+
+
+#endif /* __ASM_ARCH_REGS_RTC_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-scu-g5.h b/arch/arm/plat-aspeed/include/plat/regs-scu-g5.h
new file mode 100644
index 000000000000..0720be5393fb
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-scu-g5.h
@@ -0,0 +1,702 @@
+/* arch/arm/mach-aspeed/include/mach/regs-ast2300-scu.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2012/12/29 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __AST_SCU_G5_REGS_H
+#define __AST_SCU_G5_REGS_H 1
+
+/*
+ * Register for SCU
+ * */
+#define AST_SCU_PROTECT 0x00 /* protection key register */
+#define AST_SCU_RESET 0x04 /* system reset control register */
+#define AST_SCU_CLK_SEL 0x08 /* clock selection register */
+#define AST_SCU_CLK_STOP 0x0C /* clock stop control register */
+#define AST_SCU_COUNT_CTRL 0x10 /* frequency counter control register */
+#define AST_SCU_INTR_CTRL 0x14 /* Interrupt control and status register */
+#define AST_SCU_D1_PLL 0x18 /* D1-PLL Parameter register */
+#define AST_SCU_D2_PLL 0x1C /* D2-PLL Parameter register */
+#define AST_SCU_M_PLL 0x20 /* M-PLL Parameter register */
+#define AST_SCU_H_PLL 0x24 /* H-PLL Parameter register */
+#define AST_SCU_FREQ_LIMIT 0x28 /* frequency counter comparsion register */
+#define AST_SCU_MISC1_CTRL 0x2C /* Misc. Control register */
+#define AST_SCU_PCI_CONF1 0x30 /* PCI configuration setting register#1 */
+#define AST_SCU_PCI_CONF2 0x34 /* PCI configuration setting register#2 */
+#define AST_SCU_PCI_CONF3 0x38 /* PCI configuration setting register#3 */
+#define AST_SCU_SYS_CTRL 0x3C /* System reset contrl/status register*/
+#define AST_SCU_SOC_SCRATCH0 0x40 /* SOC scratch 0~31 register */
+#define AST_SCU_SOC_SCRATCH1 0x44 /* SOC scratch 32~63 register */
+#define AST_SCU_VGA0 0x40 /* VGA fuction handshake register */
+#define AST_SCU_VGA1 0x44 /* VGA fuction handshake register */
+#define AST_SCU_MAC_CLK 0x48 /* MAC interface clock delay setting register */
+#define AST_SCU_MISC2_CTRL 0x4C /* Misc. 2 Control register */
+#define AST_SCU_VGA_SCRATCH0 0x50 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH1 0x54 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH2 0x58 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH3 0x5c /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH4 0x60 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH5 0x64 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH6 0x68 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH7 0x6c /* VGA Scratch register */
+#define AST_SCU_HW_STRAP1 0x70 /* hardware strapping register */
+#define AST_SCU_RAMDOM_GEN 0x74 /* random number generator register */
+#if defined(CONFIG_ARCH_1100) || defined(CONFIG_ARCH_2050) || defined(CONFIG_ARCH_2100) || defined(CONFIG_ARCH_2200)
+#define AST_SCU_MULTI_FUNC_2 0x78
+#else
+#define AST_SCU_RAMDOM_DATA 0x78 /* random number generator data output*/
+#endif
+#define AST_SCU_REVISION_ID 0x7C /* Silicon revision ID register */
+#define AST_SCU_FUN_PIN_CTRL1 0x80 /* Multi-function Pin Control#1*/
+#define AST_SCU_FUN_PIN_CTRL2 0x84 /* Multi-function Pin Control#2*/
+#define AST_SCU_FUN_PIN_CTRL3 0x88 /* Multi-function Pin Control#3*/
+#define AST_SCU_FUN_PIN_CTRL4 0x8C /* Multi-function Pin Control#4*/
+#define AST_SCU_FUN_PIN_CTRL5 0x90 /* Multi-function Pin Control#5*/
+#define AST_SCU_FUN_PIN_CTRL6 0x94 /* Multi-function Pin Control#6*/
+#define AST_SCU_WDT_RESET 0x9C /* Watchdog Reset Selection */
+#define AST_SCU_FUN_PIN_CTRL7 0xA0 /* Multi-function Pin Control#7*/
+#define AST_SCU_FUN_PIN_CTRL8 0xA4 /* Multi-function Pin Control#8*/
+#define AST_SCU_FUN_PIN_CTRL9 0xA8 /* Multi-function Pin Control#9*/
+#define AST_SCU_PWR_SAVING_EN 0xC0 /* Power Saving Wakeup Enable*/
+#define AST_SCU_PWR_SAVING_CTRL 0xC4 /* Power Saving Wakeup Control*/
+#define AST_SCU_HW_STRAP2 0xD0 /* Haardware strapping register set 2*/
+#define AST_SCU_COUNTER4 0xE0 /* SCU Free Run Counter Read Back #4*/
+#define AST_SCU_COUNTER4_EXT 0xE4 /* SCU Free Run Counter Extended Read Back #4*/
+
+//CPU 2
+#define AST_SCU_CPU2_CTRL 0x100 /* CPU2 Control Register*/
+#define AST_SCU_CPU2_BASE0_ADDR 0x104 /* CPU2 Base Address for Segment 0x00:0000~0x1F:FFFF*/
+#define AST_SCU_CPU2_BASE1_ADDR 0x108 /* CPU2 Base Address for Segment 0x20:0000~0x3F:FFFF*/
+#define AST_SCU_CPU2_BASE2_ADDR 0x10C /* CPU2 Base Address for Segment 0x40:0000~0x5F:FFFF*/
+#define AST_SCU_CPU2_BASE3_ADDR 0x110 /* CPU2 Base Address for Segment 0x60:0000~0x7F:FFFF*/
+#define AST_SCU_CPU2_BASE4_ADDR 0x114 /* CPU2 Base Address for Segment 0x80:0000~0xFF:FFFF*/
+#define AST_SCU_CPU2_CACHE_CTRL 0x118 /* CPU2 Cache Function Control */
+
+//
+#define AST_SCU_UART24_REF 0x160 /* Generate UART 24Mhz Ref from H-PLL when CLKIN is 25Mhz */
+#define AST_SCU_PCIE_CONFIG_SET 0x180 /* PCI-E Configuration Setting Control Register */
+#define AST_SCU_BMC_MMIO_DEC 0x184 /* BMC MMIO Decode Setting Register */
+#define AST_SCU_DEC_AREA1 0x188 /* 1st relocated controller decode area location */
+#define AST_SCU_DEC_AREA2 0x18C /* 2nd relocated controller decode area location */
+#define AST_SCU_MBOX_DEC_AREA 0x190 /* Mailbox decode area location*/
+#define AST_SCU_SRAM_DEC_AREA0 0x194 /* Shared SRAM area decode location*/
+#define AST_SCU_SRAM_DEC_AREA1 0x198 /* Shared SRAM area decode location*/
+#define AST_SCU_BMC_CLASS 0x19C /* BMC device class code and revision ID */
+#define AST_SCU_BMC_DEV_ID 0x1A4 /* BMC device ID */
+
+
+/* AST_SCU_PROTECT: 0x00 - protection key register */
+#define SCU_PROTECT_UNLOCK 0x1688A8A8
+
+/* AST_SCU_RESET :0x04 - system reset control register */
+#define SCU_RESET_I2S (0x1 << 31)
+#define SCU_RESET_IR (0x1 << 30)
+#define SCU_RESET_PS21 (0x1 << 29)
+#define SCU_RESET_PS20 (0x1 << 28)
+#define SCU_PWAKE_PIN_EN (0x1 << 27)
+#define SCU_PWAKE_PIN_OUT (0x1 << 26
+#define SCU_RESET_X_DMA (0x1 << 25)
+#define SCU_RESET_MCTP (0x1 << 24)
+//#define SCU_RESET_ADC (0x1 << 23) reserved
+#define SCU_RESET_JTAG (0x1 << 22)
+#define SCU_RESET_PCIE_EN (0x1 << 21)
+#define SCU_RESET_PCIE_OUT (0x1 << 20)
+#define SCU_RESET_PCIE (0x1 << 19)
+#define SCU_RESET_H264 (0x1 << 18)
+#define SCU_RESET_RFX (0x1 << 17)
+#define SCU_RESET_SD (0x1 << 16)
+#define SCU_RESET_USB11 (0x1 << 15)
+#define SCU_RESET_USB20 (0x1 << 14)
+#define SCU_RESET_CRT (0x1 << 13)
+//#define SCU_RESET_MAC1 (0x1 << 12) reserved
+#define SCU_RESET_MAC0 (0x1 << 11)
+//#define SCU_RESET_PECI (0x1 << 10)
+//#define SCU_RESET_PWM (0x1 << 9)
+#define SCU_PCI_VGA_DIS (0x1 << 8)
+#define SCU_RESET_2D (0x1 << 7)
+#define SCU_RESET_VIDEO (0x1 << 6)
+//#define SCU_RESET_LPC (0x1 << 5)
+#define SCU_RESET_HAC (0x1 << 4)
+//#define SCU_RESET_USB11_HID (0x1 << 3)
+#define SCU_RESET_I2C (0x1 << 2)
+#define SCU_RESET_AHB (0x1 << 1)
+#define SCU_RESET_SRAM_CTRL (0x1 << 0)
+
+/* AST_SCU_CLK_SEL : 0x08 - clock selection register */
+#define SCU_CLK_VIDEO_SLOW_EN (0x1 << 31)
+#define SCU_CLK_VIDEO_SLOW_SET(x) ((x & 0x7) << 28)
+#define SCU_CLK_VIDEO_SLOW_MASK (0x7 << 28)
+#define SCU_CLK_2D_ENG_GCLK_INVERT (0x1 << 27) //valid only at CRT mode SCU2C[7]
+#define SCU_CLK_2D_ENG_THROT_EN (0x1 << 26) //valid only at CRT mode SCU2C[7]
+#define SCU_PCLK_APB_DIV(x) ((x & 0x7) << 23)
+#define SCU_GET_PCLK_DIV(x) ((x >> 23) & 0x7)
+#define SCU_PCLK_APB_DIV_MASK (0x7 << 23) //limitation on PCLK .. PCLK > 0.5*LCLK (33Mhz)
+//#define SCU_GET_LHCLK_DIV(x) ((x >> 20) & 0x7)
+//#define SCU_SET_LHCLK_DIV(x) (x << 20)
+//#define SCU_LHCLK_DIV_MASK (0x7 << 20)
+//#define SCU_LHCLK_SOURCE_EN (0x1 << 19) //0: ext , 1:internel
+#define SCU_SET_MAC_DIV(x) ((x & 0x7) << 16)
+#define SCU_GET_MAC_DIV(x) ((x >> 16) & 0x7)
+#define SCU_CLK_MAC_MASK (0x7 << 16)
+#define SCU_CLK_SD_EN (0x1 << 15)
+#define SCU_SET_SD_DIV(x) ((x & 0x7) << 12)
+#define SCU_GET_SD_DIV(x) ((x >> 12) & 0x7)
+#define SCU_CLK_SD_MASK (0x7 << 12)
+//
+#define SCU_CLK_VIDEO_DELAY(x) ((x & 0xf) << 8)
+#define SCU_CLK_VIDEO_DELAY_MASK (0xf << 8)
+#define SCU_CLK_CPU_AHB_SLOW_EN (0x1 << 7)
+#define SCU_CLK_CPU_AHB_SLOW(x) ((x & 0x7) << 4)
+#define SCU_CLK_CPU_AHB_SLOW_MASK (0x7 << 4)
+#define SCU_GET_CPU_AHB_DIV(x) ((x >> 4) & 0x7)
+#define SCU_ECLK_SOURCE(x) (x << 2)
+#define SCU_ECLK_SOURCE_MASK (0x3 << 2)
+#define SCU_CLK_CPU_AHB_SLOW_IDLE (0x1 << 1)
+#define SCU_CLK_CPU_AHB_DYN_SLOW_EN (0x1 << 0)
+
+/* AST_SCU_CLK_STOP : 0x0C - clock stop control register */
+//#define SCU_LHCLK_STOP_EN (0x1 << 28)
+#define SCU_SDCLK_STOP_EN (0x1 << 27)
+#define SCU_IRCLK_STOP_EN (0x1 << 26)
+#define SCU_I2SCLK_STOP_EN (0x1 << 25)
+#define SCU_RSACLK_STOP_EN (0x1 << 24)
+#define SCU_H264CLK_STOP_EN (0x1 << 23)
+//bit 22 must keep 1
+//#define SCU_MAC1CLK_STOP_EN (0x1 << 21)
+#define SCU_MAC0CLK_STOP_EN (0x1 << 20)
+#define SCU_BBCLK_STOP_EN (0x1 << 19)
+#define SCU_RFXCLK_STOP_EN (0x1 << 18)
+#define SCU_UART0_CLK_STOP_EN (0x1 << 17)
+#define SCU_UART2_CLK_STOP_EN (0x1 << 16)
+#define SCU_UART1_CLK_STOP_EN (0x1 << 15)
+#define SCU_USB20_CLK_EN (0x1 << 14)
+#define SCU_YCLK_STOP_EN (0x1 << 13)
+#define SCU_PS2CLK_STOP_EN (0x1 << 12)
+//
+#define SCU_D1CLK_STOP_EN (0x1 << 10)
+#define SCU_USB11CLK_STOP_EN (0x1 << 9)
+#define SCU_D4CLK_STOP_EN (0x1 << 8)
+#define SCU_D3CLK_STOP_EN (0x1 << 7)
+#define SCU_REFCLK_STOP_EN (0x1 << 6)
+#define SCU_D2CLK_STOP_EN (0x1 << 5)
+#define SCU_SACLK_STOP_EN (0x1 << 4)
+#define SCU_VCLK_STOP_EN (0x1 << 3)
+#define SCU_MCLK_STOP_EN (0x1 << 2)
+#define SCU_GCLK_STOP_EN (0x1 << 1)
+#define SCU_ECLK_STOP_EN (0x1 << 0)
+
+/* AST_SCU_COUNT_CTRL : 0x10 - frequency counter control register */
+#define SCU_FREQ_COMP_RESULT (0x1 << 7)
+#define SCU_FREQ_MEASU_FINISH (0x1 << 6)
+#define SCU_FREQ_SOURCE_FOR_MEASU(x) ((x & 0xf) << 2)
+#define SCU_FREQ_SOURCE_FOR_MEASU_MASK (0xf << 2)
+
+#define SCU_SOURCE_6M 0xf
+#define SCU_SOURCE_12M 0xe
+#define SCU_SOURCE_I2SM_CLK 0xd
+#define SCU_SOURCE_H_CLK 0xc
+#define SCU_SOURCE_B_CLK 0xb
+#define SCU_SOURCE_D2_PLL 0xa
+
+#define SCU_SOURCE_VIDEO_CLK 0x7
+#define SCU_SOURCE_LPC_CLK 0x6
+#define SCU_SOURCE_JITTER_CLK 0x5
+#define SCU_SOURCE_M_CLK 0x4
+#define SCU_SOURCE_XP_CLK 0x3
+#define SCU_SOURCE_D_PLL 0x2
+#define SCU_SOURCE_NAND 0x1
+#define SCU_SOURCE_DEL_CELL 0x0
+
+#define SCU_OSC_COUNT_EN (0x1 << 1)
+#define SCU_RING_OSC_EN (0x1 << 0)
+
+/* AST_SCU_INTR_CTRL : 0x14 - Interrupt control and status register */
+//#define INTR_LPC_H_L_RESET (0x1 << 21)
+//#define INTR_LPC_L_H_RESET (0x1 << 20)
+#define INTR_PCIE_H_L_RESET (0x1 << 17)
+#define INTR_PCIE_L_H_RESET (0x1 << 16)
+//#define INTR_VGA_SCRATCH_CHANGE (0x1 << 17)
+//#define INTR_VGA_CURSOR_CHANGE (0x1 << 16)
+#define INTR_MSI_EN (0x1 << 2)
+//#define INTR_LPC_H_L_RESET_EN (0x1 << 1)
+//#define INTR_LPC_L_H_RESET_EN (0x1 << 0)
+#define INTR_PCIE_H_L_RESET_EN (0x1 << 1)
+#define INTR_PCIE_L_H_RESET_EN (0x1 << 0)
+//#define INTR_VGA_SCRATCH_CHANGE_EN (0x1 << 1)
+//#define INTR_VGA_CURSOR_CHANGE_EN (0x1 << 0)
+
+
+/* AST_SCU_D1_PLL: 0x18 - D1-PLL Parameter register */
+#define SCU_D1_PLL_SET_PD2(x) ((x & 0x7) << 19)
+#define SCU_D1_PLL_GET_PD2(x) ((x >> 19) & 0x7)
+#define SCU_D1_PLL_PD2_MASK (0x7 << 19)
+#define SCU_D1_PLL_BYPASS_EN (0x1 << 18)
+#define SCU_D1_PLL_OFF (0x1 << 17)
+#define SCU_D1_PLL_SET_PD(x) ((x & 0x3) << 15)
+#define SCU_D1_PLL_GET_PD(x) ((x >> 15) & 0x3)
+#define SCU_D1_PLL_PD_MASK (0x3 << 15)
+#define SCU_D1_PLL_SET_OD(x) ((x & 0x3) << 13)
+#define SCU_D1_PLL_GET_OD(x) ((x >> 13) & 0x3)
+#define SCU_D1_PLL_OD_MASK (0x3 << 13)
+#define SCU_D1_PLL_SET_DENUM(x) ((x & 0x1f) << 8)
+#define SCU_D1_PLL_GET_DENUM(x) ((x >> 8) & 0x1f)
+#define SCU_D1_PLL_DENUM_MASK (0x1f << 8)
+#define SCU_D1_PLL_SET_NUM(x) (x & 0xff)
+#define SCU_D1_PLL_GET_NUM(x) (x & 0xff)
+#define SCU_D1_PLL_NUM_MASK (0xff)
+
+/* AST_SCU_D2_PLL: 0x1C - D2-PLL Parameter register */
+#define SCU_D2_PLL_SET_PD2(x) ((x & 0x7) << 19)
+#define SCU_D2_PLL_GET_PD2(x) ((x >> 19) & 0x7)
+#define SCU_D2_PLL_PD2_MASK (0x7 << 19)
+#define SCU_D2_PLL_BYPASS_EN (0x1 << 18)
+#define SCU_D2_PLL_OFF (0x1 << 17)
+#define SCU_D2_PLL_SET_PD(x) ((x & 0x3) << 15)
+#define SCU_D2_PLL_GET_PD(x) ((x >> 15) & 0x3)
+#define SCU_D2_PLL_PD_MASK (0x3 << 15)
+#define SCU_D2_PLL_SET_OD(x) ((x & 0x3) << 13)
+#define SCU_D2_PLL_GET_OD(x) ((x >> 13) & 0x3)
+#define SCU_D2_PLL_OD_MASK (0x3 << 13)
+#define SCU_D2_PLL_SET_DENUM(x) ((x & 0x1f) << 8)
+#define SCU_D2_PLL_GET_DENUM(x) ((x >> 8) & 0x1f)
+#define SCU_D2_PLL_DENUM_MASK (0x1f << 8)
+#define SCU_D2_PLL_SET_NUM(x) (x & 0xff)
+#define SCU_D2_PLL_GET_NUM(x) (x & 0xff)
+#define SCU_D2_PLL_NUM_MASK (0xff)
+
+/* AST_SCU_M_PLL : 0x20 - M-PLL Parameter register */
+#define SCU_M_PLL_BYPASS_EN (0x1 << 17)
+#define SCU_M_PLL_OFF (0x1 << 16)
+#define SCU_M_PLL_NUM(x) ((x & 0x3f) << 5)
+#define SCU_M_PLL_GET_NUM(x) ((x >> 5) & 0x3f)
+#define SCU_M_PLL_NUM_MASK (0x3f << 5)
+#define SCU_M_PLL_OUT_DIV (0x1 << 4)
+#define SCU_M_PLL_GET_DIV(x) ((x >> 4) & 0x1)
+#define SCU_M_PLL_SET_DENUM(x) (x & 0xf)
+#define SCU_M_PLL_GET_DENUM(x) (x & 0xf)
+
+/* AST_SCU_H_PLL: 0x24- H-PLL Parameter register */
+#define SCU_H_PLL_BYPASS_EN (0x1 << 17)
+#define SCU_H_PLL_OFF (0x1 << 16)
+#define SCU_H_PLL_SET_NUM(x) ((x & 0x3f) << 5)
+#define SCU_H_PLL_GET_NUM(x) ((x >> 5) & 0x3f)
+#define SCU_H_PLL_NUM_MASK (0x3f << 5)
+#define SCU_H_PLL_OUT_DIV (0x1 << 4)
+#define SCU_H_PLL_GET_DIV(x) ((x >> 4) & 0x1)
+#define SCU_H_PLL_SET_DENUM(x) (x & 0xf)
+#define SCU_H_PLL_GET_DENUM(x) (x & 0xf)
+#define SCU_H_PLL_DENUM_MASK (0xf)
+
+/* AST_SCU_FREQ_LIMIT : 0x28 - frequency counter comparsion register */
+#define SCU_FREQ_U_LIMIT(x) ((x & 0x3fff) << 16)
+#define SCU_FREQ_U_LIMIT_MASK (0x3fff << 16)
+#define SCU_FREQ_L_LIMIT(x) (x & 0x3fff)
+#define SCU_FREQ_L_LIMIT_MASK (0x3fff)
+
+/* AST_SCU_MISC_CTRL : 0x2C - Misc. Control register */
+#define HPLL_MPLL 0
+#define HPLL_DIV2 1
+#define SCU_MISC_24MHZ_BCLK (0x1 << 28)
+#define SCU_MISC_RFX_CLK_SEL(x) ((x & 0x1) << 27)
+#define SCU_MISC_RFX_CLK_HPLL_DIV2 (0x1 << 27)
+#define SCU_MISC_JTAG_MASTER_DIS (0x1 << 26)
+#define SCU_MISC_ST_CLK_HPLL_DIV2 (0x1 << 25)
+#define SCU_MISC_H264_CLK_HPLL_DIV2 (0x1 << 24)
+#define SCU_MISC_AX_CLK_HPLL_DIV2 (0x1 << 23)
+#define SCU_MISC_BB_CLK_HPLL_DIV2 (0x1 << 22)
+#define SCU_MISC_D4_CLK_D2_PLL (0x1 << 21)
+#define SCU_MISC_D3_CLK_D2_PLL (0x1 << 20)
+#define SCU_MISC_D2_CLK_D2_PLL (0x1 << 19)
+#define SCU_MISC_D1_CLK_D2_PLL (0x1 << 18)
+#define SCU_MISC_DAC_MASK (0x3 << 16)
+#define SCU_MISC_DAC_SOURCE_CRT (0x1 << 16) //00 VGA, 01: CRT, 1x: PASS-Through DVO
+#define SCU_MISC_DAC_SOURCE_MASK (0x3 << 16)
+#define SCU_MISC_RST_CRT1_EN (0x1 << 15)
+#define SCU_MISC_RST_CRT2_EN (0x1 << 14)
+#define SCU_MISC_RST_CRT3_EN (0x1 << 13)
+#define SCU_MISC_RST_CRT4_EN (0x1 << 12)
+#define SCU_MISC_Y_CLK_INVERT (0x1 << 11)
+
+#define SCU_MISC_OUT_DELAY (0x1 << 9)
+#define SCU_MISC_PCI_TO_AHB_DIS (0x1 << 8)
+//#define SCU_MISC_2D_CRT_EN (0x1 << 7)
+//#define SCU_MISC_VGA_CRT_DIS (0x1 << 6)
+//#define SCU_MISC_VGA_REG_ACCESS_EN (0x1 << 5)
+#define SCU_MISC_D2_PLL_DIS (0x1 << 4)
+#define SCU_MISC_DAC_DIS (0x1 << 3)
+#define SCU_MISC_D1_PLL_DIS (0x1 << 2)
+#define SCU_MISC_OSC_CLK_OUT_PIN (0x1 << 1)
+//#define SCU_MISC_LPC_TO_SPI_DIS (0x1 << 0)
+
+/* AST_SCU_PCI_CONF1 : 0x30 - PCI configuration setting register#1 */
+#define SCU_PCI_DEVICE_ID(x) (x << 16)
+#define SCU_PCI_VENDOR_ID(x) (x)
+
+/* AST_SCU_PCI_CONF2 0x34 PCI configuration setting register#2 */
+#define SCU_PCI_SUB_SYS_ID(x) (x << 16)
+#define SCU_PCI_SUB_VENDOR_ID(x) (x)
+
+/* AST_SCU_PCI_CONF3 0x38 PCI configuration setting register#3 */
+#define SCU_PCI_CLASS_CODE(x) (x << 8)
+#define SCU_PCI_REVISION_ID(x) (x)
+
+/* AST_SCU_SYS_CTRL 0x3C System reset contrl/status register*/
+#define SCU_SYS_EXT_SOC_RESET_EN (0x1 << 3)
+#define SCU_SYS_EXT_RESET_FLAG (0x1 << 2)
+#define SCU_SYS_WDT_RESET_FLAG (0x1 << 1)
+#define SCU_SYS_PWR_RESET_FLAG (0x1 << 0)
+
+/* AST_SCU_SOC_SCRATCH0 0x40 SOC scratch 0~31 register */
+
+
+
+
+/* AST_SCU_SOC_SCRATCH1 0x44 SOC scratch 32~63 register */
+
+
+/* AST_SCU_VGA0 0x40 VGA fuction handshake register */
+#define SCU_VGA_SLT_HANDSHAKE(x) (x << 24)
+#define SCU_VGA_SLT_HANDSHAKE_MASK (0xff << 24)
+#define SCU_VGA_CTM_DEF(x) (x << 16)
+#define SCU_VGA_CTM_DEF_MASK (0xff << 16)
+#define SCU_MAC0_PHY_MODE(x) (x << 14)
+#define SCU_MAC0_GET_PHY_MODE(x) ((x >> 14) & 0x3)
+#define SCU_MAC0_PHY_MODE_MASK(x) (0x3 << 14)
+#define SCU_MAC1_PHY_MODE(x) (x << 12)
+#define SCU_MAC1_PHY_MODE_MASK (0x3 << 12)
+#define SCU_MAC1_GET_PHY_MODE(x) ((x >> 12) & 0x3)
+
+#define SCU_VGA_ASPEED_DEF(x) (x << 8)
+#define SCU_VGA_ASPEED_DEF_MASK (0xf << 8)
+
+#define SCU_VGA_DRAM_INIT_MASK(x) ((x >> 7) & 0x1)
+
+/* AST_SCU_VGA1 0x44 VGA fuction handshake register */
+
+
+/* AST_SCU_MAC_CLK 0x48 MAC interface clock delay setting register */
+
+
+
+/* AST_SCU_MISC_CTRL 0x4C Misc. 2 Control register */
+/* AST_SCU_VGA_SCRATCH0 0x50 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH1 0x54 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH2 0x58 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH3 0x5c VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH4 0x60 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH5 0x64 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH6 0x68 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH7 0x6c VGA Scratch register */
+
+/* AST_SCU_HW_STRAP1 0x70 hardware strapping register */
+#define SCU_HW_STRAP_SW_DEFINE(x) (x << 29)
+#define SCU_HW_STRAP_SW_DEFINE_MASK (0x3 << 29)
+#define SCU_HW_STRAP_DRAM_SIZE(x) (x << 27)
+#define SCU_HW_STRAP_DRAM_SIZE_MASK (0x3 << 27)
+
+#define VGA_64M_DRAM 0
+#define VGA_128M_DRAM 1
+#define VGA_256M_DRAM 2
+#define VGA_512M_DRAM 3
+
+#define SCU_HW_STRAP_DRAM_CONFIG(x) ((x & 0x7) << 24)
+#define SCU_HW_STRAP_DRAM_CONFIG_MASK (0x7 << 24)
+
+#define SCU_HW_STRAP_SPI_MODE(x) ((x & 0x3) << 12)
+#define SCU_HW_STRAP_SPI_MODE_MASK (0x3 << 12)
+#define SPI_MODE_DIS (0)
+#define SPI_MODE_MASTER_EN (1)
+#define SPI_MODE_M_S_EN (2)
+#define SPI_MODE_PS (3)
+
+#define SCU_HW_STRAP_SET_CPU_AHB_RATIO(x) (x << 10)
+#define SCU_HW_STRAP_GET_CPU_AHB_RATIO(x) ((x >> 10) & 3)
+#define SCU_HW_STRAP_CPU_AHB_RATIO_MASK (0x3 << 10)
+
+
+#define CPU_AHB_RATIO_1_1 0
+#define CPU_AHB_RATIO_2_1 1
+#define CPU_AHB_RATIO_4_1 2
+#define CPU_AHB_RATIO_3_1 3
+
+#define SCU_HW_STRAP_GET_H_PLL_CLK(x) ((x >> 8 )& 0x3)
+#define SCU_HW_STRAP_H_PLL_CLK_MASK (0x3 << 8)
+#define CPU_384MHZ 0
+#define CPU_360MHZ 1
+#define CPU_336MHZ 2
+#define CPU_408MHZ 3
+
+//#define SCU_HW_STRAP_MAC1_INF (0x1 << 7)
+#define SCU_HW_STRAP_MAC0_INF (0x1 << 6)
+//#define SCU_HW_STRAP_VGA_BIOS_ROM (0x1 << 5)
+#define SCU_HW_STRAP_SPI_WIDTH (0x1 << 4)
+//#define SCU_HW_STRAP_VGA_SIZE_GET(x) ((x >> 2)& 0x3)
+
+#define SCU_HW_STRAP_BOOT_MODE(x) (x)
+#define NOR_BOOT 0
+#define NAND_BOOT 1
+#define SPI_BOOT 2
+#define DIS_BOOT 3
+
+/* AST_SCU_RAMDOM_GEN 0x74 random number generator register */
+/* AST_SCU_RAMDOM_DATA 0x78 random number generator data output*/
+
+/* AST_SCU_MULTI_FUNC_2 0x78 */
+
+/* AST_SCU_REVISION_ID 0x7C Silicon revision ID register */
+#define AST1100_A0 0x00000200
+#define AST1100_A1 0x00000201
+#define AST1100_A2 0x00000202
+#define AST1100_A3 0x00000202
+
+#define AST2050_A0 0x00000200
+#define AST2050_A1 0x00000201
+#define AST2050_A2 0x00000202
+#define AST2050_A3 0x00000202
+
+#define AST2100_A0 0x00000300
+#define AST2100_A1 0x00000301
+#define AST2100_A2 0x00000302
+#define AST2100_A3 0x00000302
+
+#define AST2200_A0 0x00000102
+#define AST2200_A1 0x00000102
+
+#define AST2300_A0 0x01000003
+#define AST2300_A1 0x01010303
+#define AST1300_A1 0x01010003
+#define AST1050_A1 0x01010203
+
+#define AST2400_A0 0x02000303
+
+
+/* AST_SCU_FUN_PIN_CTRL1 0x80 Multi-function Pin Control#1*/
+#define SCU_FUN_PIN_UART4_RXD (0x1 << 31)
+#define SCU_FUN_PIN_UART4_TXD (0x1 << 30)
+#define SCU_FUN_PIN_UART4_NRTS (0x1 << 29)
+#define SCU_FUN_PIN_UART4_NDTR (0x1 << 28)
+#define SCU_FUN_PIN_UART4_NRI (0x1 << 27)
+#define SCU_FUN_PIN_UART4_NDSR (0x1 << 26)
+#define SCU_FUN_PIN_UART4_NDCD (0x1 << 25)
+#define SCU_FUN_PIN_UART4_NCTS (0x1 << 24)
+#define SCU_FUN_PIN_UART3_RXD (0x1 << 23)
+#define SCU_FUN_PIN_UART3_TXD (0x1 << 22)
+#define SCU_FUN_PIN_UART3_NRTS (0x1 << 21)
+#define SCU_FUN_PIN_UART3_NDTR (0x1 << 20)
+#define SCU_FUN_PIN_UART3_NRI (0x1 << 19)
+#define SCU_FUN_PIN_UART3_NDSR (0x1 << 18)
+#define SCU_FUN_PIN_UART3_NDCD (0x1 << 17)
+#define SCU_FUN_PIN_UART3_NCTS (0x1 << 16)
+#define SCU_FUN_PIN_SPICS1 (0x1 << 15)
+#define SCU_FUN_PIN_LPCPME (0x1 << 14)
+#define SCU_FUN_PIN_LPCPD (0x1 << 13)
+#define SCU_FUN_PIN_LPCRST (0x1 << 12)
+#define SCU_FUN_PIN_I2C_SALT4 (0x1 << 11)
+#define SCU_FUN_PIN_I2C_SALT3 (0x1 << 10)
+#define SCU_FUN_PIN_I2C_SALT2 (0x1 << 9)
+#define SCU_FUN_PIN_I2C_SALT1 (0x1 << 8)
+#define SCU_FUN_PIN_TIMER8 (0x1 << 7)
+#define SCU_FUN_PIN_TIMER7 (0x1 << 6)
+#define SCU_FUN_PIN_TIMER6 (0x1 << 5)
+#define SCU_FUN_PIN_TIMER5 (0x1 << 4)
+#define SCU_FUN_PIN_TIMER4 (0x1 << 3)
+#define SCU_FUN_PIN_TIMER3 (0x1 << 2)
+#define SCU_FUN_PIN_MAC1_PHY_LINK (0x1 << 1)
+#define SCU_FUN_PIN_MAC0_PHY_LINK (0x1)
+
+/* AST_SCU_FUN_PIN_CTRL2 0x84 Multi-function Pin Control#2*/
+#define SCU_FUN_PIN_VPIB9 (0x1 << 31)
+#define SCU_FUN_PIN_VPIB8 (0x1 << 30)
+#define SCU_FUN_PIN_VPIB7 (0x1 << 29)
+#define SCU_FUN_PIN_VPIB6 (0x1 << 28)
+#define SCU_FUN_PIN_VPIB5 (0x1 << 27)
+#define SCU_FUN_PIN_VPIB4 (0x1 << 26)
+#define SCU_FUN_PIN_VPIB3 (0x1 << 25)
+#define SCU_FUN_PIN_VPIB2 (0x1 << 24)
+#define SCU_FUN_PIN_VPIB1 (0x1 << 23)
+#define SCU_FUN_PIN_VPIB0 (0x1 << 22)
+#define SCU_FUN_PIN_VPICLK (0x1 << 21)
+#define SCU_FUN_PIN_VPIVS (0x1 << 20)
+#define SCU_FUN_PIN_VPIHS (0x1 << 19)
+#define SCU_FUN_PIN_VPIODD (0x1 << 18)
+#define SCU_FUN_PIN_VPIDE (0x1 << 17)
+
+#define SCU_FUN_PIN_UART2_RXD (0x1 << 31)
+#define SCU_FUN_PIN_UART2_TXD (0x1 << 30)
+#define SCU_FUN_PIN_UART2_NRTS (0x1 << 29)
+#define SCU_FUN_PIN_UART2_NDTR (0x1 << 28)
+#define SCU_FUN_PIN_UART2_NRI (0x1 << 27)
+#define SCU_FUN_PIN_UART2_NDSR (0x1 << 26)
+#define SCU_FUN_PIN_UART2_NDCD (0x1 << 25)
+#define SCU_FUN_PIN_UART2_NCTS (0x1 << 24)
+#define SCU_FUN_PIN_UART1_RXD (0x1 << 23)
+#define SCU_FUN_PIN_UART1_TXD (0x1 << 22)
+#define SCU_FUN_PIN_UART1_NRTS (0x1 << 21)
+#define SCU_FUN_PIN_UART1_NDTR (0x1 << 20)
+#define SCU_FUN_PIN_UART1_NRI (0x1 << 19)
+#define SCU_FUN_PIN_UART1_NDSR (0x1 << 18)
+#define SCU_FUN_PIN_UART1_NDCD (0x1 << 17)
+#define SCU_FUN_PIN_UART1_NCTS (0x1 << 16)
+
+
+#define SCU_FUN_PIN_NAND_FLWP (0x1 << 7)
+#define SCU_FUN_PIN_NAND_FLBUSY (0x1 << 6)
+
+/* AST_SCU_FUN_PIN_CTRL3 0x88 Multi-function Pin Control#3*/
+#define SCU_FUN_PIN_MAC0_MDIO (0x1 << 31)
+#define SCU_FUN_PIN_MAC0_MDC (0x1 << 30)
+#define SCU_FUN_PIN_ROMA25 (0x1 << 29)
+#define SCU_FUN_PIN_ROMA24 (0x1 << 28)
+#define SCU_FUN_PIN_ROMCS4 (0x1 << 27)
+#define SCU_FUN_PIN_ROMCS3 (0x1 << 26)
+#define SCU_FUN_PIN_ROMCS2 (0x1 << 25)
+#define SCU_FUN_PIN_ROMCS1 (0x1 << 24)
+#define SCU_FUN_PIN_ROMCS(x) (0x1 << (23+x))
+
+//Video pin
+#define SCU_FUN_PIN_VPIR9 (0x1 << 19)
+#define SCU_FUN_PIN_VPIR8 (0x1 << 18)
+#define SCU_FUN_PIN_VPIR7 (0x1 << 17)
+#define SCU_FUN_PIN_VPIR6 (0x1 << 16)
+#define SCU_FUN_PIN_VPIR5 (0x1 << 15)
+#define SCU_FUN_PIN_VPIR4 (0x1 << 14)
+#define SCU_FUN_PIN_VPIR3 (0x1 << 13)
+#define SCU_FUN_PIN_VPIR2 (0x1 << 12)
+#define SCU_FUN_PIN_VPIR1 (0x1 << 11)
+#define SCU_FUN_PIN_VPIR0 (0x1 << 10)
+#define SCU_FUN_PIN_VPIG9 (0x1 << 9)
+#define SCU_FUN_PIN_VPIG8 (0x1 << 8)
+#define SCU_FUN_PIN_VPIG7 (0x1 << 7)
+#define SCU_FUN_PIN_VPIG6 (0x1 << 6)
+#define SCU_FUN_PIN_VPIG5 (0x1 << 5)
+#define SCU_FUN_PIN_VPIG4 (0x1 << 4)
+#define SCU_FUN_PIN_VPIG3 (0x1 << 3)
+#define SCU_FUN_PIN_VPIG2 (0x1 << 2)
+#define SCU_FUN_PIN_VPIG1 (0x1 << 1)
+#define SCU_FUN_PIN_VPIG0 (0x1 << 0)
+
+//pwm pin
+#define SCU_FUN_PIN_PWM_TACHO (0)
+
+/* AST_SCU_FUN_PIN_CTRL4 0x8C Multi-function Pin Control#4*/
+#define SCU_FUN_PIN_ROMA23 (0x1 << 7)
+#define SCU_FUN_PIN_ROMA22 (0x1 << 6)
+
+#define SCU_FUN_PIN_ROMWE (0x1 << 5)
+#define SCU_FUN_PIN_ROMOE (0x1 << 4)
+#define SCU_FUN_PIN_ROMD7 (0x1 << 3)
+#define SCU_FUN_PIN_ROMD6 (0x1 << 2)
+#define SCU_FUN_PIN_ROMD5 (0x1 << 1)
+#define SCU_FUN_PIN_ROMD4 (0x1)
+
+/* AST_SCU_FUN_PIN_CTRL5 0x90 Multi-function Pin Control#5*/
+#define SCU_FUN_PIN_SPICS1 (0x1 << 31)
+#define SCU_FUN_PIN_LPC_PLUS (0x1 << 30)
+#define SCU_FUC_PIN_USB20_HOST (0x1 << 29)
+#define SCU_FUC_PIN_USB11_PORT4 (0x1 << 28)
+#define SCU_FUC_PIN_I2C14 (0x1 << 27)
+#define SCU_FUC_PIN_I2C13 (0x1 << 26)
+#define SCU_FUC_PIN_I2C12 (0x1 << 25)
+#define SCU_FUC_PIN_I2C11 (0x1 << 24)
+#define SCU_FUC_PIN_I2C10 (0x1 << 23)
+#define SCU_FUC_PIN_I2C9 (0x1 << 22)
+#define SCU_FUC_PIN_I2C8 (0x1 << 21)
+#define SCU_FUC_PIN_I2C7 (0x1 << 20)
+#define SCU_FUC_PIN_I2C6 (0x1 << 19)
+#define SCU_FUC_PIN_I2C5 (0x1 << 18)
+#define SCU_FUC_PIN_I2C4 (0x1 << 17)
+#define SCU_FUC_PIN_I2C3 (0x1 << 16)
+#define SCU_FUC_PIN_MII2_RX_DWN_DIS (0x1 << 15)
+#define SCU_FUC_PIN_MII2_TX_DWN_DIS (0x1 << 14)
+#define SCU_FUC_PIN_MII1_RX_DWN_DIS (0x1 << 13)
+#define SCU_FUC_PIN_MII1_TX_DWN_DIS (0x1 << 12)
+
+#define SCU_FUC_PIN_MII2_TX_DRIV(x) (x << 10)
+#define SCU_FUC_PIN_MII2_TX_DRIV_MASK (0x3 << 10)
+#define SCU_FUC_PIN_MII1_TX_DRIV(x) (x << 8)
+#define SCU_FUC_PIN_MII1_TX_DRIV_MASK (0x3 << 8)
+
+#define MII_NORMAL_DRIV 0x0
+#define MII_HIGH_DRIV 0x2
+
+#define SCU_FUC_PIN_UART6 (0x1 << 7)
+#define SCU_FUC_PIN_ROM_16BIT (0x1 << 6)
+#define SCU_FUC_PIN_DIGI_V_OUT(x) (x << 4)
+#define SCU_FUC_PIN_DIGI_V_OUT_MASK (0x3 << 4)
+
+#define VIDEO_DISABLE 0x0
+#define VIDEO_12BITS 0x1
+#define VIDEO_24BITS 0x2
+//#define VIDEO_DISABLE 0x3
+
+#define SCU_FUC_PIN_USB11_PORT2 (0x1 << 3)
+#define SCU_FUC_PIN_MAC1_MDIO (0x1 << 2)
+#define SCU_FUC_PIN_SD2 (0x1 << 1)
+#define SCU_FUC_PIN_SD1 (0x1 << 0)
+
+
+/* AST_SCU_FUN_PIN_CTRL6 0x94 Multi-function Pin Control#6*/
+#define SCU_VIDEO_OUT_MASK (~0x3)
+
+/* AST_SCU_WDT_RESET 0x9C Watchdog Reset Selection */
+/* AST_SCU_FUN_PIN_CTRL7 0xA0 Multi-function Pin Control#7*/
+/* AST_SCU_FUN_PIN_CTRL8 0xA4 Multi-function Pin Control#8*/
+#define SCU_FUN_PIN_ROMA17 (0x1 << 31)
+#define SCU_FUN_PIN_ROMA16 (0x1 << 30)
+#define SCU_FUN_PIN_ROMA15 (0x1 << 29)
+#define SCU_FUN_PIN_ROMA14 (0x1 << 28)
+#define SCU_FUN_PIN_ROMA13 (0x1 << 27)
+#define SCU_FUN_PIN_ROMA12 (0x1 << 26)
+#define SCU_FUN_PIN_ROMA11 (0x1 << 25)
+#define SCU_FUN_PIN_ROMA10 (0x1 << 24)
+#define SCU_FUN_PIN_ROMA9 (0x1 << 23)
+#define SCU_FUN_PIN_ROMA8 (0x1 << 22)
+#define SCU_FUN_PIN_ROMA7 (0x1 << 21)
+#define SCU_FUN_PIN_ROMA6 (0x1 << 20)
+#define SCU_FUN_PIN_ROMA5 (0x1 << 19)
+#define SCU_FUN_PIN_ROMA4 (0x1 << 18)
+#define SCU_FUN_PIN_ROMA3 (0x1 << 17)
+#define SCU_FUN_PIN_ROMA2 (0x1 << 16)
+
+/* AST_SCU_FUN_PIN_CTRL9 0xA8 Multi-function Pin Control#9*/
+#define SCU_FUN_PIN_ROMA21 (0x1 << 3)
+#define SCU_FUN_PIN_ROMA20 (0x1 << 2)
+#define SCU_FUN_PIN_ROMA19 (0x1 << 1)
+#define SCU_FUN_PIN_ROMA18 (0x1)
+
+/* AST_SCU_PWR_SAVING_EN 0xC0 Power Saving Wakeup Enable*/
+/* AST_SCU_PWR_SAVING_CTRL 0xC4 Power Saving Wakeup Control*/
+/* AST_SCU_HW_STRAP2 0xD0 Haardware strapping register set 2*/
+/* AST_SCU_COUNTER4 0xE0 SCU Free Run Counter Read Back #4*/
+/* AST_SCU_COUNTER4_EXT 0xE4 SCU Free Run Counter Extended Read Back #4*/
+
+//CPU 2
+/* AST_SCU_CPU2_CTRL 0x100 CPU2 Control Register*/
+/* AST_SCU_CPU2_BASE0_ADDR 0x104 CPU2 Base Address for Segment 0x00:0000~0x1F:FFFF*/
+/* AST_SCU_CPU2_BASE1_ADDR 0x108 CPU2 Base Address for Segment 0x20:0000~0x3F:FFFF*/
+/* AST_SCU_CPU2_BASE2_ADDR 0x10C CPU2 Base Address for Segment 0x40:0000~0x5F:FFFF*/
+/* AST_SCU_CPU2_BASE3_ADDR 0x110 CPU2 Base Address for Segment 0x60:0000~0x7F:FFFF*/
+/* AST_SCU_CPU2_BASE4_ADDR 0x114 CPU2 Base Address for Segment 0x80:0000~0xFF:FFFF*/
+/* AST_SCU_CPU2_CACHE_CTRL 0x118 CPU2 Cache Function Control */
+
+//
+/* AST_SCU_UART24_REF 0x160 Generate UART 24Mhz Ref from H-PLL when CLKIN is 25Mhz */
+/* AST_SCU_PCIE_CONFIG_SET 0x180 PCI-E Configuration Setting Control Register */
+/* AST_SCU_BMC_MMIO_DEC 0x184 BMC MMIO Decode Setting Register */
+/* AST_SCU_DEC_AREA1 0x188 1st relocated controller decode area location */
+/* AST_SCU_DEC_AREA2 0x18C 2nd relocated controller decode area location */
+/* AST_SCU_MBOX_DEC_AREA 0x190 Mailbox decode area location*/
+/* AST_SCU_SRAM_DEC_AREA0 0x194 Shared SRAM area decode location*/
+/* AST_SCU_SRAM_DEC_AREA1 0x198 Shared SRAM area decode location*/
+/* AST_SCU_BMC_CLASS 0x19C BMC device class code and revision ID */
+/* AST_SCU_BMC_DEV_ID 0x1A4 BMC device ID */
+
+#endif /* __AST_SCU_G5_REGS_H */
+
diff --git a/arch/arm/plat-aspeed/include/plat/regs-scu.h b/arch/arm/plat-aspeed/include/plat/regs-scu.h
new file mode 100644
index 000000000000..0abdcbdd47ee
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-scu.h
@@ -0,0 +1,740 @@
+/* arch/arm/mach-aspeed/include/mach/regs-ast2300-scu.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2012/12/29 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __AST_SCU_H
+#define __AST_SCU_H 1
+
+/*
+ * Register for SCU
+ * */
+#define AST_SCU_PROTECT 0x00 /* protection key register */
+#define AST_SCU_RESET 0x04 /* system reset control register */
+#define AST_SCU_CLK_SEL 0x08 /* clock selection register */
+#define AST_SCU_CLK_STOP 0x0C /* clock stop control register */
+#define AST_SCU_COUNT_CTRL 0x10 /* frequency counter control register */
+#define AST_SCU_COUNT_VAL 0x14 /* frequency counter measure register */
+#define AST_SCU_INTR_CTRL 0x18 /* Interrupt control and status register */
+#define AST_SCU_D2_PLL 0x1C /* D2-PLL Parameter register */
+#define AST_SCU_M_PLL 0x20 /* M-PLL Parameter register */
+#define AST_SCU_H_PLL 0x24 /* H-PLL Parameter register */
+#define AST_SCU_FREQ_LIMIT 0x28 /* frequency counter comparsion register */
+#define AST_SCU_MISC1_CTRL 0x2C /* Misc. Control register */
+#define AST_SCU_PCI_CONF1 0x30 /* PCI configuration setting register#1 */
+#define AST_SCU_PCI_CONF2 0x34 /* PCI configuration setting register#2 */
+#define AST_SCU_PCI_CONF3 0x38 /* PCI configuration setting register#3 */
+#define AST_SCU_SYS_CTRL 0x3C /* System reset contrl/status register*/
+#define AST_SCU_SOC_SCRATCH0 0x40 /* SOC scratch 0~31 register */
+#define AST_SCU_SOC_SCRATCH1 0x44 /* SOC scratch 32~63 register */
+#define AST_SCU_VGA0 0x40 /* VGA fuction handshake register */
+#define AST_SCU_VGA1 0x44 /* VGA fuction handshake register */
+#define AST_SCU_MAC_CLK 0x48 /* MAC interface clock delay setting register */
+#define AST_SCU_MISC2_CTRL 0x4C /* Misc. 2 Control register */
+#define AST_SCU_VGA_SCRATCH0 0x50 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH1 0x54 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH2 0x58 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH3 0x5c /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH4 0x60 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH5 0x64 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH6 0x68 /* VGA Scratch register */
+#define AST_SCU_VGA_SCRATCH7 0x6c /* VGA Scratch register */
+#define AST_SCU_HW_STRAP1 0x70 /* hardware strapping register */
+#define AST_SCU_RAMDOM_GEN 0x74 /* random number generator register */
+#if defined(CONFIG_ARCH_1100) || defined(CONFIG_ARCH_2050) || defined(CONFIG_ARCH_2100) || defined(CONFIG_ARCH_2200)
+#define AST_SCU_MULTI_FUNC_2 0x78
+#else
+#define AST_SCU_RAMDOM_DATA 0x78 /* random number generator data output*/
+#endif
+#define AST_SCU_REVISION_ID 0x7C /* Silicon revision ID register */
+#define AST_SCU_FUN_PIN_CTRL1 0x80 /* Multi-function Pin Control#1*/
+#define AST_SCU_FUN_PIN_CTRL2 0x84 /* Multi-function Pin Control#2*/
+#define AST_SCU_FUN_PIN_CTRL3 0x88 /* Multi-function Pin Control#3*/
+#define AST_SCU_FUN_PIN_CTRL4 0x8C /* Multi-function Pin Control#4*/
+#define AST_SCU_FUN_PIN_CTRL5 0x90 /* Multi-function Pin Control#5*/
+#define AST_SCU_FUN_PIN_CTRL6 0x94 /* Multi-function Pin Control#6*/
+#define AST_SCU_WDT_RESET 0x9C /* Watchdog Reset Selection */
+#define AST_SCU_FUN_PIN_CTRL7 0xA0 /* Multi-function Pin Control#7*/
+#define AST_SCU_FUN_PIN_CTRL8 0xA4 /* Multi-function Pin Control#8*/
+#define AST_SCU_FUN_PIN_CTRL9 0xA8 /* Multi-function Pin Control#9*/
+#define AST_SCU_PWR_SAVING_EN 0xC0 /* Power Saving Wakeup Enable*/
+#define AST_SCU_PWR_SAVING_CTRL 0xC4 /* Power Saving Wakeup Control*/
+#define AST_SCU_HW_STRAP2 0xD0 /* Haardware strapping register set 2*/
+#define AST_SCU_COUNTER4 0xE0 /* SCU Free Run Counter Read Back #4*/
+#define AST_SCU_COUNTER4_EXT 0xE4 /* SCU Free Run Counter Extended Read Back #4*/
+
+//CPU 2
+#define AST_SCU_CPU2_CTRL 0x100 /* CPU2 Control Register*/
+#define AST_SCU_CPU2_BASE0_ADDR 0x104 /* CPU2 Base Address for Segment 0x00:0000~0x1F:FFFF*/
+#define AST_SCU_CPU2_BASE1_ADDR 0x108 /* CPU2 Base Address for Segment 0x20:0000~0x3F:FFFF*/
+#define AST_SCU_CPU2_BASE2_ADDR 0x10C /* CPU2 Base Address for Segment 0x40:0000~0x5F:FFFF*/
+#define AST_SCU_CPU2_BASE3_ADDR 0x110 /* CPU2 Base Address for Segment 0x60:0000~0x7F:FFFF*/
+#define AST_SCU_CPU2_BASE4_ADDR 0x114 /* CPU2 Base Address for Segment 0x80:0000~0xFF:FFFF*/
+#define AST_SCU_CPU2_CACHE_CTRL 0x118 /* CPU2 Cache Function Control */
+
+//
+#define AST_SCU_UART24_REF 0x160 /* Generate UART 24Mhz Ref from H-PLL when CLKIN is 25Mhz */
+#define AST_SCU_PCIE_CONFIG_SET 0x180 /* PCI-E Configuration Setting Control Register */
+#define AST_SCU_BMC_MMIO_DEC 0x184 /* BMC MMIO Decode Setting Register */
+#define AST_SCU_DEC_AREA1 0x188 /* 1st relocated controller decode area location */
+#define AST_SCU_DEC_AREA2 0x18C /* 2nd relocated controller decode area location */
+#define AST_SCU_MBOX_DEC_AREA 0x190 /* Mailbox decode area location*/
+#define AST_SCU_SRAM_DEC_AREA0 0x194 /* Shared SRAM area decode location*/
+#define AST_SCU_SRAM_DEC_AREA1 0x198 /* Shared SRAM area decode location*/
+#define AST_SCU_BMC_CLASS 0x19C /* BMC device class code and revision ID */
+#define AST_SCU_BMC_DEV_ID 0x1A4 /* BMC device ID */
+
+
+/* AST_SCU_PROTECT: 0x00 - protection key register */
+#define SCU_PROTECT_UNLOCK 0x1688A8A8
+
+/* AST_SCU_RESET :0x04 - system reset control register */
+#if defined (CONFIG_ARCH_AST1010)
+#define SCU_RESET_ADC (0x1 << 6)
+#define SCU_RESET_JTAG (0x1 << 5)
+#define SCU_RESET_MAC0 (0x1 << 4)
+#define SCU_RESET_PECI (0x1 << 3)
+#define SCU_RESET_PWM (0x1 << 2)
+#define SCU_RESET_LPC (0x1 << 1)
+#define SCU_RESET_I2C (0x1)
+#else
+#define SCU_RESET_X_DMA (0x1 << 25)
+#define SCU_RESET_MCTP (0x1 << 24)
+#define SCU_RESET_ADC (0x1 << 23)
+#define SCU_RESET_JTAG (0x1 << 22)
+#define SCU_PWAKE_PIN_EN (0x1 << 20)
+#define SCU_PWAKE_PIN_OUT (0x1 << 19)
+#define SCU_RESET_MIC (0x1 << 18)
+#define SCU_RESET_RESV (0x1 << 17) //must keep 1
+#define SCU_RESET_SD (0x1 << 16)
+#define SCU_RESET_USB11 (0x1 << 15)
+#define SCU_RESET_USB20 (0x1 << 14)
+#define SCU_RESET_CRT (0x1 << 13)
+#define SCU_RESET_MAC1 (0x1 << 12)
+#define SCU_RESET_MAC0 (0x1 << 11)
+#define SCU_RESET_PECI (0x1 << 10)
+#define SCU_RESET_PWM (0x1 << 9)
+#define SCU_PCI_VGA_DIS (0x1 << 8)
+#define SCU_RESET_2D (0x1 << 7)
+#define SCU_RESET_VIDEO (0x1 << 6)
+#define SCU_RESET_LPC (0x1 << 5)
+#define SCU_RESET_HAC (0x1 << 4)
+#define SCU_RESET_USB11_HID (0x1 << 3)
+#define SCU_RESET_I2C (0x1 << 2)
+#define SCU_RESET_AHB (0x1 << 1)
+#define SCU_RESET_SRAM_CTRL (0x1 << 0)
+#endif
+
+/* AST_SCU_CLK_SEL : 0x08 - clock selection register */
+#if defined(CONFIG_ARCH_AST1010)
+#define SCU_CLK_MAC_DIV(x) (x << 12)
+#define SCU_CLK_MAC_MASK (0x3 << 12)
+#define SCU_LHCLK_SOURCE_EN (0x1 << 11) //0: ext , 1:internel
+#define SCU_LHCLK_LPC_DIV(x) (x << 8)
+#define SCU_LHCLK_LPC_MASK (0x7 << 8)
+#define SCU_PCLK_APB_DIV(x) (x << 5)
+#define SCU_GET_PCLK_DIV(x) ((x >> 5) & 0x7)
+#define SCU_PCLK_APB_DIV_MASK (0x7 << 5) //limitation on PCLK .. PCLK > 0.5*LCLK (33Mhz)
+#define SCU_CLK_CPU_AHB_SLOW_EN (0x1 << 4)
+#define SCU_CLK_CPU_AHB_SLOW(x) (x << 3)
+#define SCU_CLK_CPU_AHB_SLOW_MASK (0x3 << 3)
+#define SCU_GET_AHB_DIV(x) ((x >> 3) & 0x3)
+#define SCU_CLK_CPU_AHB_SLOW_IDLE (0x1 << 1)
+#define SCU_CLK_CPU_AHB_DYN_SLOW_EN (0x1)
+#else
+#define SCU_CLK_VIDEO_SLOW_EN (0x1 << 31)
+#define SCU_CLK_VIDEO_SLOW_SET(x) (x << 28)
+#define SCU_CLK_VIDEO_SLOW_MASK (0x7 << 28)
+#define SCU_CLK_2D_ENG_GCLK_INVERT (0x1 << 27) //valid only at CRT mode SCU2C[7]
+#define SCU_CLK_2D_ENG_THROT_EN (0x1 << 26) //valid only at CRT mode SCU2C[7]
+#define SCU_PCLK_APB_DIV(x) (x << 23)
+#define SCU_GET_PCLK_DIV(x) ((x >> 23) & 0x7)
+#define SCU_PCLK_APB_DIV_MASK (0x7 << 23) //limitation on PCLK .. PCLK > 0.5*LCLK (33Mhz)
+#define SCU_GET_LHCLK_DIV(x) ((x >> 20) & 0x7)
+#define SCU_SET_LHCLK_DIV(x) (x << 20)
+#define SCU_LHCLK_DIV_MASK (0x7 << 20)
+#define SCU_LHCLK_SOURCE_EN (0x1 << 19) //0: ext , 1:internel
+#define SCU_CLK_MAC_DIV(x) (x << 16)
+#define SCU_CLK_MAC_MASK (0x7 << 16)
+#define SCU_CLK_SD_EN (0x1 << 15)
+#define SCU_CLK_SD_DIV(x) (x << 12)
+#define SCU_CLK_SD_GET_DIV(x) ((x >> 12) & 0x7)
+#define SCU_CLK_SD_MASK (0x7 << 12)
+#define SCU_CLK_VIDEO_DELAY(x) (x << 8)
+#define SCU_CLK_VIDEO_DELAY_MASK (0xf << 8)
+#define SCU_CLK_CPU_AHB_SLOW_EN (0x1 << 7)
+#define SCU_CLK_CPU_AHB_SLOW(x) (x << 4)
+#define SCU_CLK_CPU_AHB_SLOW_MASK (0x7 << 4)
+#define SCU_GET_AHB_DIV(x) ((x >> 4) & 0x7)
+#define SCU_ECLK_SOURCE(x) (x << 2)
+#define SCU_ECLK_SOURCE_MASK (0x3 << 2)
+#define SCU_CLK_CPU_AHB_SLOW_IDLE (0x1 << 1)
+#define SCU_CLK_CPU_AHB_DYN_SLOW_EN (0x1 << 0)
+
+#endif
+
+/* AST_SCU_CLK_STOP : 0x0C - clock stop control register */
+#if defined(CONFIG_ARCH_AST1010)
+#define SCU_LHCLK_STOP_EN (0x1 << 7)
+#define SCU_MAC0CLK_STOP_EN (0x1 << 6)
+#define SCU_UART3_CLK_STOP_EN (0x1 << 5)
+#define SCU_UART2_CLK_STOP_EN (0x1 << 4)
+#define SCU_UART1_CLK_STOP_EN (0x1 << 3)
+#define SCU_LCLK_STOP_EN (0x1 << 2)
+#define SCU_REFCLK_STOP_EN (0x1 << 1)
+#define SCU_MCLK_STOP_EN (0x1)
+#else
+#define SCU_LHCLK_STOP_EN (0x1 << 28)
+#define SCU_SDCLK_STOP_EN (0x1 << 27)
+#define SCU_UART4CLK_STOP_EN (0x1 << 26)
+#define SCU_UART3CLK_STOP_EN (0x1 << 25)
+#define SCU_RSACLK_STOP_EN (0x1 << 24)
+//bit 22~23 must keep 1
+#define SCU_MAC1CLK_STOP_EN (0x1 << 21)
+#define SCU_MAC0CLK_STOP_EN (0x1 << 20)
+//bit 18~19 must keep 1
+#define SCU_UART5_CLK_STOP_EN (0x1 << 17)
+#define SCU_UART2_CLK_STOP_EN (0x1 << 16)
+#define SCU_UART1_CLK_STOP_EN (0x1 << 15)
+#define SCU_USB20_CLK_EN (0x1 << 14)
+#define SCU_YCLK_STOP_EN (0x1 << 13)
+#define SCU_D2CLK_STOP_EN (0x1 << 10)
+#define SCU_USB11CLK_STOP_EN (0x1 << 9)
+#define SCU_LCLK_STOP_EN (0x1 << 8)
+#define SCU_UCLK_STOP_EN (0x1 << 7)
+#define SCU_REFCLK_STOP_EN (0x1 << 6)
+#define SCU_DCLK_STOP_EN (0x1 << 5)
+#define SCU_SACLK_STOP_EN (0x1 << 4)
+#define SCU_VCLK_STOP_EN (0x1 << 3)
+#define SCU_MCLK_STOP_EN (0x1 << 2)
+#define SCU_GCLK_STOP_EN (0x1 << 1)
+#define SCU_ECLK_STOP_EN (0x1 << 0)
+#endif
+
+/* AST_SCU_COUNT_CTRL : 0x10 - frequency counter control register */
+#define SCU_FREQ_COMP_RESULT (0x1 << 7)
+#define SCU_FREQ_MEASU_FINISH (0x1 << 6)
+#define SCU_FREQ_SOURCE_FOR_MEASU(x) (x << 2)
+#define SCU_FREQ_SOURCE_FOR_MEASU_MASK (0xf << 2)
+
+#define SCU_SOURCE_6M 0xf
+#define SCU_SOURCE_12M 0xe
+#define SCU_SOURCE_I2SM_CLK 0xd
+#define SCU_SOURCE_H_CLK 0xc
+#define SCU_SOURCE_B_CLK 0xb
+#define SCU_SOURCE_D2_PLL 0xa
+
+#define SCU_SOURCE_VIDEO_CLK 0x7
+#define SCU_SOURCE_LPC_CLK 0x6
+#define SCU_SOURCE_I2S_CLK 0x5
+#define SCU_SOURCE_M_CLK 0x4
+#define SCU_SOURCE_SALI_CLK 0x3
+#define SCU_SOURCE_D_PLL 0x2
+#define SCU_SOURCE_NAND 0x1
+#define SCU_SOURCE_DEL_CELL 0x0
+
+#define SCU_OSC_COUNT_EN (0x1 << 1)
+#define SCU_RING_OSC_EN (0x1 << 0)
+
+
+/* AST_SCU_INTR_CTRL : 0x18 - Interrupt control and status register */
+#define INTR_LPC_H_L_RESET (0x1 << 21)
+#define INTR_LPC_L_H_RESET (0x1 << 20)
+#define INTR_PCIE_H_L_RESET (0x1 << 19)
+#define INTR_PCIE_L_H_RESET (0x1 << 18)
+#define INTR_VGA_SCRATCH_CHANGE (0x1 << 17)
+#define INTR_VGA_CURSOR_CHANGE (0x1 << 16)
+#define INTR_MSI_EN (0x1 << 6)
+#define INTR_LPC_H_L_RESET_EN (0x1 << 5)
+#define INTR_LPC_L_H_RESET_EN (0x1 << 4)
+#define INTR_PCIE_H_L_RESET_EN (0x1 << 3)
+#define INTR_PCIE_L_H_RESET_EN (0x1 << 2)
+#define INTR_VGA_SCRATCH_CHANGE_EN (0x1 << 1)
+#define INTR_VGA_CURSOR_CHANGE_EN (0x1 << 0)
+
+/* AST_SCU_D2_PLL: 0x1C - D2-PLL Parameter register */
+#define SCU_D2_PLL_SET_PD2(x) (x << 19)
+#define SCU_D2_PLL_GET_PD2(x) ((x >> 19)&0x7)
+#define SCU_D2_PLL_PD2_MASK (0x7 << 19)
+#define SCU_D2_PLL_BYPASS_EN (0x1 << 18)
+#define SCU_D2_PLL_OFF (0x1 << 17)
+#define SCU_D2_PLL_SET_PD(x) (x << 15)
+#define SCU_D2_PLL_GET_PD(x) ((x >> 15) &0x3)
+#define SCU_D2_PLL_PD_MASK (0x3 << 15)
+#define SCU_D2_PLL_SET_OD(x) (x << 13)
+#define SCU_D2_PLL_GET_OD(x) ((x >> 13) & 0x3)
+#define SCU_D2_PLL_OD_MASK (0x3 << 13)
+#define SCU_D2_PLL_SET_DENUM(x) (x << 8)
+#define SCU_D2_PLL_GET_DENUM(x) ((x >>8)&0x1f)
+#define SCU_D2_PLL_DENUM_MASK (0x1f << 8)
+#define SCU_D2_PLL_SET_NUM(x) (x)
+#define SCU_D2_PLL_GET_NUM(x) (x & 0xff)
+#define SCU_D2_PLL_NUM_MASK (0xff)
+
+
+/* AST_SCU_M_PLL : 0x20 - M-PLL Parameter register */
+#define SCU_M_PLL_BYPASS_EN (0x1 << 17)
+#define SCU_M_PLL_OFF (0x1 << 16)
+#define SCU_M_PLL_NUM(x) (x << 5)
+#define SCU_M_PLL_GET_NUM(x) ((x >> 5) & 0x3f)
+#define SCU_M_PLL_NUM_MASK (0x3f << 5)
+#define SCU_M_PLL_OUT_DIV (0x1 << 4)
+#define SCU_M_PLL_GET_DIV(x) ((x >> 4) & 0x1)
+#define SCU_M_PLL_DENUM(x) (x)
+#define SCU_M_PLL_GET_DENUM(x) (x & 0xf)
+
+
+/* AST_SCU_H_PLL: 0x24- H-PLL Parameter register */
+#if defined(CONFIG_ARCH_AST1010)
+#define SCU_H_PLL_MASK_EN (0x1 << 10)
+#define SCU_H_PLL_REST_EN (0x1 << 9)
+#define SCU_H_PLL_OUT_DIV(x) (x << 7)
+#define SCU_H_PLL_GET_DIV(x) ((x >> 7) & 0x3)
+#define SCU_H_PLL_GET_DENUM(x) ((x >> 6) & 0x1)
+#define SCU_H_PLL_NUM(x) (x)
+#define SCU_H_PLL_GET_NUM(x) (x & 0x3f)
+#define SCU_H_PLL_NUM_MASK (0x3f)
+
+#else
+#define SCU_H_PLL_PARAMETER (0x1 << 18)
+#define SCU_H_PLL_BYPASS_EN (0x1 << 17)
+#define SCU_H_PLL_OFF (0x1 << 16)
+#define SCU_H_PLL_NUM(x) (x << 5)
+#define SCU_H_PLL_GET_NUM(x) ((x >> 5) & 0x3f)
+#define SCU_H_PLL_NUM_MASK (0x3f << 5)
+#define SCU_H_PLL_OUT_DIV (0x1 << 4)
+#define SCU_H_PLL_GET_DIV(x) ((x >> 4) & 0x1)
+#define SCU_H_PLL_DENUM(x) (x)
+#define SCU_H_PLL_GET_DENUM(x) (x & 0xf)
+#define SCU_H_PLL_DENUM_MASK (0xf)
+#endif
+
+/* AST_SCU_FREQ_LIMIT : 0x28 - frequency counter comparsion register */
+#define SCU_FREQ_U_LIMIT(x) (x << 16)
+#define SCU_FREQ_U_LIMIT_MASK (0x3fff << 16)
+#define SCU_FREQ_L_LIMIT(x) (x)
+#define SCU_FREQ_L_LIMIT_MASK (0x3fff)
+
+
+/* AST_SCU_MISC_CTRL : 0x2C - Misc. Control register */
+#define SCU_MISC_JTAG_MASTER_DIS (0x1 << 26)
+#define SCU_MISC_DRAM_W_P2A_DIS (0x1 << 25)
+#define SCU_MISC_SPI_W_P2A_DIS (0x1 << 24)
+#define SCU_MISC_SOC_W_P2A_DIS (0x1 << 23)
+#define SCU_MISC_FLASH_W_P2A_DIS (0x1 << 22)
+#define SCU_MISC_D_PLL_ASSIGN(x) (x << 20)
+#define SCU_MISC_D_PLL_ASSIGN_MASK (0x3 << 20)
+#define SCU_MISC_VGA_CONFIG_PREFETCH (0x1 << 19)
+#define SCU_MISC_DVO_SOURCE_CRT (0x1 << 18) //0:VGA , 1:CRT
+#define SCU_MISC_DAC_MASK (0x3 << 16)
+#define SCU_MISC_DAC_SOURCE_CRT (0x1 << 16) //00 VGA, 01: CRT, 1x: PASS-Through DVO
+#define SCU_MISC_DAC_SOURCE_MASK (0x3 << 16)
+#define SCU_MISC_JTAG_TO_PCIE_EN (0x1 << 15)
+#define SCU_MISC_JTAG__M_TO_PCIE_EN (0x1 << 14)
+#define SCU_MISC_VUART_TO_CTRL (0x1 << 13)
+#define SCU_MISC_DIV13_EN (0x1 << 12)
+#define SCU_MISC_Y_CLK_INVERT (0x1 << 11)
+#define SCU_MISC_OUT_DELAY (0x1 << 9)
+#define SCU_MISC_PCI_TO_AHB_DIS (0x1 << 8)
+#define SCU_MISC_2D_CRT_EN (0x1 << 7)
+#define SCU_MISC_VGA_CRT_DIS (0x1 << 6)
+#define SCU_MISC_VGA_REG_ACCESS_EN (0x1 << 5)
+#define SCU_MISC_D2_PLL_DIS (0x1 << 4)
+#define SCU_MISC_DAC_DIS (0x1 << 3)
+#define SCU_MISC_D_PLL_DIS (0x1 << 2)
+#define SCU_MISC_OSC_CLK_OUT_PIN (0x1 << 1)
+#define SCU_MISC_LPC_TO_SPI_DIS (0x1 << 0)
+
+/* AST_SCU_PCI_CONF1 : 0x30 - PCI configuration setting register#1 */
+#define SCU_PCI_DEVICE_ID(x) (x << 16)
+#define SCU_PCI_VENDOR_ID(x) (x)
+
+/* AST_SCU_PCI_CONF2 0x34 PCI configuration setting register#2 */
+#define SCU_PCI_SUB_SYS_ID(x) (x << 16)
+#define SCU_PCI_SUB_VENDOR_ID(x) (x)
+
+/* AST_SCU_PCI_CONF3 0x38 PCI configuration setting register#3 */
+#define SCU_PCI_CLASS_CODE(x) (x << 8)
+#define SCU_PCI_REVISION_ID(x) (x)
+
+/* AST_SCU_SYS_CTRL 0x3C System reset contrl/status register*/
+#define SCU_SYS_EXT_SOC_RESET_EN (0x1 << 3)
+#define SCU_SYS_EXT_RESET_FLAG (0x1 << 2)
+#define SCU_SYS_WDT_RESET_FLAG (0x1 << 1)
+#define SCU_SYS_PWR_RESET_FLAG (0x1 << 0)
+
+/* AST_SCU_SOC_SCRATCH0 0x40 SOC scratch 0~31 register */
+
+
+
+
+/* AST_SCU_SOC_SCRATCH1 0x44 SOC scratch 32~63 register */
+
+
+/* AST_SCU_VGA0 0x40 VGA fuction handshake register */
+#define SCU_VGA_SLT_HANDSHAKE(x) (x << 24)
+#define SCU_VGA_SLT_HANDSHAKE_MASK (0xff << 24)
+#define SCU_VGA_CTM_DEF(x) (x << 16)
+#define SCU_VGA_CTM_DEF_MASK (0xff << 16)
+#define SCU_MAC0_PHY_MODE(x) (x << 14)
+#define SCU_MAC0_GET_PHY_MODE(x) ((x >> 14) & 0x3)
+#define SCU_MAC0_PHY_MODE_MASK(x) (0x3 << 14)
+#define SCU_MAC1_PHY_MODE(x) (x << 12)
+#define SCU_MAC1_PHY_MODE_MASK (0x3 << 12)
+#define SCU_MAC1_GET_PHY_MODE(x) ((x >> 12) & 0x3)
+
+#define SCU_VGA_ASPEED_DEF(x) (x << 8)
+#define SCU_VGA_ASPEED_DEF_MASK (0xf << 8)
+
+#define SCU_VGA_DRAM_INIT_MASK(x) ((x >> 7) & 0x1)
+
+/* AST_SCU_VGA1 0x44 VGA fuction handshake register */
+
+
+/* AST_SCU_MAC_CLK 0x48 MAC interface clock delay setting register */
+
+
+
+/* AST_SCU_MISC_CTRL 0x4C Misc. 2 Control register */
+/* AST_SCU_VGA_SCRATCH0 0x50 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH1 0x54 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH2 0x58 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH3 0x5c VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH4 0x60 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH5 0x64 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH6 0x68 VGA Scratch register */
+/* AST_SCU_VGA_SCRATCH7 0x6c VGA Scratch register */
+
+/* AST_SCU_HW_STRAP1 0x70 hardware strapping register */
+#define SCU_HW_STRAP_SW_DEFINE(x) (x << 29)
+#define SCU_HW_STRAP_SW_DEFINE_MASK (0x3 << 29)
+#define SCU_HW_STRAP_DRAM_SIZE (x << 29)
+#define SCU_HW_STRAP_DRAM_SIZE_MASK (0x3 << 29)
+
+#define VGA_64M_DRAM 0
+#define VGA_128M_DRAM 1
+#define VGA_256M_DRAM 2
+#define VGA_512M_DRAM 3
+
+#define SCU_HW_STRAP_DRAM_CONFIG (x << 24)
+#define SCU_HW_STRAP_DRAM_CONFIG_MASK (0x7 << 24)
+
+#define SCU_HW_STRAP_GPIOE_PT_EN (0x1 << 22)
+#define SCU_HW_STRAP_GPIOD_PT_EN (0x1 << 21)
+#define SCU_HW_STRAP_LPC_DEC_SUPER_IO (0x1 << 20)
+#define SCU_HW_STRAP_ACPI_DIS (0x1 << 19)
+
+//bit 23, 18 [1,0]
+#define SCU_HW_STRAP_SET_CLK_SOURCE(x) ((((x&0x3) >> 1)<<23)||((x&0x1) << 18))
+#define SCU_HW_STRAP_GET_CLK_SOURCE(x) (((x>>23)&0x1<<1) | ((x>>18)&0x1))
+#define SCU_HW_STRAP_CLK_SOURCE_MASK ((0x1 << 23) | (0x1 << 18))
+
+#define CLK_25M_IN (0x1 << 23)
+#define CLK_24M_IN 0
+#define CLK_48M_IN 1
+#define CLK_25M_IN_24M_USB_CKI 3
+#define CLK_25M_IN_48M_USB_CKI 3
+
+#define SCU_HW_STRAP_2ND_BOOT_WDT (0x1 << 17)
+#define SCU_HW_STRAP_SUPER_IO_CONFIG (0x1 << 16)
+#define SCU_HW_STRAP_VGA_CLASS_CODE (0x1 << 15)
+#define SCU_HW_STRAP_LPC_RESET_PIN (0x1 << 14)
+#define SCU_HW_STRAP_SPI_MODE(x) (x << 12)
+#define SCU_HW_STRAP_SPI_MODE_MASK (0x3 << 12)
+#define SPI_MODE_DIS (0)
+#define SPI_MODE_MASTER_EN (1)
+#define SPI_MODE_M_S_EN (2)
+#define SPI_MODE_PS (3)
+
+#define SCU_HW_STRAP_SET_CPU_AHB_RATIO(x) (x << 10)
+#define SCU_HW_STRAP_GET_CPU_AHB_RATIO(x) ((x >> 10) & 3)
+#define SCU_HW_STRAP_CPU_AHB_RATIO_MASK (0x3 << 10)
+
+
+#define CPU_AHB_RATIO_1_1 0
+#define CPU_AHB_RATIO_2_1 1
+#define CPU_AHB_RATIO_4_1 2
+#define CPU_AHB_RATIO_3_1 3
+
+#define SCU_HW_STRAP_GET_H_PLL_CLK(x) ((x >> 8 )& 0x3)
+#define SCU_HW_STRAP_H_PLL_CLK_MASK (0x3 << 8)
+#define CPU_384MHZ 0
+#define CPU_360MHZ 1
+#define CPU_336MHZ 2
+#define CPU_408MHZ 3
+
+#define SCU_HW_STRAP_MAC1_RGMII (0x1 << 7)
+#define SCU_HW_STRAP_MAC0_RGMII (0x1 << 6)
+#define SCU_HW_STRAP_VGA_BIOS_ROM (0x1 << 5)
+#define SCU_HW_STRAP_SPI_WIDTH (0x1 << 4)
+#define SCU_HW_STRAP_VGA_SIZE_GET(x) ((x >> 2)& 0x3)
+
+#define SCU_HW_STRAP_BOOT_MODE(x) (x)
+#define NOR_BOOT 0
+#define NAND_BOOT 1
+#define SPI_BOOT 2
+#define DIS_BOOT 3
+
+/* AST_SCU_RAMDOM_GEN 0x74 random number generator register */
+/* AST_SCU_RAMDOM_DATA 0x78 random number generator data output*/
+
+/* AST_SCU_MULTI_FUNC_2 0x78 */
+
+#define MULTI_FUNC_VIDEO_RGB18 (0x1 << 2)
+#define MULTI_FUNC_VIDEO_SINGLE_EDGE (0x1 << 0)
+
+
+
+/* AST_SCU_REVISION_ID 0x7C Silicon revision ID register */
+#define AST1100_A0 0x00000200
+#define AST1100_A1 0x00000201
+#define AST1100_A2 0x00000202
+#define AST1100_A3 0x00000202
+
+#define AST2050_A0 0x00000200
+#define AST2050_A1 0x00000201
+#define AST2050_A2 0x00000202
+#define AST2050_A3 0x00000202
+
+#define AST2100_A0 0x00000300
+#define AST2100_A1 0x00000301
+#define AST2100_A2 0x00000302
+#define AST2100_A3 0x00000302
+
+#define AST2200_A0 0x00000102
+#define AST2200_A1 0x00000102
+
+#define AST2300_A0 0x01000003
+#define AST2300_A1 0x01010303
+#define AST1300_A1 0x01010003
+#define AST1050_A1 0x01010203
+
+#define AST2400_A0 0x02000303
+
+
+/* AST_SCU_FUN_PIN_CTRL1 0x80 Multi-function Pin Control#1*/
+#define SCU_FUN_PIN_UART4_RXD (0x1 << 31)
+#define SCU_FUN_PIN_UART4_TXD (0x1 << 30)
+#define SCU_FUN_PIN_UART4_NRTS (0x1 << 29)
+#define SCU_FUN_PIN_UART4_NDTR (0x1 << 28)
+#define SCU_FUN_PIN_UART4_NRI (0x1 << 27)
+#define SCU_FUN_PIN_UART4_NDSR (0x1 << 26)
+#define SCU_FUN_PIN_UART4_NDCD (0x1 << 25)
+#define SCU_FUN_PIN_UART4_NCTS (0x1 << 24)
+#define SCU_FUN_PIN_UART3_RXD (0x1 << 23)
+#define SCU_FUN_PIN_UART3_TXD (0x1 << 22)
+#define SCU_FUN_PIN_UART3_NRTS (0x1 << 21)
+#define SCU_FUN_PIN_UART3_NDTR (0x1 << 20)
+#define SCU_FUN_PIN_UART3_NRI (0x1 << 19)
+#define SCU_FUN_PIN_UART3_NDSR (0x1 << 18)
+#define SCU_FUN_PIN_UART3_NDCD (0x1 << 17)
+#define SCU_FUN_PIN_UART3_NCTS (0x1 << 16)
+
+
+
+
+#define SCU_FUN_PIN_MAC1_PHY_LINK (0x1 << 1)
+#define SCU_FUN_PIN_MAC0_PHY_LINK (0x1)
+
+
+/* AST_SCU_FUN_PIN_CTRL2 0x84 Multi-function Pin Control#2*/
+#define SCU_FUN_PIN_VPIB9 (0x1 << 31)
+#define SCU_FUN_PIN_VPIB8 (0x1 << 30)
+#define SCU_FUN_PIN_VPIB7 (0x1 << 29)
+#define SCU_FUN_PIN_VPIB6 (0x1 << 28)
+#define SCU_FUN_PIN_VPIB5 (0x1 << 27)
+#define SCU_FUN_PIN_VPIB4 (0x1 << 26)
+#define SCU_FUN_PIN_VPIB3 (0x1 << 25)
+#define SCU_FUN_PIN_VPIB2 (0x1 << 24)
+#define SCU_FUN_PIN_VPIB1 (0x1 << 23)
+#define SCU_FUN_PIN_VPIB0 (0x1 << 22)
+#define SCU_FUN_PIN_VPICLK (0x1 << 21)
+#define SCU_FUN_PIN_VPIVS (0x1 << 20)
+#define SCU_FUN_PIN_VPIHS (0x1 << 19)
+#define SCU_FUN_PIN_VPIODD (0x1 << 18)
+#define SCU_FUN_PIN_VPIDE (0x1 << 17)
+
+#define SCU_FUN_PIN_UART2_RXD (0x1 << 31)
+#define SCU_FUN_PIN_UART2_TXD (0x1 << 30)
+#define SCU_FUN_PIN_UART2_NRTS (0x1 << 29)
+#define SCU_FUN_PIN_UART2_NDTR (0x1 << 28)
+#define SCU_FUN_PIN_UART2_NRI (0x1 << 27)
+#define SCU_FUN_PIN_UART2_NDSR (0x1 << 26)
+#define SCU_FUN_PIN_UART2_NDCD (0x1 << 25)
+#define SCU_FUN_PIN_UART2_NCTS (0x1 << 24)
+#define SCU_FUN_PIN_UART1_RXD (0x1 << 23)
+#define SCU_FUN_PIN_UART1_TXD (0x1 << 22)
+#define SCU_FUN_PIN_UART1_NRTS (0x1 << 21)
+#define SCU_FUN_PIN_UART1_NDTR (0x1 << 20)
+#define SCU_FUN_PIN_UART1_NRI (0x1 << 19)
+#define SCU_FUN_PIN_UART1_NDSR (0x1 << 18)
+#define SCU_FUN_PIN_UART1_NDCD (0x1 << 17)
+#define SCU_FUN_PIN_UART1_NCTS (0x1 << 16)
+
+
+#define SCU_FUN_PIN_NAND_FLWP (0x1 << 7)
+#define SCU_FUN_PIN_NAND_FLBUSY (0x1 << 6)
+
+/* AST_SCU_FUN_PIN_CTRL3 0x88 Multi-function Pin Control#3*/
+#if defined(CONFIG_ARCH_AST1010)
+#define SCU_FUN_PIN_MAC0_MDIO (0x1 << 23)
+#define SCU_FUN_PIN_MAC0_MDC (0x1 << 22)
+#else
+#define SCU_FUN_PIN_MAC0_MDIO (0x1 << 31)
+#define SCU_FUN_PIN_MAC0_MDC (0x1 << 30)
+#define SCU_FUN_PIN_ROMA25 (0x1 << 29)
+#define SCU_FUN_PIN_ROMA24 (0x1 << 28)
+#define SCU_FUN_PIN_ROMCS4 (0x1 << 27)
+#define SCU_FUN_PIN_ROMCS3 (0x1 << 26)
+#define SCU_FUN_PIN_ROMCS2 (0x1 << 25)
+#define SCU_FUN_PIN_ROMCS1 (0x1 << 24)
+#define SCU_FUN_PIN_ROMCS(x) (0x1 << (23+x))
+
+//Video pin
+#define SCU_FUN_PIN_VPIR9 (0x1 << 19)
+#define SCU_FUN_PIN_VPIR8 (0x1 << 18)
+#define SCU_FUN_PIN_VPIR7 (0x1 << 17)
+#define SCU_FUN_PIN_VPIR6 (0x1 << 16)
+#define SCU_FUN_PIN_VPIR5 (0x1 << 15)
+#define SCU_FUN_PIN_VPIR4 (0x1 << 14)
+#define SCU_FUN_PIN_VPIR3 (0x1 << 13)
+#define SCU_FUN_PIN_VPIR2 (0x1 << 12)
+#define SCU_FUN_PIN_VPIR1 (0x1 << 11)
+#define SCU_FUN_PIN_VPIR0 (0x1 << 10)
+#define SCU_FUN_PIN_VPIG9 (0x1 << 9)
+#define SCU_FUN_PIN_VPIG8 (0x1 << 8)
+#define SCU_FUN_PIN_VPIG7 (0x1 << 7)
+#define SCU_FUN_PIN_VPIG6 (0x1 << 6)
+#define SCU_FUN_PIN_VPIG5 (0x1 << 5)
+#define SCU_FUN_PIN_VPIG4 (0x1 << 4)
+#define SCU_FUN_PIN_VPIG3 (0x1 << 3)
+#define SCU_FUN_PIN_VPIG2 (0x1 << 2)
+#define SCU_FUN_PIN_VPIG1 (0x1 << 1)
+#define SCU_FUN_PIN_VPIG0 (0x1 << 0)
+#endif
+
+
+//pwm pin
+#define SCU_FUN_PIN_PWM_TACHO (0)
+/* AST_SCU_FUN_PIN_CTRL4 0x8C Multi-function Pin Control#4*/
+#define SCU_FUN_PIN_ROMA23 (0x1 << 7)
+#define SCU_FUN_PIN_ROMA22 (0x1 << 6)
+
+#define SCU_FUN_PIN_ROMWE (0x1 << 5)
+#define SCU_FUN_PIN_ROMOE (0x1 << 4)
+#define SCU_FUN_PIN_ROMD7 (0x1 << 3)
+#define SCU_FUN_PIN_ROMD6 (0x1 << 2)
+#define SCU_FUN_PIN_ROMD5 (0x1 << 1)
+#define SCU_FUN_PIN_ROMD4 (0x1)
+
+/* AST_SCU_FUN_PIN_CTRL5 0x90 Multi-function Pin Control#5*/
+#define SCU_FUN_PIN_SPICS1 (0x1 << 31)
+#define SCU_FUN_PIN_LPC_PLUS (0x1 << 30)
+#define SCU_FUC_PIN_USB20_HOST (0x1 << 29)
+#define SCU_FUC_PIN_USB11_PORT4 (0x1 << 28)
+#define SCU_FUC_PIN_I2C14 (0x1 << 27)
+#define SCU_FUC_PIN_I2C13 (0x1 << 26)
+#define SCU_FUC_PIN_I2C12 (0x1 << 25)
+#define SCU_FUC_PIN_I2C11 (0x1 << 24)
+#define SCU_FUC_PIN_I2C10 (0x1 << 23)
+#define SCU_FUC_PIN_I2C9 (0x1 << 22)
+#define SCU_FUC_PIN_I2C8 (0x1 << 21)
+#define SCU_FUC_PIN_I2C7 (0x1 << 20)
+#define SCU_FUC_PIN_I2C6 (0x1 << 19)
+#define SCU_FUC_PIN_I2C5 (0x1 << 18)
+#define SCU_FUC_PIN_I2C4 (0x1 << 17)
+#define SCU_FUC_PIN_I2C3 (0x1 << 16)
+#define SCU_FUC_PIN_MII2_RX_DWN_DIS (0x1 << 15)
+#define SCU_FUC_PIN_MII2_TX_DWN_DIS (0x1 << 14)
+#define SCU_FUC_PIN_MII1_RX_DWN_DIS (0x1 << 13)
+#define SCU_FUC_PIN_MII1_TX_DWN_DIS (0x1 << 12)
+
+#define SCU_FUC_PIN_MII2_TX_DRIV(x) (x << 10)
+#define SCU_FUC_PIN_MII2_TX_DRIV_MASK (0x3 << 10)
+#define SCU_FUC_PIN_MII1_TX_DRIV(x) (x << 8)
+#define SCU_FUC_PIN_MII1_TX_DRIV_MASK (0x3 << 8)
+
+#define MII_NORMAL_DRIV 0x0
+#define MII_HIGH_DRIV 0x2
+
+#define SCU_FUC_PIN_UART6 (0x1 << 7)
+#define SCU_FUC_PIN_ROM_16BIT (0x1 << 6)
+#define SCU_FUC_PIN_DIGI_V_OUT(x) (x << 4)
+#define SCU_FUC_PIN_DIGI_V_OUT_MASK (0x3 << 4)
+
+#define VIDEO_DISABLE 0x0
+#define VIDEO_12BITS 0x1
+#define VIDEO_24BITS 0x2
+//#define VIDEO_DISABLE 0x3
+
+#define SCU_FUC_PIN_USB11_PORT2 (0x1 << 3)
+#define SCU_FUC_PIN_MAC1_MDIO (0x1 << 2)
+#define SCU_FUC_PIN_SD2 (0x1 << 1)
+#define SCU_FUC_PIN_SD1 (0x1 << 0)
+
+
+/* AST_SCU_FUN_PIN_CTRL6 0x94 Multi-function Pin Control#6*/
+#define SCU_VIDEO_OUT_MASK (~0x3)
+
+/* AST_SCU_WDT_RESET 0x9C Watchdog Reset Selection */
+/* AST_SCU_FUN_PIN_CTRL7 0xA0 Multi-function Pin Control#7*/
+/* AST_SCU_FUN_PIN_CTRL8 0xA4 Multi-function Pin Control#8*/
+#define SCU_FUN_PIN_ROMA17 (0x1 << 31)
+#define SCU_FUN_PIN_ROMA16 (0x1 << 30)
+#define SCU_FUN_PIN_ROMA15 (0x1 << 29)
+#define SCU_FUN_PIN_ROMA14 (0x1 << 28)
+#define SCU_FUN_PIN_ROMA13 (0x1 << 27)
+#define SCU_FUN_PIN_ROMA12 (0x1 << 26)
+#define SCU_FUN_PIN_ROMA11 (0x1 << 25)
+#define SCU_FUN_PIN_ROMA10 (0x1 << 24)
+#define SCU_FUN_PIN_ROMA9 (0x1 << 23)
+#define SCU_FUN_PIN_ROMA8 (0x1 << 22)
+#define SCU_FUN_PIN_ROMA7 (0x1 << 21)
+#define SCU_FUN_PIN_ROMA6 (0x1 << 20)
+#define SCU_FUN_PIN_ROMA5 (0x1 << 19)
+#define SCU_FUN_PIN_ROMA4 (0x1 << 18)
+#define SCU_FUN_PIN_ROMA3 (0x1 << 17)
+#define SCU_FUN_PIN_ROMA2 (0x1 << 16)
+
+/* AST_SCU_FUN_PIN_CTRL9 0xA8 Multi-function Pin Control#9*/
+#define SCU_FUN_PIN_ROMA21 (0x1 << 3)
+#define SCU_FUN_PIN_ROMA20 (0x1 << 2)
+#define SCU_FUN_PIN_ROMA19 (0x1 << 1)
+#define SCU_FUN_PIN_ROMA18 (0x1)
+
+/* AST_SCU_PWR_SAVING_EN 0xC0 Power Saving Wakeup Enable*/
+/* AST_SCU_PWR_SAVING_CTRL 0xC4 Power Saving Wakeup Control*/
+/* AST_SCU_HW_STRAP2 0xD0 Haardware strapping register set 2*/
+/* AST_SCU_COUNTER4 0xE0 SCU Free Run Counter Read Back #4*/
+/* AST_SCU_COUNTER4_EXT 0xE4 SCU Free Run Counter Extended Read Back #4*/
+
+//CPU 2
+/* AST_SCU_CPU2_CTRL 0x100 CPU2 Control Register*/
+/* AST_SCU_CPU2_BASE0_ADDR 0x104 CPU2 Base Address for Segment 0x00:0000~0x1F:FFFF*/
+/* AST_SCU_CPU2_BASE1_ADDR 0x108 CPU2 Base Address for Segment 0x20:0000~0x3F:FFFF*/
+/* AST_SCU_CPU2_BASE2_ADDR 0x10C CPU2 Base Address for Segment 0x40:0000~0x5F:FFFF*/
+/* AST_SCU_CPU2_BASE3_ADDR 0x110 CPU2 Base Address for Segment 0x60:0000~0x7F:FFFF*/
+/* AST_SCU_CPU2_BASE4_ADDR 0x114 CPU2 Base Address for Segment 0x80:0000~0xFF:FFFF*/
+/* AST_SCU_CPU2_CACHE_CTRL 0x118 CPU2 Cache Function Control */
+
+//
+/* AST_SCU_UART24_REF 0x160 Generate UART 24Mhz Ref from H-PLL when CLKIN is 25Mhz */
+/* AST_SCU_PCIE_CONFIG_SET 0x180 PCI-E Configuration Setting Control Register */
+/* AST_SCU_BMC_MMIO_DEC 0x184 BMC MMIO Decode Setting Register */
+/* AST_SCU_DEC_AREA1 0x188 1st relocated controller decode area location */
+/* AST_SCU_DEC_AREA2 0x18C 2nd relocated controller decode area location */
+/* AST_SCU_MBOX_DEC_AREA 0x190 Mailbox decode area location*/
+/* AST_SCU_SRAM_DEC_AREA0 0x194 Shared SRAM area decode location*/
+/* AST_SCU_SRAM_DEC_AREA1 0x198 Shared SRAM area decode location*/
+/* AST_SCU_BMC_CLASS 0x19C BMC device class code and revision ID */
+/* AST_SCU_BMC_DEV_ID 0x1A4 BMC device ID */
+
+#endif
+
diff --git a/arch/arm/plat-aspeed/include/plat/regs-sdmc.h b/arch/arm/plat-aspeed/include/plat/regs-sdmc.h
new file mode 100644
index 000000000000..2bcc9488ca72
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-sdmc.h
@@ -0,0 +1,31 @@
+/* arch/arm/mach-aspeed/include/mach/regs-ast1010-scu.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2012/12/29 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __AST_SDMC_H
+#define __AST_SDMC_H 1
+
+/*
+ * Register for SDMC
+ * */
+#define AST_SDMC_PROTECT 0x00 /* protection key register */
+#define AST_SDMC_CONFIG 0x04 /* Configuration register */
+
+
+/* AST_SDMC_PROTECT: 0x00 - protection key register */
+#define SDMC_PROTECT_UNLOCK 0xFC600309
+
+/* AST_SDMC_CONFIG :0x04 - Configuration register */
+#define SDMC_CONFIG_MEM_GET(x) (x & 0x3)
+
+
+#endif
+
diff --git a/arch/arm/plat-aspeed/include/plat/regs-smc.h b/arch/arm/plat-aspeed/include/plat/regs-smc.h
new file mode 100644
index 000000000000..d4e02524c9d9
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-smc.h
@@ -0,0 +1,54 @@
+/* arch/arm/plat-aspeed/include/mach/regs-smc.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED Static memory ctrol
+*/
+
+#ifndef __ASM_ARCH_REGS_FMC_H
+#define __ASM_ARCH_REGS_FMC_H __FILE__
+
+#define FMC_CE_TYPE 0x00
+#define FMC_CE_CTRL 0x04
+#define FMC_INTR_CTRL 0x08
+#define FMC_CE0_CTRL 0x10
+#define FMC_CE1_CTRL 0x14
+#define FMC_CE2_CTRL 0x18
+#define FMC_CE3_CTRL 0x1c
+#define FMC_CE4_CTRL 0x20
+
+#define FMC_CE0_ADDR 0x30
+#define FMC_CE1_ADDR 0x34
+#define FMC_CE2_ADDR 0x38
+#define FMC_CE3_ADDR 0x3c
+#define FMC_CE4_ADDR 0x40
+
+#define FMC_MISC_CTRL1 0x50
+#define FMC_MISC_CTRL2 0x54
+#define FMC_NAND_CTRL 0x58
+#define FMC_NAND_ECC 0x5c
+#define FMC_NAND_ECC_CK1 0x60
+#define FMC_NAND_ECC_CK2 0x64
+#define FMC_NAND_ECC_CK3 0x68
+#define FMC_NAND_ECC_GEN1 0x6c
+#define FMC_NAND_ECC_GEN2 0x70
+#define FMC_NAND_ECC_GEN3 0x74
+#define FMC_NAND_ECC_CK_R1 0x78
+#define FMC_NAND_ECC_CK_R2 0x7c
+#define FMC_DMA_CTRL 0x80
+#define FMC_DMA_FLASH_ADDR 0x84
+#define FMC_DMA_DRAM_ADDR 0x88
+#define FMC_DMA_LEN 0x8C
+#define FMC_CHECK_SUM 0x90
+#define FMC_SPI_TIMING 0x94
+
+
+
+
+
+#endif /* __ASM_ARCH_REGS_FMC_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-spi.h b/arch/arm/plat-aspeed/include/plat/regs-spi.h
new file mode 100644
index 000000000000..9b20cf80e71e
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-spi.h
@@ -0,0 +1,51 @@
+/********************************************************************************
+* File Name : regs-spi.h
+*
+* Copyright (C) 2012-2020 ASPEED Technology Inc.
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by the Free Software Foundation;
+* either version 2 of the License, or (at your option) any later version.
+* 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.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+********************************************************************************/
+
+/* Register offsets */
+#define AST_SPI_CONFIG 0x00
+#define AST_SPI_CTRL 0x04
+#define AST_SPI_MISC 0x10
+#define AST_SPI_TIMING 0x14
+
+/* AST_SPI_CONFIG 0x00 : SPI Flash Configuration Register */
+#define SPI_CONF_CLKX2 (0x1 << 1)
+#define SPI_CONF_WRITE_EN (0x1)
+
+/* FMC_CE0_CTRL for SPI 0x10, 0x14, 0x18, 0x1c, 0x20 */
+#define SPI_IO_MODE(x) (x << 28)
+#define SPI_SINGLE_BIT 0
+#define SPI_DUAL_BIT_D 2
+#define SPI_DUAL_BIT_DA 3
+#define SPI_CE_WIDTH(x) (x << 24)
+#define SPI_CMD_DATA(x) (x << 16)
+#define SPI_DUMMY_CMD (1 << 15)
+#define SPI_DUMMY_HIGH (1 << 14)
+//#define SPI_CLK_DIV (1 << 13) ?? TODO ask....
+//#define SPI_ADDR_CYCLE (1 << 13) ?? TODO ask....
+#define SPI_CMD_MERGE_DIS (1 << 12)
+#define SPI_CLK_DIV(x) (x << 8)
+#define SPI_CLK_DIV_MASK (0xf << 8)
+
+#define SPI_DUMMY_LOW (x << 6)
+#define SPI_LSB_FIRST_CTRL (1 << 5)
+#define SPI_CPOL_1 (1 << 4)
+#define SPI_DUAL_DATA (1 << 3)
+#define SPI_CE_INACTIVE (1 << 2)
+#define SPI_CMD_MODE (x)
+#define SPI_CMD_NOR_R_MODE 0
+#define SPI_CMD_FAST_R_MODE 1
+#define SPI_CMD_NOR_W_MODE 2
+#define SPI_CMD_USER_MODE 3
+
diff --git a/arch/arm/plat-aspeed/include/plat/regs-uart-dma.h b/arch/arm/plat-aspeed/include/plat/regs-uart-dma.h
new file mode 100644
index 000000000000..2282bb184166
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-uart-dma.h
@@ -0,0 +1,79 @@
+/* arch/arm/mach-aspeed/include/mach/regs-uart-dma.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2013/05/15 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __AST1070_UART_DMA_H
+#define __AST1070_UART_DMA_H 1
+
+#define UART_DMA0_TX_CTRL 0x00
+#define UART_DMA0_TX_DESCPT 0x04
+#define UART_DMA1_TX_CTRL 0x08
+#define UART_DMA1_TX_DESCPT 0x0C
+#define UART_DMA2_TX_CTRL 0x10
+#define UART_DMA2_TX_DESCPT 0x14
+#define UART_DMA3_TX_CTRL 0x18
+#define UART_DMA3_TX_DESCPT 0x1C
+#define UART_DMA0_RX_CTRL 0x20
+#define UART_DMA0_RX_DESCPT 0x24
+#define UART_DMA1_RX_CTRL 0x28
+#define UART_DMA1_RX_DESCPT 0x2C
+#define UART_DMA2_RX_CTRL 0x30
+#define UART_DMA2_RX_DESCPT 0x34
+#define UART_DMA3_RX_CTRL 0x38
+#define UART_DMA3_RX_DESCPT 0x3C
+#define UART_DMA_CTRL 0x40
+#define UART_DMA_IER 0x44
+#define UART_DMA_ISR 0x48
+
+/* */
+#define DMA_TRIGGER (1 << 2)
+#define DMA_ENABLE (1 << 0)
+
+/* UART_DMA_CTRL 0x40 */
+#define SPI_CLK_MASK (0x1f << 16)
+#define SPI_CLK_SET(x) ((x) << 16)
+#define DMA_RX_TIMEOUT(x) ((x) << 4)
+#define DMA_BURST_LEN(x) ((x) << 2)
+#define DMA_BURST_MASK (0x3 << 2)
+#define BURST_1 0
+#define BURST_2 1
+#define BURST_4 2
+#define BURST_8 3
+#define RXDESC_AUTO_POLLING (1 << 1)
+#define TXDESC_AUTO_POLLING (1 << 0)
+
+/* UART_DMA_IER / UART_DMA_ISR 0x44 0x48 */
+
+#define UART_DMA3_RX_INT (1 << 7)
+#define UART_DMA2_RX_INT (1 << 6)
+#define UART_DMA1_RX_INT (1 << 5)
+#define UART_DMA0_RX_INT (1 << 4)
+#define UART_DMA3_TX_INT (1 << 3)
+#define UART_DMA2_TX_INT (1 << 2)
+#define UART_DMA1_TX_INT (1 << 1)
+#define UART_DMA0_TX_INT (1 << 0)
+
+
+/* UART DESC #0 Command Register */
+#define DESC0_INT_EN (1 << 9)
+#define DESC0_END (1 << 8)
+#define DESC0_HW_OWN (1 << 0)
+
+/* UART DESC #1 Base Address of Data */
+#define DESC1_LEN(x) ((x) << 16)
+#define DESC1_NEXT(x) (x)
+
+/* UART DESC #2 Base Address of Data */
+
+/* UART DESC #3 Descriptor Status Register */
+#define DESC3_TIMEOUT_STS (1 << 16)
+#define DESC3_GET_LEN(x) ((x) & 0xffff)
+#endif
diff --git a/arch/arm/plat-aspeed/include/plat/regs-udc11.h b/arch/arm/plat-aspeed/include/plat/regs-udc11.h
new file mode 100644
index 000000000000..3b74d63cab8e
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-udc11.h
@@ -0,0 +1,98 @@
+/* arch/arm/plat-aspeed/include/mach/regs-udc11.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED UDC11 Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_UDC11_H
+#define __ASM_ARCH_REGS_UDC11_H __FILE__
+
+#define AST_UDC11_CTRL 0x00 /* Function Control and Status Register */
+#define AST_UDC11_CONF 0x04 /* Function Configuration Setting Register */
+#define AST_UDC11_REST 0x08 /* Endpoint Toggle Bit Reset Register */
+#define AST_UDC11_STS 0x0C /* USB Status Register */
+#define AST_UDC11_IER 0x10 /* Interrupt Control Register */
+#define AST_UDC11_ISR 0x14 /* Interrupt Status Register */
+#define AST_UDC11_EP0_CTRL 0x18 /* Endpoint 0 Control and Status Register */
+#define AST_UDC11_EP1_CTRL 0x1C /* Endpoint 1 Control and Status Register */
+#define AST_UDC11_EP2_CTRL 0x20 /* Endpoint 2 Control and Status Register */
+#define AST_UDC11_EP0_SETUP0 0x24 /* Endpoint 0 Setup/OUT Data Buffer LOW Register */
+#define AST_UDC11_EP0_SETUP1 0x28 /* Endpoint 0 Setup/OUT Data Buffer HIGH Register */
+#define AST_UDC11_EP0_DATA0 0x2C /* Endpoint 0 IN DATA Buffer LOW Register */
+#define AST_UDC11_EP0_DATA1 0x30 /* Endpoint 0 IN DATA Buffer HIGH Register */
+#define AST_UDC11_EP1_DATA0 0x34 /* Endpoint 1 IN DATA Buffer LOW Register */
+#define AST_UDC11_EP1_DATA1 0x38 /* Endpoint 1 IN DATA Buffer HIGH Register */
+#define AST_UDC11_EP2_DATA0 0x3C /* Endpoint 2 IN DATA Buffer LOW Register */
+#define AST_UDC11_EP2_DATA1 0x40 /* Endpoint 2 IN DATA Buffer HIGH Register */
+
+/* AST_UDC11_CTRL 0x00 Function Control and Status Register */
+#define UDC11_CTRL_TEST_RESULT (1 << 10)
+#define UDC11_CTRL_TEST_STS (1 << 9)
+#define UDC11_CTRL_TEST_MODE(x) ((x) << 6)
+#define UDC11_CTRL_WKP(x) ((x) << 4)
+#define UDC11_CTRL_WKP_EN (1 << 3)
+#define UDC11_CTRL_CLK_STOP (1 << 2)
+#define UDC11_CTRL_LS_EN (1 << 1)
+#define UDC11_CTRL_CONNECT_EN (1)
+
+/* AST_UDC11_CONF 0x04 Function Configuration Setting Register */
+#define UDC11_CONF_ADDR_MASK (0x3f << 1)
+#define UDC11_CONF_SET_ADDR(x) (x << 1)
+#define UDC11_CONF_SET_CONF (1)
+
+/* AST_UDC11_REST 0x08 Endpoint Toggle Bit Reset Register */
+#define UDC11_REST_EP2 (1 << 1)
+#define UDC11_REST_EP1 (1)
+
+
+/* AST_UDC11_STS 0x0C USB Status Register */
+#define UDC11_STS_SUSPEND (1 << 31)
+#define UDC11_STS_BUS_RST (1 << 30)
+#define UDC11_STS_LINE_DP (1 << 29)
+#define UDC11_STS_LINE_DN (1 << 28)
+#define UDC11_STS_FRAM_NUM_MASK (0x7ff << 16)
+#define UDC11_STS_GET_FRAM_NUM(x) ((x >> 16) & 0x7ff)
+#define UDC11_STS_LAST_ADDR (0x7f << 4)
+#define UDC11_STS_LAST_EP (0xf)
+
+/* AST_UDC11_IER 0x10 Interrupt Control Register */
+/* AST_UDC11_ISR 0x14 Interrupt Status Register */
+#define UDC11_EP0_OUT (1 << 9)
+#define UDC11_EP0_NAK (1 << 8)
+#define UDC11_EP2_IN_ACK (1 << 7)
+#define UDC11_EP1_IN_ACK (1 << 6)
+#define UDC11_EP0_IN_ACK (1 << 5)
+#define UDC11_EP0_OUT_ACK (1 << 4)
+#define UDC11_EP0_SETUP (1 << 3)
+#define UDC11_SUSPEND_RESUME (1 << 2)
+#define UDC11_SUSPEND_ENTRY (1 << 1)
+#define UDC11_BUS_REST (1)
+
+/* AST_UDC11_EP0_CTRL 0x18 Endpoint 0 Control and Status Register */
+/* AST_UDC11_EP1_CTRL 0x1C Endpoint 1 Control and Status Register */
+/* AST_UDC11_EP2_CTRL 0x20 Endpoint 2 Control and Status Register */
+#define GET_EP_OUT_RX_LEN(x) ((x & 0xf) >> 8) //only for EP0
+#define GET_EP_IN_TX_LEN(x) ((x & 0xf) >> 4)
+#define SET_EP_IN_TX_LEN(x) ((x & 0xf) << 4)
+#define EP_OUT_BUFF_RX_RDY (1 << 2) //only for EP0
+#define EP_IN_BUFF_TX_RDY (1 << 1)
+#define EP_CTRL_STALL
+
+
+
+
+
+
+
+
+
+
+
+
+#endif /* __ASM_ARCH_REGS_UDC11_H */
diff --git a/arch/arm/plat-aspeed/include/plat/regs-video.h b/arch/arm/plat-aspeed/include/plat/regs-video.h
new file mode 100644
index 000000000000..ee990750f64f
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-video.h
@@ -0,0 +1,348 @@
+/* arch/arm/mach-aspeed/include/mach/regs-video.h
+ *
+ * Copyright (C) 2012-2020 ASPEED Technology Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * History :
+ * 1. 2012/08/15 Ryan Chen Create
+ *
+********************************************************************************/
+#ifndef __AST_VIDEO_H
+#define __AST_VIDEO_H 1
+
+/*
+ * Register for VIDEO
+ * */
+#define AST_VIDEO_PROTECT 0x000 /* protection key register */
+#define AST_VIDEO_SEQ_CTRL 0x004 /* Video Sequence Control register */
+#define AST_VIDEO_PASS_CTRL 0x008 /* Video Pass 1 Control register */
+
+#define AST_VIDEO_DIRECT_BASE 0x00C /* Video Direct Frame buffer mode control Register VR008[5]=1 */
+#define AST_VIDEO_DIRECT_CTRL 0x010 /* Video Direct Frame buffer mode control Register VR008[5]=1 */
+
+#define AST_VIDEO_TIMING_H 0x00C /* Video Timing Generation Setting Register */
+#define AST_VIDEO_TIMING_V 0x010 /* Video Timing Generation Setting Register */
+#define AST_VIDEO_SCAL_FACTOR 0x014 /* Video Scaling Factor Register */
+
+#define AST_VIDEO_SCALING0 0x018 /* Video Scaling Filter Parameter Register #0 */
+#define AST_VIDEO_SCALING1 0x01C /* Video Scaling Filter Parameter Register #1 */
+#define AST_VIDEO_SCALING2 0x020 /* Video Scaling Filter Parameter Register #2 */
+#define AST_VIDEO_SCALING3 0x024 /* Video Scaling Filter Parameter Register #3 */
+
+#define AST_VIDEO_BCD_CTRL 0x02C /* Video BCD Control Register */
+#define AST_VIDEO_CAPTURE_WIN 0x030 /* Video Capturing Window Setting Register */
+#define AST_VIDEO_COMPRESS_WIN 0x034 /* Video Compression Window Setting Register */
+
+
+#define AST_VIDEO_COMPRESS_PRO 0x038 /* Video Compression Stream Buffer Processing Offset Register */
+#define AST_VIDEO_COMPRESS_READ 0x03C /* Video Compression Stream Buffer Read Offset Register */
+
+#define AST_VIDEO_SOURCE_BUFF0 0x044 /* Video Based Address of Video Source Buffer #1 Register */
+#define AST_VIDEO_SOURCE_SCAN_LINE 0x048 /* Video Scan Line Offset of Video Source Buffer Register */
+#define AST_VIDEO_SOURCE_BUFF1 0x04C /* Video Based Address of Video Source Buffer #2 Register */
+#define AST_VIDEO_BCD_BUFF 0x050 /* Video Base Address of BCD Flag Buffer Register */
+#define AST_VIDEO_STREAM_BUFF 0x054 /* Video Base Address of Compressed Video Stream Buffer Register */
+#define AST_VIDEO_STREAM_SIZE 0x058 /* Video Stream Buffer Size Register */
+
+
+#define AST_VIDEO_COMPRESS_CTRL 0x060 /* Video Compression Control Register */
+
+
+#define AST_VIDEO_DEF_HEADER 0x080 /* Video User Defined Header Parameter Setting with Compression */
+
+#define AST_VIDEO_H_DETECT_STS 0x090 /* Video Source Left/Right Edge Detection Read Back Register */
+#define AST_VIDEO_V_DETECT_STS 0x094 /* Video Source Top/Bottom Edge Detection Read Back Register */
+
+
+#define AST_VIDEO_MODE_DET_STS 0x098 /* Video Mode Detection Status Read Back Register */
+
+#define AST_VIDEO_MODE_DET1 0x0A4 /* Video Mode Detection Control Register 1*/
+
+
+#define AST_VIDEO_CTRL 0x300 /* Video Control Register */
+#define AST_VIDEO_INT_EN 0x304 /* Video interrupt Enable */
+#define AST_VIDEO_INT_STS 0x308 /* Video interrupt status */
+#define AST_VIDEO_MODE_DETECT 0x30C /* Video Mode Detection Parameter Register */
+
+#define AST_VIDEO_CRC1 0x320 /* Primary CRC Parameter Register */
+#define AST_VIDEO_CRC2 0x324 /* Second CRC Parameter Register */
+#define AST_VIDEO_DATA_TRUNCA 0x328 /* Video Data Truncation Register */
+
+
+#define AST_VIDEO_SCRATCH_340 0x340 /* Video Scratch Remap Read Back */
+#define AST_VIDEO_SCRATCH_344 0x344 /* Video Scratch Remap Read Back */
+#define AST_VIDEO_SCRATCH_348 0x348 /* Video Scratch Remap Read Back */
+#define AST_VIDEO_SCRATCH_34C 0x34C /* Video Scratch Remap Read Back */
+#define AST_VIDEO_SCRATCH_350 0x350 /* Video Scratch Remap Read Back */
+#define AST_VIDEO_SCRATCH_354 0x354 /* Video Scratch Remap Read Back */
+#define AST_VIDEO_SCRATCH_358 0x358 /* Video Scratch Remap Read Back */
+#define AST_VIDEO_SCRATCH_35C 0x35C /* Video Scratch Remap Read Back */
+#define AST_VIDEO_SCRATCH_360 0x360 /* Video Scratch Remap Read Back */
+#define AST_VIDEO_SCRATCH_364 0x364 /* Video Scratch Remap Read Back */
+
+
+#define AST_VIDEO_ENCRYPT_SRAM 0x400 /* Video RC4/AES128 Encryption Key Register #0 ~ #63 */
+
+/////////////////////////////////////////////////////////////////////////////
+
+/* AST_VIDEO_PROTECT: 0x000 - protection key register */
+#define VIDEO_PROTECT_UNLOCK 0x1A038AA8
+
+/* AST_VIDEO_SEQ_CTRL 0x004 Video Sequence Control register */
+#define VIDEO_HALT_ENG_STS (1 << 21)
+#define VIDEO_COMPRESS_BUSY (1 << 18)
+#define VIDEO_CAPTURE_BUSY (1 << 16)
+#define VIDEO_HALT_ENG_TRIGGER (1 << 12)
+#define VIDEO_COMPRESS_FORMAT_MASK (3 << 10)
+#define VIDEO_COMPRESS_FORMAT(x) (x << 10) // 0 YUV444
+#define YUV420 1
+#define VIDEO_COMPRESS_JPEG_CPB (1 << 8)
+//if bit 0 : 1
+#define VIDEO_INPUT_MODE_CHG_WDT (1 << 7)
+#define VIDEO_INSERT_FULL_COMPRESS (1 << 6)
+#define VIDEO_AUTO_COMPRESS (1 << 5)
+#define VIDEO_COMPRESS_TRIGGER (1 << 4)
+#define VIDEO_CAPTURE_MULTI_FRAME (1 << 3)
+#define VIDEO_COMPRESS_FORCE_IDLE (1 << 2)
+#define VIDEO_CAPTURE_TIRGGER (1 << 1)
+#define VIDEO_DETECT_TRIGGER (1 << 0)
+
+
+#define VIDEO_HALT_ENG_RB (1 << 21)
+#define VIDEO_HALT_ENG_RB (1 << 21)
+#define VIDEO_HALT_ENG_RB (1 << 21)
+#define VIDEO_HALT_ENG_RB (1 << 21)
+#define VIDEO_HALT_ENG_RB (1 << 21)
+#define VIDEO_HALT_ENG_RB (1 << 21)
+
+
+/* AST_VIDEO_PASS_CTRL 0x008 Video Pass1 Control register */
+//x * source frame rate / 60
+#define VIDEO_FRAME_RATE_CTRL(x) (x << 16)
+#define VIDEO_HSYNC_POLARITY_CTRL (1 << 15)
+#define VIDEO_INTERLANCE_MODE (1 << 14)
+#define VIDEO_DUAL_EDGE_MODE (1 << 13) //0 : Single edage
+#define VIDEO_18BIT_SINGLE_EDGE (1 << 12) //0: 24bits
+#define VIDEO_DVO_INPUT_DELAY_MASK (7 << 9)
+#define VIDEO_DVO_INPUT_DELAY(x) (x << 9) //0 : no delay , 1: 1ns, 2: 2ns, 3:3ns
+// if biit 5 : 0
+#define VIDEO_HW_CURSOR_DIS (1 << 8)
+// if biit 5 : 1
+#define VIDEO_AUTO_FATCH (1 << 8)
+#define VIDEO_CAPTURE_MODE(x) (x << 6)
+#define YUV_MODE 1
+#define RGB_MODE 2
+#define GRAY_MODE 3
+#define VIDEO_DIRT_FATCH (1 << 5)
+// if biit 5 : 0
+#define VIDEO_INTERNAL_DE (1 << 4)
+#define VIDEO_EXT_ADC_ATTRIBUTE (1 << 3)
+
+// if biit 5 : 1
+#define VIDEO_16BPP_MODE (1 << 4)
+#define VIDEO_16BPP_MODE_555 (1 << 3) //0:565
+
+#define VIDEO_FROM_EXT_SOURCE (1 << 2)
+#define VIDEO_SO_VSYNC_POLARITY (1 << 1)
+#define VIDEO_SO_HSYNC_POLARITY (1 << 0)
+
+/* AST_VIDEO_TIMING_H 0x00C Video Timing Generation Setting Register */
+#define VIDEO_HSYNC_PIXEL_FIRST_SET(x) ((x) << 16)
+#define VIDEO_HSYNC_PIXEL_LAST_SET(x) (x)
+
+
+/* AST_VIDEO_DIRECT_CTRL 0x010 Video Direct Frame buffer mode control Register VR008[5]=1 */
+#define VIDEO_FETCH_TIMING(x) ((x) << 16)
+#define VIDEO_FETCH_LINE_OFFSET(x) (x)
+
+/* AST_VIDEO_TIMING_V 0x010 Video Timing Generation Setting Register */
+#define VIDEO_VSYNC_PIXEL_FIRST_SET(x) ((x) << 16)
+#define VIDEO_VSYNC_PIXEL_LAST_SET(x) (x)
+
+
+/* AST_VIDEO_SCAL_FACTOR 0x014 Video Scaling Factor Register */
+#define VIDEO_V_SCAL_FACTOR(x) (((x) & 0xffff) << 16)
+#define VIDEO_H_SCAL_FACTOR(x) (x & 0xffff)
+
+
+/* AST_VIDEO_SCALING0 0x018 Video Scaling Filter Parameter Register #0 */
+/* AST_VIDEO_SCALING1 0x01C Video Scaling Filter Parameter Register #1 */
+/* AST_VIDEO_SCALING2 0x020 Video Scaling Filter Parameter Register #2 */
+/* AST_VIDEO_SCALING3 0x024 Video Scaling Filter Parameter Register #3 */
+
+
+/* AST_VIDEO_BCD_CTRL 0x02C Video BCD Control Register */
+#define VIDEO_ABCD_TOL(x) (x << 24)
+#define VIDEO_BCD_TOL(x) (x << 16)
+#define VIDEO_ABCD_CHG_EN (1 << 1)
+#define VIDEO_BCD_CHG_EN (1 << 0)
+
+
+
+/* AST_VIDEO_CAPTURE_WIN 0x030 Video Capturing Window Setting Register */
+#define VIDEO_CAPTURE_V(x) (x & 0x7ff)
+#define VIDEO_CAPTURE_H(x) ((x & 0x7ff) << 16)
+
+/* AST_VIDEO_COMPRESS_WIN 0x034 Video Compression Window Setting Register */
+#define VIDEO_COMPRESS_V(x) (x & 0x7ff)
+#define VIDEO_COMPRESS_H(x) ((x & 0x7ff) << 16)
+
+
+
+/* AST_VIDEO_RESET :0x03c - system reset control register */
+
+/* AST_VIDEO_STREAM_SIZE 0x058 Video Stream Buffer Size Register */
+#define VIDEO_STREAM_PKT_N(x) (x << 3)
+#define STREAM_4_PKTS 0
+#define STREAM_8_PKTS 1
+#define STREAM_16_PKTS 2
+#define STREAM_32_PKTS 3
+#define STREAM_64_PKTS 4
+#define STREAM_128_PKTS 5
+
+#define VIDEO_STREAM_PKT_SIZE(x) (x)
+#define STREAM_1KB 0
+#define STREAM_2KB 1
+#define STREAM_4KB 2
+#define STREAM_8KB 3
+#define STREAM_16KB 4
+#define STREAM_32KB 5
+#define STREAM_64KB 6
+#define STREAM_128KB 7
+
+
+
+
+
+
+
+
+/* AST_VIDEO_COMPRESS_CTRL 0x060 Video Compression Control Register */
+#define VIDEO_HQ_DCT_LUM(x) ((x) << 27)
+#define VIDEO_HQ_DCT_CHROM(x) ((x) << 22)
+#define VIDEO_DCT_HUFFMAN_ENCODE(x) ((x) << 20)
+#define VIDEO_DCT_RESET (1 << 17)
+#define VIDEO_HQ_ENABLE (1 << 16)
+#define VIDEO_DCT_LUM(x) ((x) << 11)
+#define VIDEO_DCT_CHROM(x) ((x) << 6)
+#define VIDEO_RC4_ENABLE (1 << 5)
+#define VIDEO_COMPRESS_QUANTIZ_MODE (1 << 2)
+#define VIDEO_4COLOR_VQ_ENCODE (1 << 1)
+#define VIDEO_DCT_ONLY_ENCODE (1 << 0)
+
+
+/* AST_VIDEO_H_DETECT_STS 0x090 Video Source Left/Right Edge Detection Read Back Register */
+#define VIDEO_DET_INTERLANCE_MODE (1 << 31)
+#define VIDEO_GET_HSYNC_RIGHT(x) ((x & 0x0FFF0000) >> 16)
+#define VIDEO_GET_HSYNC_LEFT(x) (x & 0xFFF)
+#define VIDEO_NO_DISPLAY_CLOCK_DET (1 << 15)
+#define VIDEO_NO_ACT_DISPLAY_DET (1 << 14)
+#define VIDEO_NO_HSYNC_DET (1 << 13)
+#define VIDEO_NO_VSYNC_DET (1 << 12)
+
+/* AST_VIDEO_V_DETECT_STS 0x094 Video Source Top/Bottom Edge Detection Read Back Register */
+#define VIDEO_GET_VSYNC_BOTTOM(x) ((x & 0x0FFF0000) >> 16)
+#define VIDEO_GET_VSYNC_TOP(x) (x & 0xFFF)
+
+
+/* AST_VIDEO_MODE_DET_STS 0x098 Video Mode Detection Status Read Back Register */
+#define VIDEO_DET_HSYNC_RDY (1 << 31)
+#define VIDEO_DET_VSYNC_RDY (1 << 30)
+#define VIDEO_DET_HSYNC_POLAR (1 << 29)
+#define VIDEO_DET_VSYNC_POLAR (1 << 28)
+#define VIDEO_GET_VER_SCAN_LINE(x) ((x >> 16) & 0xfff)
+#define VIDEO_OUT_SYNC (1 << 15)
+#define VIDEO_DET_VER_STABLE (1 << 14)
+#define VIDEO_DET_HOR_STABLE (1 << 13)
+#define VIDEO_DET_FROM_ADC (1 << 12)
+#define VIDEO_DET_HOR_PERIOD(x) (x & 0xfff)
+
+
+/* AST_VIDEO_MODE_DET1 0x0A4 Video Mode Detection Control Register 1*/
+#define VIDEO_DET_HSYNC_DELAY_MASK (0xff << 16)
+#define VIDEO_DET_LONG_H_STABLE_EN (1 << 29)
+
+
+/* AST_VIDEO_CTRL 0x300 Video Control Register */
+#define VIDEO_CTRL_CRYPTO(x) (x << 17)
+#define VIDEO_CTRL_CRYPTO_MASK (1 << 17)
+#define CRYPTO_RC4_MODE 0
+#define CRYPTO_AES_MODE 1
+#define VIDEO_CTRL_CRYPTO_FAST (1 << 16)
+//15 reserved
+#define VIDEO_CTRL_RC4_VC (1 << 14)
+#define VIDEO_CTRL_CAPTURE_MASK (3 << 12)
+#define VIDEO_CTRL_CAPTURE_MODE(x) (x << 12)
+#define VIDEO_CTRL_COMPRESS_MASK (3 << 10)
+#define VIDEO_CTRL_COMPRESS_MODE(x) (x << 10)
+#define MODE_32BPP_YUV444 0
+#define MODE_24BPP_YUV444 1
+#define MODE_16BPP_YUV422 3
+
+#define VIDEO_CTRL_RC4_TEST_MODE (1 << 9)
+#define VIDEO_CTRL_RC4_RST (1 << 8)
+#define VIDEO_CTRL_RC4_VIDEO_M_SEL (1 << 7) //video management
+#define VIDEO_CTRL_RC4_VIDEO_2_SEL (1 << 6) // Video 2
+
+#define VIDEO_CTRL_DWN_SCALING_MASK (0x3 << 4)
+#define VIDEO_CTRL_DWN_SCALING(x) (x << 4)
+#define DWN_V1 0x1
+#define DWN_V2 0x2
+#define DWN_VM 0x3
+
+
+
+#define VIDEO_CTRL_VSYNC_DELAY_MASK (3 << 2)
+#define VIDEO_CTRL_VSYNC_DELAY(x) (x << 2)
+#define NO_DELAY 0
+#define DELAY_DIV12_HSYNC 1
+#define AUTO_DELAY 2
+
+
+/* AST_VIDEO_INT_EN 0x304 Video interrupt Enable */
+/* AST_VIDEO_INT_STS 0x308 Video interrupt status */
+#define VIDEO_FRAME_COMPLETE (1 << 5)
+#define VIDEO_MODE_DETECT_RDY (1 << 4)
+#define VIDEO_COMPRESS_COMPLETE (1 << 3)
+#define VIDEO_COMPRESS_PKT_COMPLETE (1 << 2)
+#define VIDEO_CAPTURE_COMPLETE (1 << 1)
+#define VIDEO_MODE_DETECT_WDT (1 << 0)
+
+/* AST_VIDEO_MODE_DETECT 0x30C Video Mode Detection Parameter Register */
+#define VIDEO_MODE_HOR_TOLER(x) (x << 28)
+#define VIDEO_MODE_VER_TOLER(x) (x << 24)
+#define VIDEO_MODE_HOR_STABLE(x) (x << 20)
+#define VIDEO_MODE_VER_STABLE(x) (x << 16)
+#define VIDEO_MODE_EDG_THROD(x) (x << 8)
+
+#define MODEDETECTION_VERTICAL_STABLE_MAXIMUM 0x6
+#define MODEDETECTION_HORIZONTAL_STABLE_MAXIMUM 0x6
+#define MODEDETECTION_VERTICAL_STABLE_THRESHOLD 0x2
+#define MODEDETECTION_HORIZONTAL_STABLE_THRESHOLD 0x2
+
+/* AST_VIDEO_SCRATCH_34C 0x34C Video Scratch Remap Read Back */
+#define SCRATCH_VGA_GET_REFLASH_RATE(x) ((x >> 8) & 0xf)
+#define SCRATCH_VGA_GET_COLOR_MODE(x) ((x >> 4) & 0xf)
+
+/* AST_VIDEO_SCRATCH_350 0x350 Video Scratch Remap Read Back */
+#define SCRATCH_VGA_GET_MODE_HEADER(x) ((x >> 8) & 0xff)
+#define SCRATCH_VGA_GET_NEW_COLOR_MODE(x) ((x >> 16) & 0xff)
+#define SCRATCH_VGA_GET_NEW_PIXEL_CLK(x) ((x >> 24) & 0xff)
+
+
+/* AST_VIDEO_SCRATCH_35C 0x35C Video Scratch Remap Read Back */
+#define SCRATCH_VGA_PWR_STS_HSYNC (1 << 31)
+#define SCRATCH_VGA_PWR_STS_VSYNC (1 << 30)
+#define SCRATCH_VGA_ATTRIBTE_INDEX_BIT5 (1 << 29)
+#define SCRATCH_VGA_MASK_REG (1 << 28)
+#define SCRATCH_VGA_CRT_RST (1 << 27)
+#define SCRATCH_VGA_SCREEN_OFF (1 << 26)
+#define SCRATCH_VGA_RESET (1 << 25)
+#define SCRATCH_VGA_ENABLE (1 << 24)
+
+
+#endif
+
diff --git a/arch/arm/plat-aspeed/include/plat/regs-vuart.h b/arch/arm/plat-aspeed/include/plat/regs-vuart.h
new file mode 100644
index 000000000000..b4bb88a0912c
--- /dev/null
+++ b/arch/arm/plat-aspeed/include/plat/regs-vuart.h
@@ -0,0 +1,39 @@
+/* arch/arm/plat-aspeed/include/mach/regs-iic.h
+ *
+ * Copyright (c) 2012 ASPEED Technology Inc. <ryan_chen@aspeedtech.com>
+ * http://www.aspeedtech.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * ASPEED VUART Controller
+*/
+
+#ifndef __AST_VUART_H_
+#define __AST_VUART_H_
+
+#define AST_VUART_CTRLA 0x20
+#define AST_VUART_CTRLB 0x24
+#define AST_VUART_ADDRL 0x28
+#define AST_VUART_ADDRH 0x2C
+#define AST_VUART_CTRLE 0x30
+#define AST_VUART_CTRLF 0x34
+#define AST_VUART_CTRLG 0x38
+#define AST_VUART_CTRLH 0x3C
+
+
+
+/* AST_VUART_CTRLA 0x20 */
+#define VUART_ENABLE (1 << 0)
+#define VUART_SIRQ_POLARITY (1 << 1)
+#define VUART_DISABLE_H_TX_DISCARD (1 << 5)
+
+
+/* AST_VUART_CTRLB 0x24 */
+#define SET_SIRQ_NUM(x) (x << 4)
+
+
+
+
+#endif
diff --git a/arch/arm/plat-aspeed/irq.c b/arch/arm/plat-aspeed/irq.c
new file mode 100644
index 000000000000..b1183591ae67
--- /dev/null
+++ b/arch/arm/plat-aspeed/irq.c
@@ -0,0 +1,136 @@
+/*
+ * linux/arch/arm/plat-aspeed/irq.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <linux/init.h>
+#include <linux/stddef.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/platform_device.h>
+#include <linux/sysdev.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <asm/system.h>
+#include <asm/irq.h>
+#include <asm/io.h>
+#include <asm/mach/irq.h>
+#include <mach/hardware.h>
+
+#include <plat/regs-intr.h>
+
+static void ast_mask_irq(unsigned int irq)
+{
+ int i=0;
+ u32 regVal;
+ u8 timer;
+
+#ifdef IRQ_TIMER7
+ if(((irq >= IRQ_TIMER0) && (irq <= IRQ_TIMER2)) || ((i >= IRQ_TIMER3) && (i <= IRQ_TIMER7)))
+ timer = 1;
+
+#else
+ if((irq >= IRQ_TIMER0) && (irq <= IRQ_TIMER2))
+ timer = 1;
+#endif
+
+ if (irq > 32) {
+ i=1;
+ irq = irq - 32;
+ } else
+ i=0;
+
+ regVal = readl(AST_INTR_DIS(i));
+ regVal |= (1 << irq);
+ writel(regVal, AST_INTR_DIS(i));
+
+ /*
+ * clear the interrupt
+ */
+ if(timer)
+ IRQ_EDGE_CLEAR(i,irq);
+
+}
+
+static void ast_unmask_irq(unsigned int irq)
+{
+ int i;
+ u32 regVal;
+
+ if (irq > 32) {
+ i=1;
+ irq = irq - 32;
+ } else
+ i=0;
+
+ regVal = readl(AST_INTR_EN(i));
+ regVal |= (1 << irq);
+ writel(regVal, AST_INTR_EN(i));
+}
+
+static struct irq_chip ast_irq_chip = {
+ .name = "ast_irq",
+ .ack = ast_mask_irq,
+ .mask = ast_mask_irq,
+ .unmask = ast_unmask_irq,
+};
+
+void __init ast_init_irq(void)
+{
+ unsigned int i;
+
+ /* VIC1 */
+ writel(0, AST_INTR_SEL(0));
+ writel(0, AST_INTR_EN(0));
+ writel(0xFFFFFFFF, AST_INTR_DIS(0));
+ writel(0xFFFFFFFF, AST_INTR_EDGE_CLR(0));
+
+#if defined(NEW_VIC)
+ writel(0, AST_INTR_SEL(1));
+ writel(0, AST_INTR_EN(1));
+ writel(0xFFFFFFFF, AST_INTR_DIS(1));
+ writel(0xFFFFFFFF, AST_INTR_EDGE_CLR(1));
+#endif
+
+ //TOTAL IRQ NUM =
+ for (i = 0; i < AST_VIC_NUM; i++)
+ {
+ if(i<32) {
+ if((i >= IRQ_TIMER0) && (i <= IRQ_TIMER2)) //Timer0/1/2
+ IRQ_SET_RISING_EDGE(0,i);
+ else {
+ IRQ_SET_HIGH_LEVEL(0,i);
+ IRQ_SET_LEVEL_TRIGGER(0,i);
+ }
+#ifdef IRQ_TIMER7
+ } else {
+ if((i >= IRQ_TIMER3) && (i <= IRQ_TIMER7)) //Timer3/4/5/6/7
+ IRQ_SET_RISING_EDGE(0,i-32);
+ else {
+ IRQ_SET_HIGH_LEVEL(1,i-32);
+ IRQ_SET_LEVEL_TRIGGER(1,i-32);
+ }
+#endif
+ }
+
+ set_irq_chip(i, &ast_irq_chip);
+ set_irq_handler(i, handle_level_irq);
+ set_irq_flags(i, IRQF_VALID);
+ }
+
+}
diff --git a/arch/arm/plat-aspeed/timer.c b/arch/arm/plat-aspeed/timer.c
new file mode 100644
index 000000000000..079d958c6e3f
--- /dev/null
+++ b/arch/arm/plat-aspeed/timer.c
@@ -0,0 +1,137 @@
+/*
+ * timer.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/spinlock.h>
+#include <linux/interrupt.h>
+#include <linux/sched.h>
+
+#include <linux/irq.h>
+#include <asm/system.h>
+#include <asm/io.h>
+#include <mach/hardware.h>
+#include <mach/irqs.h>
+#include <mach/time.h>
+#include <plat/ast-scu.h>
+
+#define ASPEED_TIMER0_VA_BASE (IO_ADDRESS(AST_TIMER_BASE)+ASPEED_TIMER0_OFFSET)
+#define ASPEED_TIMER1_VA_BASE (IO_ADDRESS(AST_TIMER_BASE)+ASPEED_TIMER1_OFFSET)
+#define ASPEED_TIMER2_VA_BASE (IO_ADDRESS(AST_TIMER_BASE)+ASPEED_TIMER2_OFFSET)
+#define ASPEED_TIMERC_VA_BASE (IO_ADDRESS(AST_TIMER_BASE)+ASPEED_TIMERRC_OFFSET)
+
+/*
+ * Returns number of ms since last clock interrupt. Note that interrupts
+ * will have been disabled by do_gettimeoffset()
+ */
+static unsigned long ast_gettimeoffset(void)
+{
+ volatile TimerStruct_t *timer0 = (TimerStruct_t *) ASPEED_TIMER0_VA_BASE;
+ unsigned long ticks1, ticks2;//, status;
+
+ /*
+ * Get the current number of ticks. Note that there is a race
+ * condition between us reading the timer and checking for
+ * an interrupt. We get around this by ensuring that the
+ * counter has not reloaded between our two reads.
+ */
+ ticks2 = timer0->TimerValue;
+ do {
+ ticks1 = ticks2;
+// status = readl(AST_RAW_STS(0));// __raw_readl(IO_ADDRESS(ASPEED_VIC_BASE) + ASPEED_VIC_RAW_STATUS_OFFSET);
+ ticks2 = timer0->TimerValue;
+ } while (ticks2 > ticks1);
+
+ /*
+ * Number of ticks since last interrupt.
+ */
+ ticks1 = TIMER_RELOAD - ticks2;
+
+ /*
+ * Interrupt pending? If so, we've reloaded once already.
+ */
+// if (status & (1 << IRQ_TIMER0))
+// ticks1 += TIMER_RELOAD;
+
+ /*
+ * Convert the ticks to usecs
+ */
+ return TICKS2USECS(ticks1);
+}
+
+
+/*
+ * IRQ handler for the timer
+ */
+static irqreturn_t
+ast_timer_interrupt(int irq, void *dev_id)
+{
+
+// write_seqlock(&xtime_lock);
+
+ /*
+ * clear the interrupt in Irq.c
+ */
+// IRQ_EDGE_CLEAR(0,IRQ_TIMER0);
+
+ timer_tick();
+
+
+// write_sequnlock(&xtime_lock);
+
+ return IRQ_HANDLED;
+}
+
+static struct irqaction ast_timer_irq = {
+ .name = "ast timer",
+ .flags = IRQF_DISABLED | IRQF_TIMER,
+ .handler = ast_timer_interrupt,
+};
+
+/*
+ * Set up timer interrupt, and return the current time in seconds.
+ */
+static void __init ast_setup_timer(void)
+{
+ volatile TimerStruct_t *timer0 = (volatile TimerStruct_t *) ASPEED_TIMER0_VA_BASE;
+ volatile __u32 *timerc = (volatile __u32*) ASPEED_TIMERC_VA_BASE;
+
+ /*
+ * Initialise to a known state (all timers off)
+ */
+ *timerc = 0;
+
+ timer0->TimerLoad = TIMER_RELOAD - 1;
+ timer0->TimerValue = TIMER_RELOAD - 1;
+ *timerc = TIMER0_ENABLE | TIMER0_RefExt;
+
+ /*
+ * Make irqs happen for the system timer
+ */
+ ast_scu_show_system_info();
+
+ setup_irq(IRQ_TIMER0, &ast_timer_irq);
+
+}
+
+struct sys_timer ast_timer = {
+ .init = ast_setup_timer,
+// .offset = ast_gettimeoffset,
+};