2024-02-01 17:24:05

by Alexey Klimov

[permalink] [raw]
Subject: [PATCH 1/4] dt-bindings: hwinfo: samsung,exynos-chipid: add gs101-chipid compatible

Add "google,gs101-chipid" compatible string to binding document.

Signed-off-by: Alexey Klimov <[email protected]>
---
.../devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml b/Documentation/devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml
index 780ccb5ee9b4..b1d933808b6c 100644
--- a/Documentation/devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml
+++ b/Documentation/devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml
@@ -13,6 +13,7 @@ properties:
compatible:
oneOf:
- enum:
+ - google,gs101-chipid
- samsung,exynos4210-chipid
- samsung,exynos850-chipid
- items:
--
2.43.0



2024-02-01 17:49:51

by Alexey Klimov

[permalink] [raw]
Subject: [PATCH 4/4] soc: samsung: exynos-chipid: fix revision calculation for gs101

The main revision for gs101 SoC is not reported in the CHIPID_REV
register. The gs101 Product ID and revisions registers have a behaviour
split between old Exynos SoCs and new SoCs. The sub-revision is
reported in CHIPID_REV register in [19:16] bits but main revision
is still present in Product ID [7:0].

To construct soc_info->revision correctly for gs101 the main_rev
should not be reset from a value read from CHIPID_REV.

Signed-off-by: Alexey Klimov <[email protected]>
---
drivers/soc/samsung/exynos-chipid.c | 20 ++++++++++++++++----
include/linux/soc/samsung/exynos-chipid.h | 1 +
2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index 7fee6094db12..3b952ffd8cf7 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -87,14 +87,26 @@ static int exynos_chipid_get_chipid_info(struct regmap *regmap,
soc_info->product_id = val & EXYNOS_MASK;

if (data->rev_reg != EXYNOS_CHIPID_REG_PRO_ID) {
- ret = regmap_read(regmap, data->rev_reg, &val);
+ unsigned int val2;
+
+ ret = regmap_read(regmap, data->rev_reg, &val2);
if (ret < 0)
return ret;
+
+ if (data->main_rev_shift == 0)
+ main_rev = (val >> data->main_rev_shift)
+ & EXYNOS_REV_PART_MASK_GS101;
+ else
+ main_rev = (val2 >> data->main_rev_shift)
+ & EXYNOS_REV_PART_MASK;
+
+ sub_rev = (val2 >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
+ } else {
+ main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
+ sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
}
- main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
- sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
- soc_info->revision = (main_rev << EXYNOS_REV_PART_SHIFT) | sub_rev;

+ soc_info->revision = (main_rev << EXYNOS_REV_PART_SHIFT) | sub_rev;
return 0;
}

diff --git a/include/linux/soc/samsung/exynos-chipid.h b/include/linux/soc/samsung/exynos-chipid.h
index 62f0e2531068..1eb13068f513 100644
--- a/include/linux/soc/samsung/exynos-chipid.h
+++ b/include/linux/soc/samsung/exynos-chipid.h
@@ -10,6 +10,7 @@

#define EXYNOS_CHIPID_REG_PRO_ID 0x00
#define EXYNOS_REV_PART_MASK 0xf
+#define EXYNOS_REV_PART_MASK_GS101 0xff
#define EXYNOS_REV_PART_SHIFT 4
#define EXYNOS_MASK 0xfffff000

--
2.43.0


2024-02-05 12:18:30

by Peter Griffin

[permalink] [raw]
Subject: Re: [PATCH 1/4] dt-bindings: hwinfo: samsung,exynos-chipid: add gs101-chipid compatible

Hi Alexey,

On Thu, 1 Feb 2024 at 17:22, Alexey Klimov <[email protected]> wrote:
>
> Add "google,gs101-chipid" compatible string to binding document.
>
> Signed-off-by: Alexey Klimov <[email protected]>
> ---

Thanks for your contribution.
Reviewed-by: Peter Griffin <[email protected]>






> .../devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml b/Documentation/devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml
> index 780ccb5ee9b4..b1d933808b6c 100644
> --- a/Documentation/devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml
> +++ b/Documentation/devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml
> @@ -13,6 +13,7 @@ properties:
> compatible:
> oneOf:
> - enum:
> + - google,gs101-chipid
> - samsung,exynos4210-chipid
> - samsung,exynos850-chipid
> - items:
> --
> 2.43.0
>

2024-02-05 15:15:21

by Peter Griffin

[permalink] [raw]
Subject: Re: [PATCH 4/4] soc: samsung: exynos-chipid: fix revision calculation for gs101

Hi Alexey,

On Thu, 1 Feb 2024 at 17:22, Alexey Klimov <[email protected]> wrote:
>
> The main revision for gs101 SoC is not reported in the CHIPID_REV
> register. The gs101 Product ID and revisions registers have a behaviour
> split between old Exynos SoCs and new SoCs. The sub-revision is
> reported in CHIPID_REV register in [19:16] bits but main revision
> is still present in Product ID [7:0].
>
> To construct soc_info->revision correctly for gs101 the main_rev
> should not be reset from a value read from CHIPID_REV.
>

I think it would also be worth adding in the commit message how the
main_rev and sub_rev relate to the a0, b0, b1 reported by the
bootloader.

> Signed-off-by: Alexey Klimov <[email protected]>
> ---
> drivers/soc/samsung/exynos-chipid.c | 20 ++++++++++++++++----
> include/linux/soc/samsung/exynos-chipid.h | 1 +
> 2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
> index 7fee6094db12..3b952ffd8cf7 100644
> --- a/drivers/soc/samsung/exynos-chipid.c
> +++ b/drivers/soc/samsung/exynos-chipid.c
> @@ -87,14 +87,26 @@ static int exynos_chipid_get_chipid_info(struct regmap *regmap,
> soc_info->product_id = val & EXYNOS_MASK;
>
> if (data->rev_reg != EXYNOS_CHIPID_REG_PRO_ID) {
> - ret = regmap_read(regmap, data->rev_reg, &val);
> + unsigned int val2;
> +
> + ret = regmap_read(regmap, data->rev_reg, &val2);
> if (ret < 0)
> return ret;
> +
> + if (data->main_rev_shift == 0)
> + main_rev = (val >> data->main_rev_shift)
> + & EXYNOS_REV_PART_MASK_GS101;

Looks like it can be simplified to
main_rev = val & EXYNOS_REV_PART_MASK_GS101;

Peter

2024-02-05 17:22:27

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/4] dt-bindings: hwinfo: samsung,exynos-chipid: add gs101-chipid compatible


On Thu, 01 Feb 2024 17:22:21 +0000, Alexey Klimov wrote:
> Add "google,gs101-chipid" compatible string to binding document.
>
> Signed-off-by: Alexey Klimov <[email protected]>
> ---
> .../devicetree/bindings/hwinfo/samsung,exynos-chipid.yaml | 1 +
> 1 file changed, 1 insertion(+)
>

Acked-by: Rob Herring <[email protected]>