Merge git://git.denx.de/u-boot-sunxi
[platform/kernel/u-boot.git] / board / toradex / colibri_pxa270 / colibri_pxa270.c
index d72e5d6..5d62e66 100644 (file)
@@ -2,45 +2,34 @@
  * Toradex Colibri PXA270 Support
  *
  * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
+ * Copyright (C) 2016 Marcel Ziswiler <marcel.ziswiler@toradex.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
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <dm.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/regs-mmc.h>
 #include <asm/arch/pxa.h>
-#include <netdev.h>
+#include <asm/arch/regs-mmc.h>
+#include <asm/arch/regs-uart.h>
 #include <asm/io.h>
+#include <dm/platdata.h>
+#include <dm/platform_data/serial_pxa.h>
+#include <netdev.h>
 #include <serial.h>
+#include <usb.h>
+#include "../common/tdx-common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct serial_device *default_serial_console(void)
-{
-       return &serial_ffuart_device;
-}
-
 int board_init(void)
 {
        /* We have RAM, disable cache */
        dcache_disable();
        icache_disable();
 
-       /* arch number of vpac270 */
+       /* arch number of Toradex Colibri PXA270 */
        gd->bd->bi_arch_number = MACH_TYPE_COLIBRI;
 
        /* adress of boot parameters */
@@ -49,6 +38,20 @@ int board_init(void)
        return 0;
 }
 
+int checkboard(void)
+{
+       puts("Model: Toradex Colibri PXA270\n");
+
+       return 0;
+}
+
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+       return ft_common_board_setup(blob, bd);
+}
+#endif
+
 int dram_init(void)
 {
        pxa2xx_dram_init();
@@ -57,7 +60,7 @@ int dram_init(void)
 }
 
 #ifdef CONFIG_CMD_USB
-int usb_board_init(void)
+int board_usb_init(int index, enum usb_init_type init)
 {
        writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) &
                ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
@@ -88,9 +91,9 @@ int usb_board_init(void)
        return 0;
 }
 
-void usb_board_init_fail(void)
+int board_usb_cleanup(int index, enum usb_init_type init)
 {
-       return;
+       return 0;
 }
 
 void usb_board_stop(void)
@@ -122,3 +125,14 @@ int board_mmc_init(bd_t *bis)
        return 0;
 }
 #endif
+
+static const struct pxa_serial_platdata serial_platdata = {
+       .base = (struct pxa_uart_regs *)FFUART_BASE,
+       .port = FFUART_INDEX,
+       .baudrate = CONFIG_BAUDRATE,
+};
+
+U_BOOT_DEVICE(pxa_serials) = {
+       .name = "serial_pxa",
+       .platdata = &serial_platdata,
+};