Merge branch 'master' of git://git.denx.de/u-boot-arm
authorMinkyu Kang <mk7.kang@samsung.com>
Tue, 23 Mar 2010 10:09:13 +0000 (19:09 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Tue, 23 Mar 2010 10:09:13 +0000 (19:09 +0900)
Conflicts:

cpu/arm920t/ep93xx/timer.c

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
13 files changed:
MAINTAINERS
board/samsung/smdkc100/smdkc100.c
cpu/arm1176/cpu.c
cpu/arm1176/start.S
cpu/arm_cortexa8/s5pc1xx/Makefile
cpu/arm_cortexa8/s5pc1xx/clock.c
cpu/arm_cortexa8/s5pc1xx/gpio.c [new file with mode: 0644]
cpu/arm_cortexa8/s5pc1xx/sromc.c [new file with mode: 0644]
doc/README.s5pc1xx
include/asm-arm/arch-s5pc1xx/clk.h
include/asm-arm/arch-s5pc1xx/gpio.h
include/asm-arm/arch-s5pc1xx/smc.h [new file with mode: 0644]
include/configs/smdkc100.h

index 80057ce..092ebec 100644 (file)
@@ -617,6 +617,10 @@ Simon Kagstrom <simon.kagstrom@netinsight.net>
 
        openrd_base     ARM926EJS (Kirkwood SoC)
 
+Minkyu Kang <mk7.kang@samsung.com>
+
+       SMDKC100        ARM CORTEX-A8 (S5PC100 SoC)
+
 Nishant Kamat <nskamat@ti.com>
 
        omap1610h2      ARM926EJS
@@ -631,17 +635,17 @@ Sergey Kubushyn <ksi@koi8.net>
        SONATA          ARM926EJS
        SCHMOOGIE       ARM926EJS
 
-Sandeep Paulraj <s-paulraj@ti.com>
-
-       davinci_dm355evm        ARM926EJS
-       davinci_dm355leopard    ARM926EJS
-       davinci_dm365evm        ARM926EJS
-       davinci_dm6467evm       ARM926EJS
-
 Prakash Kumar <prakash@embedx.com>
 
        cerf250         xscale
 
+Vipin Kumar <vipin.kumar@st.com>
+
+       spear300        ARM926EJS (spear300 Soc)
+       spear310        ARM926EJS (spear310 Soc)
+       spear320        ARM926EJS (spear320 Soc)
+       spear600        ARM926EJS (spear600 Soc)
+
 Sergey Lapin <slapin@ossfans.org>
 
        afeb9260        ARM926EJS (AT91SAM9260 SoC)
@@ -674,6 +678,13 @@ Kyungmin Park <kyungmin.park@samsung.com>
 
        apollon         ARM1136EJS
 
+Sandeep Paulraj <s-paulraj@ti.com>
+
+       davinci_dm355evm        ARM926EJS
+       davinci_dm355leopard    ARM926EJS
+       davinci_dm365evm        ARM926EJS
+       davinci_dm6467evm       ARM926EJS
+
 Peter Pearse <peter.pearse@arm.com>
        integratorcp    All current ARM supplied & supported core modules
                        -see http://www.arm.com/products/DevTools/Hardware_Platforms.html
@@ -774,10 +785,6 @@ Alex Z
        lart            SA1100
        dnp1110         SA1110
 
-Minkyu Kang <mk7.kang@samsung.com>
-
-       SMDKC100        ARM CORTEX-A8 (S5PC100 SoC)
-
 -------------------------------------------------------------------------
 
 Unknown / orphaned boards:
index 15a1a27..fb466c6 100644 (file)
  */
 
 #include <common.h>
+#include <asm/io.h>
+#include <asm/arch/smc.h>
+#include <asm/arch/gpio.h>
+#include <netdev.h>
+
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * Miscellaneous platform dependent initialisations
+ */
+static void smc9115_pre_init(void)
+{
+       u32 smc_bw_conf, smc_bc_conf;
+
+       struct s5pc100_gpio *const gpio =
+               (struct s5pc100_gpio *)S5PC100_GPIO_BASE;
+
+       /* gpio configuration GPK0CON */
+       gpio_cfg_pin(&gpio->gpio_k0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2));
+
+       /* Ethernet needs bus width of 16 bits */
+       smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK);
+       smc_bc_conf = SMC_BC_TACS(0x0) | SMC_BC_TCOS(0x4) | SMC_BC_TACC(0xe)
+                       | SMC_BC_TCOH(0x1) | SMC_BC_TAH(0x4)
+                       | SMC_BC_TACP(0x6) | SMC_BC_PMC(0x0);
+
+       /* Select and configure the SROMC bank */
+       s5pc1xx_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
+}
+
 int board_init(void)
 {
+       smc9115_pre_init();
+
        gd->bd->bi_arch_number = MACH_TYPE_SMDKC100;
        gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
@@ -49,3 +79,12 @@ int checkboard(void)
        return 0;
 }
 #endif
+
+int board_eth_init(bd_t *bis)
+{
+       int rc = 0;
+#ifdef CONFIG_SMC911X
+       rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
+#endif
+       return rc;
+}
index 2c0014f..befa0cd 100644 (file)
@@ -33,7 +33,9 @@
 
 #include <common.h>
 #include <command.h>
+#ifdef CONFIG_S3C64XX
 #include <asm/arch/s3c6400.h>
+#endif
 #include <asm/system.h>
 
 static void cache_flush (void);
index 68a356d..e2b6c9b 100644 (file)
@@ -35,7 +35,9 @@
 #ifdef CONFIG_ENABLE_MMU
 #include <asm/proc/domain.h>
 #endif
+#ifdef CONFIG_S3C64XX
 #include <asm/arch/s3c6400.h>
+#endif
 
 #if !defined(CONFIG_ENABLE_MMU) && !defined(CONFIG_SYS_PHY_UBOOT_BASE)
 #define CONFIG_SYS_PHY_UBOOT_BASE      CONFIG_SYS_UBOOT_BASE
@@ -190,10 +192,12 @@ mmu_disable:
 #endif
 
 mmu_disable_phys:
+#ifdef CONFIG_S3C64XX
        /* Peri port setup */
        ldr     r0, =0x70000000
        orr     r0, r0, #0x13
        mcr     p15,0,r0,c15,c2,4       @ 256M (0x70000000 - 0x7fffffff)
+#endif
 
        /*
         * Go setup Memory and board specific bits prior to relocation.
index 4f922e6..01c93fe 100644 (file)
@@ -33,6 +33,8 @@ SOBJS += reset.o
 
 COBJS  += clock.o
 COBJS  += cpu_info.o
+COBJS  += gpio.o
+COBJS  += sromc.o
 COBJS  += timer.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
index a9e78dd..19619f9 100644 (file)
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
-
-#define APLL   0
-#define MPLL   1
-#define EPLL   2
-#define HPLL   3
-#define VPLL   4
+#include <asm/arch/clk.h>
 
 #define CLK_M  0
 #define CLK_D  1
diff --git a/cpu/arm_cortexa8/s5pc1xx/gpio.c b/cpu/arm_cortexa8/s5pc1xx/gpio.c
new file mode 100644 (file)
index 0000000..a97244b
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <mk7.kang@samsung.com>
+ *
+ * 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 <common.h>
+#include <asm/io.h>
+#include <asm/arch/gpio.h>
+
+#define CON_MASK(x)            (0xf << ((x) << 2))
+#define CON_SFR(x, v)          ((v) << ((x) << 2))
+
+#define DAT_MASK(x)            (0x1 << (x))
+#define DAT_SET(x)             (0x1 << (x))
+
+#define PULL_MASK(x)           (0x3 << ((x) << 1))
+#define PULL_MODE(x, v)                ((v) << ((x) << 1))
+
+#define DRV_MASK(x)            (0x3 << ((x) << 1))
+#define DRV_SET(x, m)          ((m) << ((x) << 1))
+#define RATE_MASK(x)           (0x1 << (x + 16))
+#define RATE_SET(x)            (0x1 << (x + 16))
+
+void gpio_cfg_pin(struct s5pc1xx_gpio_bank *bank, int gpio, int cfg)
+{
+       unsigned int value;
+
+       value = readl(&bank->con);
+       value &= ~CON_MASK(gpio);
+       value |= CON_SFR(gpio, cfg);
+       writel(value, &bank->con);
+}
+
+void gpio_direction_output(struct s5pc1xx_gpio_bank *bank, int gpio, int en)
+{
+       unsigned int value;
+
+       gpio_cfg_pin(bank, gpio, GPIO_OUTPUT);
+
+       value = readl(&bank->dat);
+       value &= ~DAT_MASK(gpio);
+       if (en)
+               value |= DAT_SET(gpio);
+       writel(value, &bank->dat);
+}
+
+void gpio_direction_input(struct s5pc1xx_gpio_bank *bank, int gpio)
+{
+       gpio_cfg_pin(bank, gpio, GPIO_INPUT);
+}
+
+void gpio_set_value(struct s5pc1xx_gpio_bank *bank, int gpio, int en)
+{
+       unsigned int value;
+
+       value = readl(&bank->dat);
+       value &= ~DAT_MASK(gpio);
+       if (en)
+               value |= DAT_SET(gpio);
+       writel(value, &bank->dat);
+}
+
+unsigned int gpio_get_value(struct s5pc1xx_gpio_bank *bank, int gpio)
+{
+       unsigned int value;
+
+       value = readl(&bank->dat);
+       return !!(value & DAT_MASK(gpio));
+}
+
+void gpio_set_pull(struct s5pc1xx_gpio_bank *bank, int gpio, int mode)
+{
+       unsigned int value;
+
+       value = readl(&bank->pull);
+       value &= ~PULL_MASK(gpio);
+
+       switch (mode) {
+       case GPIO_PULL_DOWN:
+       case GPIO_PULL_UP:
+               value |= PULL_MODE(gpio, mode);
+               break;
+       default:
+               return;
+       }
+
+       writel(value, &bank->pull);
+}
+
+void gpio_set_drv(struct s5pc1xx_gpio_bank *bank, int gpio, int mode)
+{
+       unsigned int value;
+
+       value = readl(&bank->drv);
+       value &= ~DRV_MASK(gpio);
+
+       switch (mode) {
+       case GPIO_DRV_1X:
+       case GPIO_DRV_2X:
+       case GPIO_DRV_3X:
+       case GPIO_DRV_4X:
+               value |= DRV_SET(gpio, mode);
+               break;
+       default:
+               return;
+       }
+
+       writel(value, &bank->drv);
+}
+
+void gpio_set_rate(struct s5pc1xx_gpio_bank *bank, int gpio, int mode)
+{
+       unsigned int value;
+
+       value = readl(&bank->drv);
+       value &= ~RATE_MASK(gpio);
+
+       switch (mode) {
+       case GPIO_DRV_FAST:
+       case GPIO_DRV_SLOW:
+               value |= RATE_SET(gpio);
+               break;
+       default:
+               return;
+       }
+
+       writel(value, &bank->drv);
+}
diff --git a/cpu/arm_cortexa8/s5pc1xx/sromc.c b/cpu/arm_cortexa8/s5pc1xx/sromc.c
new file mode 100644 (file)
index 0000000..380be81
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics
+ * Naveen Krishna Ch <ch.naveen@samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <common.h>
+#include <asm/io.h>
+#include <asm/arch/smc.h>
+
+/*
+ * s5pc1xx_config_sromc() - select the proper SROMC Bank and configure the
+ *                 band width control and bank control registers
+ * srom_bank   - SROM Bank 0 to 5
+ * smc_bw_conf  - SMC Band witdh reg configuration value
+ * smc_bc_conf  - SMC Bank Control reg configuration value
+ */
+void s5pc1xx_config_sromc(u32 srom_bank, u32 smc_bw_conf, u32 smc_bc_conf)
+{
+       u32 tmp;
+       struct s5pc1xx_smc *srom;
+
+       if (cpu_is_s5pc100())
+               srom = (struct s5pc1xx_smc *)S5PC100_SROMC_BASE;
+       else
+               srom = (struct s5pc1xx_smc *)S5PC110_SROMC_BASE;
+
+       /* Configure SMC_BW register to handle proper SROMC bank */
+       tmp = srom->bw;
+       tmp &= ~(0xF << (srom_bank * 4));
+       tmp |= smc_bw_conf;
+       srom->bw = tmp;
+
+       /* Configure SMC_BC register */
+       srom->bc[srom_bank] = smc_bc_conf;
+}
index 5a0fe33..ab1f024 100644 (file)
@@ -41,7 +41,23 @@ To check SoC:
                printf("cpu is s5pc110\n");
 
 gpio
-       not supported yet.
+
+       struct s5pc100_gpio *gpio = (struct s5pc100_gpio*)S5PC100_GPIO_BASE;
+
+       /* GPA[0] pin set to irq */
+       gpio_cfg_pin(&gpio->gpio_a, 0, GPIO_IRQ);
+
+       /* GPA[0] pin set to input */
+       gpio_direction_input(&gpio->gpio_a, 0);
+
+       /* GPA[0] pin set to output/high */
+       gpio_direction_output(&gpio->gpio_a, 0, 1);
+
+       /* GPA[0] value set to low */
+       gpio_set_value(&gpio->gpio_a, 0, 0);
+
+       /* get GPA[0] value */
+       value = gpio_get_value(&gpio->gpio_a, 0);
 
 Links
 =====
index f1aa44f..3e59abe 100644 (file)
 #ifndef __ASM_ARM_ARCH_CLK_H_
 #define __ASM_ARM_ARCH_CLK_H_
 
+#define APLL   0
+#define MPLL   1
+#define EPLL   2
+#define HPLL   3
+#define VPLL   4
+
 void s5pc1xx_clock_init(void);
 
 extern unsigned long (*get_pll_clk)(int pllreg);
index afbc7ea..8e4bb86 100644 (file)
@@ -124,6 +124,35 @@ struct s5pc110_gpio {
        struct s5pc1xx_gpio_bank gpio_h2;
        struct s5pc1xx_gpio_bank gpio_h3;
 };
+
+/* functions */
+void gpio_cfg_pin(struct s5pc1xx_gpio_bank *bank, int gpio, int cfg);
+void gpio_direction_output(struct s5pc1xx_gpio_bank *bank, int gpio, int en);
+void gpio_direction_input(struct s5pc1xx_gpio_bank *bank, int gpio);
+void gpio_set_value(struct s5pc1xx_gpio_bank *bank, int gpio, int en);
+unsigned int gpio_get_value(struct s5pc1xx_gpio_bank *bank, int gpio);
+void gpio_set_pull(struct s5pc1xx_gpio_bank *bank, int gpio, int mode);
+void gpio_set_drv(struct s5pc1xx_gpio_bank *bank, int gpio, int mode);
+void gpio_set_rate(struct s5pc1xx_gpio_bank *bank, int gpio, int mode);
 #endif
 
+/* Pin configurations */
+#define GPIO_INPUT     0x0
+#define GPIO_OUTPUT    0x1
+#define GPIO_IRQ       0xf
+#define GPIO_FUNC(x)   (x)
+
+/* Pull mode */
+#define GPIO_PULL_NONE 0x0
+#define GPIO_PULL_DOWN 0x1
+#define GPIO_PULL_UP   0x2
+
+/* Drive Strength level */
+#define GPIO_DRV_1X    0x0
+#define GPIO_DRV_2X    0x1
+#define GPIO_DRV_3X    0x2
+#define GPIO_DRV_4X    0x3
+#define GPIO_DRV_FAST  0x0
+#define GPIO_DRV_SLOW  0x1
+
 #endif
diff --git a/include/asm-arm/arch-s5pc1xx/smc.h b/include/asm-arm/arch-s5pc1xx/smc.h
new file mode 100644 (file)
index 0000000..88f4ffe
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * (C) Copyright 2010 Samsung Electronics
+ * Naveen Krishna Ch <ch.naveen@samsung.com>
+ *
+ * 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
+ *
+ * Note: This file contains the register description for Memory subsystem
+ *      (SROM, NAND Flash, OneNand, DDR, OneDRAM) on S5PC1XX.
+ *
+ *      Only SROMC is defined as of now
+ */
+
+#ifndef __ASM_ARCH_SMC_H_
+#define __ASM_ARCH_SMC_H_
+
+#define SMC_DATA16_WIDTH(x)    (1<<((x*4)+0))
+#define SMC_BYTE_ADDR_MODE(x)  (1<<((x*4)+1))  /* 0-> Half-word base address*/
+                                               /* 1-> Byte base address*/
+#define SMC_WAIT_ENABLE(x)     (1<<((x*4)+2))
+#define SMC_BYTE_ENABLE(x)     (1<<((x*4)+3))
+
+#define SMC_BC_TACS(x) (x << 28) /* 0clk     address set-up */
+#define SMC_BC_TCOS(x) (x << 24) /* 4clk     chip selection set-up */
+#define SMC_BC_TACC(x) (x << 16) /* 14clk    access cycle */
+#define SMC_BC_TCOH(x) (x << 12) /* 1clk     chip selection hold */
+#define SMC_BC_TAH(x)  (x << 8)  /* 4clk     address holding time */
+#define SMC_BC_TACP(x) (x << 4)  /* 6clk     page mode access cycle */
+#define SMC_BC_PMC(x)  (x << 0)  /* normal(1data)page mode configuration */
+
+#ifndef __ASSEMBLY__
+struct s5pc1xx_smc {
+       unsigned int    bw;
+       unsigned int    bc[6];
+};
+#endif /* __ASSEMBLY__ */
+
+/* Configure the Band Width and Bank Control Regs for required SROMC Bank */
+void s5pc1xx_config_sromc(u32 srom_bank, u32 smc_bw_conf, u32 smc_bc_conf);
+
+#endif /* __ASM_ARCH_SMC_H_ */
index a8ba052..09bce6d 100644 (file)
@@ -83,7 +83,6 @@
 #undef CONFIG_CMD_FLASH
 #undef CONFIG_CMD_IMLS
 #undef CONFIG_CMD_NAND
-#undef CONFIG_CMD_NET
 
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 
 #define CONFIG_DOS_PARTITION           1
 
+/*
+ * Ethernet Contoller driver
+ */
+#ifdef CONFIG_CMD_NET
+#define CONFIG_NET_MULTI
+#define CONFIG_SMC911X         1       /* we have a SMC9115 on-board   */
+#define CONFIG_SMC911X_16_BIT  1       /* SMC911X_16_BIT Mode          */
+#define CONFIG_SMC911X_BASE    0x98800300      /* SMC911X Drive Base   */
+#define CONFIG_ENV_SROM_BANK   3       /* Select SROM Bank-3 for Ethernet*/
+#endif /* CONFIG_CMD_NET */
+
 #endif /* __CONFIG_H */