powerpc: mpc83xx: fdt: Use get_serial_clock()
[oweals/u-boot.git] / arch / powerpc / cpu / mpc83xx / fdt.c
index daf73a6e5ab164fba02beb5ea046be87b1a7c56d..b487e31cc0f75fe9deff81da11d792763efbe370 100644 (file)
@@ -1,30 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2007 Freescale Semiconductor, Inc.
  *
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * 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 <libfdt.h>
+#include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <asm/processor.h>
 
@@ -32,8 +15,9 @@ extern void ft_qe_setup(void *blob);
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_BOOTCOUNT_LIMIT) && defined(CONFIG_MPC8360)
-#include <asm/immap_qe.h>
+#if defined(CONFIG_BOOTCOUNT_LIMIT) && \
+       (defined(CONFIG_QE) && !defined(CONFIG_ARCH_MPC831X))
+#include <linux/immap_qe.h>
 
 void fdt_fixup_muram (void *blob)
 {
@@ -68,8 +52,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
     defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) ||\
     defined(CONFIG_HAS_ETH4) || defined(CONFIG_HAS_ETH5)
-       fdt_fixup_ethernet(blob);
-#ifdef CONFIG_MPC8313
+#ifdef CONFIG_ARCH_MPC8313
        /*
        * mpc8313e erratum IPIC1 swapped TSEC interrupt ID numbers on rev. 1
        * h/w (see AN3545).  The base device tree in use has rev. 1 ID numbers,
@@ -87,7 +70,8 @@ void ft_cpu_setup(void *blob, bd_t *bd)
                                u32 tmp[] = { 32, 0x8, 33, 0x8, 34, 0x8 };
 
                                path = fdt_path_offset(blob, prop);
-                               prop = fdt_getprop(blob, path, "interrupts", 0);
+                               prop = fdt_getprop(blob, path, "interrupts",
+                                                  NULL);
                                if (prop)
                                        fdt_setprop(blob, path, "interrupts",
                                                    &tmp, sizeof(tmp));
@@ -99,7 +83,8 @@ void ft_cpu_setup(void *blob, bd_t *bd)
                                u32 tmp[] = { 35, 0x8, 36, 0x8, 37, 0x8 };
 
                                path = fdt_path_offset(blob, prop);
-                               prop = fdt_getprop(blob, path, "interrupts", 0);
+                               prop = fdt_getprop(blob, path, "interrupts",
+                                                  NULL);
                                if (prop)
                                        fdt_setprop(blob, path, "interrupts",
                                                    &tmp, sizeof(tmp));
@@ -115,7 +100,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
        do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
                "bus-frequency", bd->bi_busfreq, 1);
        do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
-               "clock-frequency", gd->core_clk, 1);
+               "clock-frequency", gd->arch.core_clk, 1);
        do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
                "bus-frequency", bd->bi_busfreq, 1);
        do_fixup_by_compat_u32(blob, "fsl,soc",
@@ -131,13 +116,14 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #endif
 
 #ifdef CONFIG_SYS_NS16550
-       do_fixup_by_compat_u32(blob, "ns16550",
-               "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
+        do_fixup_by_compat_u32(blob, "ns16550",
+                "clock-frequency", get_serial_clock(), 1);
 #endif
 
        fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 
-#if defined(CONFIG_BOOTCOUNT_LIMIT)
+#if defined(CONFIG_BOOTCOUNT_LIMIT) && \
+       (defined(CONFIG_QE) && !defined(CONFIG_ARCH_MPC831X))
        fdt_fixup_muram (blob);
 #endif
 }