mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 21:58:04 +00:00
2e715fb4fc
Add support for BCM2712 (Raspberry Pi 5).
3bb5880ab3
Patches were generated from the diff between linux kernel branch linux-6.1.y
and rpi-6.1.y from raspberry pi kernel source:
- git format-patch linux-6.1.y...rpi-6.1.y
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2710/RPi3B, bcm2711/RPi4B
Signed-off-by: Marty Jones <mj8263788@gmail.com>
[Remove applied and reverted patches, squash patches and config commits]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
56 lines
1.9 KiB
Diff
56 lines
1.9 KiB
Diff
From 586f87307e75552292cfc6c76b81cd38d5ec31e2 Mon Sep 17 00:00:00 2001
|
|
From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
|
|
Date: Mon, 4 Sep 2023 10:57:47 +0100
|
|
Subject: [PATCH] spi: spi-gpio: Implement spidelay when requested bit rate <=
|
|
1 Mbps
|
|
|
|
Formerly the delay was omitted as bit-banged SPI seldom achieved
|
|
even one Mbit/s; but some modern platforms can run faster, and
|
|
some SPI devices may need to be clocked slower.
|
|
|
|
Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
|
|
---
|
|
drivers/spi/spi-gpio.c | 18 ++++++++++++------
|
|
1 file changed, 12 insertions(+), 6 deletions(-)
|
|
|
|
--- a/drivers/spi/spi-gpio.c
|
|
+++ b/drivers/spi/spi-gpio.c
|
|
@@ -11,12 +11,12 @@
|
|
#include <linux/gpio/consumer.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_device.h>
|
|
+#include <linux/delay.h>
|
|
|
|
#include <linux/spi/spi.h>
|
|
#include <linux/spi/spi_bitbang.h>
|
|
#include <linux/spi/spi_gpio.h>
|
|
|
|
-
|
|
/*
|
|
* This bitbanging SPI master driver should help make systems usable
|
|
* when a native hardware SPI engine is not available, perhaps because
|
|
@@ -111,12 +111,18 @@ static inline int getmiso(const struct s
|
|
}
|
|
|
|
/*
|
|
- * NOTE: this clocks "as fast as we can". It "should" be a function of the
|
|
- * requested device clock. Software overhead means we usually have trouble
|
|
- * reaching even one Mbit/sec (except when we can inline bitops), so for now
|
|
- * we'll just assume we never need additional per-bit slowdowns.
|
|
+ * Generic bit-banged GPIO SPI might free-run at something in the range
|
|
+ * 1Mbps ~ 10Mbps (depending on the platform), and some SPI devices may
|
|
+ * need to be clocked at a lower rate. ndelay() is often implemented by
|
|
+ * udelay() with rounding up, so do the delay only for nsecs >= 500
|
|
+ * (<= 1Mbps). The conditional test adds a small overhead.
|
|
*/
|
|
-#define spidelay(nsecs) do {} while (0)
|
|
+
|
|
+static inline void spidelay(unsigned long nsecs)
|
|
+{
|
|
+ if (nsecs >= 500)
|
|
+ ndelay(nsecs);
|
|
+}
|
|
|
|
#include "spi-bitbang-txrx.h"
|
|
|