1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-02-14 20:31:54 +00:00

Fix RPI patches

This commit is contained in:
Ycarus 2019-05-04 14:42:35 +02:00
parent 6e24dd77fa
commit c95f1d7534
9 changed files with 464 additions and 4 deletions

View file

@ -1,7 +1,7 @@
From 4d1939addc4ac55db7cb0bbbb6df87417cf25ce8 Mon Sep 17 00:00:00 2001
From 0b468d7ad239197ea5a24aef3ec74756ea3731e1 Mon Sep 17 00:00:00 2001
From: gellert <gellert@raspberrypi.org>
Date: Fri, 15 Aug 2014 16:35:06 +0100
Subject: [PATCH 044/432] MMC: added alternative MMC driver
Subject: [PATCH 044/493] MMC: added alternative MMC driver
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -293,7 +293,7 @@ index ce8398e6f2c0..b402128375b6 100644
obj-$(CONFIG_MMC_MTK) += mtk-sd.o
diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c
new file mode 100644
index 000000000000..08a700e0639a
index 000000000000..905075c94232
--- /dev/null
+++ b/drivers/mmc/host/bcm2835-mmc.c
@@ -0,0 +1,1582 @@
@ -550,7 +550,7 @@ index 000000000000..08a700e0639a
+ bcm2835_mmc_readl(host, SDHCI_INT_ENABLE),
+ bcm2835_mmc_readl(host, SDHCI_SIGNAL_ENABLE));
+ pr_debug(DRIVER_NAME ": AC12 err: 0x%08x | Slot int: 0x%08x\n",
+ bcm2835_mmc_readw(host, SDHCI_ACMD12_ERR),
+ bcm2835_mmc_readw(host, SDHCI_AUTO_CMD_STATUS),
+ bcm2835_mmc_readw(host, SDHCI_SLOT_INT_STATUS));
+ pr_debug(DRIVER_NAME ": Caps: 0x%08x | Caps_1: 0x%08x\n",
+ bcm2835_mmc_readl(host, SDHCI_CAPABILITIES),

View file

@ -0,0 +1,102 @@
From b954ef0dbb6bab97d22c921a79768e9207440fca Mon Sep 17 00:00:00 2001
From: James Hutchinson <jahutchinson99@googlemail.com>
Date: Sun, 13 Jan 2019 16:13:47 -0500
Subject: [PATCH 433/493] media: m88ds3103: serialize reset messages in
m88ds3103_set_frontend
commit 981fbe3da20a6f35f17977453bce7dfc1664d74f upstream.
Ref: https://bugzilla.kernel.org/show_bug.cgi?id=199323
Users are experiencing problems with the DVBSky S960/S960C USB devices
since the following commit:
9d659ae: ("locking/mutex: Add lock handoff to avoid starvation")
The device malfunctions after running for an indeterminable period of
time, and the problem can only be cleared by rebooting the machine.
It is possible to encourage the problem to surface by blocking the
signal to the LNB.
Further debugging revealed the cause of the problem.
In the following capture:
- thread #1325 is running m88ds3103_set_frontend
- thread #42 is running ts2020_stat_work
a> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 80
[1325] usb 1-1: dvb_usb_v2_generic_io: <<< 08
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 68 3f
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 08 ff
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 3d
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
b> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 00
[1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 21
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 66
[42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
[1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
[1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
[1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 60 02 10 0b
[1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
Two i2c messages are sent to perform a reset in m88ds3103_set_frontend:
a. 0x07, 0x80
b. 0x07, 0x00
However, as shown in the capture, the regmap mutex is being handed over
to another thread (ts2020_stat_work) in between these two messages.
>From here, the device responds to every i2c message with an 07 message,
and will only return to normal operation following a power cycle.
Use regmap_multi_reg_write to group the two reset messages, ensuring
both are processed before the regmap mutex is unlocked.
Signed-off-by: James Hutchinson <jahutchinson99@googlemail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
drivers/media/dvb-frontends/m88ds3103.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c
index dffd2d4bf1c8..c25c92797408 100644
--- a/drivers/media/dvb-frontends/m88ds3103.c
+++ b/drivers/media/dvb-frontends/m88ds3103.c
@@ -309,6 +309,9 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
u16 u16tmp;
u32 tuner_frequency_khz, target_mclk;
s32 s32tmp;
+ static const struct reg_sequence reset_buf[] = {
+ {0x07, 0x80}, {0x07, 0x00}
+ };
dev_dbg(&client->dev,
"delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n",
@@ -321,11 +324,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
}
/* reset */
- ret = regmap_write(dev->regmap, 0x07, 0x80);
- if (ret)
- goto err;
-
- ret = regmap_write(dev->regmap, 0x07, 0x00);
+ ret = regmap_multi_reg_write(dev->regmap, reset_buf, 2);
if (ret)
goto err;
--
2.19.1

View file

@ -0,0 +1,68 @@
From 16187430f6c1348b8b7cd279fec834db564a965c Mon Sep 17 00:00:00 2001
From: P33M <p33m@github.com>
Date: Wed, 24 Apr 2019 14:25:09 +0100
Subject: [PATCH 435/493] Revert "cgroup: Disable cgroup "memory" by default"
This reverts commit cd6ce4d0ded13c94ff5208c679ed5e030263149b.
---
kernel/cgroup/cgroup.c | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 3beaab75b081..63dae7e0ccae 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5290,8 +5290,6 @@ int __init cgroup_init_early(void)
}
static u16 cgroup_disable_mask __initdata;
-static u16 cgroup_enable_mask __initdata;
-static int __init cgroup_disable(char *str);
/**
* cgroup_init - cgroup initialization
@@ -5332,12 +5330,6 @@ int __init cgroup_init(void)
mutex_unlock(&cgroup_mutex);
- /* Apply an implicit disable... */
- cgroup_disable("memory");
-
- /* ...knowing that an explicit enable will override it. */
- cgroup_disable_mask &= ~cgroup_enable_mask;
-
for_each_subsys(ss, ssid) {
if (ss->early_init) {
struct cgroup_subsys_state *css =
@@ -5721,28 +5713,6 @@ static int __init cgroup_disable(char *str)
}
__setup("cgroup_disable=", cgroup_disable);
-static int __init cgroup_enable(char *str)
-{
- struct cgroup_subsys *ss;
- char *token;
- int i;
-
- while ((token = strsep(&str, ",")) != NULL) {
- if (!*token)
- continue;
-
- for_each_subsys(ss, i) {
- if (strcmp(token, ss->name) &&
- strcmp(token, ss->legacy_name))
- continue;
-
- cgroup_enable_mask |= 1 << i;
- }
- }
- return 1;
-}
-__setup("cgroup_enable=", cgroup_enable);
-
/**
* css_tryget_online_from_dir - get corresponding css from a cgroup dentry
* @dentry: directory dentry of interest
--
2.19.1

View file

@ -0,0 +1,32 @@
From cd07072158b104f2e30a14bf5162095bb3b9c230 Mon Sep 17 00:00:00 2001
From: P33M <p33m@github.com>
Date: Wed, 1 May 2019 15:00:05 +0100
Subject: [PATCH 483/493] dts: Increase default coherent pool size
dwc_otg allocates DMA-coherent buffers in atomic context for misaligned
transfer buffers. The pool that these allocations come from is set up
at boot-time but can be overridden by a commandline parameter -
increase this for now to prevent failures seen on 4.19 with multiple
USB Ethernet devices.
see: https://github.com/raspberrypi/linux/issues/2924
---
arch/arm/boot/dts/bcm270x.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/bcm270x.dtsi b/arch/arm/boot/dts/bcm270x.dtsi
index 55a03c0d5e1c..ecdb36e69c87 100644
--- a/arch/arm/boot/dts/bcm270x.dtsi
+++ b/arch/arm/boot/dts/bcm270x.dtsi
@@ -3,7 +3,7 @@
/ {
chosen {
- bootargs = "";
+ bootargs = "coherent_pool=1M";
/delete-property/ stdout-path;
};
--
2.19.1

View file

@ -0,0 +1,69 @@
From d1ed37c3a772b2609faaf78717816faf41827629 Mon Sep 17 00:00:00 2001
From: P33M <p33m@github.com>
Date: Wed, 1 May 2019 17:04:32 +0100
Subject: [PATCH 486/493] smsc95xx: dynamically fix up TX buffer alignment with
padding bytes
dwc_otg requires a 32-bit aligned buffer start address, otherwise
expensive bounce buffers are used. The LAN951x hardware can skip up to
3 bytes between the TX header and the start of frame data, which can
be used to force alignment of the URB passed to dwc_otg.
As found in https://github.com/raspberrypi/linux/issues/2924
---
drivers/net/usb/smsc95xx.c | 12 +++++++-----
drivers/net/usb/smsc95xx.h | 2 +-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index a5bbec75f22d..c087b6d75753 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -2082,7 +2082,9 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev,
struct sk_buff *skb, gfp_t flags)
{
bool csum = skb->ip_summed == CHECKSUM_PARTIAL;
- int overhead = csum ? SMSC95XX_TX_OVERHEAD_CSUM : SMSC95XX_TX_OVERHEAD;
+ unsigned int align_bytes = -((uintptr_t)skb->data) & 0x3;
+ int overhead = csum ? SMSC95XX_TX_OVERHEAD_CSUM + align_bytes
+ : SMSC95XX_TX_OVERHEAD + align_bytes;
u32 tx_cmd_a, tx_cmd_b;
/* We do not advertise SG, so skbs should be already linearized */
@@ -2116,16 +2118,16 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev,
}
}
- skb_push(skb, 4);
- tx_cmd_b = (u32)(skb->len - 4);
+ skb_push(skb, 4 + align_bytes);
+ tx_cmd_b = (u32)(skb->len - 4 - align_bytes);
if (csum)
tx_cmd_b |= TX_CMD_B_CSUM_ENABLE;
cpu_to_le32s(&tx_cmd_b);
memcpy(skb->data, &tx_cmd_b, 4);
skb_push(skb, 4);
- tx_cmd_a = (u32)(skb->len - 8) | TX_CMD_A_FIRST_SEG_ |
- TX_CMD_A_LAST_SEG_;
+ tx_cmd_a = (u32)(skb->len - 8 - align_bytes) | TX_CMD_A_FIRST_SEG_ |
+ (align_bytes << 16) | TX_CMD_A_LAST_SEG_;
cpu_to_le32s(&tx_cmd_a);
memcpy(skb->data, &tx_cmd_a, 4);
diff --git a/drivers/net/usb/smsc95xx.h b/drivers/net/usb/smsc95xx.h
index cfc704f3a460..55f9f03e1a0c 100644
--- a/drivers/net/usb/smsc95xx.h
+++ b/drivers/net/usb/smsc95xx.h
@@ -21,7 +21,7 @@
#define _SMSC95XX_H
/* Tx command words */
-#define TX_CMD_A_DATA_OFFSET_ (0x001F0000) /* Data Start Offset */
+#define TX_CMD_A_DATA_OFFSET_ (0x00030000) /* Data Start Offset */
#define TX_CMD_A_FIRST_SEG_ (0x00002000) /* First Segment */
#define TX_CMD_A_LAST_SEG_ (0x00001000) /* Last Segment */
#define TX_CMD_A_BUF_SIZE_ (0x000007FF) /* Buffer Size */
--
2.19.1

View file

@ -0,0 +1,28 @@
From 2f5a6b906ad86ef6570863a75b204551c2c62fec Mon Sep 17 00:00:00 2001
From: P33M <p33m@github.com>
Date: Thu, 2 May 2019 11:53:45 +0100
Subject: [PATCH 487/493] lan78xx: use default alignment for rx buffers
The lan78xx uses a 12-byte hardware rx header, so there is no need
to allocate SKBs with NET_IP_ALIGN set. Removes alignment faults
in both dwc_otg and in ipv6 processing.
---
drivers/net/usb/lan78xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 3387f44b132f..14f206a56187 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -3250,7 +3250,7 @@ static int rx_submit(struct lan78xx_net *dev, struct urb *urb, gfp_t flags)
size_t size = dev->rx_urb_size;
int ret = 0;
- skb = netdev_alloc_skb_ip_align(dev->net, size);
+ skb = netdev_alloc_skb(dev->net, size);
if (!skb) {
usb_free_urb(urb);
return -ENOMEM;
--
2.19.1

View file

@ -0,0 +1,33 @@
From 1a3bcd6c80c9ad44e9108cf7d74db37712d171a8 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Wed, 1 May 2019 13:27:23 +0100
Subject: [PATCH 490/493] staging: mmal-vchiq: Free the event context for
control ports
vchiq_mmal_component_init calls init_event_context for the
control port, but vchiq_mmal_component_finalise didn't free
it, causing a memory leak..
Add the free call.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index 7a48877ffff5..68c5881f3bf6 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
@@ -1981,6 +1981,8 @@ int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance,
for (idx = 0; idx < component->clocks; idx++)
free_event_context(&component->clock[idx]);
+ free_event_context(&component->control);
+
mutex_unlock(&instance->vchiq_mutex);
return ret;
--
2.19.1

View file

@ -0,0 +1,72 @@
From 40dddbf98b6a28a30d68333da8e94dfacf389be1 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Wed, 1 May 2019 15:17:00 +0100
Subject: [PATCH 491/493] staging: mmal-vchiq: Replace spinlock protecting
context_map with mutex
950fd86 staging: bcm2835-camera: Replace open-coded idr with a struct idr.
replaced an internal implementation of an idr with the standard functions
and a spinlock.
idr_alloc(GFP_KERNEL) can sleep whilst calling kmem_cache_alloc to allocate
the new node, but this is not valid whilst in an atomic context due to the
spinlock.
There is no need for this to be a spinlock as a standard mutex is
sufficient.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
.../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index 68c5881f3bf6..bce42b652e57 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
@@ -185,7 +185,8 @@ struct vchiq_mmal_instance {
void *bulk_scratch;
struct idr context_map;
- spinlock_t context_map_lock;
+ /* protect accesses to context_map */
+ struct mutex context_map_lock;
struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS];
@@ -209,10 +210,10 @@ get_msg_context(struct vchiq_mmal_instance *instance)
* that when we service the VCHI reply, we can look up what
* message is being replied to.
*/
- spin_lock(&instance->context_map_lock);
+ mutex_lock(&instance->context_map_lock);
handle = idr_alloc(&instance->context_map, msg_context,
0, 0, GFP_KERNEL);
- spin_unlock(&instance->context_map_lock);
+ mutex_unlock(&instance->context_map_lock);
if (handle < 0) {
kfree(msg_context);
@@ -236,9 +237,9 @@ release_msg_context(struct mmal_msg_context *msg_context)
{
struct vchiq_mmal_instance *instance = msg_context->instance;
- spin_lock(&instance->context_map_lock);
+ mutex_lock(&instance->context_map_lock);
idr_remove(&instance->context_map, msg_context->handle);
- spin_unlock(&instance->context_map_lock);
+ mutex_unlock(&instance->context_map_lock);
kfree(msg_context);
}
@@ -2143,7 +2144,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance)
instance->bulk_scratch = vmalloc(PAGE_SIZE);
- spin_lock_init(&instance->context_map_lock);
+ mutex_init(&instance->context_map_lock);
idr_init_base(&instance->context_map, 1);
params.callback_param = instance;
--
2.19.1

View file

@ -0,0 +1,56 @@
From 591bd5452ad361deedc19d21d3f98bf1eab623ca Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Thu, 2 May 2019 22:14:34 +0100
Subject: [PATCH 492/493] BCM270X_DT: Also set coherent_pool=1M for BT Pis
See: https://github.com/raspberrypi/linux/issues/2924
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
arch/arm/boot/dts/bcm2708-rpi-0-w.dts | 2 +-
arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts | 2 +-
arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts
index 68316404aab2..aa33646fcf53 100644
--- a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts
@@ -8,7 +8,7 @@
model = "Raspberry Pi Zero W";
chosen {
- bootargs = "8250.nr_uarts=1";
+ bootargs = "coherent_pool=1M 8250.nr_uarts=1";
};
aliases {
diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
index 898ab48479e3..b5f125296e1e 100644
--- a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
@@ -9,7 +9,7 @@
model = "Raspberry Pi 3 Model B+";
chosen {
- bootargs = "8250.nr_uarts=1";
+ bootargs = "coherent_pool=1M 8250.nr_uarts=1";
};
aliases {
diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
index 61ecb46b9c06..d9d9505c6693 100644
--- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
@@ -9,7 +9,7 @@
model = "Raspberry Pi 3 Model B";
chosen {
- bootargs = "8250.nr_uarts=1";
+ bootargs = "coherent_pool=1M 8250.nr_uarts=1";
};
aliases {
--
2.19.1