common: Move clock functions into a new file
[oweals/u-boot.git] / arch / m68k / cpu / mcf52x2 / cpu_init.c
index 5d0e9f06f372c577c7ece92f57e5e251409077d4..f39fe19baf272009a97031193d4566e7c9bab6af 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2003
  * Josef Baumgartner <josef.baumgartner@telex.de>
  *
  * MCF5275 additions
  * Copyright (C) 2008 Arthur Shipkowski (art@videon-central.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 <watchdog.h>
 #include <asm/immap.h>
 #include <asm/io.h>
@@ -174,7 +158,7 @@ void uart_port_conf(int port)
 }
 
 #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;
 
@@ -228,7 +212,7 @@ void cpu_init_f(void)
        /* FlexBus Chipselect */
        init_fbcs();
 
-#ifdef CONFIG_FSL_I2C
+#ifdef CONFIG_SYS_I2C_FSL
        CONFIG_SYS_I2C_PINMUX_REG =
            CONFIG_SYS_I2C_PINMUX_REG & CONFIG_SYS_I2C_PINMUX_CLR;
        CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET;
@@ -321,7 +305,7 @@ void uart_port_conf(int port)
 }
 
 #if defined(CONFIG_CMD_NET)
-int fecpin_setclear(struct eth_device *dev, int setclear)
+int fecpin_setclear(fec_info_t *info, int setclear)
 {
        if (setclear) {
                /* Enable Ethernet pins */
@@ -334,18 +318,6 @@ int fecpin_setclear(struct eth_device *dev, int setclear)
 }
 #endif                         /* CONFIG_CMD_NET */
 
-#if defined(CONFIG_CF_QSPI)
-
-/* Configure PIOs for SIN, SOUT, and SCK */
-void cfspi_port_conf(void)
-{
-       mbar_writeByte(MCF_GPIO_PAR_QSPI,
-                      MCF_GPIO_PAR_QSPI_SIN_SIN   |
-                      MCF_GPIO_PAR_QSPI_SOUT_SOUT |
-                      MCF_GPIO_PAR_QSPI_SCK_SCK);
-}
-#endif                         /* CONFIG_CF_QSPI */
-
 #endif                         /* CONFIG_M5271 */
 
 #if defined(CONFIG_M5272)
@@ -454,7 +426,7 @@ void uart_port_conf(int port)
 }
 
 #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;
 
@@ -498,7 +470,7 @@ void cpu_init_f(void)
        init_fbcs();
 #endif                         /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
 
-#ifdef CONFIG_FSL_I2C
+#ifdef CONFIG_SYS_I2C_FSL
        CONFIG_SYS_I2C_PINMUX_REG &= CONFIG_SYS_I2C_PINMUX_CLR;
        CONFIG_SYS_I2C_PINMUX_REG |= CONFIG_SYS_I2C_PINMUX_SET;
 #endif
@@ -537,14 +509,17 @@ void uart_port_conf(int port)
 }
 
 #if defined(CONFIG_CMD_NET)
-int fecpin_setclear(struct eth_device *dev, int setclear)
+int fecpin_setclear(fec_info_t *info, int setclear)
 {
-       struct fec_info_s *info = (struct fec_info_s *) dev->priv;
        gpio_t *gpio = (gpio_t *)MMAP_GPIO;
+       u32 fec0_base;
+
+       if (fec_get_base_addr(0, &fec0_base))
+               return -1;
 
        if (setclear) {
                /* Enable Ethernet pins */
-               if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
+               if (info->iobase == fec0_base) {
                        setbits_be16(&gpio->par_feci2c, 0x0f00);
                        setbits_8(&gpio->par_fec0hl, 0xc0);
                } else {
@@ -552,7 +527,7 @@ int fecpin_setclear(struct eth_device *dev, int setclear)
                        setbits_8(&gpio->par_fec1hl, 0xc0);
                }
        } else {
-               if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
+               if (info->iobase == fec0_base) {
                        clrbits_be16(&gpio->par_feci2c, 0x0f00);
                        clrbits_8(&gpio->par_fec0hl, 0xc0);
                } else {
@@ -672,7 +647,7 @@ void uart_port_conf(int port)
 }
 
 #if defined(CONFIG_CMD_NET)
-int fecpin_setclear(struct eth_device *dev, int setclear)
+int fecpin_setclear(fec_info_t *info, int setclear)
 {
        if (setclear) {
                MCFGPIO_PASPAR |= 0x0F00;