tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
broadcom_sta: fix build on 5.6
Matthieu Coudron
5 years ago
8ce65087
8f43c555
+89
2 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
broadcom-sta
default.nix
linux-5.6.patch
+2
pkgs/os-specific/linux/broadcom-sta/default.nix
···
35
35
./linux-4.12.patch
36
36
./linux-4.15.patch
37
37
./linux-5.1.patch
38
38
+
# source: https://salsa.debian.org/Herrie82-guest/broadcom-sta/-/commit/247307926e5540ad574a17c062c8da76990d056f
39
39
+
./linux-5.6.patch
38
40
./null-pointer-fix.patch
39
41
./gcc.patch
40
42
];
+87
pkgs/os-specific/linux/broadcom-sta/linux-5.6.patch
···
1
1
+
From dd057e40a167f4febb1a7c77dd32b7d36056952c Mon Sep 17 00:00:00 2001
2
2
+
From: Herman van Hazendonk <github.com@herrie.org>
3
3
+
Date: Tue, 31 Mar 2020 17:09:55 +0200
4
4
+
Subject: [PATCH] Add fixes for 5.6 kernel
5
5
+
6
6
+
Use ioremap instead of ioremap_nocache and proc_ops instead of file_operations on Linux kernel 5.6 and above.
7
7
+
8
8
+
Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
9
9
+
---
10
10
+
src/shared/linux_osl.c | 6 +++++-
11
11
+
src/wl/sys/wl_linux.c | 21 ++++++++++++++++++++-
12
12
+
2 files changed, 25 insertions(+), 2 deletions(-)
13
13
+
14
14
+
diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
15
15
+
index 6157d18..dcfc075 100644
16
16
+
--- a/src/shared/linux_osl.c
17
17
+
+++ b/src/shared/linux_osl.c
18
18
+
@@ -942,7 +942,11 @@ osl_getcycles(void)
19
19
+
void *
20
20
+
osl_reg_map(uint32 pa, uint size)
21
21
+
{
22
22
+
- return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
23
23
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
24
24
+
+ return (ioremap((unsigned long)pa, (unsigned long)size));
25
25
+
+ #else
26
26
+
+ return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
27
27
+
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
28
28
+
}
29
29
+
30
30
+
void
31
31
+
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
32
32
+
index 0d05100..6d9dd0d 100644
33
33
+
--- a/src/wl/sys/wl_linux.c
34
34
+
+++ b/src/wl/sys/wl_linux.c
35
35
+
@@ -582,10 +582,17 @@ wl_attach(uint16 vendor, uint16 device, ulong regs,
36
36
+
}
37
37
+
wl->bcm_bustype = bustype;
38
38
+
39
39
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
40
40
+
+ if ((wl->regsva = ioremap(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
41
41
+
+ WL_ERROR(("wl%d: ioremap() failed\n", unit));
42
42
+
+ goto fail;
43
43
+
+ }
44
44
+
+ #else
45
45
+
if ((wl->regsva = ioremap_nocache(dev->base_addr, PCI_BAR0_WINSZ)) == NULL) {
46
46
+
WL_ERROR(("wl%d: ioremap() failed\n", unit));
47
47
+
goto fail;
48
48
+
}
49
49
+
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
50
50
+
51
51
+
wl->bar1_addr = bar1_addr;
52
52
+
wl->bar1_size = bar1_size;
53
53
+
@@ -772,8 +779,13 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
54
54
+
if ((val & 0x0000ff00) != 0)
55
55
+
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
56
56
+
bar1_size = pci_resource_len(pdev, 2);
57
57
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
58
58
+
+ bar1_addr = (uchar *)ioremap(pci_resource_start(pdev, 2),
59
59
+
+ bar1_size);
60
60
+
+ #else
61
61
+
bar1_addr = (uchar *)ioremap_nocache(pci_resource_start(pdev, 2),
62
62
+
bar1_size);
63
63
+
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
64
64
+
wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), PCI_BUS, pdev,
65
65
+
pdev->irq, bar1_addr, bar1_size);
66
66
+
67
67
+
@@ -3335,12 +3347,19 @@ wl_proc_write(struct file *filp, const char __user *buff, size_t length, loff_t
68
68
+
}
69
69
+
70
70
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
71
71
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
72
72
+
+static const struct proc_ops wl_fops = {
73
73
+
+ .proc_read = wl_proc_read,
74
74
+
+ .proc_write = wl_proc_write,
75
75
+
+};
76
76
+
+#else
77
77
+
static const struct file_operations wl_fops = {
78
78
+
.owner = THIS_MODULE,
79
79
+
.read = wl_proc_read,
80
80
+
.write = wl_proc_write,
81
81
+
};
82
82
+
-#endif
83
83
+
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
84
84
+
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
85
85
+
86
86
+
static int
87
87
+
wl_reg_proc_entry(wl_info_t *wl)