Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / m68k / cpu / mcf5227x / cpu_init.c
index 91b5fadc8809493d3a97b232d8cea9247fdf7139..4ab13b4d8eabcbaca3f6edbdf7f385cf0b79c617 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *
  * (C) Copyright 2000-2003
@@ -5,11 +6,11 @@
  *
  * (C) Copyright 2004-2007, 2012 Freescale Semiconductor, Inc.
  * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <cpu_func.h>
+#include <init.h>
 #include <watchdog.h>
 
 #include <asm/immap.h>
 #include <asm/rtc.h>
 #include <linux/compiler.h>
 
+void cfspi_port_conf(void)
+{
+       gpio_t *gpio = (gpio_t *)MMAP_GPIO;
+
+       out_8(&gpio->par_dspi,
+             GPIO_PAR_DSPI_SIN_SIN | GPIO_PAR_DSPI_SOUT_SOUT |
+             GPIO_PAR_DSPI_SCK_SCK);
+}
+
 /*
  * Breath some life into the CPU...
  *
@@ -94,6 +104,8 @@ void cpu_init_f(void)
 #endif
 
        icache_enable();
+
+       cfspi_port_conf();
 }
 
 /*
@@ -138,57 +150,3 @@ void uart_port_conf(int port)
                break;
        }
 }
-
-#ifdef CONFIG_CF_DSPI
-void cfspi_port_conf(void)
-{
-       gpio_t *gpio = (gpio_t *) MMAP_GPIO;
-
-       out_8(&gpio->par_dspi,
-               GPIO_PAR_DSPI_SIN_SIN | GPIO_PAR_DSPI_SOUT_SOUT |
-               GPIO_PAR_DSPI_SCK_SCK);
-}
-
-int cfspi_claim_bus(uint bus, uint cs)
-{
-       dspi_t *dspi = (dspi_t *) MMAP_DSPI;
-       gpio_t *gpio = (gpio_t *) MMAP_GPIO;
-
-       if ((in_be32(&dspi->sr) & DSPI_SR_TXRXS) != DSPI_SR_TXRXS)
-               return -1;
-
-       /* Clear FIFO and resume transfer */
-       clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF);
-
-       switch (cs) {
-       case 0:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_UNMASK);
-               setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);
-               break;
-       case 2:
-               clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK);
-               setbits_8(&gpio->par_timer, GPIO_PAR_TIMER_T2IN_DSPIPCS2);
-               break;
-       }
-
-       return 0;
-}
-
-void cfspi_release_bus(uint bus, uint cs)
-{
-       dspi_t *dspi = (dspi_t *) MMAP_DSPI;
-       gpio_t *gpio = (gpio_t *) MMAP_GPIO;
-
-       /* Clear FIFO */
-       clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF);
-
-       switch (cs) {
-       case 0:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);
-               break;
-       case 2:
-               clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK);
-               break;
-       }
-}
-#endif