command: Remove the cmd_tbl_t typedef
[oweals/u-boot.git] / board / renesas / sh7757lcr / sh7757lcr.c
index a62be24cd870ef7a6a0eca7380c1bd3862367098..5e76b9e7b4c1762652582d1860e6e7d03e7501f1 100644 (file)
@@ -1,29 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2011  Renesas Solutions Corp.
- *
- * 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 <command.h>
+#include <env.h>
+#include <flash.h>
+#include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <asm/processor.h>
 #include <asm/io.h>
+#include <asm/mmc.h>
+#include <spi.h>
 #include <spi_flash.h>
 
 int checkboard(void)
@@ -44,6 +34,7 @@ static void init_gctrl(void)
 
 static int init_pcie_bridge_from_spi(void *buf, size_t size)
 {
+#ifdef CONFIG_DEPRECATED
        struct spi_flash *spi;
        int ret;
        unsigned long pcie_addr;
@@ -68,6 +59,10 @@ static int init_pcie_bridge_from_spi(void *buf, size_t size)
        spi_flash_free(spi);
 
        return 0;
+#else
+       printf("No SPI support so no PCIe support\n");
+       return 1;
+#endif
 }
 
 static void init_pcie_bridge(void)
@@ -149,7 +144,7 @@ static void set_mac_to_sh_eth_register(int channel, char *mac_string)
        unsigned char mac[6];
        unsigned long val;
 
-       eth_parse_enetaddr(mac_string, mac);
+       string_to_enetaddr(mac_string, mac);
 
        if (!channel)
                ether = ETHER0_MAC_BASE;
@@ -168,7 +163,7 @@ static void set_mac_to_sh_giga_eth_register(int channel, char *mac_string)
        unsigned char mac[6];
        unsigned long val;
 
-       eth_parse_enetaddr(mac_string, mac);
+       string_to_enetaddr(mac_string, mac);
 
        if (!channel)
                ether = GETHER0_MAC_BASE;
@@ -238,33 +233,14 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
+int board_mmc_init(bd_t *bis)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       printf("    Physical address\n");
-       printf("    0x%08x - 0x%08x : Accessible Space as ECC Area\n",
-               SH7757LCR_SDRAM_PHYS_TOP,
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_SIZE - 1);
-       printf("    0x%08x - 0x%08x : No Access Area\n",
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_SIZE,
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_SIZE * 2 - 1);
-       printf("    0x%08x - 0x%08x : Non-ECC Area for DVC/AVC\n",
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_ECC_SETTING * 2,
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_ECC_SETTING * 2 +
-                       SH7757LCR_SDRAM_DVC_SIZE - 1);
-       printf("    0x%08x - 0x%08x : Non-ECC Area for G200eR2\n",
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_GRA_OFFSET,
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_GRA_OFFSET + 0x00ffffff);
-
-       return 0;
+       return mmcif_mmc_init();
 }
 
 static int get_sh_eth_mac_raw(unsigned char *buf, int size)
 {
+#ifdef CONFIG_DEPRECATED
        struct spi_flash *spi;
        int ret;
 
@@ -281,6 +257,7 @@ static int get_sh_eth_mac_raw(unsigned char *buf, int size)
                return 1;
        }
        spi_flash_free(spi);
+#endif
 
        return 0;
 }
@@ -312,10 +289,10 @@ static void init_ethernet_mac(void)
        for (i = 0; i < SH7757LCR_ETHERNET_NUM_CH; i++) {
                get_sh_eth_mac(i, mac_string, buf);
                if (i == 0)
-                       setenv("ethaddr", mac_string);
+                       env_set("ethaddr", mac_string);
                else {
                        sprintf(env_string, "eth%daddr", i);
-                       setenv(env_string, mac_string);
+                       env_set(env_string, mac_string);
                }
 
                set_mac_to_sh_eth_register(i, mac_string);
@@ -325,7 +302,7 @@ static void init_ethernet_mac(void)
        for (i = 0; i < SH7757LCR_GIGA_ETHERNET_NUM_CH; i++) {
                get_sh_eth_mac(i + SH7757LCR_ETHERNET_NUM_CH, mac_string, buf);
                sprintf(env_string, "eth%daddr", i + SH7757LCR_ETHERNET_NUM_CH);
-               setenv(env_string, mac_string);
+               env_set(env_string, mac_string);
 
                set_mac_to_sh_giga_eth_register(i, mac_string);
        }
@@ -368,7 +345,7 @@ int board_late_init(void)
        return 0;
 }
 
-int do_sh_g200(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_sh_g200(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        struct gctrl_regs *gctrl = GCTRL_BASE;
        unsigned long graofst;
@@ -386,7 +363,8 @@ U_BOOT_CMD(
        "enable SH-G200 bus (disable PCIe-G200)"
 );
 
-int do_write_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+#ifdef CONFIG_DEPRECATED
+int do_write_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        int i, ret;
        char mac_string[256];
@@ -452,3 +430,4 @@ U_BOOT_CMD(
        "write MAC address for ETHERC/GETHERC",
        "[ETHERC ch0] [ETHERC ch1] [GETHERC ch0] [GETHERC ch1]\n"
 );
+#endif