1. 28 11月, 2017 1 次提交
  2. 07 11月, 2017 1 次提交
    • J
      i2c: aspeed: Deassert reset in probe · edd20e95
      Joel Stanley 提交于
      In order to use i2c from a cold boot, the i2c peripheral must be taken
      out of reset. We request a shared reset controller each time a bus
      driver is loaded, as the reset is shared between the 14 i2c buses.
      
      On remove the reset is asserted, which only touches the hardware once
      the last i2c bus is removed.
      
      The reset is required as the I2C buses will not work without releasing
      the reset. Previously the driver only worked with out of tree hacks
      that released this reset before the driver was loaded. Update the
      device tree bindings to reflect this.
      Signed-off-by: NJoel Stanley <joel@jms.id.au>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      edd20e95
  3. 02 11月, 2017 5 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
    • A
      i2c: thunderx: Remove duplicate NULL check · 620c50dc
      Andy Shevchenko 提交于
      Since i2c_unregister_device() became NULL-aware we may remove duplicate
      NULL check.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      620c50dc
    • A
      i2c: taos-evm: Remove duplicate NULL check · bfd96212
      Andy Shevchenko 提交于
      Since i2c_unregister_device() became NULL-aware we may remove duplicate
      NULL check.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: NJean Delvare <jdelvare@suse.de>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      bfd96212
    • H
      i2c: xgene-slimpro: Support v2 · da24b824
      Hoan Tran 提交于
      This patch supports xgene-slimpro-i2c v2 which uses the non-cachable memory
      as the PCC shared memory.
      Signed-off-by: NHoan Tran <hotran@apm.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      da24b824
    • W
      i2c: mpc: remove useless variable initialization · af336675
      Wolfram Sang 提交于
      cppcheck rightfully says:
      
      drivers/i2c/busses/i2c-mpc.c:329: style: Variable 'node' is reassigned a value before the old one has been used.
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      af336675
  4. 30 10月, 2017 5 次提交
    • C
      i2c: omap: Trigger bus recovery in lockup case · 93367bfc
      Claudio Foellmi 提交于
      A very conservative check for bus activity (to prevent interference
      in multimaster setups) prevented the bus recovery methods from being
      triggered in the case that SDA or SCL was stuck low.
      This defeats the purpose of the recovery mechanism, which was introduced
      for exactly this situation (a slave device keeping SDA pulled down).
      
      Also added a check to make sure SDA is low before attempting recovery.
      If SDA is not stuck low, recovery will not help, so we can skip it.
      
      Note that bus lockups can persist across reboots. The only other options
      are to reset or power cycle the offending slave device, and many i2c
      slaves do not even have a reset pin.
      
      If we see that one of the lines is low for the entire timeout duration,
      we can actually be sure that there is no other master driving the bus.
      It is therefore save for us to attempt a bus recovery.
      Signed-off-by: NClaudio Foellmi <claudio.foellmi@ergon.ch>
      Tested-by: NVignesh R <vigneshr@ti.com>
      Reviewed-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      [wsa: fixed one return code to -EBUSY]
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      93367bfc
    • L
      i2c: gpio: Add support for named gpios in DT · 05c74778
      Linus Walleij 提交于
      This adds support for using the "sda" and "scl" GPIOs in
      device tree instead of anonymously using index 0 and 1 of
      the "gpios" property.
      
      We add a helper function to retrieve the GPIO descriptors
      and some explicit error handling since the probe may have
      to be deferred. At least this happened to me when moving
      to using named "sda" and "scl" lines (all of a sudden this
      started to probe before the GPIO driver) so we need to
      gracefully defer probe when we ge -ENOENT in the error
      pointer.
      Suggested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      05c74778
    • L
      i2c: gpio: Local vars in probe · b9ab0517
      Linus Walleij 提交于
      By creating local variables for *dev and *np, the code become
      much easier to read, in my opinion.
      Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      b9ab0517
    • L
      i2c: gpio: Enforce open drain through gpiolib · 7bb75029
      Linus Walleij 提交于
      The I2C GPIO bitbang driver currently emulates open drain
      behaviour by implementing what the gpiolib already does:
      not actively driving the line high, instead setting it to
      input.
      
      This makes no sense. Use the new facility in gpiolib to
      request the lines enforced into open drain mode, and let
      the open drain emulation already present in the gpiolib
      kick in and handle this.
      
      As a bonus: if the GPIO driver in the back-end actually
      supports open drain in hardware using the .set_config()
      callback, it will be utilized. That's correct: we never
      used that hardware feature before, instead relying on
      emulating open drain even if the GPIO controller could
      actually handle this for us.
      
      Users will sometimes get messages like this:
      gpio-485 (?): enforced open drain please flag it properly
        in DT/ACPI DSDT/board file
      gpio-486 (?): enforced open drain please flag it properly
        in DT/ACPI DSDT/board file
      i2c-gpio gpio-i2c: using lines 485 (SDA) and 486 (SCL)
      
      Which is completely proper: since the line is used as
      open drain, it should actually be flagged properly with
      e.g.
      
      gpios = <&gpio0 5 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>,
              <&gpio0 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
      
      Or similar facilities in board file descriptor tables
      or ACPI DSDT.
      Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      7bb75029
    • L
      i2c: gpio: Convert to use descriptors · b2e63555
      Linus Walleij 提交于
      This converts the GPIO-based I2C-driver to using GPIO
      descriptors instead of the old global numberspace-based
      GPIO interface. We:
      
      - Convert the driver to unconditionally grab two GPIOs
        from the device by index 0 (SDA) and 1 (SCL) which
        will work fine with device tree and descriptor tables.
        The existing device trees will continue to work just
        like before, but without any roundtrip through the
        global numberspace.
      
      - Brutally convert all boardfiles still passing global
        GPIOs by registering descriptor tables associated with
        the devices instead so this driver does not need to keep
        supporting passing any GPIO numbers as platform data.
      
      There is no stepwise approach as elegant as this, I
      strongly prefer this big hammer over any antsteps for this
      conversion. This way the old GPIO numbers go away and
      NEVER COME BACK.
      
      Special conversion for the different boards utilizing
      I2C-GPIO:
      
      - EP93xx (arch/arm/mach-ep93xx): pretty straight forward as
        all boards were using the same two GPIO lines, just define
        these two in a lookup table for "i2c-gpio" and register
        these along with the device. None of them define any
        other platform data so just pass NULL as platform data.
        This platform selects GPIOLIB so all should be smooth.
        The pins appear on a gpiochip for bank "G" as pins 1 (SDA)
        and 0 (SCL).
      
      - IXP4 (arch/arm/mach-ixp4): descriptor tables have to
        be registered for each board separately. They all use
        "IXP4XX_GPIO_CHIP" so it is pretty straight forward.
        Most board define no other platform data than SCL/SDA
        so they can drop the #include of <linux/i2c-gpio.h> and
        assign NULL to platform data.
      
        The "goramo_mlr" (Goramo Multilink Router) board is a bit
        worrisome: it implements its own I2C bit-banging in the
        board file, and optionally registers an I2C serial port,
        but claims the same GPIO lines for itself in the board file.
        This is not going to work: there will be competition for the
        GPIO lines, so delete the optional extra I2C bus instead, no
        I2C devices are registered on it anyway, there are just hints
        that it may contain an EEPROM that may be accessed from
        userspace. This needs to be fixed up properly by the serial
        clock using I2C emulation so drop a note in the code.
      
      - KS8695 board acs5k (arch/arm/mach-ks8695/board-acs5.c)
        has some platform data in addition to the pins so it needs to
        be kept around sans GPIO lines. Its GPIO chip is named
        "KS8695" and the arch selects GPIOLIB.
      
      - PXA boards (arch/arm/mach-pxa/*) use some of the platform
        data so it needs to be preserved here. The viper board even
        registers two GPIO I2Cs. The gpiochip is named "gpio-pxa" and
        the arch selects GPIOLIB.
      
      - SA1100 Simpad (arch/arm/mach-sa1100/simpad.c) defines a GPIO
        I2C bus, and the arch selects GPIOLIB.
      
      - Blackfin boards (arch/blackfin/bf533 etc) for these I assume
        their I2C GPIOs refer to the local gpiochip defined in
        arch/blackfin/kernel/bfin_gpio.c names "BFIN-GPIO".
        The arch selects GPIOLIB. The boards get spiked with
        IF_ENABLED(I2C_GPIO) but that is a side effect of it
        being like that already (I would just have Kconfig select
        I2C_GPIO and get rid of them all.) I also delete any
        platform data set to 0 as it will get that value anyway
        from static declartions of platform data.
      
      - The MIPS selects GPIOLIB and the Alchemy machine is using
        two local GPIO chips, one of them has a GPIO I2C. We need
        to adjust the local offset from the global number space here.
        The ATH79 has a proper GPIO driver in drivers/gpio/gpio-ath79.c
        and AFAICT the chip is named "ath79-gpio" and the PB44
        PCF857x expander spawns from this on GPIO 1 and 0. The latter
        board only use the platform data to specify pins so it can be
        cut altogether after this.
      
      - The MFD Silicon Motion SM501 is a special case. It dynamically
        spawns an I2C bus off the MFD using sm501_create_subdev().
        We use an approach to dynamically create a machine descriptor
        table and attach this to the "SM501-LOW" or "SM501-HIGH"
        gpiochip. We use chip-local offsets to grab the right lines.
        We can get rid of two local static inline helpers as part
        of this refactoring.
      
      Cc: Steven Miao <realmz6@gmail.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Magnus Damm <magnus.damm@gmail.com>
      Cc: Ben Dooks <ben.dooks@codethink.co.uk>
      Cc: Heiko Schocher <hs@denx.de>
      Acked-by: NWu, Aaron <Aaron.Wu@analog.com>
      Acked-by: NOlof Johansson <olof@lixom.net>
      Acked-by: NLee Jones <lee.jones@linaro.org>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      b2e63555
  5. 29 10月, 2017 1 次提交
    • P
      i2c: i2c-smbus: Use threaded irq for smbalert · 9b9f2b8b
      Phil Reid 提交于
      Prior to this commit the smbalert_irq was handling in the hard irq
      context. This change switch to using a thread irq which avoids the need
      for the work thread. Using threaded irq also removes the need for the
      edge_triggered flag as the enabling / disabling of the hard irq for level
      triggered interrupts will be handled by the irq core.
      
      Without this change have an irq connected to something like an i2c gpio
      resulted in a null ptr deferences. Specifically handle_nested_irq calls
      the threaded irq handler.
      
      There are currently 3 in tree drivers affected by this change.
      
      i2c-parport driver calls i2c_handle_smbus_alert in a hard irq context.
      This driver use edge trigger interrupts which skip the enable / disable
      calls. But it still need to handle the smbus transaction on a thread. So
      the work thread is kept for this driver.
      
      i2c-parport-light & i2c-thunderx-pcidrv provide the irq number in the
      setup which will result in the thread irq being used.
      
      i2c-parport-light is edge trigger so the enable / disable call was
      skipped as well.
      
      i2c-thunderx-pcidrv is getting the edge / level trigger setting from of
      data and was setting the flag as required. However the irq core should
      handle this automatically.
      Signed-off-by: NPhil Reid <preid@electromag.com.au>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      9b9f2b8b
  6. 28 10月, 2017 3 次提交
  7. 27 10月, 2017 3 次提交
  8. 18 10月, 2017 6 次提交
  9. 14 10月, 2017 5 次提交
  10. 05 10月, 2017 7 次提交
  11. 14 9月, 2017 3 次提交