m68k: Remove M54451EVB board
[platform/kernel/u-boot.git] / arch / m68k / cpu / mcf5445x / cpu_init.c
index 9c324dc..9b3f9f0 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/processor.h>
@@ -67,6 +68,25 @@ void init_fbcs(void)
 #endif
 }
 
+#ifdef CONFIG_CF_DSPI
+void cfspi_port_conf(void)
+{
+       gpio_t *gpio = (gpio_t *)MMAP_GPIO;
+
+#ifdef CONFIG_MCF5441x
+       pm_t *pm = (pm_t *)MMAP_PM;
+
+       out_8(&gpio->par_dspi0,
+             GPIO_PAR_DSPI0_SIN_DSPI0SIN | GPIO_PAR_DSPI0_SOUT_DSPI0SOUT |
+             GPIO_PAR_DSPI0_SCK_DSPI0SCK);
+       out_8(&gpio->srcr_dspiow, 3);
+
+       /* DSPI0 */
+       out_8(&pm->pmcr0, 23);
+#endif
+}
+#endif
+
 /*
  * Breath some life into the CPU...
  *
@@ -174,37 +194,21 @@ void cpu_init_f(void)
 
        /* Lowest slew rate for UART0,1,2 */
        out_8(&gpio->srcr_uart, 0x00);
-#endif         /* CONFIG_MCF5441x */
-
-#ifdef CONFIG_MCF5445x
-       scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
 
-       out_be32(&scm1->mpr, 0x77777777);
-       out_be32(&scm1->pacra, 0);
-       out_be32(&scm1->pacrb, 0);
-       out_be32(&scm1->pacrc, 0);
-       out_be32(&scm1->pacrd, 0);
-       out_be32(&scm1->pacre, 0);
-       out_be32(&scm1->pacrf, 0);
-       out_be32(&scm1->pacrg, 0);
-
-       /* FlexBus */
-       out_8(&gpio->par_be,
-               GPIO_PAR_BE_BE3_BE3 | GPIO_PAR_BE_BE2_BE2 |
-               GPIO_PAR_BE_BE1_BE1 | GPIO_PAR_BE_BE0_BE0);
-       out_8(&gpio->par_fbctl,
-               GPIO_PAR_FBCTL_OE | GPIO_PAR_FBCTL_TA_TA |
-               GPIO_PAR_FBCTL_RW_RW | GPIO_PAR_FBCTL_TS_TS);
+#ifdef CONFIG_FSL_ESDHC_IMX
+       /* eSDHC pin as faster speed */
+       out_8(&gpio->srcr_sdhc, 0x03);
 
-#ifdef CONFIG_SYS_FSL_I2C
-       out_be16(&gpio->par_feci2c,
-               GPIO_PAR_FECI2C_SCL_SCL | GPIO_PAR_FECI2C_SDA_SDA);
+       /* All esdhc pins as SD */
+       out_8(&gpio->par_sdhch, 0xff);
+       out_8(&gpio->par_sdhcl, 0xff);
 #endif
-#endif         /* CONFIG_MCF5445x */
+#endif         /* CONFIG_MCF5441x */
 
        /* FlexBus Chipselect */
        init_fbcs();
 
+#ifdef CONFIG_SYS_CS0_BASE
        /*
         * now the flash base address is no longer at 0 (Newer ColdFire family
         * boot at address 0 instead of 0xFFnn_nnnn). The vector table must
@@ -212,6 +216,7 @@ void cpu_init_f(void)
         */
        if (CONFIG_SYS_CS0_BASE != 0)
                setvbr(CONFIG_SYS_CS0_BASE);
+#endif
 
        icache_enable();
 }
@@ -323,88 +328,17 @@ void uart_port_conf(int port)
                        GPIO_PAR_CANI2C_CAN1TX_U9TXD | GPIO_PAR_CANI2C_CAN1RX_U9RXD);
                break;
 #endif
-#ifdef CONFIG_MCF5445x
-       case 0:
-               clrbits_8(&gpio->par_uart,
-                       GPIO_PAR_UART_U0TXD_U0TXD | GPIO_PAR_UART_U0RXD_U0RXD);
-               setbits_8(&gpio->par_uart,
-                       GPIO_PAR_UART_U0TXD_U0TXD | GPIO_PAR_UART_U0RXD_U0RXD);
-               break;
-       case 1:
-#ifdef CONFIG_SYS_UART1_PRI_GPIO
-               clrbits_8(&gpio->par_uart,
-                       GPIO_PAR_UART_U1TXD_U1TXD | GPIO_PAR_UART_U1RXD_U1RXD);
-               setbits_8(&gpio->par_uart,
-                       GPIO_PAR_UART_U1TXD_U1TXD | GPIO_PAR_UART_U1RXD_U1RXD);
-#elif defined(CONFIG_SYS_UART1_ALT1_GPIO)
-               clrbits_be16(&gpio->par_ssi,
-                       ~(GPIO_PAR_SSI_SRXD_UNMASK | GPIO_PAR_SSI_STXD_UNMASK));
-               setbits_be16(&gpio->par_ssi,
-                       GPIO_PAR_SSI_SRXD_U1RXD | GPIO_PAR_SSI_STXD_U1TXD);
-#endif
-               break;
-       case 2:
-#if defined(CONFIG_SYS_UART2_ALT1_GPIO)
-               clrbits_8(&gpio->par_timer,
-                       ~(GPIO_PAR_TIMER_T3IN_UNMASK | GPIO_PAR_TIMER_T2IN_UNMASK));
-               setbits_8(&gpio->par_timer,
-                       GPIO_PAR_TIMER_T3IN_U2RXD | GPIO_PAR_TIMER_T2IN_U2TXD);
-#elif defined(CONFIG_SYS_UART2_ALT2_GPIO)
-               clrbits_8(&gpio->par_timer,
-                       ~(GPIO_PAR_FECI2C_SCL_UNMASK | GPIO_PAR_FECI2C_SDA_UNMASK));
-               setbits_8(&gpio->par_timer,
-                       GPIO_PAR_FECI2C_SCL_U2TXD | GPIO_PAR_FECI2C_SDA_U2RXD);
-#endif
-               break;
-#endif /* CONFIG_MCF5445x */
        }
 }
 
 #if defined(CONFIG_CMD_NET)
-int fecpin_setclear(struct eth_device *dev, int setclear)
+int fecpin_setclear(fec_info_t *info, int setclear)
 {
        gpio_t *gpio = (gpio_t *) MMAP_GPIO;
-       struct fec_info_s *info = (struct fec_info_s *)dev->priv;
-
-#ifdef CONFIG_MCF5445x
-       if (setclear) {
-#ifdef CONFIG_SYS_FEC_NO_SHARED_PHY
-               if (info->iobase == CONFIG_SYS_FEC0_IOBASE)
-                       setbits_be16(&gpio->par_feci2c,
-                               GPIO_PAR_FECI2C_MDC0_MDC0 |
-                               GPIO_PAR_FECI2C_MDIO0_MDIO0);
-               else
-                       setbits_be16(&gpio->par_feci2c,
-                               GPIO_PAR_FECI2C_MDC1_MDC1 |
-                               GPIO_PAR_FECI2C_MDIO1_MDIO1);
-#else
-               setbits_be16(&gpio->par_feci2c,
-                       GPIO_PAR_FECI2C_MDC0_MDC0 | GPIO_PAR_FECI2C_MDIO0_MDIO0);
-#endif
+       u32 fec0_base;
 
-               if (info->iobase == CONFIG_SYS_FEC0_IOBASE)
-                       setbits_8(&gpio->par_fec, GPIO_PAR_FEC_FEC0_RMII_GPIO);
-               else
-                       setbits_8(&gpio->par_fec, GPIO_PAR_FEC_FEC1_RMII_ATA);
-       } else {
-               clrbits_be16(&gpio->par_feci2c,
-                       GPIO_PAR_FECI2C_MDC0_MDC0 | GPIO_PAR_FECI2C_MDIO0_MDIO0);
-
-               if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
-#ifdef CONFIG_SYS_FEC_FULL_MII
-                       setbits_8(&gpio->par_fec, GPIO_PAR_FEC_FEC0_MII);
-#else
-                       clrbits_8(&gpio->par_fec, ~GPIO_PAR_FEC_FEC0_UNMASK);
-#endif
-               } else {
-#ifdef CONFIG_SYS_FEC_FULL_MII
-                       setbits_8(&gpio->par_fec, GPIO_PAR_FEC_FEC1_MII);
-#else
-                       clrbits_8(&gpio->par_fec, ~GPIO_PAR_FEC_FEC1_UNMASK);
-#endif
-               }
-       }
-#endif /* CONFIG_MCF5445x */
+       if (fec_get_base_addr(0, &fec0_base))
+               return -1;
 
 #ifdef CONFIG_MCF5441x
        if (setclear) {
@@ -422,115 +356,3 @@ int fecpin_setclear(struct eth_device *dev, int setclear)
        return 0;
 }
 #endif
-
-#ifdef CONFIG_CF_DSPI
-void cfspi_port_conf(void)
-{
-       gpio_t *gpio = (gpio_t *) MMAP_GPIO;
-
-#ifdef CONFIG_MCF5445x
-       out_8(&gpio->par_dspi,
-               GPIO_PAR_DSPI_SIN_SIN |
-               GPIO_PAR_DSPI_SOUT_SOUT |
-               GPIO_PAR_DSPI_SCK_SCK);
-#endif
-
-#ifdef CONFIG_MCF5441x
-       pm_t *pm = (pm_t *) MMAP_PM;
-
-       out_8(&gpio->par_dspi0,
-               GPIO_PAR_DSPI0_SIN_DSPI0SIN | GPIO_PAR_DSPI0_SOUT_DSPI0SOUT |
-               GPIO_PAR_DSPI0_SCK_DSPI0SCK);
-       out_8(&gpio->srcr_dspiow, 3);
-
-       /* DSPI0 */
-       out_8(&pm->pmcr0, 23);
-#endif
-}
-
-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);
-
-#ifdef CONFIG_MCF5445x
-       switch (cs) {
-       case 0:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);
-               setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);
-               break;
-       case 1:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS1_PCS1);
-               setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS1_PCS1);
-               break;
-       case 2:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS2_PCS2);
-               setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS2_PCS2);
-               break;
-       case 3:
-               clrbits_8(&gpio->par_dma, ~GPIO_PAR_DMA_DACK0_UNMASK);
-               setbits_8(&gpio->par_dma, GPIO_PAR_DMA_DACK0_PCS3);
-               break;
-       case 5:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS5_PCS5);
-               setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS5_PCS5);
-               break;
-       }
-#endif
-
-#ifdef CONFIG_MCF5441x
-       switch (cs) {
-       case 0:
-               clrbits_8(&gpio->par_dspi0, ~GPIO_PAR_DSPI0_PCS0_MASK);
-               setbits_8(&gpio->par_dspi0, GPIO_PAR_DSPI0_PCS0_DSPI0PCS0);
-               break;
-       case 1:
-               clrbits_8(&gpio->par_dspiow, GPIO_PAR_DSPIOW_DSPI0PSC1);
-               setbits_8(&gpio->par_dspiow, GPIO_PAR_DSPIOW_DSPI0PSC1);
-               break;
-       }
-#endif
-
-       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);
-
-#ifdef CONFIG_MCF5445x
-       switch (cs) {
-       case 0:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);
-               break;
-       case 1:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS1_PCS1);
-               break;
-       case 2:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS2_PCS2);
-               break;
-       case 3:
-               clrbits_8(&gpio->par_dma, ~GPIO_PAR_DMA_DACK0_UNMASK);
-               break;
-       case 5:
-               clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS5_PCS5);
-               break;
-       }
-#endif
-
-#ifdef CONFIG_MCF5441x
-       if (cs == 1)
-               clrbits_8(&gpio->par_dspiow, GPIO_PAR_DSPIOW_DSPI0PSC1);
-#endif
-}
-#endif