Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d6a5b88

Browse files
committedJan 14, 2021
linux-rockchip: Add lec-px30 support patches
Signed-off-by: Alexandru Costache <alexandru@balena.io>
1 parent 7bbcdae commit d6a5b88

11 files changed

+28755
-0
lines changed
 

‎layers/meta-balena-nanopc-t4/recipes-kernel/linux/files/4.4.185/0001-Device-tree-for-LEC-PX30-A2.patch

+8,638
Large diffs are not rendered by default.

‎layers/meta-balena-nanopc-t4/recipes-kernel/linux/files/4.4.185/0002-Added-ethernet-driver-support-for-LEC-PX30-A2.patch

+9,584
Large diffs are not rendered by default.

‎layers/meta-balena-nanopc-t4/recipes-kernel/linux/files/4.4.185/0003-Added-mcp25xxfd-driver-support-for-LEC-PX30-A2.patch

+4,567
Large diffs are not rendered by default.

‎layers/meta-balena-nanopc-t4/recipes-kernel/linux/files/4.4.185/0004-Added-LT9611-driver-support-for-LEC-PX30-A2.patch

+1,027
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
From 73325c6a311a6e606714a48b2ca5615ea512254f Mon Sep 17 00:00:00 2001
2+
From: Dineshkumar V <dineshkumar.varadarajan@adlinktech.com>
3+
Date: Thu, 5 Dec 2019 21:45:51 +0530
4+
Subject: [PATCH 5/5] Modified compatible property as per target kernel dts
5+
file
6+
7+
---
8+
drivers/clk/rockchip/clk-px30.c | 2 +-
9+
drivers/cpufreq/rockchip-cpufreq.c | 2 +-
10+
2 files changed, 2 insertions(+), 2 deletions(-)
11+
12+
diff --git a/drivers/clk/rockchip/clk-px30.c b/drivers/clk/rockchip/clk-px30.c
13+
index 56e78c2..96690f1 100644
14+
--- a/drivers/clk/rockchip/clk-px30.c
15+
+++ b/drivers/clk/rockchip/clk-px30.c
16+
@@ -1068,7 +1068,7 @@ static void __init px30_clk_init(struct device_node *np)
17+
PX30_GRF_SOC_STATUS0);
18+
rockchip_clk_register_branches(ctx, px30_clk_branches,
19+
ARRAY_SIZE(px30_clk_branches));
20+
- if (of_machine_is_compatible("rockchip,px30"))
21+
+ if (of_machine_is_compatible("adlink,lec-px30"))
22+
rockchip_clk_register_branches(ctx, px30_gpu_src_clk,
23+
ARRAY_SIZE(px30_gpu_src_clk));
24+
else
25+
diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c
26+
index c206b7c..ccb38ab 100644
27+
--- a/drivers/cpufreq/rockchip-cpufreq.c
28+
+++ b/drivers/cpufreq/rockchip-cpufreq.c
29+
@@ -164,7 +164,7 @@ out:
30+
}
31+
static const struct of_device_id rockchip_cpufreq_of_match[] = {
32+
{
33+
- .compatible = "rockchip,px30",
34+
+ .compatible = "adlink,lec-px30",
35+
.data = (void *)&px30_get_soc_info,
36+
},
37+
{
38+
--
39+
2.7.4
40+

‎layers/meta-balena-nanopc-t4/recipes-kernel/linux/files/4.4.185/0006-Added-Sx150x-gpio-expander-suppport-for-LEC-PX30-A2.patch

+289
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
From 2ed09d2c6dabe7ae167b4e1fa585f5e1fbced5b2 Mon Sep 17 00:00:00 2001
2+
From: Dineshkumar V <dineshkumar.varadarajan@adlinktech.com>
3+
Date: Wed, 26 Feb 2020 18:45:49 +0530
4+
Subject: [PATCH 7/7] Added SPI chip select enable/disable support for SPI
5+
Read/Write
6+
7+
---
8+
drivers/spi/spi-rockchip.c | 14 ++------------
9+
drivers/spi/spi.c | 18 ++++++++++++++++--
10+
include/linux/spi/spi.h | 1 +
11+
3 files changed, 19 insertions(+), 14 deletions(-)
12+
13+
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
14+
index a9a6339..7e44fcf 100644
15+
--- a/drivers/spi/spi-rockchip.c
16+
+++ b/drivers/spi/spi-rockchip.c
17+
@@ -433,18 +433,9 @@ static void rockchip_spi_dma_txcb(void *data)
18+
spin_unlock_irqrestore(&rs->lock, flags);
19+
}
20+
21+
-static u32 rockchip_spi_calc_burst_size(u32 data_len)
22+
-{
23+
- u32 i;
24+
25+
/* burst size: 1, 2, 4, 8 */
26+
- for (i = 1; i < 8; i <<= 1) {
27+
- if (data_len & i)
28+
- break;
29+
- }
30+
31+
- return i;
32+
-}
33+
34+
static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
35+
{
36+
@@ -465,7 +456,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
37+
rxconf.direction = rs->dma_rx.direction;
38+
rxconf.src_addr = rs->dma_rx.addr;
39+
rxconf.src_addr_width = rs->n_bytes;
40+
- rxconf.src_maxburst = rockchip_spi_calc_burst_size(rs->len / rs->n_bytes);
41+
+ rxconf.src_maxburst = 1;
42+
dmaengine_slave_config(rs->dma_rx.ch, &rxconf);
43+
44+
rxdesc = dmaengine_prep_slave_sg(
45+
@@ -598,8 +589,7 @@ static void rockchip_spi_config(struct rockchip_spi *rs)
46+
writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_RXFTLR);
47+
48+
writel_relaxed(rs->fifo_len / 2 - 1, rs->regs + ROCKCHIP_SPI_DMATDLR);
49+
- writel_relaxed(rockchip_spi_calc_burst_size(rs->len / rs->n_bytes) - 1,
50+
- rs->regs + ROCKCHIP_SPI_DMARDLR);
51+
+ writel_relaxed(0, rs->regs + ROCKCHIP_SPI_DMARDLR);
52+
writel_relaxed(dmacr, rs->regs + ROCKCHIP_SPI_DMACR);
53+
54+
spi_set_clk(rs, div);
55+
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
56+
index c132c67..6b94ee4 100644
57+
--- a/drivers/spi/spi.c
58+
+++ b/drivers/spi/spi.c
59+
@@ -673,6 +673,10 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
60+
if (spi->mode & SPI_CS_HIGH)
61+
enable = !enable;
62+
63+
+ if(spi->spi_gpio_cs>0)
64+
+ {
65+
+ gpio_set_value(spi->spi_gpio_cs,!enable);
66+
+ }
67+
if (gpio_is_valid(spi->cs_gpio))
68+
gpio_set_value(spi->cs_gpio, !enable);
69+
else if (spi->master->set_cs)
70+
@@ -903,8 +907,6 @@ static int spi_map_msg(struct spi_master *master, struct spi_message *msg)
71+
if (max_tx || max_rx) {
72+
list_for_each_entry(xfer, &msg->transfers,
73+
transfer_list) {
74+
- if (!xfer->len)
75+
- continue;
76+
if (!xfer->tx_buf)
77+
xfer->tx_buf = master->dummy_tx;
78+
if (!xfer->rx_buf)
79+
@@ -1521,6 +1523,18 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc)
80+
}
81+
spi->max_speed_hz = value;
82+
83+
+ spi->spi_gpio_cs=of_get_named_gpio(nc,"spi-gpio-cs",0);
84+
+ if(spi->spi_gpio_cs>0)
85+
+ {
86+
+ printk("spi->spi_gpio_cs=%d\n",spi->spi_gpio_cs);
87+
+ rc = gpio_request(spi->spi_gpio_cs, "spi0_gpio_cs");
88+
+ if (rc != 0) {
89+
+ gpio_free(spi->spi_gpio_cs);
90+
+ printk("gpio request spi_gpio_cs failed\n");
91+
+ }
92+
+ else
93+
+ gpio_direction_output(spi->spi_gpio_cs, 1);
94+
+ }
95+
/* Store a pointer to the node in the device structure */
96+
of_node_get(nc);
97+
spi->dev.of_node = nc;
98+
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
99+
index cce80e6..e1b8c04 100644
100+
--- a/include/linux/spi/spi.h
101+
+++ b/include/linux/spi/spi.h
102+
@@ -158,6 +158,7 @@ struct spi_device {
103+
void *controller_data;
104+
char modalias[SPI_NAME_SIZE];
105+
int cs_gpio; /* chip select gpio */
106+
+ int spi_gpio_cs;/*add by lm*/
107+
108+
/* the statistics */
109+
struct spi_statistics statistics;
110+
--
111+
2.7.4
112+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 981b285389321d180d4dad2e81cf34f513fa507e Mon Sep 17 00:00:00 2001
2+
From: Arun Kumar E V <dineshkumar.varadarajan@adlinktech.com>
3+
Date: Tue, 3 Mar 2020 15:21:29 +0530
4+
Subject: [PATCH 9/9] Modified Boot Arguments to mount fileystem from SD card
5+
6+
---
7+
arch/arm64/boot/dts/rockchip/rk3326-linux.dtsi | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/arch/arm64/boot/dts/rockchip/rk3326-linux.dtsi b/arch/arm64/boot/dts/rockchip/rk3326-linux.dtsi
11+
index 9fbb720..4f2c272 100644
12+
--- a/arch/arm64/boot/dts/rockchip/rk3326-linux.dtsi
13+
+++ b/arch/arm64/boot/dts/rockchip/rk3326-linux.dtsi
14+
@@ -45,7 +45,7 @@
15+
16+
chosen {
17+
//bootargs = "earlycon=uart8250,mmio32,0xff160000 swiotlb=1 console=ttyFIQ0 rw root=PARTUUID=614e0000-0000 rootwait";
18+
- bootargs = "earlycon=uart8250,mmio32,0xff160000 swiotlb=1 console=ttyFIQ0 rw root=/dev/mmcblk1p4 rootwait";
19+
+ bootargs = "earlycon=uart8250,mmio32,0xff160000 swiotlb=1 console=ttyFIQ0 rw root=/dev/mmcblk0p4 rootwait";
20+
/* bootargs = "console=tty1 rw root=PARTUUID=614e0000-0000 rootwait";*/
21+
};
22+
23+
--
24+
2.7.4
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Patch imported from https://github.com/armbian/build.git at revision c55f6ea8bc220bded6695fdae8b0c5bfa891b688
2+
3+
Upstream-Status: Inappropriate [not author]
4+
Signed-off-by: Florin Sarbu <florin@balena.io>
5+
---
6+
drivers/net/wireless/rockchip_wlan/rkwifi/rk_wifi_config.c | 2 +-
7+
1 file changed, 1 insertion(+), 1 deletion(-)
8+
9+
diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/rk_wifi_config.c b/drivers/net/wireless/rockchip_wlan/rkwifi/rk_wifi_config.c
10+
index fa07a94..352ea75 100644
11+
--- a/drivers/net/wireless/rockchip_wlan/rkwifi/rk_wifi_config.c
12+
+++ b/drivers/net/wireless/rockchip_wlan/rkwifi/rk_wifi_config.c
13+
@@ -18,7 +18,7 @@
14+
*/
15+
16+
#define VENDOR_ETC_FIRMWARE "/vendor/etc/firmware/"
17+
-#define SYSTEM_ETC_FIRMWARE "/system/etc/firmware/"
18+
+#define SYSTEM_ETC_FIRMWARE "/lib/firmware/rkwifi/"
19+
char ANDROID_FW_PATH[64] = {0};
20+
21+
extern int get_wifi_chip_type(void);
22+
--
23+
2.7.4
24+

‎layers/meta-balena-nanopc-t4/recipes-kernel/linux/files/4.4.185/defconfig

+4,411
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
SUMMARY = "LEC-PX30 kernel"
2+
DESCRIPTION = "ADLINK iPi LEC-PX30 kernel"
3+
4+
FILESEXTRAPATHS_prepend := "${THISDIR}/files/4.4.185:"
5+
6+
LINUX_VERSION = "4.4.185"
7+
8+
SRC_URI = " \
9+
git://github.com/rockchip-linux/kernel.git;branch=develop-4.4 \
10+
file://adjust_wireless_firmware_path.patch \
11+
"
12+
SRCREV = "e83084b53d4e02f5fd25aad25b42ffd3108c7f15"
13+
14+
require recipes-kernel/linux/linux-yocto.inc
15+
16+
PV = "${LINUX_VERSION}+git${SRCPV}"
17+
18+
S = "${WORKDIR}/git"
19+
20+
KCONFIG_MODE="--alldefconfig"
21+
22+
COMPATIBLE_MACHINE = "(lec-px30)"
23+
24+
SRC_URI += " \
25+
file://defconfig \
26+
file://0001-Device-tree-for-LEC-PX30-A2.patch \
27+
file://0002-Added-ethernet-driver-support-for-LEC-PX30-A2.patch \
28+
file://0003-Added-mcp25xxfd-driver-support-for-LEC-PX30-A2.patch \
29+
file://0004-Added-LT9611-driver-support-for-LEC-PX30-A2.patch \
30+
file://0005-Modified-compatible-property-as-per-target-kernel-dt.patch \
31+
file://0006-Added-Sx150x-gpio-expander-suppport-for-LEC-PX30-A2.patch \
32+
file://0007-Added-SPI-chip-select-enable-disable-support-for-SPI.patch \
33+
"
34+
35+
# Comment the below line to mount file system from eMMC
36+
# SRC_URI += "file://0008-Modified-Boot-Arguments-to-mount-fileystem-from-SD-c.patch")"
37+
38+

0 commit comments

Comments
 (0)
Please sign in to comment.