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 1928eb384e23170a70b33b341a638f8e2be4e733..4ab13b4d8eabcbaca3f6edbdf7f385cf0b79c617 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  *
  * (C) Copyright 2000-2003
@@ -5,27 +6,11 @@
  *
  * (C) Copyright 2004-2007, 2012 Freescale Semiconductor, Inc.
  * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
- *
- * 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 <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...
  *
@@ -105,11 +99,13 @@ void cpu_init_f(void)
        out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);
 #endif
 
-#ifdef CONFIG_FSL_I2C
+#ifdef CONFIG_SYS_I2C_FSL
        out_8(&gpio->par_i2c, GPIO_PAR_I2C_SCL_SCL | GPIO_PAR_I2C_SDA_SDA);
 #endif
 
        icache_enable();
+
+       cfspi_port_conf();
 }
 
 /*
@@ -154,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