dm: Use dm.h header when driver mode is used
[oweals/u-boot.git] / board / toradex / colibri_pxa270 / colibri_pxa270.c
index c1e25623488d63ae2f3c7c0f72ca6d59d1dec894..5d62e66495b5826bc2269d861fe09855fba3dd9c 100644 (file)
@@ -2,17 +2,24 @@
  * Toradex Colibri PXA270 Support
  *
  * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
+ * Copyright (C) 2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>
  *
  * 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;
 
@@ -22,7 +29,7 @@ int board_init(void)
        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 */
@@ -31,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();
@@ -39,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),
@@ -70,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)
@@ -104,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,
+};