Sat Feb 15 12:45:05 2020 UTC ()
Need to limit the DMA range for tx1.  Assume 32bit DMA everywhere for now.


(skrll)
diff -r1.24 -r1.25 src/sys/arch/arm/nvidia/tegra_sdhc.c

cvs diff -r1.24 -r1.25 src/sys/arch/arm/nvidia/tegra_sdhc.c (expand / switch to unified diff)

--- src/sys/arch/arm/nvidia/tegra_sdhc.c 2019/10/13 06:11:31 1.24
+++ src/sys/arch/arm/nvidia/tegra_sdhc.c 2020/02/15 12:45:05 1.25
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tegra_sdhc.c,v 1.24 2019/10/13 06:11:31 skrll Exp $ */ 1/* $NetBSD: tegra_sdhc.c,v 1.25 2020/02/15 12:45:05 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#define TEGRA_SDHC_NO_SDR104 29#define TEGRA_SDHC_NO_SDR104
30 30
31#include "locators.h" 31#include "locators.h"
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: tegra_sdhc.c,v 1.24 2019/10/13 06:11:31 skrll Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: tegra_sdhc.c,v 1.25 2020/02/15 12:45:05 skrll Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/bus.h> 37#include <sys/bus.h>
38#include <sys/device.h> 38#include <sys/device.h>
39#include <sys/intr.h> 39#include <sys/intr.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kernel.h> 41#include <sys/kernel.h>
42 42
43#include <dev/sdmmc/sdhcreg.h> 43#include <dev/sdmmc/sdhcreg.h>
44#include <dev/sdmmc/sdhcvar.h> 44#include <dev/sdmmc/sdhcvar.h>
45#include <dev/sdmmc/sdmmcvar.h> 45#include <dev/sdmmc/sdmmcvar.h>
46 46
47#include <arm/nvidia/tegra_reg.h> 47#include <arm/nvidia/tegra_reg.h>
@@ -101,27 +101,34 @@ tegra_sdhc_attach(device_t parent, devic @@ -101,27 +101,34 @@ tegra_sdhc_attach(device_t parent, devic
101 bus_size_t size; 101 bus_size_t size;
102 u_int bus_width; 102 u_int bus_width;
103 int error; 103 int error;
104 104
105 if (fdtbus_get_reg(faa->faa_phandle, 0, &addr, &size) != 0) { 105 if (fdtbus_get_reg(faa->faa_phandle, 0, &addr, &size) != 0) {
106 aprint_error(": couldn't get registers\n"); 106 aprint_error(": couldn't get registers\n");
107 return; 107 return;
108 } 108 }
109 109
110 if (of_getprop_uint32(faa->faa_phandle, "bus-width", &bus_width)) 110 if (of_getprop_uint32(faa->faa_phandle, "bus-width", &bus_width))
111 bus_width = 4; 111 bus_width = 4;
112 112
113 sc->sc.sc_dev = self; 113 sc->sc.sc_dev = self;
114 sc->sc.sc_dmat = faa->faa_dmat; 114
 115 error = bus_dmatag_subregion(faa->faa_dmat, 0, 0xffffffff,
 116 &sc->sc.sc_dmat, BUS_DMA_WAITOK);
 117 if (error != 0) {
 118 aprint_error(": couldn't create DMA tag: %d\n", error);
 119 return;
 120 }
 121
115 sc->sc.sc_flags = SDHC_FLAG_32BIT_ACCESS | 122 sc->sc.sc_flags = SDHC_FLAG_32BIT_ACCESS |
116 SDHC_FLAG_NO_PWR0 | 123 SDHC_FLAG_NO_PWR0 |
117 SDHC_FLAG_NO_CLKBASE | 124 SDHC_FLAG_NO_CLKBASE |
118 SDHC_FLAG_NO_TIMEOUT | 125 SDHC_FLAG_NO_TIMEOUT |
119 SDHC_FLAG_SINGLE_POWER_WRITE | 126 SDHC_FLAG_SINGLE_POWER_WRITE |
120 SDHC_FLAG_NO_HS_BIT | 127 SDHC_FLAG_NO_HS_BIT |
121 SDHC_FLAG_USE_DMA | 128 SDHC_FLAG_USE_DMA |
122 SDHC_FLAG_USE_ADMA2; 129 SDHC_FLAG_USE_ADMA2;
123 if (bus_width == 8) { 130 if (bus_width == 8) {
124 sc->sc.sc_flags |= SDHC_FLAG_8BIT_MODE; 131 sc->sc.sc_flags |= SDHC_FLAG_8BIT_MODE;
125 } 132 }
126 sc->sc.sc_host = &sc->sc_host; 133 sc->sc.sc_host = &sc->sc_host;
127 134