Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Remove HOST1X and AHB_A2 from pmap_devmap



details:   https://anonhg.NetBSD.org/src/rev/25c1e468e5f7
branches:  trunk
changeset: 341720:25c1e468e5f7
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Nov 19 22:09:16 2015 +0000

description:
Remove HOST1X and AHB_A2 from pmap_devmap

diffstat:

 sys/arch/arm/nvidia/files.tegra       |   8 +++++---
 sys/arch/arm/nvidia/tegra_ehci.c      |  30 +++++++++++++++++++++---------
 sys/arch/arm/nvidia/tegra_io.c        |  21 +++++++--------------
 sys/arch/arm/nvidia/tegra_pcie.c      |   8 ++------
 sys/arch/arm/nvidia/tegra_reg.h       |   8 +++-----
 sys/arch/arm/nvidia/tegra_soc.c       |  31 ++-----------------------------
 sys/arch/arm/nvidia/tegra_usbphy.c    |  16 +++++++---------
 sys/arch/arm/nvidia/tegra_var.h       |  12 +++++++-----
 sys/arch/evbarm/conf/JETSONTK1        |  14 ++++++--------
 sys/arch/evbarm/tegra/tegra_machdep.c |  18 ++----------------
 10 files changed, 62 insertions(+), 104 deletions(-)

diffs (truncated from 455 to 300 lines):

diff -r 1b98dfe2cd09 -r 25c1e468e5f7 sys/arch/arm/nvidia/files.tegra
--- a/sys/arch/arm/nvidia/files.tegra   Thu Nov 19 20:57:49 2015 +0000
+++ b/sys/arch/arm/nvidia/files.tegra   Thu Nov 19 22:09:16 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.tegra,v 1.21 2015/11/12 00:43:52 jmcneill Exp $
+#      $NetBSD: files.tegra,v 1.22 2015/11/19 22:09:16 jmcneill Exp $
 #
 # Configuration info for NVIDIA Tegra ARM Peripherals
 #
@@ -72,12 +72,14 @@
 file   arch/arm/nvidia/tegra_rtc.c             tegra_rtc
 
 # USB PHY
+define tegrausbphybus { }
 device tegrausbphy
-attach tegrausbphy at tegraio with tegra_usbphy
+attach tegrausbphy at tegrausbphybus with tegra_usbphy
 file   arch/arm/nvidia/tegra_usbphy.c          tegra_usbphy
 
 # USB 2.0
-attach ehci at tegraio with tegra_ehci
+device tegraehci: usbus, usbroothub, usb_dma, ehci, tegrausbphybus
+attach tegraehci at tegraio with tegra_ehci
 file   arch/arm/nvidia/tegra_ehci.c            tegra_ehci
 
 # SDMMC
diff -r 1b98dfe2cd09 -r 25c1e468e5f7 sys/arch/arm/nvidia/tegra_ehci.c
--- a/sys/arch/arm/nvidia/tegra_ehci.c  Thu Nov 19 20:57:49 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_ehci.c  Thu Nov 19 22:09:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_ehci.c,v 1.9 2015/10/21 20:02:12 jmcneill Exp $ */
+/* $NetBSD: tegra_ehci.c,v 1.10 2015/11/19 22:09:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_ehci.c,v 1.9 2015/10/21 20:02:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_ehci.c,v 1.10 2015/11/19 22:09:16 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -45,6 +45,7 @@
 #include <dev/usb/ehcireg.h>
 #include <dev/usb/ehcivar.h>
 
+#include <arm/nvidia/tegra_reg.h>
 #include <arm/nvidia/tegra_var.h>
 #include <arm/nvidia/tegra_usbreg.h>
 
@@ -61,6 +62,8 @@
        bus_space_handle_t      sc_bsh;
        void                    *sc_ih;
        u_int                   sc_port;
+
+       device_t                sc_usbphydev;
 };
 
 static int     tegra_ehci_port_status(struct ehci_softc *sc, uint32_t v,
@@ -82,11 +85,16 @@
        struct tegra_ehci_softc * const sc = device_private(self);
        struct tegraio_attach_args * const tio = aux;
        const struct tegra_locators * const loc = &tio->tio_loc;
+       struct tegrausbphy_attach_args tup;
        int error;
 
        sc->sc_bst = tio->tio_bst;
-       bus_space_subregion(tio->tio_bst, tio->tio_bsh,
-           loc->loc_offset, loc->loc_size, &sc->sc_bsh);
+       error = bus_space_map(sc->sc_bst, TEGRA_AHB_A2_BASE + loc->loc_offset,
+           loc->loc_size, 0, &sc->sc_bsh);
+       if (error) {
+               aprint_error(": couldn't map USB%d\n", loc->loc_port + 1);
+               return;
+       }
        sc->sc_port = loc->loc_port;
 
        sc->sc.sc_dev = self;
@@ -97,11 +105,10 @@
        sc->sc.sc_flags = EHCIF_ETTF;
        sc->sc.sc_id_vendor = 0x10de;
        strlcpy(sc->sc.sc_vendor, "Tegra", sizeof(sc->sc.sc_vendor));
-       sc->sc.sc_size = loc->loc_size;
-       sc->sc.iot = tio->tio_bst;
-       bus_space_subregion(tio->tio_bst, tio->tio_bsh,
-           loc->loc_offset + TEGRA_EHCI_REG_OFFSET,
-           loc->loc_size - TEGRA_EHCI_REG_OFFSET, &sc->sc.ioh);
+       sc->sc.sc_size = loc->loc_size - TEGRA_EHCI_REG_OFFSET;
+       sc->sc.iot = sc->sc_bst;
+       bus_space_subregion(sc->sc_bst, sc->sc_bsh, TEGRA_EHCI_REG_OFFSET,
+           sc->sc.sc_size, &sc->sc.ioh);
        sc->sc.sc_vendor_init = tegra_ehci_init;
        sc->sc.sc_vendor_port_status = tegra_ehci_port_status;
 
@@ -119,6 +126,11 @@
        }
        aprint_normal_dev(self, "interrupting on irq %d\n", loc->loc_intr);
 
+       tup.tup_bst = sc->sc_bst;
+       tup.tup_bsh = sc->sc_bsh;
+       tup.tup_port = sc->sc_port;
+       sc->sc_usbphydev = config_found_ia(self, "tegrausbphybus", &tup, NULL);
+
        error = ehci_init(&sc->sc);
        if (error != USBD_NORMAL_COMPLETION) {
                aprint_error_dev(self, "init failed, error = %d\n", error);
diff -r 1b98dfe2cd09 -r 25c1e468e5f7 sys/arch/arm/nvidia/tegra_io.c
--- a/sys/arch/arm/nvidia/tegra_io.c    Thu Nov 19 20:57:49 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_io.c    Thu Nov 19 22:09:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_io.c,v 1.18 2015/11/18 17:12:06 jakllsch Exp $ */
+/* $NetBSD: tegra_io.c,v 1.19 2015/11/19 22:09:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_tegra.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_io.c,v 1.18 2015/11/18 17:12:06 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_io.c,v 1.19 2015/11/19 22:09:16 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -118,17 +118,11 @@
 };
 
 static const struct tegra_locators tegra_ahb_a2_locators[] = {
-  { "tegrausbphy",
-    TEGRA_USB1_OFFSET, TEGRA_USB1_SIZE, 0, NOINTR },
-  { "ehci",
+  { "tegraehci",
     TEGRA_USB1_OFFSET, TEGRA_USB1_SIZE, 0, TEGRA_INTR_USB1 },
-  { "tegrausbphy",
-    TEGRA_USB2_OFFSET, TEGRA_USB2_SIZE, 1, NOINTR },
-  { "ehci",
+  { "tegraehci",
     TEGRA_USB2_OFFSET, TEGRA_USB2_SIZE, 1, TEGRA_INTR_USB2 },
-  { "tegrausbphy",
-    TEGRA_USB3_OFFSET, TEGRA_USB3_SIZE, 2, NOINTR },
-  { "ehci",
+  { "tegraehci",
     TEGRA_USB3_OFFSET, TEGRA_USB3_SIZE, 2, TEGRA_INTR_USB3 },
 };
 
@@ -169,7 +163,7 @@
            tegra_ppsb_locators, __arraycount(tegra_ppsb_locators));
        tegraio_scan(self, tegra_apb_bsh,
            tegra_apb_locators, __arraycount(tegra_apb_locators));
-       tegraio_scan(self, tegra_ahb_a2_bsh,
+       tegraio_scan(self, (bus_space_handle_t)NULL,
            tegra_ahb_a2_locators, __arraycount(tegra_ahb_a2_locators));
        tegraio_scan(self, (bus_space_handle_t)NULL,
            tegra_host1x_locators, __arraycount(tegra_host1x_locators));
@@ -192,8 +186,7 @@
                        .tio_bst = &armv7_generic_bs_tag,
                        .tio_a4x_bst = &armv7_generic_a4x_bs_tag,
                        .tio_bsh = bsh,
-                       .tio_dmat = &tegra_dma_tag,
-                       .tio_coherent_dmat = &tegra_coherent_dma_tag,
+                       .tio_dmat = &tegra_dma_tag
                };
                cfdata_t cf = config_search_ia(tegraio_find, self,
                    "tegraio", &tio);
diff -r 1b98dfe2cd09 -r 25c1e468e5f7 sys/arch/arm/nvidia/tegra_pcie.c
--- a/sys/arch/arm/nvidia/tegra_pcie.c  Thu Nov 19 20:57:49 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_pcie.c  Thu Nov 19 22:09:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_pcie.c,v 1.12 2015/11/17 22:01:39 jakllsch Exp $ */
+/* $NetBSD: tegra_pcie.c,v 1.13 2015/11/19 22:09:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_pcie.c,v 1.12 2015/11/17 22:01:39 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_pcie.c,v 1.13 2015/11/19 22:09:16 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -133,11 +133,7 @@
        int error;
 
        sc->sc_dev = self;
-#if notyet
-       sc->sc_dmat = tio->tio_coherent_dmat;
-#else
        sc->sc_dmat = tio->tio_dmat;
-#endif
        sc->sc_bst = tio->tio_bst;
        sc->sc_intr = loc->loc_intr;
        if (bus_space_map(sc->sc_bst, TEGRA_PCIE_AFI_BASE, TEGRA_PCIE_AFI_SIZE,
diff -r 1b98dfe2cd09 -r 25c1e468e5f7 sys/arch/arm/nvidia/tegra_reg.h
--- a/sys/arch/arm/nvidia/tegra_reg.h   Thu Nov 19 20:57:49 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_reg.h   Thu Nov 19 22:09:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_reg.h,v 1.17 2015/11/14 03:44:52 jakllsch Exp $ */
+/* $NetBSD: tegra_reg.h,v 1.18 2015/11/19 22:09:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -72,10 +72,8 @@
 #define TEGRA_AHB_A2_BASE      0x7c000000
 #define TEGRA_AHB_A2_SIZE      0x02000000
 
-#define TEGRA_HOST1X_VBASE     0xfaf00000
-#define TEGRA_PPSB_VBASE       0xfb000000
-#define TEGRA_APB_VBASE                0xfc000000
-#define TEGRA_AHB_A2_VBASE     0xfd000000
+#define TEGRA_PPSB_VBASE       0xfd000000
+#define TEGRA_APB_VBASE                0xfe000000
 
 #define TEGRA_REF_FREQ         12000000
 
diff -r 1b98dfe2cd09 -r 25c1e468e5f7 sys/arch/arm/nvidia/tegra_soc.c
--- a/sys/arch/arm/nvidia/tegra_soc.c   Thu Nov 19 20:57:49 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_soc.c   Thu Nov 19 22:09:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_soc.c,v 1.6 2015/05/13 11:06:13 jmcneill Exp $ */
+/* $NetBSD: tegra_soc.c,v 1.7 2015/11/19 22:09:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_soc.c,v 1.6 2015/05/13 11:06:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_soc.c,v 1.7 2015/11/19 22:09:16 jmcneill Exp $");
 
 #define        _ARM32_BUS_DMA_PRIVATE
 #include <sys/param.h>
@@ -48,10 +48,8 @@
 #include <arm/nvidia/tegra_mcreg.h>
 #include <arm/nvidia/tegra_var.h>
 
-bus_space_handle_t tegra_host1x_bsh;
 bus_space_handle_t tegra_ppsb_bsh;
 bus_space_handle_t tegra_apb_bsh;
-bus_space_handle_t tegra_ahb_a2_bsh;
 
 struct arm32_bus_dma_tag tegra_dma_tag = {
        _BUS_DMAMAP_FUNCS,
@@ -59,32 +57,12 @@
        _BUS_DMATAG_FUNCS,
 };
 
-static struct arm32_dma_range tegra_coherent_dma_ranges[] = {
-       [0] = {
-               .dr_sysbase = TEGRA_EXTMEM_BASE,
-               .dr_busbase = TEGRA_EXTMEM_BASE,
-               .dr_flags = _BUS_DMAMAP_COHERENT,
-       },
-};
-
-struct arm32_bus_dma_tag tegra_coherent_dma_tag = {
-       ._ranges = tegra_coherent_dma_ranges,
-       ._nranges = __arraycount(tegra_coherent_dma_ranges),
-       _BUS_DMAMAP_FUNCS,
-       _BUS_DMAMEM_FUNCS,
-       _BUS_DMATAG_FUNCS,
-};
-
 static void    tegra_mpinit(void);
 
 void
 tegra_bootstrap(void)
 {
        if (bus_space_map(&armv7_generic_bs_tag,
-           TEGRA_HOST1X_BASE, TEGRA_HOST1X_SIZE, 0,
-           &tegra_host1x_bsh) != 0)
-               panic("couldn't map HOST1X");
-       if (bus_space_map(&armv7_generic_bs_tag,
            TEGRA_PPSB_BASE, TEGRA_PPSB_SIZE, 0,
            &tegra_ppsb_bsh) != 0)
                panic("couldn't map PPSB");
@@ -92,10 +70,6 @@
            TEGRA_APB_BASE, TEGRA_APB_SIZE, 0,
            &tegra_apb_bsh) != 0)
                panic("couldn't map APB");
-       if (bus_space_map(&armv7_generic_bs_tag,
-           TEGRA_AHB_A2_BASE, TEGRA_AHB_A2_SIZE, 0,
-           &tegra_ahb_a2_bsh) != 0)
-               panic("couldn't map AHB A2");
 
        curcpu()->ci_data.cpu_cc_freq = tegra_car_pllx_rate();
 
@@ -105,7 +79,6 @@
 void
 tegra_dma_bootstrap(psize_t psize)
 {
-       tegra_coherent_dma_ranges[0].dr_len = psize;
 }
 
 void
diff -r 1b98dfe2cd09 -r 25c1e468e5f7 sys/arch/arm/nvidia/tegra_usbphy.c



Home | Main Index | Thread Index | Old Index