Re: [PATCH RFC 2/8] soc: samsung: Exynos chipid driver update
From: Sylwester Nawrocki
Date: Fri Apr 05 2019 - 06:04:24 EST
On 4/5/19 11:22, Krzysztof Kozlowski wrote:
> On Thu, 4 Apr 2019 at 19:22, Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx> wrote:
>>
>> This patch adds definition of selected CHIP ID register offsets
>> and register bit field definitions for Exynos5422 SoC.
>>
>> exynos_chipid_read() helper function is added to allow reading
>> the CHIP ID block registers.
>>
>> Signed-off-by: Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx>
>> ---
>> drivers/soc/samsung/exynos-chipid.c | 16 +++++-----
>> drivers/soc/samsung/exynos-chipid.h | 48 +++++++++++++++++++++++++++++
>> 2 files changed, 57 insertions(+), 7 deletions(-)
>> create mode 100644 drivers/soc/samsung/exynos-chipid.h
>>
>> diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
>> index 5cb018807817..4920f0ef2c55 100644
>> --- a/drivers/soc/samsung/exynos-chipid.c
>> +++ b/drivers/soc/samsung/exynos-chipid.c
>> @@ -16,10 +16,7 @@
>> -#define EXYNOS_SUBREV_MASK (0xF << 4)
>> -#define EXYNOS_MAINREV_MASK (0xF << 0)
>> -#define EXYNOS_REV_MASK (EXYNOS_SUBREV_MASK | EXYNOS_MAINREV_MASK)
>> -#define EXYNOS_MASK 0xFFFFF000
>
> Create hex-addresses in first commit in lower case.
>> +static void __iomem *exynos_chipid_base;
>
> No, this was removed in Pankaj's version v6 -> v7 and I do not want it
> to be file-scope. Having it file-scope is error prone and prevents
> having multiple instances (I do not expect having more than one but
> still code should be rather nicely generic).
I'm going to switch to using regmap so that will not be needed any
more, together with exynos_chipid_read() helper. Then the header
file would be moved to include/linux/soc/samsung.
>> +unsigned int exynos_chipid_read(unsigned int offset)
>> +{
>> + return readl_relaxed(exynos_chipid_base + offset);
>> +}
>> diff --git a/drivers/soc/samsung/exynos-chipid.h b/drivers/soc/samsung/exynos-chipid.h
>> new file mode 100644
>> index 000000000000..826a12c25fa2
>> --- /dev/null
>> +++ b/drivers/soc/samsung/exynos-chipid.h
>> @@ -0,0 +1,48 @@
>> +#define EXYNOS_CHIPID_REG_PRO_ID 0x00
>> + #define EXYNOS_SUBREV_MASK (0xf << 4)
>> + #define EXYNOS_MAINREV_MASK (0xf << 0)
>> + #define EXYNOS_REV_MASK (EXYNOS_SUBREV_MASK | \
>> + EXYNOS_MAINREV_MASK)
>> + #define EXYNOS_MASK 0xfffff000
>> +
>> +#define EXYNOS_CHIPID_REG_PKG_ID 0x04
>
> Can you comment that these are fields from this register?
> The same in second one.
OK, I will add some comment here.
>> + #define EXYNOS5422_IDS_OFFSET 24
>> + #define EXYNOS5422_IDS_MASK 0xff
--
Regards,
Sylwester