2019-03-07 14:04:20

by Neil Armstrong

[permalink] [raw]
Subject: [PATCH v2 0/3] arm64: meson: Add SoC ID detection for G12A

This patchset :
- Fixes the package id detection for S905 variants and AXG packages
- Adds new SoC IDs and Packages IDs for G12A/G12B, and S805X/Y
- Adds Add AO Secure node for G12A dtsi

Changes since v1:
- Added G12B S922X package ID
- Added G12A S905D2 package ID
- Fixed patch 2 commit message

Neil Armstrong (3):
soc: amlogic: gx-socinfo: Add mask for each SoC packages
soc: amlogic: gx-socinfo: Add new SoC IDs and Packages IDs
arm64: dts: meson-g12a: Add AO Secure node

arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 6 ++++
drivers/soc/amlogic/meson-gx-socinfo.c | 39 +++++++++++++--------
2 files changed, 30 insertions(+), 15 deletions(-)

--
2.20.1



2019-03-07 14:02:33

by Neil Armstrong

[permalink] [raw]
Subject: [PATCH v2 1/3] soc: amlogic: gx-socinfo: Add mask for each SoC packages

When updated IDs on f842c41adc04 ("amlogic: meson-gx-socinfo: Update soc ids")
we introduced packages ids using the full 8bit value, but in the function
socinfo_to_package_id() the id was filtered with the 0xf0 mask.

While the 0xf0 mask is valid for most board, it filters out the lower
4 bits which encodes some characteristics of the chip.

This patch moves the mask into the meson_gx_package_id table to be applied
on each package name independently and add the correct mask for some
specific entries.

An example is the S905, in the vendor code the S905 is package_id
different from 0x20, and S905M is exactly 0x20.

Another example are the The Wetek Hub & Play2 boards using a S905-H
variant, which is the S905 SoC with some licence bits enabled.
These licence bits are encoded in the lower 4bits, so to detect
the -H variant, we must detect the id == 0x3 with the 0xf mask.

Fixes: f842c41adc04 ("amlogic: meson-gx-socinfo: Update soc ids")
Signed-off-by: Neil Armstrong <[email protected]>
---
drivers/soc/amlogic/meson-gx-socinfo.c | 32 ++++++++++++++------------
1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c
index 37ea0a1c24c8..1ae339f5eadb 100644
--- a/drivers/soc/amlogic/meson-gx-socinfo.c
+++ b/drivers/soc/amlogic/meson-gx-socinfo.c
@@ -43,20 +43,21 @@ static const struct meson_gx_package_id {
const char *name;
unsigned int major_id;
unsigned int pack_id;
+ unsigned int pack_mask;
} soc_packages[] = {
- { "S905", 0x1f, 0 },
- { "S905H", 0x1f, 0x13 },
- { "S905M", 0x1f, 0x20 },
- { "S905D", 0x21, 0 },
- { "S905X", 0x21, 0x80 },
- { "S905W", 0x21, 0xa0 },
- { "S905L", 0x21, 0xc0 },
- { "S905M2", 0x21, 0xe0 },
- { "S912", 0x22, 0 },
- { "962X", 0x24, 0x10 },
- { "962E", 0x24, 0x20 },
- { "A113X", 0x25, 0x37 },
- { "A113D", 0x25, 0x22 },
+ { "S905", 0x1f, 0, 0x20 }, /* pack_id != 0x20 */
+ { "S905H", 0x1f, 0x3, 0xf }, /* pack_id & 0xf == 0x3 */
+ { "S905M", 0x1f, 0x20, 0xf0 }, /* pack_id == 0x20 */
+ { "S905D", 0x21, 0, 0xf0 },
+ { "S905X", 0x21, 0x80, 0xf0 },
+ { "S905W", 0x21, 0xa0, 0xf0 },
+ { "S905L", 0x21, 0xc0, 0xf0 },
+ { "S905M2", 0x21, 0xe0, 0xf0 },
+ { "S912", 0x22, 0, 0x0 }, /* Only S912 is known for GXM */
+ { "962X", 0x24, 0x10, 0xf0 },
+ { "962E", 0x24, 0x20, 0xf0 },
+ { "A113X", 0x25, 0x37, 0xff },
+ { "A113D", 0x25, 0x22, 0xff },
};

static inline unsigned int socinfo_to_major(u32 socinfo)
@@ -81,13 +82,14 @@ static inline unsigned int socinfo_to_misc(u32 socinfo)

static const char *socinfo_to_package_id(u32 socinfo)
{
- unsigned int pack = socinfo_to_pack(socinfo) & 0xf0;
+ unsigned int pack = socinfo_to_pack(socinfo);
unsigned int major = socinfo_to_major(socinfo);
int i;

for (i = 0 ; i < ARRAY_SIZE(soc_packages) ; ++i) {
if (soc_packages[i].major_id == major &&
- soc_packages[i].pack_id == pack)
+ soc_packages[i].pack_id ==
+ (pack & soc_packages[i].pack_mask))
return soc_packages[i].name;
}

--
2.20.1


2019-03-07 14:02:43

by Neil Armstrong

[permalink] [raw]
Subject: [PATCH v2 2/3] soc: amlogic: gx-socinfo: Add new SoC IDs and Packages IDs

This adds the:
- G12A SoC ID and S905X2, S905D2 package IDs, found booting the
X96 Max and U200 Reference Board
- G12B SoC ID and S922X package ID, found booting the Odroid-N2
- S805X, S805Y package IDs found in the vendor U-Boot source

Signed-off-by: Neil Armstrong <[email protected]>
---
drivers/soc/amlogic/meson-gx-socinfo.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c
index 1ae339f5eadb..c8d138d85f34 100644
--- a/drivers/soc/amlogic/meson-gx-socinfo.c
+++ b/drivers/soc/amlogic/meson-gx-socinfo.c
@@ -37,6 +37,8 @@ static const struct meson_gx_soc_id {
{ "AXG", 0x25 },
{ "GXLX", 0x26 },
{ "TXHD", 0x27 },
+ { "G12A", 0x28 },
+ { "G12B", 0x29 },
};

static const struct meson_gx_package_id {
@@ -53,11 +55,16 @@ static const struct meson_gx_package_id {
{ "S905W", 0x21, 0xa0, 0xf0 },
{ "S905L", 0x21, 0xc0, 0xf0 },
{ "S905M2", 0x21, 0xe0, 0xf0 },
+ { "S805X", 0x21, 0x30, 0xf0 },
+ { "S805Y", 0x21, 0xb0, 0xf0 },
{ "S912", 0x22, 0, 0x0 }, /* Only S912 is known for GXM */
{ "962X", 0x24, 0x10, 0xf0 },
{ "962E", 0x24, 0x20, 0xf0 },
{ "A113X", 0x25, 0x37, 0xff },
{ "A113D", 0x25, 0x22, 0xff },
+ { "S905D2", 0x28, 0x10, 0xf0 },
+ { "S905X2", 0x28, 0x40, 0xf0 },
+ { "S922X", 0x29, 0x40, 0xf0 },
};

static inline unsigned int socinfo_to_major(u32 socinfo)
--
2.20.1


2019-03-07 14:02:54

by Neil Armstrong

[permalink] [raw]
Subject: [PATCH v2 3/3] arm64: dts: meson-g12a: Add AO Secure node

This adds the Always-On ao-secure system control registers node,
which is used by the meson-gx-socinfo driver to detect the SoC IDs.

Signed-off-by: Neil Armstrong <[email protected]>
---
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
index 191d31db9853..30aa618dce49 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a.dtsi
@@ -122,6 +122,12 @@
#size-cells = <2>;
ranges = <0x0 0x0 0x0 0xff800000 0x0 0x100000>;

+ sec_AO: ao-secure@140 {
+ compatible = "amlogic,meson-gx-ao-secure", "syscon";
+ reg = <0x0 0x140 0x0 0x140>;
+ amlogic,has-chip-id;
+ };
+
uart_AO: serial@3000 {
compatible = "amlogic,meson-gx-uart",
"amlogic,meson-ao-uart";
--
2.20.1


2019-03-12 20:27:52

by Kevin Hilman

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] arm64: meson: Add SoC ID detection for G12A

Neil Armstrong <[email protected]> writes:

> This patchset :
> - Fixes the package id detection for S905 variants and AXG packages
> - Adds new SoC IDs and Packages IDs for G12A/G12B, and S805X/Y
> - Adds Add AO Secure node for G12A dtsi
>
> Changes since v1:
> - Added G12B S922X package ID
> - Added G12A S905D2 package ID
> - Fixed patch 2 commit message

Series queued for v5.2.

> Neil Armstrong (3):
> soc: amlogic: gx-socinfo: Add mask for each SoC packages
> soc: amlogic: gx-socinfo: Add new SoC IDs and Packages IDs

Applied to branch: v5.2/drivers.

> arm64: dts: meson-g12a: Add AO Secure node

Applied to v5.2/dt64,

Thanks for all the new SoC detection!

Kevin