Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Set com(4) frequency in ibm4xx_device_register() in...



details:   https://anonhg.NetBSD.org/src/rev/a55fc2ec038b
branches:  trunk
changeset: 960803:a55fc2ec038b
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Mar 29 13:38:31 2021 +0000

description:
Set com(4) frequency in ibm4xx_device_register() in order to dedup codes.

diffstat:

 sys/arch/evbppc/conf/files.obs405         |   3 +-
 sys/arch/evbppc/obs405/obs200_autoconf.c  |   6 +-
 sys/arch/evbppc/obs405/obs266_autoconf.c  |   6 +-
 sys/arch/evbppc/obs405/obs405_autoconf.c  |  62 -------------------------------
 sys/arch/evbppc/obs405/obs600_autoconf.c  |   6 +-
 sys/arch/evbppc/walnut/autoconf.c         |  21 +---------
 sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c |  13 +++++-
 sys/arch/powerpc/include/ibm4xx/cpu.h     |   4 +-
 8 files changed, 25 insertions(+), 96 deletions(-)

diffs (260 lines):

diff -r 91d563d83fb6 -r a55fc2ec038b sys/arch/evbppc/conf/files.obs405
--- a/sys/arch/evbppc/conf/files.obs405 Mon Mar 29 13:17:53 2021 +0000
+++ b/sys/arch/evbppc/conf/files.obs405 Mon Mar 29 13:38:31 2021 +0000
@@ -1,11 +1,10 @@
-#      $NetBSD: files.obs405,v 1.21 2010/03/18 13:47:04 kiyohara Exp $
+#      $NetBSD: files.obs405,v 1.22 2021/03/29 13:38:31 rin Exp $
 #
 # obs405-specific configuration info
 
 file   arch/powerpc/ibm4xx/ibm4xx_autoconf.c
 file   arch/powerpc/ibm4xx/ibm40x_machdep.c
 file   arch/powerpc/ibm4xx/ibm4xx_machdep.c
-file   arch/evbppc/obs405/obs405_autoconf.c
 file   arch/evbppc/obs405/obs405_machdep.c
 
 # Memory Disk for install kernel
diff -r 91d563d83fb6 -r a55fc2ec038b sys/arch/evbppc/obs405/obs200_autoconf.c
--- a/sys/arch/evbppc/obs405/obs200_autoconf.c  Mon Mar 29 13:17:53 2021 +0000
+++ b/sys/arch/evbppc/obs405/obs200_autoconf.c  Mon Mar 29 13:38:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obs200_autoconf.c,v 1.8 2021/03/02 07:21:01 rin Exp $  */
+/*     $NetBSD: obs200_autoconf.c,v 1.9 2021/03/29 13:38:31 rin Exp $  */
 
 /*
  * Copyright 2004 Shigeyuki Fukushima.
@@ -33,7 +33,7 @@
  * DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obs200_autoconf.c,v 1.8 2021/03/02 07:21:01 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obs200_autoconf.c,v 1.9 2021/03/29 13:38:31 rin Exp $");
 
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -69,5 +69,5 @@
 void device_register(device_t dev, void *aux)
 {
 
-       obs405_device_register(dev, aux, OBS200_COM_FREQ);
+       ibm4xx_device_register(dev, aux, OBS200_COM_FREQ);
 }
diff -r 91d563d83fb6 -r a55fc2ec038b sys/arch/evbppc/obs405/obs266_autoconf.c
--- a/sys/arch/evbppc/obs405/obs266_autoconf.c  Mon Mar 29 13:17:53 2021 +0000
+++ b/sys/arch/evbppc/obs405/obs266_autoconf.c  Mon Mar 29 13:38:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obs266_autoconf.c,v 1.8 2021/03/02 07:21:01 rin Exp $  */
+/*     $NetBSD: obs266_autoconf.c,v 1.9 2021/03/29 13:38:31 rin Exp $  */
 
 /*
  * Copyright 2004 Shigeyuki Fukushima.
@@ -33,7 +33,7 @@
  * DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obs266_autoconf.c,v 1.8 2021/03/02 07:21:01 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obs266_autoconf.c,v 1.9 2021/03/29 13:38:31 rin Exp $");
 
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -69,5 +69,5 @@
 device_register(device_t dev, void *aux)
 {
 
-       obs405_device_register(dev, aux, OBS266_COM_FREQ);
+       ibm4xx_device_register(dev, aux, OBS266_COM_FREQ);
 }
diff -r 91d563d83fb6 -r a55fc2ec038b sys/arch/evbppc/obs405/obs405_autoconf.c
--- a/sys/arch/evbppc/obs405/obs405_autoconf.c  Mon Mar 29 13:17:53 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*     $NetBSD: obs405_autoconf.c,v 1.7 2021/03/29 13:17:53 rin Exp $  */
-
-/*
- * Copyright 2004 Shigeyuki Fukushima.
- * All rights reserved.
- *
- * Written by Shigeyuki Fukushima for The NetBSD Project.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer in the documentation and/or other materials provided
- *    with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- */
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obs405_autoconf.c,v 1.7 2021/03/29 13:17:53 rin Exp $");
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/systm.h>
-#include <sys/device_if.h>
-#include <sys/cpu.h>
-
-#include <machine/obs405.h>
-
-#include <powerpc/ibm4xx/cpu.h>
-#include <powerpc/ibm4xx/dev/comopbvar.h>
-
-void
-obs405_device_register(device_t dev, void *aux, int com_freq)
-{
-       device_t parent = device_parent(dev);
-
-       /* register "com" device */
-       if (device_is_a(dev, "com") && device_is_a(parent, "opb")) {
-               /* Set the frequency of the on-chip UART. */
-               com_opb_device_register(dev, com_freq);
-               return;
-       }
-
-       ibm4xx_device_register(dev, aux);
-}
diff -r 91d563d83fb6 -r a55fc2ec038b sys/arch/evbppc/obs405/obs600_autoconf.c
--- a/sys/arch/evbppc/obs405/obs600_autoconf.c  Mon Mar 29 13:17:53 2021 +0000
+++ b/sys/arch/evbppc/obs405/obs600_autoconf.c  Mon Mar 29 13:38:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obs600_autoconf.c,v 1.10 2021/03/02 07:27:24 rin Exp $ */
+/*     $NetBSD: obs600_autoconf.c,v 1.11 2021/03/29 13:38:31 rin Exp $ */
 
 /*
  * Copyright 2004 Shigeyuki Fukushima.
@@ -33,7 +33,7 @@
  * DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.10 2021/03/02 07:27:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.11 2021/03/29 13:38:31 rin Exp $");
 
 #include "dwctwo.h"
 
@@ -126,5 +126,5 @@
        }
 #endif
 
-       obs405_device_register(dev, aux, OBS600_COM_FREQ);
+       ibm4xx_device_register(dev, aux, OBS600_COM_FREQ);
 }
diff -r 91d563d83fb6 -r a55fc2ec038b sys/arch/evbppc/walnut/autoconf.c
--- a/sys/arch/evbppc/walnut/autoconf.c Mon Mar 29 13:17:53 2021 +0000
+++ b/sys/arch/evbppc/walnut/autoconf.c Mon Mar 29 13:38:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.23 2021/03/29 13:17:53 rin Exp $        */
+/*     $NetBSD: autoconf.c,v 1.24 2021/03/29 13:38:31 rin Exp $        */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.23 2021/03/29 13:17:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.24 2021/03/29 13:38:31 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -77,21 +77,6 @@
 void
 device_register(device_t dev, void *aux)
 {
-       device_t parent = device_parent(dev);
 
-       if (device_is_a(dev, "com") && device_is_a(parent, "opb")) {
-               /* Set the frequency of the on-chip UART. */
-               prop_number_t pn = prop_number_create_integer(COM_FREQ * 6);
-               KASSERT(pn != NULL);
-
-               if (prop_dictionary_set(device_properties(dev),
-                                       "clock-frequency", pn) == false) {
-                       printf("WARNING: unable to set clock-frequency "
-                           "property for %s\n", device_xname(dev));
-               }
-               prop_object_release(pn);
-               return;
-       }
-
-       ibm4xx_device_register(dev, aux);
+       ibm4xx_device_register(dev, aux, COM_FREQ * 6);
 }
diff -r 91d563d83fb6 -r a55fc2ec038b sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c
--- a/sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c Mon Mar 29 13:17:53 2021 +0000
+++ b/sys/arch/powerpc/ibm4xx/ibm4xx_autoconf.c Mon Mar 29 13:38:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibm4xx_autoconf.c,v 1.16 2021/03/29 13:17:53 rin Exp $ */
+/*     $NetBSD: ibm4xx_autoconf.c,v 1.17 2021/03/29 13:40:21 rin Exp $ */
 /*     Original Tag: ibm4xxgpx_autoconf.c,v 1.2 2004/10/23 17:12:22 thorpej Exp $      */
 
 /*
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.16 2021/03/29 13:17:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.17 2021/03/29 13:40:21 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -45,6 +45,7 @@
 #include <net/if_ether.h>
 
 #include <powerpc/ibm4xx/cpu.h>
+#include <powerpc/ibm4xx/dev/comopbvar.h>
 #include <powerpc/ibm4xx/dev/opbvar.h>
 
 void
@@ -55,10 +56,16 @@
 }
 
 void
-ibm4xx_device_register(device_t dev, void *aux)
+ibm4xx_device_register(device_t dev, void *aux, int com_freq)
 {
        device_t parent = device_parent(dev);
 
+       if (device_is_a(dev, "com") && device_is_a(parent, "opb")) {
+               /* Set the frequency of the on-chip UART. */
+               com_opb_device_register(dev, com_freq);
+               return;
+       }
+
        if (device_is_a(dev, "emac") && device_is_a(parent, "opb")) {
                /* Set the mac-address of the on-chip Ethernet. */
                struct opb_attach_args *oaa = aux;
diff -r 91d563d83fb6 -r a55fc2ec038b sys/arch/powerpc/include/ibm4xx/cpu.h
--- a/sys/arch/powerpc/include/ibm4xx/cpu.h     Mon Mar 29 13:17:53 2021 +0000
+++ b/sys/arch/powerpc/include/ibm4xx/cpu.h     Mon Mar 29 13:38:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.22 2018/04/19 21:50:07 christos Exp $        */
+/*     $NetBSD: cpu.h,v 1.23 2021/03/29 13:40:21 rin Exp $     */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -73,7 +73,7 @@
 extern void ibm4xx_install_extint(void (*)(void));
 
 /* export from ibm4xx/ibm4xx_autoconf.c */
-extern void ibm4xx_device_register(device_t dev, void *aux);
+extern void ibm4xx_device_register(device_t, void *, int);
 
 /* export from ibm4xx/clock.c */
 extern void calc_delayconst(void);



Home | Main Index | Thread Index | Old Index