1. 24 Jan, 2018 1 commit
  2. 17 Jan, 2018 4 commits
  3. 15 Jan, 2018 20 commits
  4. 04 Jan, 2018 1 commit
    • Jan Kundrát's avatar
      i2c: gpio: Enable working over slow can_sleep GPIOs · f11a0446
      Jan Kundrát authored
      "Slow" GPIOs (usually those connected over an SPI or an I2C bus) are,
      well, slow in their operation. It is generally a good idea to avoid
      using them for time-critical operation, but sometimes the hardware just
      sucks, and the software has to cope. In addition to that, the I2C bus
      itself does not actually define any strict timing limits; the bus is
      free to go all the way down to DC. The timeouts (and therefore the
      slowest acceptable frequency) are present only in SMBus.
      
      The `can_sleep` is IMHO a wrong concept to use here. My SPI-to-quad-UART
      chip (MAX14830) is connected via a 26MHz SPI bus, and it happily drives
      SCL at 200kHz (5µs pulses) during my benchmarks. That's faster than the
      maximal allowed speed of the traditional I2C.
      
      The previous version of this code did not really block operation over
      slow GPIO pins, anyway. Instead, it just resorted to printing a warning
      with a backtrace each time a GPIO pin was accessed, thereby slowing
      things down even more.
      
      Finally, it's not just me. A similar patch was originally submitted in
      2015 [1].
      
      [1] https://patchwork.ozlabs.org/patch/450956/Signed-off-by: default avatarJan Kundrát <jan.kundrat@cesnet.cz>
      Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      f11a0446
  5. 03 Jan, 2018 4 commits
  6. 02 Jan, 2018 4 commits
  7. 01 Jan, 2018 6 commits
    • Bartosz Golaszewski's avatar
      eeprom: at24: fix a whitespace error in platform data · 98fb3a34
      Bartosz Golaszewski authored
      Replace spaces with tabs in the definition of AT24_FLAG_NO_RDROL.
      
      Fixes: 9d404411091c ("eeprom: at24: support eeproms that do not auto-rollover reads")
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      98fb3a34
    • Bartosz Golaszewski's avatar
      eeprom: at24: add support for the write-protect pin · 6ce261e8
      Bartosz Golaszewski authored
      AT24 EEPROMs have a write-protect pin, which - when pulled high -
      inhibits writes to the upper quadrant of memory (although it has been
      observed that on some chips it disables writing to the entire memory
      range).
      
      On some boards, this pin is connected to a GPIO and pulled high by
      default, which forces the user to manually change its state before
      writing. On linux this means that we either need to hog the line all
      the time, or set the GPIO value before writing from outside of the
      at24 driver.
      
      Make the driver check if the write-protect GPIO was defined in the
      device tree and pull it low whenever writing to the EEPROM.
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      6ce261e8
    • Bartosz Golaszewski's avatar
      dt-bindings: at24: new optional property - wp-gpios · 3f3d8ef7
      Bartosz Golaszewski authored
      AT24 EEPROMs have a write-protect pin, which - when pulled high -
      inhibits writes to the upper quadrant of memory (although it has been
      observed that on some chips it disables writing to the entire memory
      range).
      
      On some boards, this pin is connected to a GPIO and pulled high by
      default, which forces the user to manually change its state before
      writing. On linux this means that we either need to hog the line all
      the time, or set the GPIO value before writing from outside of the
      at24 driver.
      
      Add a new optional property to the device tree binding document, which
      allows to specify the GPIO line to which the write-protect pin is
      connected.
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      3f3d8ef7
    • Sven Van Asbroeck's avatar
      eeprom: at24: remove temporary fix for at24mac402 size · ef542e59
      Sven Van Asbroeck authored
      The chip size passed via devicetree, i2c, or acpi device ids is now no
      longer limited to a power of two. So the temporary fix can be removed.
      Signed-off-by: default avatarSven Van Asbroeck <svendev@arcx.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      ef542e59
    • Sven Van Asbroeck's avatar
      eeprom: at24: convert magic numbers to structs · b680f4fa
      Sven Van Asbroeck authored
      Fundamental properties such as capacity and page size differ among
      at24-type chips. But these chips do not have an id register, so this
      can't be discovered at runtime.
      
      Traditionally, at24-type eeprom properties were determined in two ways:
      - by passing a 'struct at24_platform_data' via platform_data, or
      - by naming the chip type in the devicetree, which passes a 'magic
        number' to probe(), which is then converted to a 'struct
        at24_platform_data'.
      
      Recently a bug was discovered because the magic number rounds down all
      chip sizes to the lowest power of two. This was addressed by
      a work-around commit 5478e478 ("eeprom: at24: correctly set the
      size for at24mac402"), with the wish that magic numbers should over
      time be converted to structs.
      
      This patch replaces the magic numbers with 'struct at24_chip_data'.
      Signed-off-by: default avatarSven Van Asbroeck <svendev@arcx.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      b680f4fa
    • Bartosz Golaszewski's avatar
      eeprom: at24: code shrink · eef69398
      Bartosz Golaszewski authored
      A regmap_config struct is pretty big and declaring two of them
      statically just to tweak the reg_bits value adds unnecessary bloat.
      
      Declare the regmap config locally in at24_probe() instead.
      
      Bloat-o-meter output for ARM:
      
      add/remove: 0/2 grow/shrink: 1/0 up/down: 4/-272 (-268)
      Function                                     old     new   delta
      at24_probe                                  1560    1564      +4
      regmap_config_8                              136       -    -136
      regmap_config_16                             136       -    -136
      Total: Before=7012, After=6744, chg -3.82%
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      eef69398