Wed Jan 27 02:32:31 2021 UTC ()
Use DEVICE_COMPAT_EOL.


(thorpej)
diff -r1.16 -r1.17 src/sys/dev/spi/m25p.c
diff -r1.6 -r1.7 src/sys/dev/spi/oj6sh.c
diff -r1.4 -r1.5 src/sys/dev/spi/ssdfb_spi.c

cvs diff -r1.16 -r1.17 src/sys/dev/spi/m25p.c (expand / switch to unified diff)

--- src/sys/dev/spi/m25p.c 2021/01/17 21:42:35 1.16
+++ src/sys/dev/spi/m25p.c 2021/01/27 02:32:31 1.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: m25p.c,v 1.16 2021/01/17 21:42:35 thorpej Exp $ */ 1/* $NetBSD: m25p.c,v 1.17 2021/01/27 02:32:31 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2006 Urbana-Champaign Independent Media Center. 4 * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
5 * Copyright (c) 2006 Garrett D'Amore. 5 * Copyright (c) 2006 Garrett D'Amore.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Portions of this code were written by Garrett D'Amore for the 8 * Portions of this code were written by Garrett D'Amore for the
9 * Champaign-Urbana Community Wireless Network Project. 9 * Champaign-Urbana Community Wireless Network Project.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or 11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following 12 * without modification, are permitted provided that the following
13 * conditions are met: 13 * conditions are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -32,27 +32,27 @@ @@ -32,27 +32,27 @@
32 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED. IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT 33 * ARE DISCLAIMED. IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT
34 * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT, 34 * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT,
35 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 35 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
38 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 38 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
41 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 */ 42 */
43 43
44#include <sys/cdefs.h> 44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD: m25p.c,v 1.16 2021/01/17 21:42:35 thorpej Exp $"); 45__KERNEL_RCSID(0, "$NetBSD: m25p.c,v 1.17 2021/01/27 02:32:31 thorpej Exp $");
46 46
47#include <sys/param.h> 47#include <sys/param.h>
48#include <sys/systm.h> 48#include <sys/systm.h>
49#include <sys/device.h> 49#include <sys/device.h>
50#include <sys/kernel.h> 50#include <sys/kernel.h>
51 51
52#include <dev/sysmon/sysmonvar.h> 52#include <dev/sysmon/sysmonvar.h>
53 53
54#include <dev/spi/spivar.h> 54#include <dev/spi/spivar.h>
55#include <dev/spi/spiflash.h> 55#include <dev/spi/spiflash.h>
56 56
57/* 57/*
58 * Device driver for STMicroelectronics M25P Family SPI Flash Devices 58 * Device driver for STMicroelectronics M25P Family SPI Flash Devices
@@ -108,28 +108,27 @@ static const struct m25p_info { @@ -108,28 +108,27 @@ static const struct m25p_info {
108 { 0x00, 0xEF, 0x3012, "Winbond W25X20", 256, 64 }, /* 2Mbit */ 108 { 0x00, 0xEF, 0x3012, "Winbond W25X20", 256, 64 }, /* 2Mbit */
109 { 0x00, 0xEF, 0x3013, "Winbond W25X40", 512, 64 }, /* 4Mbit */ 109 { 0x00, 0xEF, 0x3013, "Winbond W25X40", 512, 64 }, /* 4Mbit */
110 { 0x00, 0xEF, 0x3014, "Winbond W25X80", 1024, 64 }, /* 8Mbit */ 110 { 0x00, 0xEF, 0x3014, "Winbond W25X80", 1024, 64 }, /* 8Mbit */
111 { 0x13, 0xEF, 0x4014, "Winbond W25Q80.V", 1024, 64 }, /* 8Mbit */ 111 { 0x13, 0xEF, 0x4014, "Winbond W25Q80.V", 1024, 64 }, /* 8Mbit */
112 { 0x14, 0xEF, 0x4015, "Winbond W25Q16.V", 2048, 64 }, /* 16Mbit */ 112 { 0x14, 0xEF, 0x4015, "Winbond W25Q16.V", 2048, 64 }, /* 16Mbit */
113 { 0x15, 0xEF, 0x4016, "Winbond W25Q32.V", 4096, 64 }, /* 32Mbit */ 113 { 0x15, 0xEF, 0x4016, "Winbond W25Q32.V", 4096, 64 }, /* 32Mbit */
114 { 0x15, 0xEF, 0x4018, "Winbond W25Q128.V", 16384, 64 }, /* 128Mbit */ 114 { 0x15, 0xEF, 0x4018, "Winbond W25Q128.V", 16384, 64 }, /* 128Mbit */
115 { 0x15, 0xEF, 0x6016, "Winbond W25Q32.W", 4096, 64 }, /* 32Mbit */ 115 { 0x15, 0xEF, 0x6016, "Winbond W25Q32.W", 4096, 64 }, /* 32Mbit */
116 { 0 } 116 { 0 }
117}; 117};
118 118
119static const struct device_compatible_entry compat_data[] = { 119static const struct device_compatible_entry compat_data[] = {
120 { .compat = "jedec,spi-nor" }, 120 { .compat = "jedec,spi-nor" },
121 121 DEVICE_COMPAT_EOL
122 { 0 } 
123}; 122};
124 123
125static int 124static int
126m25p_match(device_t parent, cfdata_t cf, void *aux) 125m25p_match(device_t parent, cfdata_t cf, void *aux)
127{ 126{
128 struct spi_attach_args *sa = aux; 127 struct spi_attach_args *sa = aux;
129 int res; 128 int res;
130 129
131 res = spi_compatible_match(sa, cf, compat_data); 130 res = spi_compatible_match(sa, cf, compat_data);
132 if (!res) 131 if (!res)
133 return res; 132 return res;
134 133
135 /* configure for 20MHz, which is the max for normal reads */ 134 /* configure for 20MHz, which is the max for normal reads */

cvs diff -r1.6 -r1.7 src/sys/dev/spi/oj6sh.c (expand / switch to unified diff)

--- src/sys/dev/spi/oj6sh.c 2021/01/17 21:42:35 1.6
+++ src/sys/dev/spi/oj6sh.c 2021/01/27 02:32:31 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: oj6sh.c,v 1.6 2021/01/17 21:42:35 thorpej Exp $ */ 1/* $NetBSD: oj6sh.c,v 1.7 2021/01/27 02:32:31 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014 Genetec Corporation. All rights reserved. 4 * Copyright (c) 2014 Genetec Corporation. All rights reserved.
5 * Written by Hashimoto Kenichi for Genetec Corporation. 5 * Written by Hashimoto Kenichi for Genetec Corporation.
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 * Sharp NetWalker's Optical Joystick 30 * Sharp NetWalker's Optical Joystick
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: oj6sh.c,v 1.6 2021/01/17 21:42:35 thorpej Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: oj6sh.c,v 1.7 2021/01/27 02:32:31 thorpej Exp $");
35 35
36#include "opt_oj6sh.h" 36#include "opt_oj6sh.h"
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/kernel.h> 40#include <sys/kernel.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/lock.h> 42#include <sys/lock.h>
43#include <sys/callout.h> 43#include <sys/callout.h>
44#include <sys/bus.h> 44#include <sys/bus.h>
45#include <sys/mutex.h> 45#include <sys/mutex.h>
46#include <sys/workqueue.h> 46#include <sys/workqueue.h>
47 47
@@ -118,28 +118,27 @@ static void oj6sh_disable(void *); @@ -118,28 +118,27 @@ static void oj6sh_disable(void *);
118static int oj6sh_ioctl(void *, u_long, void *, int, struct lwp *); 118static int oj6sh_ioctl(void *, u_long, void *, int, struct lwp *);
119 119
120static bool oj6sh_resume(device_t, const pmf_qual_t *); 120static bool oj6sh_resume(device_t, const pmf_qual_t *);
121static bool oj6sh_suspend(device_t, const pmf_qual_t *); 121static bool oj6sh_suspend(device_t, const pmf_qual_t *);
122 122
123static const struct wsmouse_accessops oj6sh_accessops = { 123static const struct wsmouse_accessops oj6sh_accessops = {
124 .enable = oj6sh_enable, 124 .enable = oj6sh_enable,
125 .ioctl = oj6sh_ioctl, 125 .ioctl = oj6sh_ioctl,
126 .disable = oj6sh_disable 126 .disable = oj6sh_disable
127}; 127};
128 128
129static const struct device_compatible_entry compat_data[] = { 129static const struct device_compatible_entry compat_data[] = {
130 { .compat = "oj6sh" }, 130 { .compat = "oj6sh" },
131 131 DEVICE_COMPAT_EOL
132 { 0 } 
133}; 132};
134 133
135static int 134static int
136oj6sh_match(device_t parent, cfdata_t cf, void *aux) 135oj6sh_match(device_t parent, cfdata_t cf, void *aux)
137{ 136{
138 struct spi_attach_args *sa = aux; 137 struct spi_attach_args *sa = aux;
139 138
140 if (spi_compatible_match(sa, cf, compat_data) == 0) 139 if (spi_compatible_match(sa, cf, compat_data) == 0)
141 return 0; 140 return 0;
142 if (spi_configure(sa->sa_handle, SPI_MODE_0, 2500000)) 141 if (spi_configure(sa->sa_handle, SPI_MODE_0, 2500000))
143 return 0; 142 return 0;
144 143
145 return 2; 144 return 2;

cvs diff -r1.4 -r1.5 src/sys/dev/spi/ssdfb_spi.c (expand / switch to unified diff)

--- src/sys/dev/spi/ssdfb_spi.c 2021/01/17 21:42:35 1.4
+++ src/sys/dev/spi/ssdfb_spi.c 2021/01/27 02:32:31 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ssdfb_spi.c,v 1.4 2021/01/17 21:42:35 thorpej Exp $ */ 1/* $NetBSD: ssdfb_spi.c,v 1.5 2021/01/27 02:32:31 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2019 The NetBSD Foundation, Inc. 4 * Copyright (c) 2019 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 Tobias Nygren. 8 * by Tobias Nygren.
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: ssdfb_spi.c,v 1.4 2021/01/17 21:42:35 thorpej Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.5 2021/01/27 02:32:31 thorpej Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/kernel.h> 37#include <sys/kernel.h>
38#include <dev/wscons/wsdisplayvar.h> 38#include <dev/wscons/wsdisplayvar.h>
39#include <dev/rasops/rasops.h> 39#include <dev/rasops/rasops.h>
40#include <dev/spi/spivar.h> 40#include <dev/spi/spivar.h>
41#include <dev/ic/ssdfbvar.h> 41#include <dev/ic/ssdfbvar.h>
42 42
43struct bs_state { 43struct bs_state {
44 uint8_t *base; 44 uint8_t *base;
45 uint8_t *cur; 45 uint8_t *cur;
46 uint8_t mask; 46 uint8_t mask;
@@ -65,28 +65,27 @@ static int ssdfb_spi_xfer_rect_4wire_ssd @@ -65,28 +65,27 @@ static int ssdfb_spi_xfer_rect_4wire_ssd
65 65
66static void ssdfb_bitstream_init(struct bs_state *, uint8_t *); 66static void ssdfb_bitstream_init(struct bs_state *, uint8_t *);
67static void ssdfb_bitstream_append(struct bs_state *, uint8_t, uint8_t); 67static void ssdfb_bitstream_append(struct bs_state *, uint8_t, uint8_t);
68static void ssdfb_bitstream_append_cmd(struct bs_state *, uint8_t); 68static void ssdfb_bitstream_append_cmd(struct bs_state *, uint8_t);
69static void ssdfb_bitstream_append_data(struct bs_state *, uint8_t *, 69static void ssdfb_bitstream_append_data(struct bs_state *, uint8_t *,
70 size_t); 70 size_t);
71static void ssdfb_bitstream_final(struct bs_state *); 71static void ssdfb_bitstream_final(struct bs_state *);
72 72
73CFATTACH_DECL_NEW(ssdfb_spi, sizeof(struct ssdfb_spi_softc), 73CFATTACH_DECL_NEW(ssdfb_spi, sizeof(struct ssdfb_spi_softc),
74 ssdfb_spi_match, ssdfb_spi_attach, NULL, NULL); 74 ssdfb_spi_match, ssdfb_spi_attach, NULL, NULL);
75 75
76static const struct device_compatible_entry compat_data[] = { 76static const struct device_compatible_entry compat_data[] = {
77 { .compat = "solomon,ssd1322" }, 77 { .compat = "solomon,ssd1322" },
78 78 DEVICE_COMPAT_EOL
79 { 0 } 
80}; 79};
81 80
82static int 81static int
83ssdfb_spi_match(device_t parent, cfdata_t match, void *aux) 82ssdfb_spi_match(device_t parent, cfdata_t match, void *aux)
84{ 83{
85 struct spi_attach_args *sa = aux; 84 struct spi_attach_args *sa = aux;
86 int res; 85 int res;
87 86
88 res = spi_compatible_match(sa, match, compat_data); 87 res = spi_compatible_match(sa, match, compat_data);
89 if (!res) 88 if (!res)
90 return res; 89 return res;
91 90
92 /* 91 /*