Add dump reg and sunxi sys info drivers and enable them in dt

This commit is contained in:
pbiel 2023-01-26 16:53:22 +01:00
parent bdf63dfd79
commit a182269fd4
6 changed files with 9582 additions and 1 deletions

View File

@ -0,0 +1,60 @@
From 452a691a83df1aab77cec33203cb04a817817a05 Mon Sep 17 00:00:00 2001
From: The-going <48602507+The-going@users.noreply.github.com>
Date: Thu, 5 May 2022 22:55:13 +0300
Subject: [PATCH] drv: nvmem: sunxi_sid: Add sunxi_get_soc_chipid,
sunxi_get_serial
---
drivers/nvmem/sunxi_sid.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 37a6abb0e..c81fac63d 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -37,6 +37,25 @@ struct sunxi_sid {
u32 value_offset;
};
+static unsigned int sunxi_soc_chipid[4];
+static unsigned int sunxi_serial[4];
+
+int sunxi_get_soc_chipid(unsigned char *chipid)
+{
+ memcpy(chipid, sunxi_soc_chipid, 16);
+
+ return 0;
+}
+EXPORT_SYMBOL(sunxi_get_soc_chipid);
+
+int sunxi_get_serial(unsigned char *serial)
+{
+ memcpy(serial, sunxi_serial, 16);
+
+ return 0;
+}
+EXPORT_SYMBOL(sunxi_get_serial);
+
static int sunxi_sid_read(void *context, unsigned int offset,
void *val, size_t bytes)
{
@@ -167,6 +186,15 @@ static int sunxi_sid_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, nvmem);
+ nvmem_cfg->reg_read(sid, 0, &sunxi_soc_chipid[0], sizeof(int));
+ nvmem_cfg->reg_read(sid, 4, &sunxi_soc_chipid[1], sizeof(int));
+ nvmem_cfg->reg_read(sid, 8, &sunxi_soc_chipid[2], sizeof(int));
+ nvmem_cfg->reg_read(sid, 12, &sunxi_soc_chipid[3], sizeof(int));
+
+ sunxi_serial[0] = sunxi_soc_chipid[3];
+ sunxi_serial[1] = sunxi_soc_chipid[2];
+ sunxi_serial[2] = (sunxi_soc_chipid[1] >> 16) & 0x0ffff;
+
return 0;
}
--
2.35.3

View File

@ -0,0 +1,27 @@
From 9a7776b44588c24d04ffff63194d8a137624f8ac Mon Sep 17 00:00:00 2001
From: Patryk Biel <patryk.biel.external@trumpf.com>
Date: Thu, 26 Jan 2023 09:50:42 +0100
Subject: [PATCH] Add sunxi-info device tree node
---
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
index ab344ea8a..d0b95d43a 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
@@ -586,5 +586,10 @@ r_rsb: rsb@7083000 {
#address-cells = <1>;
#size-cells = <0>;
};
+
+ sunxi-info {
+ compatible = "allwinner,sun50i-h616-sys-info";
+ status = "okay";
+ };
};
};
--
2.34.1

View File

@ -0,0 +1,32 @@
From 706dc6ed092e4a1b9d84893cb4186fbd354bb1c8 Mon Sep 17 00:00:00 2001
From: Patryk Biel <patryk.biel.external@trumpf.com>
Date: Thu, 26 Jan 2023 09:51:22 +0100
Subject: [PATCH] Add addr_mgt device tree node
---
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
index d0b95d43a..15f45a3f9 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
@@ -591,5 +591,15 @@ sunxi-info {
compatible = "allwinner,sun50i-h616-sys-info";
status = "okay";
};
+
+ addr_mgt {
+ compatible = "allwinner,sunxi-addr_mgt";
+ type_addr_wifi = <0x00>;
+ type_addr_bt = <0x00>;
+ type_addr_eth = <0x00>;
+ status = "okay";
+ linux,phandle = <0x179>;
+ phandle = <0x179>;
+ };
};
};
--
2.34.1

File diff suppressed because it is too large Load Diff

View File

@ -6,5 +6,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
SRC_URI[sha256sum] = "0a1a5ae2f30eb2b38215e59077f045aabd7f4e2857a881482f02ea48186105d8" SRC_URI[sha256sum] = "0a1a5ae2f30eb2b38215e59077f045aabd7f4e2857a881482f02ea48186105d8"
SRC_URI:append:orange-pi-zero2sun50i = " file://defconfig"
SRC_URI:append:orange-pi-zero2sun50i = " file://0001-dts-add-h616-and-orangepizero2.patch" SRC_URI:append:orange-pi-zero2sun50i = " file://0001-dts-add-h616-and-orangepizero2.patch"
SRC_URI:append:orange-pi-zero2sun50i = " file://0002-drv-add-dump_reg-and-sunxi-sysinfo-drivers.patch"
SRC_URI:append:orange-pi-zero2sun50i = " file://0003-drv-add-sunxi_get_soc_chipid-and-sunxi_get_serial.patch"
SRC_URI:append:orange-pi-zero2sun50i = " file://0004-dts-add-sunxi-info-device-tree-node.patch"
SRC_URI:append:orange-pi-zero2sun50i = " file://0005-dts-add-addr_mgt-device-tree-node.patch"