Fri Feb 16 12:08:02 2024 UTC (94d)
Trailing whitespace


(skrll)
diff -r1.15 -r1.15.22.1 src/sys/arch/arm/broadcom/bcm2835_bsc.c
diff -r1.18 -r1.18.16.1 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
diff -r1.6 -r1.6.2.1 src/sys/arch/arm/broadcom/bcm2838_pcie.c

cvs diff -r1.15 -r1.15.22.1 src/sys/arch/arm/broadcom/bcm2835_bsc.c (expand / switch to unified diff)

--- src/sys/arch/arm/broadcom/bcm2835_bsc.c 2020/03/31 12:23:17 1.15
+++ src/sys/arch/arm/broadcom/bcm2835_bsc.c 2024/02/16 12:08:02 1.15.22.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bcm2835_bsc.c,v 1.15 2020/03/31 12:23:17 jmcneill Exp $ */ 1/* $NetBSD: bcm2835_bsc.c,v 1.15.22.1 2024/02/16 12:08:02 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2019 Jason R. Thorpe 4 * Copyright (c) 2019 Jason R. Thorpe
5 * Copyright (c) 2012 Jonathan A. Kollasch 5 * Copyright (c) 2012 Jonathan A. Kollasch
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 26 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.15 2020/03/31 12:23:17 jmcneill Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.15.22.1 2024/02/16 12:08:02 skrll Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/bus.h> 34#include <sys/bus.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/kernhist.h> 36#include <sys/kernhist.h>
37#include <sys/intr.h> 37#include <sys/intr.h>
38#include <sys/mutex.h> 38#include <sys/mutex.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40 40
41#include <dev/i2c/i2cvar.h> 41#include <dev/i2c/i2cvar.h>
42 42
43#include <arm/broadcom/bcm2835reg.h> 43#include <arm/broadcom/bcm2835reg.h>
44#include <arm/broadcom/bcm2835_bscreg.h> 44#include <arm/broadcom/bcm2835_bscreg.h>
@@ -193,27 +193,27 @@ bsciic_next_state(struct bsciic_softc *  @@ -193,27 +193,27 @@ bsciic_next_state(struct bsciic_softc *
193 if (sc->sc_exec.datalen == 0) { 193 if (sc->sc_exec.datalen == 0) {
194 return BSC_EXEC_STATE_DONE; 194 return BSC_EXEC_STATE_DONE;
195 } 195 }
196 196
197 if (I2C_OP_READ_P(sc->sc_exec.op)) { 197 if (I2C_OP_READ_P(sc->sc_exec.op)) {
198 return BSC_EXEC_STATE_RECV_DATA; 198 return BSC_EXEC_STATE_RECV_DATA;
199 } 199 }
200 200
201 return BSC_EXEC_STATE_SEND_DATA; 201 return BSC_EXEC_STATE_SEND_DATA;
202 202
203 case BSC_EXEC_STATE_SEND_DATA: 203 case BSC_EXEC_STATE_SEND_DATA:
204 case BSC_EXEC_STATE_RECV_DATA: 204 case BSC_EXEC_STATE_RECV_DATA:
205 return BSC_EXEC_STATE_DONE; 205 return BSC_EXEC_STATE_DONE;
206  206
207 case BSC_EXEC_STATE_DONE: 207 case BSC_EXEC_STATE_DONE:
208 case BSC_EXEC_STATE_ERROR: 208 case BSC_EXEC_STATE_ERROR:
209 return sc->sc_exec_state; 209 return sc->sc_exec_state;
210 } 210 }
211 211
212 panic("bsciic_next_state: invalid state: %d", sc->sc_exec_state); 212 panic("bsciic_next_state: invalid state: %d", sc->sc_exec_state);
213} 213}
214 214
215#define BSC_EXEC_PHASE_COMPLETE(sc) \ 215#define BSC_EXEC_PHASE_COMPLETE(sc) \
216 ((sc)->sc_exec_state == BSC_EXEC_STATE_ERROR || \ 216 ((sc)->sc_exec_state == BSC_EXEC_STATE_ERROR || \
217 (sc)->sc_bufpos == (sc)->sc_buflen) 217 (sc)->sc_bufpos == (sc)->sc_buflen)
218 218
219static void 219static void

cvs diff -r1.18 -r1.18.16.1 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c (expand / switch to unified diff)

--- src/sys/arch/arm/broadcom/bcm2835_vcaudio.c 2021/04/24 23:36:26 1.18
+++ src/sys/arch/arm/broadcom/bcm2835_vcaudio.c 2024/02/16 12:08:02 1.18.16.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bcm2835_vcaudio.c,v 1.18 2021/04/24 23:36:26 thorpej Exp $ */ 1/* $NetBSD: bcm2835_vcaudio.c,v 1.18.16.1 2024/02/16 12:08:02 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2013 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 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29/* 29/*
30 * VideoCore audio interface 30 * VideoCore audio interface
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.18 2021/04/24 23:36:26 thorpej Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.18.16.1 2024/02/16 12:08:02 skrll Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/types.h> 37#include <sys/types.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/device.h> 39#include <sys/device.h>
40#include <sys/conf.h> 40#include <sys/conf.h>
41#include <sys/bus.h> 41#include <sys/bus.h>
42#include <sys/kmem.h> 42#include <sys/kmem.h>
43 43
44#include <sys/audioio.h> 44#include <sys/audioio.h>
45#include <dev/audio/audio_if.h> 45#include <dev/audio/audio_if.h>
46 46
47#include <interface/compat/vchi_bsd.h> 47#include <interface/compat/vchi_bsd.h>
@@ -78,27 +78,27 @@ enum vcaudio_dest { @@ -78,27 +78,27 @@ enum vcaudio_dest {
78 VCAUDIO_DEST_HP = 1, 78 VCAUDIO_DEST_HP = 1,
79 VCAUDIO_DEST_HDMI = 2, 79 VCAUDIO_DEST_HDMI = 2,
80}; 80};
81 81
82/* 82/*
83 * Maximum message size is 4000 bytes and VCHIQ can accept 16 messages. 83 * Maximum message size is 4000 bytes and VCHIQ can accept 16 messages.
84 * 84 *
85 * 4000 bytes of 16bit 48kHz stereo is approximately 21ms. 85 * 4000 bytes of 16bit 48kHz stereo is approximately 21ms.
86 * 86 *
87 * We get complete messages at ~10ms intervals. 87 * We get complete messages at ~10ms intervals.
88 * 88 *
89 * Setting blocksize to 4 x 1600 means that we send approx 33ms of audio. We 89 * Setting blocksize to 4 x 1600 means that we send approx 33ms of audio. We
90 * prefill by two blocks before starting audio meaning we have 50ms of latency. 90 * prefill by two blocks before starting audio meaning we have 50ms of latency.
91 *  91 *
92 * Six messages of 1600 bytes was chosen working back from a desired latency of 92 * Six messages of 1600 bytes was chosen working back from a desired latency of
93 * 50ms. 93 * 50ms.
94 */ 94 */
95 95
96/* 40ms block of 16bit 48kHz stereo is 7680 bytes. */ 96/* 40ms block of 16bit 48kHz stereo is 7680 bytes. */
97#define VCAUDIO_MSGSIZE 1920 97#define VCAUDIO_MSGSIZE 1920
98#define VCAUDIO_NUMMSGS 4 98#define VCAUDIO_NUMMSGS 4
99#define VCAUDIO_BLOCKSIZE (VCAUDIO_MSGSIZE * VCAUDIO_NUMMSGS) 99#define VCAUDIO_BLOCKSIZE (VCAUDIO_MSGSIZE * VCAUDIO_NUMMSGS)
100/* The driver seems to have no buffer size restrictions. */ 100/* The driver seems to have no buffer size restrictions. */
101#define VCAUDIO_PREFILLCOUNT 2 101#define VCAUDIO_PREFILLCOUNT 2
102 102
103struct vcaudio_softc { 103struct vcaudio_softc {
104 device_t sc_dev; 104 device_t sc_dev;

cvs diff -r1.6 -r1.6.2.1 src/sys/arch/arm/broadcom/bcm2838_pcie.c (expand / switch to unified diff)

--- src/sys/arch/arm/broadcom/bcm2838_pcie.c 2022/10/15 11:07:38 1.6
+++ src/sys/arch/arm/broadcom/bcm2838_pcie.c 2024/02/16 12:08:02 1.6.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bcm2838_pcie.c,v 1.6 2022/10/15 11:07:38 jmcneill Exp $ */ 1/* $NetBSD: bcm2838_pcie.c,v 1.6.2.1 2024/02/16 12:08:02 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2020 The NetBSD Foundation, Inc. 4 * Copyright (c) 2020 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Michael van Elst 8 * by Michael van Elst
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: bcm2838_pcie.c,v 1.6 2022/10/15 11:07:38 jmcneill Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: bcm2838_pcie.c,v 1.6.2.1 2024/02/16 12:08:02 skrll Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/device.h> 36#include <sys/device.h>
37 37
38#include <dev/pci/pcireg.h> 38#include <dev/pci/pcireg.h>
39#include <dev/pci/pcivar.h> 39#include <dev/pci/pcivar.h>
40#include <dev/pci/pciconf.h> 40#include <dev/pci/pciconf.h>
41 41
42#include <dev/fdt/fdtvar.h> 42#include <dev/fdt/fdtvar.h>
43 43
44#include <arch/arm/pci/pci_msi_machdep.h> 44#include <arch/arm/pci/pci_msi_machdep.h>
45#include <arch/arm/broadcom/bcm2838_pcie.h> 45#include <arch/arm/broadcom/bcm2838_pcie.h>
46 46
@@ -407,27 +407,27 @@ bcmstb_setwin(struct bcmstb_softc *sc, i @@ -407,27 +407,27 @@ bcmstb_setwin(struct bcmstb_softc *sc, i
407 407
408 STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT(win), 408 STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT(win),
409 PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_BASE 409 PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_BASE
410 | PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_LIMIT, 410 | PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_LIMIT,
411 __SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_BASE) 411 __SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_BASE)
412 | __SHIFTIN(limit, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_LIMIT)); 412 | __SHIFTIN(limit, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_LIMIT_LIMIT));
413 413
414 base = (ca >> 32) & 0xff; 414 base = (ca >> 32) & 0xff;
415 limit = ((ca + sz - 1) >> 32) & 0xff; 415 limit = ((ca + sz - 1) >> 32) & 0xff;
416 416
417 STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI(win), 417 STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI(win),
418 PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE, 418 PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE,
419 __SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE)); 419 __SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_BASE_HI_BASE));
420  420
421 STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI(win), 421 STBRMW(sc, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI(win),
422 PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT, 422 PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT,
423 __SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT)); 423 __SHIFTIN(base, PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI_LIMIT));
424} 424}
425 425
426static int 426static int
427bcmstb_encode_size(int bits) 427bcmstb_encode_size(int bits)
428{ 428{
429 /* 4K .. 32K */ 429 /* 4K .. 32K */
430 if (bits >= 12 && bits <= 15) 430 if (bits >= 12 && bits <= 15)
431 return 28 + (bits - 12); 431 return 28 + (bits - 12);
432 432
433 /* 64K .. 32G */ 433 /* 64K .. 32G */