Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Get rid of a4x bus_space tag from fdtbus_attach_...



details:   https://anonhg.NetBSD.org/src/rev/df1e6c82d610
branches:  trunk
changeset: 976635:df1e6c82d610
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Sep 28 11:54:22 2020 +0000

description:
Get rid of a4x bus_space tag from fdtbus_attach_args. The only consumer
of this was various com(4) glue so modify all of that to use the new
com_init_regs_stride instead.

diffstat:

 sys/arch/arm/acpi/acpi_platform.c         |   6 +---
 sys/arch/arm/altera/cycv_platform.c       |   5 +--
 sys/arch/arm/amlogic/meson_platform.c     |   7 +----
 sys/arch/arm/broadcom/bcm2835_com.c       |  17 +++++++++-----
 sys/arch/arm/broadcom/bcm283x_platform.c  |   7 +----
 sys/arch/arm/fdt/arm_platform.c           |   6 +---
 sys/arch/arm/nvidia/tegra_com.c           |  35 +++++++++++++++---------------
 sys/arch/arm/nvidia/tegra_platform.c      |   6 +---
 sys/arch/arm/rockchip/rk_platform.c       |   6 +---
 sys/arch/arm/samsung/exynos_platform.c    |   6 +---
 sys/arch/arm/sunxi/sunxi_platform.c       |   7 +----
 sys/arch/arm/ti/am3_platform.c            |   6 +---
 sys/arch/arm/ti/omap3_platform.c          |   6 +---
 sys/arch/arm/ti/ti_com.c                  |  19 +++++++++-------
 sys/arch/arm/vexpress/vexpress_platform.c |   6 +---
 sys/arch/arm/virt/virt_platform.c         |   6 +---
 sys/arch/arm/xilinx/zynq_platform.c       |   6 +---
 sys/dev/fdt/fdtvar.h                      |   3 +-
 18 files changed, 69 insertions(+), 91 deletions(-)

diffs (truncated from 691 to 300 lines):

diff -r 594956adc675 -r df1e6c82d610 sys/arch/arm/acpi/acpi_platform.c
--- a/sys/arch/arm/acpi/acpi_platform.c Mon Sep 28 11:34:47 2020 +0000
+++ b/sys/arch/arm/acpi/acpi_platform.c Mon Sep 28 11:54:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.19 2020/09/13 21:41:17 jmcneill Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.20 2020/09/28 11:54:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.19 2020/09/13 21:41:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.20 2020/09/28 11:54:22 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -239,10 +239,8 @@
 acpi_platform_init_attach_args(struct fdt_attach_args *faa)
 {
        extern struct bus_space arm_generic_bs_tag;
-       extern struct bus_space arm_generic_a4x_bs_tag;
 
        faa->faa_bst = &arm_generic_bs_tag;
-       faa->faa_a4x_bst = &arm_generic_a4x_bs_tag;
        faa->faa_dmat = &acpi_coherent_dma_tag;
 }
 
diff -r 594956adc675 -r df1e6c82d610 sys/arch/arm/altera/cycv_platform.c
--- a/sys/arch/arm/altera/cycv_platform.c       Mon Sep 28 11:34:47 2020 +0000
+++ b/sys/arch/arm/altera/cycv_platform.c       Mon Sep 28 11:54:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_platform.c,v 1.13 2020/07/10 12:25:08 skrll Exp $ */
+/* $NetBSD: cycv_platform.c,v 1.14 2020/09/28 11:54:22 jmcneill Exp $ */
 
 /* This file is in the public domain. */
 
@@ -7,7 +7,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.13 2020/07/10 12:25:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.14 2020/09/28 11:54:22 jmcneill Exp $");
 
 #define        _ARM32_BUS_DMA_PRIVATE
 #include <sys/param.h>
@@ -131,7 +131,6 @@
 static void
 cycv_platform_init_attach_args(struct fdt_attach_args *faa) {
        faa->faa_bst = &armv7_generic_bs_tag;
-       faa->faa_a4x_bst = &armv7_generic_a4x_bs_tag;
        faa->faa_dmat = &arm_generic_dma_tag;
 }
 
diff -r 594956adc675 -r df1e6c82d610 sys/arch/arm/amlogic/meson_platform.c
--- a/sys/arch/arm/amlogic/meson_platform.c     Mon Sep 28 11:34:47 2020 +0000
+++ b/sys/arch/arm/amlogic/meson_platform.c     Mon Sep 28 11:54:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_platform.c,v 1.15 2020/07/10 12:25:08 skrll Exp $ */
+/* $NetBSD: meson_platform.c,v 1.16 2020/09/28 11:54:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
 #include "arml2cc.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.15 2020/07/10 12:25:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.16 2020/09/28 11:54:22 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -118,11 +118,9 @@
 
 extern struct arm32_bus_dma_tag arm_generic_dma_tag;
 extern struct bus_space arm_generic_bs_tag;
-extern struct bus_space arm_generic_a4x_bs_tag;
 
 #define        meson_dma_tag           arm_generic_dma_tag
 #define        meson_bs_tag            arm_generic_bs_tag
-#define        meson_a4x_bs_tag        arm_generic_a4x_bs_tag
 
 static const struct pmap_devmap *
 meson_platform_devmap(void)
@@ -150,7 +148,6 @@
 meson_platform_init_attach_args(struct fdt_attach_args *faa)
 {
        faa->faa_bst = &meson_bs_tag;
-       faa->faa_a4x_bst = &meson_a4x_bs_tag;
        faa->faa_dmat = &meson_dma_tag;
 }
 
diff -r 594956adc675 -r df1e6c82d610 sys/arch/arm/broadcom/bcm2835_com.c
--- a/sys/arch/arm/broadcom/bcm2835_com.c       Mon Sep 28 11:34:47 2020 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_com.c       Mon Sep 28 11:54:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_com.c,v 1.5 2018/12/08 17:46:09 thorpej Exp $ */
+/* $NetBSD: bcm2835_com.c,v 1.6 2020/09/28 11:54:23 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.5 2018/12/08 17:46:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.6 2020/09/28 11:54:23 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -70,7 +70,7 @@
        struct fdt_attach_args * const faa = aux;
        const int phandle = faa->faa_phandle;
 
-       bus_space_tag_t bst = faa->faa_a4x_bst;
+       bus_space_tag_t bst = faa->faa_bst;
        bus_space_handle_t bsh;
        bus_addr_t addr;
        bus_size_t size;
@@ -105,7 +105,7 @@
 
        sc->sc_frequency *= 2;
 
-       com_init_regs(&sc->sc_regs, bst, bsh, addr);
+       com_init_regs_stride(&sc->sc_regs, bst, bsh, addr, 2);
 
        com_attach_subr(sc);
        aprint_naive("\n");
@@ -137,7 +137,9 @@
 bcmaux_com_console_consinit(struct fdt_attach_args *faa, u_int uart_freq)
 {
        const int phandle = faa->faa_phandle;
-       bus_space_tag_t bst = faa->faa_a4x_bst;
+       bus_space_tag_t bst = faa->faa_bst;
+       bus_space_handle_t dummy_bsh;
+       struct com_regs regs;
        bus_addr_t addr;
        tcflag_t flags;
        int speed;
@@ -148,7 +150,10 @@
                speed = 115200; /* default */
        flags = fdtbus_get_stdout_flags();
 
-       if (comcnattach(bst, addr, speed, uart_freq, COM_TYPE_BCMAUXUART,
+       memset(&dummy_bsh, 0, sizeof(dummy_bsh));
+       com_init_regs_stride(&regs, bst, dummy_bsh, addr, 2);
+
+       if (comcnattach1(&regs, speed, uart_freq, COM_TYPE_BCMAUXUART,
            flags))
                panic("Cannot initialize bcm com console");
 
diff -r 594956adc675 -r df1e6c82d610 sys/arch/arm/broadcom/bcm283x_platform.c
--- a/sys/arch/arm/broadcom/bcm283x_platform.c  Mon Sep 28 11:34:47 2020 +0000
+++ b/sys/arch/arm/broadcom/bcm283x_platform.c  Mon Sep 28 11:54:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm283x_platform.c,v 1.40 2020/07/10 12:25:09 skrll Exp $      */
+/*     $NetBSD: bcm283x_platform.c,v 1.41 2020/09/28 11:54:23 jmcneill Exp $   */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.40 2020/07/10 12:25:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.41 2020/09/28 11:54:23 jmcneill Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -1307,7 +1307,6 @@
 {
 
        faa->faa_bst = &bcm2835_bs_tag;
-       faa->faa_a4x_bst = &bcm2835_a4x_bs_tag;
 }
 #endif
 
@@ -1317,7 +1316,6 @@
 {
 
        faa->faa_bst = &bcm2836_bs_tag;
-       faa->faa_a4x_bst = &bcm2836_a4x_bs_tag;
 }
 
 static void
@@ -1325,7 +1323,6 @@
 {
 
        faa->faa_bst = &bcm2711_bs_tag;
-       faa->faa_a4x_bst = &bcm2711_a4x_bs_tag;
 }
 #endif
 
diff -r 594956adc675 -r df1e6c82d610 sys/arch/arm/fdt/arm_platform.c
--- a/sys/arch/arm/fdt/arm_platform.c   Mon Sep 28 11:34:47 2020 +0000
+++ b/sys/arch/arm/fdt/arm_platform.c   Mon Sep 28 11:54:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_platform.c,v 1.2 2020/01/06 08:29:08 skrll Exp $ */
+/* $NetBSD: arm_platform.c,v 1.3 2020/09/28 11:54:23 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_platform.c,v 1.2 2020/01/06 08:29:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_platform.c,v 1.3 2020/09/28 11:54:23 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -64,13 +64,11 @@
 
 extern struct arm32_bus_dma_tag arm_generic_dma_tag;
 extern struct bus_space arm_generic_bs_tag;
-extern struct bus_space arm_generic_a4x_bs_tag;
 
 static void
 arm_platform_init_attach_args(struct fdt_attach_args *faa)
 {
        faa->faa_bst = &arm_generic_bs_tag;
-       faa->faa_a4x_bst = &arm_generic_a4x_bs_tag;
        faa->faa_dmat = &arm_generic_dma_tag;
 }
 
diff -r 594956adc675 -r df1e6c82d610 sys/arch/arm/nvidia/tegra_com.c
--- a/sys/arch/arm/nvidia/tegra_com.c   Mon Sep 28 11:34:47 2020 +0000
+++ b/sys/arch/arm/nvidia/tegra_com.c   Mon Sep 28 11:54:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_com.c,v 1.12 2019/10/13 06:11:31 skrll Exp $ */
+/* $NetBSD: tegra_com.c,v 1.13 2020/09/28 11:54:23 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: tegra_com.c,v 1.12 2019/10/13 06:11:31 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: tegra_com.c,v 1.13 2020/09/28 11:54:23 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -83,8 +83,8 @@
        struct tegra_com_softc * const tsc = device_private(self);
        struct com_softc * const sc = &tsc->tsc_sc;
        struct fdt_attach_args * const faa = aux;
+       bus_space_tag_t bst = faa->faa_bst;
        bus_space_handle_t bsh;
-       bus_space_tag_t bst;
        char intrstr[128];
        bus_addr_t addr;
        bus_size_t size;
@@ -98,17 +98,7 @@
 
        if (of_getprop_uint32(faa->faa_phandle, "reg-shift", &reg_shift)) {
                /* missing or bad reg-shift property, assume 2 */
-               bst = faa->faa_a4x_bst;
-       } else {
-               if (reg_shift == 2) {
-                       bst = faa->faa_a4x_bst;
-               } else if (reg_shift == 0) {
-                       bst = faa->faa_bst;
-               } else {
-                       aprint_error(": unsupported reg-shift value %d\n",
-                           reg_shift);
-                       return;
-               }
+               reg_shift = 2;
        }
 
        sc->sc_dev = self;
@@ -130,7 +120,7 @@
                return;
        }
 
-       com_init_regs(&sc->sc_regs, bst, bsh, addr);
+       com_init_regs_stride(&sc->sc_regs, bst, bsh, addr, reg_shift);
 
        com_attach_subr(sc);
        aprint_naive("\n");
@@ -163,9 +153,12 @@
 tegra_com_console_consinit(struct fdt_attach_args *faa, u_int uart_freq)
 {
        const int phandle = faa->faa_phandle;
-       bus_space_tag_t bst = faa->faa_a4x_bst;
+       bus_space_tag_t bst = faa->faa_bst;
+       bus_space_handle_t dummy_bsh;
+       struct com_regs regs;
        bus_addr_t addr;
        tcflag_t flags;
+       u_int reg_shift;
        int speed;
 
        fdtbus_get_reg(phandle, 0, &addr, NULL);
@@ -174,7 +167,15 @@
                speed = 115200; /* default */
        flags = fdtbus_get_stdout_flags();
 



Home | Main Index | Thread Index | Old Index