File: 16-linux56.patch

package info (click to toggle)
broadcom-sta 6.30.223.271-29
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 18,968 kB
  • sloc: ansic: 28,321; makefile: 317; xml: 36; sh: 14
file content (165 lines) | stat: -rw-r--r-- 5,805 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
From: Herman van Hazendonk <github.com@herrie.org>
Date: Tue, 31 Mar 2020 17:09:55 +0200
Subject: [PATCH] Add fixes for 5.6 kernel

Origin: https://salsa.debian.org/Herrie82-guest/broadcom-sta/-/merge_requests/1

Use ioremap instead of ioremap_nocache and proc_ops instead of
file_operations on Linux kernel 5.6 and above.

<rosh> Patch amended to adapt i386 arch.
---
 amd64/src/shared/linux_osl.c |  6 +++++-
 amd64/src/wl/sys/wl_linux.c  | 21 ++++++++++++++++++++-
 i386/src/shared/linux_osl.c  |  6 +++++-
 i386/src/wl/sys/wl_linux.c   | 21 ++++++++++++++++++++-
 4 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/amd64/src/shared/linux_osl.c b/amd64/src/shared/linux_osl.c
index b24a973..9bce9b1 100644
--- a/amd64/src/shared/linux_osl.c
+++ b/amd64/src/shared/linux_osl.c
@@ -946,7 +946,11 @@ osl_getcycles(void)
 void *
 osl_reg_map(uint32 pa, uint size)
 {
-	return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+	#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+		return (ioremap((unsigned long)pa, (unsigned long)size));
+	#else
+		return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+	#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
 }
 
 void
diff --git a/amd64/src/wl/sys/wl_linux.c b/amd64/src/wl/sys/wl_linux.c
index 8fe9f4f..66069d4 100644
--- a/amd64/src/wl/sys/wl_linux.c
+++ b/amd64/src/wl/sys/wl_linux.c
@@ -588,10 +588,17 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
 	}
 	wl->bcm_bustype = bustype;
 
+	#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+	if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
+		WL_ERROR(("wl%d: ioremap() failed\n", unit));
+		goto fail;
+	}
+	#else
 	if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
 		WL_ERROR(("wl%d: ioremap() failed\n", unit));
 		goto fail;
 	}
+	#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
 
 	wl->bar1_addr = bar1_addr;
 	wl->bar1_size = bar1_size;
@@ -778,8 +785,13 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if ((val & 0x0000ff00) != 0)
 		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
 		bar1_size = pci_resource_len(pdev, 2);
+		#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+		bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
+			bar1_size);
+		#else
 		bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
 			bar1_size);
+		#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
 	wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
 		pdev->irq, bar1_addr, bar1_size);
 
@@ -3352,12 +3364,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+static const struct proc_ops wl_fops = {
+	.proc_read	= wl_proc_read,
+	.proc_write	= wl_proc_write,
+};
+#else
 static const struct file_operations wl_fops = {
 	.owner	= THIS_MODULE,
 	.read	= wl_proc_read,
 	.write	= wl_proc_write,
 };
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
 
 static int
 wl_reg_proc_entry(wl_info_t *wl)
diff --git a/i386/src/shared/linux_osl.c b/i386/src/shared/linux_osl.c
index 3188745..f3b78be 100644
--- a/i386/src/shared/linux_osl.c
+++ b/i386/src/shared/linux_osl.c
@@ -942,7 +942,11 @@ osl_getcycles(void)
 void *
 osl_reg_map(uint32 pa, uint size)
 {
-	return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+	#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+		return (ioremap((unsigned long)pa, (unsigned long)size));
+	#else
+		return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+	#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
 }
 
 void
diff --git a/i386/src/wl/sys/wl_linux.c b/i386/src/wl/sys/wl_linux.c
index 0d05100..bff467d 100644
--- a/i386/src/wl/sys/wl_linux.c
+++ b/i386/src/wl/sys/wl_linux.c
@@ -582,10 +582,17 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
 	}
 	wl->bcm_bustype = bustype;
 
+	#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+	if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
+		WL_ERROR(("wl%d: ioremap() failed\n", unit));
+		goto fail;
+	}
+	#else
 	if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
 		WL_ERROR(("wl%d: ioremap() failed\n", unit));
 		goto fail;
 	}
+	#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
 
 	wl->bar1_addr = bar1_addr;
 	wl->bar1_size = bar1_size;
@@ -772,8 +779,13 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if ((val & 0x0000ff00) != 0)
 		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
 		bar1_size = pci_resource_len(pdev, 2);
+		#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+		bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
+			bar1_size);
+		#else
 		bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
 			bar1_size);
+		#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
 	wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
 		pdev->irq, bar1_addr, bar1_size);
 
@@ -3335,12 +3347,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
+static const struct proc_ops wl_fops = {
+	.proc_read	= wl_proc_read,
+	.proc_write	= wl_proc_write,
+};
+#else
 static const struct file_operations wl_fops = {
 	.owner	= THIS_MODULE,
 	.read	= wl_proc_read,
 	.write	= wl_proc_write,
 };
-#endif
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
 
 static int
 wl_reg_proc_entry(wl_info_t *wl)