29 Jul, 2020

1 commit

  • Complement the u16, u32 and u64 helpers with a u8 variant to ease
    accessing byte-sized values.

    This helper will be useful for Realtek Digital Home Center platforms,
    which store some byte and sub-byte sized values in non-volatile memory.

    Signed-off-by: Andreas Färber
    Signed-off-by: Srinivas Kandagatla
    Link: https://lore.kernel.org/r/20200722100705.7772-7-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman

    Andreas Färber
     

19 Mar, 2020

1 commit

  • Add nvmem_cell_read_u64() helper to ease read of an u64 value on consumer
    side. This helper is useful on some sunxi platform that has 64 bits data
    cells stored in no volatile memory.

    Signed-off-by: Yangtao Li
    Signed-off-by: Srinivas Kandagatla
    Link: https://lore.kernel.org/r/20200310132257.23358-4-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman

    Yangtao Li
     

28 Nov, 2019

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the big set of char/misc and other driver patches for 5.5-rc1

    Loads of different things in here, this feels like the catch-all of
    driver subsystems these days. Full details are in the shortlog, but
    nothing major overall, just lots of driver updates and additions.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'char-misc-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (198 commits)
    char: Fix Kconfig indentation, continued
    habanalabs: add more protection of device during reset
    habanalabs: flush EQ workers in hard reset
    habanalabs: make the reset code more consistent
    habanalabs: expose reset counters via existing INFO IOCTL
    habanalabs: make code more concise
    habanalabs: use defines for F/W files
    habanalabs: remove prints on successful device initialization
    habanalabs: remove unnecessary checks
    habanalabs: invalidate MMU cache only once
    habanalabs: skip VA block list update in reset flow
    habanalabs: optimize MMU unmap
    habanalabs: prevent read/write from/to the device during hard reset
    habanalabs: split MMU properties to PCI/DRAM
    habanalabs: re-factor MMU masks and documentation
    habanalabs: type specific MMU cache invalidation
    habanalabs: re-factor memory module code
    habanalabs: export uapi defines to user-space
    habanalabs: don't print error when queues are full
    habanalabs: increase max jobs number to 512
    ...

    Linus Torvalds
     

06 Nov, 2019

1 commit

  • nvmem_cell_write's buf argument uses different types based on
    the configuration of CONFIG_NVMEM. The function prototype for
    enabled NVMEM uses 'void *' type, but the static dummy function
    for disabled NVMEM uses 'const char *' instead. Fix the different
    behaviour by always expecting a 'void *' typed buf argument.

    Fixes: 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
    Reported-by: kbuild test robot
    Cc: Han Nandor
    Cc: Srinivas Kandagatla
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Sebastian Reichel
    Reviewed-By: Han Nandor
    Signed-off-by: Srinivas Kandagatla
    Link: https://lore.kernel.org/r/20191029114240.14905-2-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman

    Sebastian Reichel
     

08 Oct, 2019

1 commit

  • nvmem_device_find provides a way to search for nvmem devices with
    the help of a match function simlair to bus_find_device.

    Reviewed-by: Srinivas Kandagatla
    Acked-by: Srinivas Kandagatla
    Signed-off-by: Thomas Bogendoerfer
    Signed-off-by: Paul Burton
    Cc: Jonathan Corbet
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: Lee Jones
    Cc: David S. Miller
    Cc: Alessandro Zummo
    Cc: Alexandre Belloni
    Cc: Greg Kroah-Hartman
    Cc: Jiri Slaby
    Cc: linux-doc@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-mips@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: linux-rtc@vger.kernel.org
    Cc: linux-serial@vger.kernel.org

    Thomas Bogendoerfer
     

26 Apr, 2019

1 commit

  • Add nvmem_cell_read_u16() helper to ease read of an u16 value on consumer
    side. This is inspired by nvmem_cell_read_u32() function.
    This helper is useful on stm32 that has 16 bits data cells stored in non
    volatile memory.

    Signed-off-by: Fabrice Gasnier
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Fabrice Gasnier
     

28 Sep, 2018

6 commits

  • Checkpatch emits warnings when using ENOSYS. Some of the frameworks
    started using EOPNOTSUPP as return values for API functions when given
    subsystem is disabled in Kconfig.

    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Bartosz Golaszewski
     
  • The argument representing the cell name in the nvmem_cell_get() family
    of functions is not consistend between function prototypes and
    definitions. Name it 'id' in all those routines. This is in line with
    other frameworks and can represent both the DT cell name from the
    nvmem-cell-names property as well as the con_id field from cell
    lookup entries.

    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Bartosz Golaszewski
     
  • Use SPDX license identiefiers to core nvmem files and remove GPL 2.0
    license boilerplate.

    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Bartosz Golaszewski
     
  • Add a blocking notifier chain with four events (add and remove for
    both devices and cells) so that users can get notified about the
    addition of nvmem resources they're waiting for.

    We'll use this instead of the at24 setup callback in the mityomapl138
    board file.

    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Bartosz Golaszewski
     
  • Add a way for machine code users to associate devices with nvmem cells.

    This restores the support for non-DT systems but following a different
    approach. Cells must now be associated with devices using provided
    routines and data structures before they can be retrieved using
    nvmem_cell_get().

    It's still possible to define cells statically in nvmem_config but
    cells created this way still need to be associated with consumers using
    lookup entries.

    Note that nvmem_find() must be moved higher in the source file as we
    want to call it from __nvmem_device_get() for devices that don't have
    a device node.

    The signature of __nvmem_device_get() is also changed as it's no longer
    used to retrieve cells.

    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Bartosz Golaszewski
     
  • Kernel users don't have any means of checking the names of nvmem
    devices. Add a routine that returns the name of the nvmem provider.

    This will be useful for future nvmem notifier subscribers - otherwise
    they can't check what device is being added/removed.

    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Bartosz Golaszewski
     

28 Aug, 2017

2 commits

  • missing err.h header file can cause simillar errors like below
    in some configurations.
    "error: implicit declaration of function 'ERR_PTR'
    [-Werror=implicit-function-declaration]"

    This adds the missing include to ensure we can always include
    the header.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • This function does a quick and easy read of an u32 value without any
    kind of resource management code on the consumer side.

    Signed-off-by: Leonard Crestez
    Reviewed-by: Shawn Guo
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Leonard Crestez
     

25 Jun, 2016

1 commit

  • nvmem_cell_read() is declared as void * if CONFIG_NVMEM is enabled, and
    as char * otherwise. This can result in a build warning if CONFIG_NVMEM
    is not enabled and a caller asigns the result to a type other than char *
    without using a typecast. Use a consistent declaration to avoid the
    problem.

    Fixes: e2a5402ec7c6 ("nvmem: Add nvmem_device based consumer apis.")
    Cc: Srinivas Kandagatla
    Signed-off-by: Guenter Roeck
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     

06 Aug, 2015

3 commits

  • This patch adds read/write apis which are based on nvmem_device. It is
    common that the drivers like omap cape manager or qcom cpr driver to
    access bytes directly at particular offset in the eeprom and not from
    nvmem cell info in DT. These driver would need to get access to the nvmem
    directly, which is what these new APIS provide.

    These wrapper apis would help such users to avoid code duplication in
    there drivers and also avoid them reading a big eeprom blob and parsing
    it internally in there driver.

    Signed-off-by: Srinivas Kandagatla
    Tested-by: Stefan Wahren
    Tested-by: Philipp Zabel
    Tested-by: Rajendra Nayak
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • This patch adds just consumers part of the framework just to enable easy
    review.

    Up until now, nvmem drivers were stored in drivers/misc, where they all
    had to duplicate pretty much the same code to register a sysfs file,
    allow in-kernel users to access the content of the devices they were
    driving, etc.

    This was also a problem as far as other in-kernel users were involved,
    since the solutions used were pretty much different from on driver to
    another, there was a rather big abstraction leak.

    This introduction of this framework aims at solving this. It also
    introduces DT representation for consumer devices to go get the data they
    require (MAC Addresses, SoC/Revision ID, part numbers, and so on) from
    the nvmems.

    Having regmap interface to this framework would give much better
    abstraction for nvmems on different buses.

    Signed-off-by: Maxime Ripard
    [Maxime Ripard: intial version of the framework]
    Signed-off-by: Srinivas Kandagatla
    Tested-by: Stefan Wahren
    Tested-by: Philipp Zabel
    Tested-by: Rajendra Nayak
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • This patch adds just providers part of the framework just to enable easy
    review.

    Up until now, NVMEM drivers like eeprom were stored in drivers/misc,
    where they all had to duplicate pretty much the same code to register
    a sysfs file, allow in-kernel users to access the content of the devices
    they were driving, etc.

    This was also a problem as far as other in-kernel users were involved,
    since the solutions used were pretty much different from on driver to
    another, there was a rather big abstraction leak.

    This introduction of this framework aims at solving this. It also
    introduces DT representation for consumer devices to go get the data
    they require (MAC Addresses, SoC/Revision ID, part numbers, and so on)
    from the nvmems.

    Having regmap interface to this framework would give much better
    abstraction for nvmems on different buses.

    Signed-off-by: Maxime Ripard
    [Maxime Ripard: intial version of eeprom framework]
    Signed-off-by: Srinivas Kandagatla
    Tested-by: Stefan Wahren
    Tested-by: Philipp Zabel
    Tested-by: Rajendra Nayak
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla