]> git.sur5r.net Git - u-boot/blobdiff - board/timll/devkit8000/devkit8000.c
env: Rename eth_getenv_enetaddr() to eth_env_get_enetaddr()
[u-boot] / board / timll / devkit8000 / devkit8000.c
index 10f189eed4a6a10439a1c2ce0b7c91d56dc203c0..741b3acce275378b2c996488d3a6bbd5865d6dcf 100644 (file)
  *     Syed Mohammed Khasim <khasim@ti.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
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
+#include <dm.h>
+#include <ns16550.h>
 #include <twl4030.h>
 #include <asm/io.h>
 #include <asm/arch/mmc_host_def.h>
@@ -41,6 +27,7 @@
 #include <asm/arch/mem.h>
 #include <asm/mach-types.h>
 #include "devkit8000.h"
+#include <asm/gpio.h>
 #ifdef CONFIG_DRIVER_DM9000
 #include <net.h>
 #include <netdev.h>
@@ -58,6 +45,18 @@ static u32 gpmc_net_config[GPMC_MAX_REG] = {
        0
 };
 
+static const struct ns16550_platdata devkit8000_serial = {
+       .base = OMAP34XX_UART3,
+       .reg_shift = 2,
+       .clock = V_NS16550_CLK,
+       .fcr = UART_FCR_DEFVAL,
+};
+
+U_BOOT_DEVICE(devkit8000_uart) = {
+       "ns16550_serial",
+       &devkit8000_serial
+};
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -73,6 +72,13 @@ int board_init(void)
        return 0;
 }
 
+/* Configure GPMC registers for DM9000 */
+static void gpmc_dm9000_config(void)
+{
+       enable_gpmc_cs_config(gpmc_net_config, &gpmc_cfg->cs[6],
+               CONFIG_DM9000_BASE, GPMC_SIZE_16M);
+}
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -96,7 +102,7 @@ int misc_init_r(void)
                        CONFIG_DM9000_BASE, GPMC_SIZE_16M);
 
        /* Use OMAP DIE_ID as MAC address */
-       if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
+       if (!eth_env_get_enetaddr("ethaddr", enetaddr)) {
                printf("ethaddr not set, using Die ID\n");
                die_id_0 = readl(&id_base->die_id_0);
                enetaddr[0] = 0x02; /* locally administered */
@@ -105,11 +111,11 @@ int misc_init_r(void)
                enetaddr[3] = (die_id_0 & 0x00ff0000) >> 16;
                enetaddr[4] = (die_id_0 & 0x0000ff00) >> 8;
                enetaddr[5] = (die_id_0 & 0x000000ff);
-               eth_setenv_enetaddr("ethaddr", enetaddr);
+               eth_env_set_enetaddr("ethaddr", enetaddr);
        }
 #endif
 
-       dieid_num_r();
+       omap_die_id_display();
 
        return 0;
 }
@@ -125,11 +131,17 @@ void set_muxconf_regs(void)
        MUX_DEVKIT8000();
 }
 
-#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
+#if defined(CONFIG_MMC)
 int board_mmc_init(bd_t *bis)
 {
-       omap_mmc_init(0);
-       return 0;
+       return omap_mmc_init(0, 0, 0, -1, -1);
+}
+#endif
+
+#if defined(CONFIG_MMC)
+void board_mmc_power_init(void)
+{
+       twl4030_power_mmc_init(0);
 }
 #endif
 
@@ -144,6 +156,35 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
+#ifdef CONFIG_SPL_OS_BOOT
+/*
+ * Do board specific preparation before SPL
+ * Linux boot
+ */
+void spl_board_prepare_for_linux(void)
+{
+       gpmc_dm9000_config();
+}
+
+/*
+ * devkit8000 specific implementation of spl_start_uboot()
+ *
+ * RETURN
+ * 0 if the button is not pressed
+ * 1 if the button is pressed
+ */
+int spl_start_uboot(void)
+{
+       int val = 0;
+       if (!gpio_request(SPL_OS_BOOT_KEY, "U-Boot key")) {
+               gpio_direction_input(SPL_OS_BOOT_KEY);
+               val = gpio_get_value(SPL_OS_BOOT_KEY);
+               gpio_free(SPL_OS_BOOT_KEY);
+       }
+       return !val;
+}
+#endif
+
 /*
  * Routine: get_board_mem_timings
  * Description: If we use SPL then there is no x-loader nor config header
@@ -151,16 +192,15 @@ int board_eth_init(bd_t *bis)
  * provides the timing values back to the function that configures
  * the memory.  We have either one or two banks of 128MB DDR.
  */
-void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
-               u32 *mr)
+void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
        /* General SDRC config */
-       *mcfg = MICRON_V_MCFG_165(128 << 20);
-       *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
+       timings->mcfg = MICRON_V_MCFG_165(128 << 20);
+       timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
 
        /* AC timings */
-       *ctrla = MICRON_V_ACTIMA_165;
-       *ctrlb = MICRON_V_ACTIMB_165;
+       timings->ctrla = MICRON_V_ACTIMA_165;
+       timings->ctrlb = MICRON_V_ACTIMB_165;
 
-       *mr = MICRON_V_MR_165;
+       timings->mr = MICRON_V_MR_165;
 }