mbox series

[v2,0/2] Add efuse driver for Ingenic JZ4780 SoC

Message ID 20171228212954.2922-1-malat@debian.org
Headers show
Series Add efuse driver for Ingenic JZ4780 SoC | expand

Message

Mathieu Malaterre Dec. 28, 2017, 9:29 p.m. UTC
This patchset bring support for read-only access to the JZ4780 efuse as found
on MIPS Creator CI20.

To keep the driver as simple as possible, it was not possible to re-use most of
the nvmem core functionalities. This driver is not compatible with the original
efuse driver as found in the custom linux kernel from upstream (1), in
particular it does not expose to the users neither:
`/sys/devices/platform/*/chip_id` nor `/sys/devices/platform/*/user_id`.

The goal of this driver is to provide access to the MAC address to the dm9000
driver.

(1) https://github.com/ZubairLK/CI20_linux/commit/6efd4ffca7dcfaff0794ab60cd6922ce96c60419

Changes in v2:
Properly handle offset and byte value from the main entry point.
Also add a commit message in patch #2.

Mathieu Malaterre (1):
  dts: Probe efuse for CI20

PrasannaKumar Muralidharan (1):
  nvmem: add driver for JZ4780 efuse

 .../ABI/testing/sysfs-driver-jz4780-efuse          |  16 ++
 .../bindings/nvmem/ingenic,jz4780-efuse.txt        |  17 ++
 MAINTAINERS                                        |   5 +
 arch/mips/boot/dts/ingenic/jz4780.dtsi             |  40 ++-
 arch/mips/configs/ci20_defconfig                   |   2 +
 drivers/nvmem/Kconfig                              |  10 +
 drivers/nvmem/Makefile                             |   2 +
 drivers/nvmem/jz4780-efuse.c                       | 305 +++++++++++++++++++++
 8 files changed, 385 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-jz4780-efuse
 create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt
 create mode 100644 drivers/nvmem/jz4780-efuse.c

Comments

Srinivas Kandagatla Jan. 2, 2018, 12:01 p.m. UTC | #1
On 28/12/17 21:29, Mathieu Malaterre wrote:
> This patchset bring support for read-only access to the JZ4780 efuse as found
> on MIPS Creator CI20.
> 
> To keep the driver as simple as possible, it was not possible to re-use most of
> the nvmem core functionalities. This driver is not compatible with the original
Can you explain a bit more on not able to re-use nvmem core?

If you are referring to adding nvmem cell entires in sysfs, This should 
probably go in to nvmem core, rather that in individual providers.
This is one of the feature my todo list, will try to come up with some 
thing soon.

thanks,
srini

> efuse driver as found in the custom linux kernel from upstream (1), in
> particular it does not expose to the users neither:
> `/sys/devices/platform/*/chip_id` nor `/sys/devices/platform/*/user_id`.
> 

> The goal of this driver is to provide access to the MAC address to the dm9000
> driver.
> 
> (1) https://github.com/ZubairLK/CI20_linux/commit/6efd4ffca7dcfaff0794ab60cd6922ce96c60419
> 
> Changes in v2:
> Properly handle offset and byte value from the main entry point.
> Also add a commit message in patch #2.
> 
> Mathieu Malaterre (1):
>    dts: Probe efuse for CI20
> 
> PrasannaKumar Muralidharan (1):
>    nvmem: add driver for JZ4780 efuse
> 
>   .../ABI/testing/sysfs-driver-jz4780-efuse          |  16 ++
>   .../bindings/nvmem/ingenic,jz4780-efuse.txt        |  17 ++
>   MAINTAINERS                                        |   5 +
>   arch/mips/boot/dts/ingenic/jz4780.dtsi             |  40 ++-
>   arch/mips/configs/ci20_defconfig                   |   2 +
>   drivers/nvmem/Kconfig                              |  10 +
>   drivers/nvmem/Makefile                             |   2 +
>   drivers/nvmem/jz4780-efuse.c                       | 305 +++++++++++++++++++++
>   8 files changed, 385 insertions(+), 12 deletions(-)
>   create mode 100644 Documentation/ABI/testing/sysfs-driver-jz4780-efuse
>   create mode 100644 Documentation/devicetree/bindings/nvmem/ingenic,jz4780-efuse.txt
>   create mode 100644 drivers/nvmem/jz4780-efuse.c
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
PrasannaKumar Muralidharan Jan. 2, 2018, 4:17 p.m. UTC | #2
Hi Srinivas,

On 2 January 2018 at 17:31, Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> wrote:
>
>
> On 28/12/17 21:29, Mathieu Malaterre wrote:
>>
>> This patchset bring support for read-only access to the JZ4780 efuse as
>> found
>> on MIPS Creator CI20.
>>
>> To keep the driver as simple as possible, it was not possible to re-use
>> most of
>> the nvmem core functionalities. This driver is not compatible with the
>> original
>
> Can you explain a bit more on not able to re-use nvmem core?
>
> If you are referring to adding nvmem cell entires in sysfs, This should
> probably go in to nvmem core, rather that in individual providers.
> This is one of the feature my todo list, will try to come up with some thing
> soon.

We could not find a way to expose different sized segments using nvmem
framework. Do you have any pointers for this?
We were not aware of the fact that nvmem does not expose individual
cell entries in sysfs.

Regards,
PrasannaKumar
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Srinivas Kandagatla Jan. 2, 2018, 5:58 p.m. UTC | #3
On 02/01/18 16:17, PrasannaKumar Muralidharan wrote:
> Hi Srinivas,
> 
> On 2 January 2018 at 17:31, Srinivas Kandagatla
> <srinivas.kandagatla@linaro.org> wrote:
>>
>>
>> On 28/12/17 21:29, Mathieu Malaterre wrote:
>>>
>>> This patchset bring support for read-only access to the JZ4780 efuse as
>>> found
>>> on MIPS Creator CI20.
>>>
>>> To keep the driver as simple as possible, it was not possible to re-use
>>> most of
>>> the nvmem core functionalities. This driver is not compatible with the
>>> original
>>
>> Can you explain a bit more on not able to re-use nvmem core?
>>
>> If you are referring to adding nvmem cell entires in sysfs, This should
>> probably go in to nvmem core, rather that in individual providers.
>> This is one of the feature my todo list, will try to come up with some thing
>> soon.
> 
> We could not find a way to expose different sized segments using nvmem
> framework. Do you have any pointers for this?

This does not exist at the moment, but it should be very much doable to 
add this functionality to nvmem core.

I will keep you loop if I manage to post this patch soon.

--srini
> We were not aware of the fact that nvmem does not expose individual
> cell entries in sysfs.
> 
> Regards,
> PrasannaKumar
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring Jan. 3, 2018, 8:04 p.m. UTC | #4
On Thu, Dec 28, 2017 at 10:29:53PM +0100, Mathieu Malaterre wrote:
> MIPS Creator CI20 comes with JZ4780 SoC. Provides access to the efuse block
> using jz4780 efuse driver.
> 
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
>  arch/mips/configs/ci20_defconfig | 2 ++

Your subject indicates this is a dts patch which it is not.

>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/configs/ci20_defconfig b/arch/mips/configs/ci20_defconfig
> index b5f4ad8f2c45..62c63617e97a 100644
> --- a/arch/mips/configs/ci20_defconfig
> +++ b/arch/mips/configs/ci20_defconfig
> @@ -171,3 +171,5 @@ CONFIG_STACKTRACE=y
>  # CONFIG_FTRACE is not set
>  CONFIG_CMDLINE_BOOL=y
>  CONFIG_CMDLINE="earlycon console=ttyS4,115200 clk_ignore_unused"
> +CONFIG_NVMEM=y
> +CONFIG_JZ4780_EFUSE=y
> -- 
> 2.11.0
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
James Hogan Jan. 17, 2018, 8:54 p.m. UTC | #5
On Thu, Dec 28, 2017 at 10:29:53PM +0100, Mathieu Malaterre wrote:
> MIPS Creator CI20 comes with JZ4780 SoC. Provides access to the efuse block
> using jz4780 efuse driver.
> 
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
>  arch/mips/configs/ci20_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/configs/ci20_defconfig b/arch/mips/configs/ci20_defconfig
> index b5f4ad8f2c45..62c63617e97a 100644
> --- a/arch/mips/configs/ci20_defconfig
> +++ b/arch/mips/configs/ci20_defconfig
> @@ -171,3 +171,5 @@ CONFIG_STACKTRACE=y
>  # CONFIG_FTRACE is not set
>  CONFIG_CMDLINE_BOOL=y
>  CONFIG_CMDLINE="earlycon console=ttyS4,115200 clk_ignore_unused"
> +CONFIG_NVMEM=y
> +CONFIG_JZ4780_EFUSE=y

NVMEM is already implied by RTC_CLASS (which turns on RTC_NVMEM by
default).

I would suggest loading the defconfig:
make ARCH=mips ci20_defconfig

Then enabling the extra configuration options you need, then create a
new minimal defconfig:
make ARCH=mips savedefconfig

Then look at the new file called "defconfig" or copy it over
arch/mips/configs/ci20_defconfig, and see what changes it adds. That way
you'll get the minimum you need and in the right order in the defconfig.

Don't feel like you have to submit other random changes due to config
changes since the defconfig was added, but if you do please do it as a
separate patch to bring the defconfig up to date (i.e. just load
defconfig and save it) before the patch which actually enables the
EFUSE.

Cheers
James

> -- 
> 2.11.0
> 
>