]> git.sur5r.net Git - u-boot/blobdiff - board/freescale/p1010rdb/p1010rdb.c
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
[u-boot] / board / freescale / p1010rdb / p1010rdb.c
index 03e9da19409163a7e599dba4011bff75e1033548..06aa8009b523f2b9604e57c92c5da2209716d2b1 100644 (file)
@@ -1,23 +1,7 @@
 /*
  * Copyright 2010-2011 Freescale Semiconductor, Inc.
  *
- * 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>
@@ -164,12 +148,8 @@ int checkboard(void)
 {
        struct cpu_type *cpu;
 
-       cpu = gd->cpu;
-       printf("Board: %sRDB ", cpu->name);
-#ifdef CONFIG_PHYS_64BIT
-       puts("(36-bit addrmap)");
-#endif
-       puts("\n");
+       cpu = gd->arch.cpu;
+       printf("Board: %sRDB\n", cpu->name);
 
        return 0;
 }
@@ -182,7 +162,7 @@ int board_eth_init(bd_t *bis)
        struct cpu_type *cpu;
        int num = 0;
 
-       cpu = gd->cpu;
+       cpu = gd->arch.cpu;
 
 #ifdef CONFIG_TSEC1
        SET_STD_TSEC_INFO(tsec_info[num], 1);
@@ -194,7 +174,7 @@ int board_eth_init(bd_t *bis)
 #endif
 #ifdef CONFIG_TSEC3
        /* P1014 and it's derivatives do not support eTSEC3 */
-       if (cpu->soc_ver != SVR_P1014 && cpu->soc_ver != SVR_P1014_E) {
+       if (cpu->soc_ver != SVR_P1014) {
                SET_STD_TSEC_INFO(tsec_info[num], 3);
                num++;
        }
@@ -221,7 +201,7 @@ void fdt_del_flexcan(void *blob)
        int nodeoff = 0;
 
        while ((nodeoff = fdt_node_offset_by_compatible(blob, 0,
-                               "fsl,flexcan-v1.0")) >= 0) {
+                               "fsl,p1010-flexcan")) >= 0) {
                fdt_del_node(blob, nodeoff);
        }
 }
@@ -256,13 +236,38 @@ void fdt_del_tdm(void *blob)
        }
 }
 
+void fdt_del_sdhc(void *blob)
+{
+       int nodeoff = 0;
+
+       while ((nodeoff = fdt_node_offset_by_compatible(blob, 0,
+                       "fsl,esdhc")) >= 0) {
+               fdt_del_node(blob, nodeoff);
+       }
+}
+
+void fdt_disable_uart1(void *blob)
+{
+       int nodeoff;
+
+       nodeoff = fdt_node_offset_by_compat_reg(blob, "fsl,ns16550",
+                                       CONFIG_SYS_NS16550_COM2);
+
+       if (nodeoff > 0) {
+               fdt_status_disabled(blob, nodeoff);
+       } else {
+               printf("WARNING unable to set status for fsl,ns16550 "
+                       "uart1: %s\n", fdt_strerror(nodeoff));
+       }
+}
+
 void ft_board_setup(void *blob, bd_t *bd)
 {
        phys_addr_t base;
        phys_size_t size;
        struct cpu_type *cpu;
 
-       cpu = gd->cpu;
+       cpu = gd->arch.cpu;
 
        ft_cpu_setup(blob, bd);
 
@@ -275,27 +280,36 @@ void ft_board_setup(void *blob, bd_t *bd)
 
        fdt_fixup_memory(blob, (u64)base, (u64)size);
 
+#if defined(CONFIG_HAS_FSL_DR_USB)
        fdt_fixup_dr_usb(blob, bd);
+#endif
 
        /* P1014 and it's derivatives don't support CAN and eTSEC3 */
-       if (cpu->soc_ver == SVR_P1014 || cpu->soc_ver == SVR_P1014_E) {
+       if (cpu->soc_ver == SVR_P1014) {
                fdt_del_flexcan(blob);
                fdt_del_node_and_alias(blob, "ethernet2");
        }
 #ifndef CONFIG_SDCARD
+       /* disable sdhc due to sdhc bug */
+       fdt_del_sdhc(blob);
        if (hwconfig_subarg_cmp("fsl_p1010mux", "tdm_can", "can")) {
-               printf("fdt CAN");
                fdt_del_tdm(blob);
                fdt_del_spi_slic(blob);
-       }
-#ifndef CONFIG_SPIFLASH
-       else if (hwconfig_subarg_cmp("fsl_p1010mux", "tdm_can", "tdm")) {
-               printf("fdt TDM");
+       } else if (hwconfig_subarg_cmp("fsl_p1010mux", "tdm_can", "tdm")) {
                fdt_del_flexcan(blob);
                fdt_del_spi_flash(blob);
+               fdt_disable_uart1(blob);
+       } else {
+               /*
+                * If we don't set fsl_p1010mux:tdm_can to "can" or "tdm"
+                * explicitly, defaultly spi_cs_sel to spi-flash instead of
+                * to tdm/slic.
+                */
+               fdt_del_tdm(blob);
+               fdt_del_flexcan(blob);
+               fdt_disable_uart1(blob);
        }
 #endif
-#endif
 }
 #endif
 
@@ -311,10 +325,7 @@ int misc_init_r(void)
                                MPC85xx_PMUXCR_CAN2_TDM |
                                MPC85xx_PMUXCR_CAN2_UART);
                out_8(&cpld_data->tdm_can_sel, MUX_CPLD_CAN_UART);
-       }
-#ifndef CONFIG_SPIFLASH
-               if (hwconfig_subarg_cmp("fsl_p1010mux", "tdm_can", "tdm")) {
-                       printf("TDM");
+       } else if (hwconfig_subarg_cmp("fsl_p1010mux", "tdm_can", "tdm")) {
                clrbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_CAN2_UART |
                                MPC85xx_PMUXCR_CAN1_UART);
                setbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_CAN2_TDM |
@@ -323,8 +334,11 @@ int misc_init_r(void)
                setbits_be32(&gur->pmuxcr2, MPC85xx_PMUXCR2_UART_TDM);
                out_8(&cpld_data->tdm_can_sel, MUX_CPLD_TDM);
                out_8(&cpld_data->spi_cs0_sel, MUX_CPLD_SPICS0_SLIC);
-               }
-#endif
+       } else {
+               /* defaultly spi_cs_sel to flash */
+               out_8(&cpld_data->spi_cs0_sel, MUX_CPLD_SPICS0_FLASH);
+       }
+
        return 0;
 }
 #endif