git: 85471971305d - main - riscv: enable Allwinner if_awg
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 Dec 2024 21:31:15 UTC
The branch main has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=85471971305d3c13ef5f2894b44cdf93b5e80f12
commit 85471971305d3c13ef5f2894b44cdf93b5e80f12
Author: Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-12-10 20:43:59 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-12-10 21:28:38 +0000
riscv: enable Allwinner if_awg
Enable the driver and dependencies (aw_sid, nvmem). Add compat strings,
etc.
Found on the Allwinner D1.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47923
---
share/man/man4/man4.arm/aw_sid.4 | 6 +++++-
sys/arm/allwinner/aw_sid.c | 27 +++++++++++++++++++++++++++
sys/arm/allwinner/if_awg.c | 2 ++
sys/riscv/allwinner/files.allwinner | 2 ++
sys/riscv/conf/GENERIC | 1 +
sys/riscv/conf/std.allwinner | 2 ++
6 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/share/man/man4/man4.arm/aw_sid.4 b/share/man/man4/man4.arm/aw_sid.4
index be441033d242..5cd2f3d5e072 100644
--- a/share/man/man4/man4.arm/aw_sid.4
+++ b/share/man/man4/man4.arm/aw_sid.4
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 6, 2018
+.Dd October 8, 2024
.Dt AW_SID 4
.Os
.Sh NAME
@@ -53,6 +53,10 @@ allwinner,sun50i-a64-sid
allwinner,sun8i-a83t-sid
.It
allwinner,sun8i-h3-sid
+.It
+allwinner,sun50i-h5-sid
+.It
+allwinner,sun20i-d1-sid
.El
.Sh SYSCTL VARIABLES
The following read-only variables are available via
diff --git a/sys/arm/allwinner/aw_sid.c b/sys/arm/allwinner/aw_sid.c
index a333eadc20aa..ba5faca33c5e 100644
--- a/sys/arm/allwinner/aw_sid.c
+++ b/sys/arm/allwinner/aw_sid.c
@@ -169,6 +169,27 @@ static struct aw_sid_efuse h5_efuses[] = {
},
};
+static struct aw_sid_efuse d1_efuses[] = {
+ {
+ .name = "rootkey",
+ .desc = "Root Key or ChipID",
+ .base = EFUSE_OFFSET,
+ .offset = 0x00,
+ .size = 16,
+ .id = AW_SID_FUSE_ROOTKEY,
+ .public = true,
+ },
+ {
+ .name = "calibration",
+ .desc = "Thermal Sensor Calibration Data",
+ .base = EFUSE_OFFSET,
+ .offset = 0x34,
+ .size = 4,
+ .id = AW_SID_FUSE_THSSENSOR,
+ .public = true,
+ },
+};
+
struct aw_sid_conf {
struct aw_sid_efuse *efuses;
size_t nfuses;
@@ -204,6 +225,11 @@ static const struct aw_sid_conf h5_conf = {
.nfuses = nitems(h5_efuses),
};
+static const struct aw_sid_conf d1_conf = {
+ .efuses = d1_efuses,
+ .nfuses = nitems(d1_efuses),
+};
+
static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun4i-a10-sid", (uintptr_t)&a10_conf},
{ "allwinner,sun7i-a20-sid", (uintptr_t)&a20_conf},
@@ -211,6 +237,7 @@ static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun8i-a83t-sid", (uintptr_t)&a83t_conf},
{ "allwinner,sun8i-h3-sid", (uintptr_t)&h3_conf},
{ "allwinner,sun50i-h5-sid", (uintptr_t)&h5_conf},
+ { "allwinner,sun20i-d1-sid", (uintptr_t)&d1_conf},
{ NULL, 0 }
};
diff --git a/sys/arm/allwinner/if_awg.c b/sys/arm/allwinner/if_awg.c
index 29a75e5a4d9b..98e879d22d3d 100644
--- a/sys/arm/allwinner/if_awg.c
+++ b/sys/arm/allwinner/if_awg.c
@@ -143,12 +143,14 @@ enum awg_type {
EMAC_A83T = 1,
EMAC_H3,
EMAC_A64,
+ EMAC_D1,
};
static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun8i-a83t-emac", EMAC_A83T },
{ "allwinner,sun8i-h3-emac", EMAC_H3 },
{ "allwinner,sun50i-a64-emac", EMAC_A64 },
+ { "allwinner,sun20i-d1-emac", EMAC_D1 },
{ NULL, 0 }
};
diff --git a/sys/riscv/allwinner/files.allwinner b/sys/riscv/allwinner/files.allwinner
index e29300c627a1..f6be2cf97e57 100644
--- a/sys/riscv/allwinner/files.allwinner
+++ b/sys/riscv/allwinner/files.allwinner
@@ -1,7 +1,9 @@
arm/allwinner/aw_rtc.c optional aw_rtc fdt
arm/allwinner/aw_syscon.c optional syscon
+arm/allwinner/aw_sid.c optional aw_sid nvmem
arm/allwinner/aw_wdog.c optional aw_wdog
+arm/allwinner/if_awg.c optional awg syscon
# Allwinner clock drivers
dev/clk/allwinner/aw_ccung.c optional aw_ccu fdt
diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC
index 4e01c39bc008..4fdb1bdd6403 100644
--- a/sys/riscv/conf/GENERIC
+++ b/sys/riscv/conf/GENERIC
@@ -83,6 +83,7 @@ device rcons
# pseudo devices
device clk
device hwreset
+device nvmem
device phy
device regulator
device syscon
diff --git a/sys/riscv/conf/std.allwinner b/sys/riscv/conf/std.allwinner
index f04e88c98b5b..4f3d98250cc5 100644
--- a/sys/riscv/conf/std.allwinner
+++ b/sys/riscv/conf/std.allwinner
@@ -7,6 +7,8 @@ options SOC_ALLWINNER_D1
device aw_ccu # Allwinner clock controller
device aw_rtc # Allwinner Real-time Clock
+device aw_sid # Allwinner Secure ID EFUSE
device aw_wdog # Allwinner Watchdog
+device awg # Allwinner EMAC Gigabit Ethernet
files "../allwinner/files.allwinner"