13 Jan, 2012

1 commit

  • Convert the drivers in drivers/i2c/busses/* to use the
    module_platform_driver() macro which makes the code smaller and a bit
    simpler.

    Cc: Ben Dooks
    Acked-by: Jochen Friedrich
    Acked-by: Peter Korsgaard
    Acked-by: Wolfram Sang
    Cc: Manuel Lauss
    Cc: Barry Song
    Cc: Linus Walleij
    Cc: Yong Zhang
    Cc: Lucas De Marchi
    Cc: Grant Likely
    Cc: Samuel Ortiz
    Signed-off-by: Axel Lin
    Signed-off-by: Jean Delvare

    Axel Lin
     

19 May, 2011

1 commit

  • Commit b826291c, "drivercore/dt: add a match table pointer to struct
    device" added an of_match pointer to struct device to cache the
    of_match_table entry discovered at driver match time. This was unsafe
    because matching is not an atomic operation with probing a driver. If
    two or more drivers are attempted to be matched to a driver at the
    same time, then the cached matching entry pointer could get
    overwritten.

    This patch reverts the of_match cache pointer and reworks all users to
    call of_match_device() directly instead.

    Signed-off-by: Grant Likely

    Grant Likely
     

01 Mar, 2011

1 commit


30 Sep, 2010

1 commit

  • Commit 959e85f7, "i2c: add OF-style registration and binding" caused a
    module dependency loop where of_i2c.c calls functions in i2c-core, and
    i2c-core calls of_i2c_register_devices() in of_i2c. This means that
    when i2c support is built as a module when CONFIG_OF is set, then
    neither i2c_core nor of_i2c are able to be loaded.

    This patch fixes the problem by moving the of_i2c_register_devices()
    calls back into the device drivers. Device drivers already
    specifically request the core code to parse the device tree for
    devices anyway by setting the of_node pointer, so it isn't a big
    deal to also call the registration function. The drivers just become
    slightly more verbose.

    Signed-off-by: Grant Likely
    Signed-off-by: Jean Delvare

    Grant Likely
     

06 Aug, 2010

2 commits

  • of_device is just an alias for platform_device, so remove it entirely. Also
    replace to_of_device() with to_platform_device() and update comment blocks.

    This patch was initially generated from the following semantic patch, and then
    edited by hand to pick up the bits that coccinelle didn't catch.

    @@
    @@
    -struct of_device
    +struct platform_device

    Signed-off-by: Grant Likely
    Reviewed-by: David S. Miller

    Grant Likely
     
  • * 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: (63 commits)
    of/platform: Register of_platform_drivers with an "of:" prefix
    of/address: Clean up function declarations
    of/spi: call of_register_spi_devices() from spi core code
    of: Provide default of_node_to_nid() implementation.
    of/device: Make of_device_make_bus_id() usable by other code.
    of/irq: Fix endian issues in parsing interrupt specifiers
    of: Fix phandle endian issues
    of/flattree: fix of_flat_dt_is_compatible() to match the full compatible string
    of: remove of_default_bus_ids
    of: make of_find_device_by_node generic
    microblaze: remove references to of_device and to_of_device
    sparc: remove references to of_device and to_of_device
    powerpc: remove references to of_device and to_of_device
    of/device: Replace of_device with platform_device in includes and core code
    of/device: Protect against binding of_platform_drivers to non-OF devices
    of: remove asm/of_device.h
    of: remove asm/of_platform.h
    of/platform: remove all of_bus_type and of_platform_bus_type references
    of: Merge of_platform_bus_type with platform_bus_type
    drivercore/of: Add OF style matching to platform bus
    ...

    Fix up trivial conflicts in arch/microblaze/kernel/Makefile due to just
    some obj-y removals by the devicetree branch, while the microblaze
    updates added a new file.

    Linus Torvalds
     

02 Aug, 2010

1 commit

  • This patch improves the recovery of the MPC's I2C bus from errors like bus
    hangs resulting in timeouts:
    1. make the bus timeout configurable, as it depends on the bus clock and
    the attached slave chip(s); default is still 1 second;
    2. detect any of the cases indicated by the CF, BB and RXAK MSR flags if a
    timeout occurs, and add a missing (required) MAL reset;
    3. use a more reliable method to fixup the bus if a hang has been detected.
    The sequence is sent 9 times which seems to be necessary if a slave
    "misses" more than one clock cycle. For 400 kHz bus speed, the fixup is
    also ~70us (81us vs. 150us) faster.

    Tested on a custom Lite5200b derived board, with a Dallas RTC, AD sensors
    and NXP IO expander chips attached to the i2c.

    Changes vs. v1:
    - use improved bus fixup sequence for all chips (not only the 5200)
    - calculate real clock from defaults if no clock is given in the device tree
    - better description (I hope) of the changes.

    I didn't split the changes in this file into three parts as recommended by
    Grant, as they actually belong together (i.e. they address one single
    problem, just in three places of one single source file).

    Signed-off-by: Albrecht Dreß
    [grant.likely@secretlab.ca: fixup for ->node to ->dev.of_node transition]
    Signed-off-by: Grant Likely

    Albrecht Dreß
     

06 Jul, 2010

2 commits


22 May, 2010

2 commits

  • Merging in current state of Linus' tree to deal with merge conflicts and
    build failures in vio.c after merge.

    Conflicts:
    drivers/i2c/busses/i2c-cpm.c
    drivers/i2c/busses/i2c-mpc.c
    drivers/net/gianfar.c

    Also fixed up one line in arch/powerpc/kernel/vio.c to use the
    correct node pointer.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • .name, .match_table and .owner are duplicated in both of_platform_driver
    and device_driver. This patch is a removes the extra copies from struct
    of_platform_driver and converts all users to the device_driver members.

    This patch is a pretty mechanical change. The usage model doesn't change
    and if any drivers have been missed, or if anything has been fixed up
    incorrectly, then it will fail with a compile time error, and the fixup
    will be trivial. This patch looks big and scary because it touches so
    many files, but it should be pretty safe.

    Signed-off-by: Grant Likely
    Acked-by: Sean MacLennan

    Grant Likely
     

20 May, 2010

1 commit

  • Drop NO_IRQ as 0 is the preferred way to describe 'no irq'
    (http://lkml.org/lkml/2005/11/21/221). This change is safe, as the driver is
    only used on powerpc, where NO_IRQ is 0 anyhow.

    Signed-off-by: Wolfram Sang
    Acked-by: Grant Likely
    Cc: Ben Dooks

    Wolfram Sang
     

19 May, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

08 Mar, 2010

3 commits


03 Nov, 2009

1 commit

  • The driver always ends a read with a STOP condition which
    breaks subsequent I2C reads/writes in the same transaction as
    these expect to do a repeated START(ReSTART).

    This will also help I2C multimaster as the bus will not be released
    after the first read, but when the whole transaction ends.

    Signed-off-by: Joakim Tjernlund
    Signed-off-by: Ben Dooks

    Joakim Tjernlund
     

17 Jun, 2009

1 commit


12 May, 2009

1 commit


07 Apr, 2009

3 commits

  • This patch makes the I2C bus speed configurable by using the I2C node
    property "clock-frequency". If the property is not defined, the old
    fixed clock settings will be used for backward comptibility.

    The generic I2C clock properties, especially the CPU-specific source
    clock pre-scaler are defined via the OF match table:

    static const struct of_device_id mpc_i2c_of_match[] = {
    ...
    {.compatible = "fsl,mpc8543-i2c",
    .data = &(struct fsl_i2c_match_data) {
    .setclock = mpc_i2c_setclock_8xxx,
    .prescaler = 2,
    },
    },

    The "data" field defines the relevant I2C setclock function and the
    relevant pre-scaler for the I2C source clock frequency.

    It uses arch-specific tables and functions to determine resonable
    Freqency Divider Register (fdr) values for MPC83xx, MPC85xx, MPC86xx,
    MPC5200 and MPC5200B.

    The i2c->flags field and the corresponding FSL_I2C_DEV_* definitions
    have been removed as they are obsolete.

    Signed-off-by: Wolfgang Grandegger
    Signed-off-by: Ben Dooks

    Wolfgang Grandegger
     
  • This patch used the dev_dbg, dev_err, etc. functions for debug
    and error output instead of printk and pr_debug.

    Signed-off-by: Wolfgang Grandegger
    Signed-off-by: Ben Dooks

    Wolfgang Grandegger
     
  • Fix errors reported by checkpatch (indention, long lines, trailing
    white space, etc.).

    Signed-off-by: Wolfgang Grandegger
    Signed-off-by: Ben Dooks

    Wolfgang Grandegger
     

30 Mar, 2009

1 commit


29 Mar, 2009

1 commit

  • i2c_adapter.timeout is in jiffies. Fix all drivers which thought
    otherwise. It didn't really matter as long as the value was only used
    inside the driver, but soon i2c-core will use it too so it must have
    the proper unit.

    Note: for the i2c-mpc driver, this fixes a bug in polling mode.
    Timeout would trigger after 1 jiffy, which is most probably not what
    the author wanted.

    Signed-off-by: Jean Delvare
    Cc: Clifford Wolf
    Acked-by: Sean MacLennan
    Cc: Stefan Roese
    Acked-by: Lennert Buytenhek
    Cc: Dan Williams
    Cc: Grant Likely
    Acked-by: Mark A. Greer

    Jean Delvare
     

09 Mar, 2009

1 commit

  • The i2c_wait() function is using wait_event_interruptible_timeout() to wait for
    the I2C controller to signal that it has completed an I2C bus operation. If
    the process that causes the I2C operation terminated abruptly, the wait will
    be interrupted, returning an error. It is better to let the I2C operation
    finished before the process exits.

    It is safe to use wait_event_timeout() instead, because the timeout will allow
    the process to exit if the I2C bus hangs. It's also better to allow the
    I2C operation to finish, because unacknowledged I2C operations can cause the
    I2C bus to hang.

    Signed-off-by: Timur Tabi
    Acked-by: Ben Dooks
    Signed-off-by: Kumar Gala

    Timur Tabi
     

27 Jan, 2009

1 commit


09 Oct, 2008

1 commit

  • This patch suppresses I2C device probing by clearing the class field
    of the "struct i2c_adapter" for the MPC I2C bus adapters. Some board
    configurations which rely on probing must be fixed up by adding a
    proper I2C device node to the DTS file, like the TQM85xx modules.

    Signed-off-by: Wolfgang Grandegger
    Signed-off-by: Grant Likely

    Wolfgang Grandegger
     

16 Jul, 2008

1 commit


15 Jul, 2008

1 commit

  • Let general purpose I2C/SMBus bus drivers add SPD to their class. Once
    this is done, we will be able to tell the eeprom driver to only probe
    for SPD EEPROMs and similar on these buses.

    Note that I took a conservative approach here, adding I2C_CLASS_SPD to
    many drivers that have no idea whether they can host SPD EEPROMs or not.
    This is to make sure that the eeprom driver doesn't stop probing buses
    where SPD EEPROMs or equivalent live.

    So, bus driver maintainers and users should feel free to remove the SPD
    class from drivers those buses never have SPD EEPROMs or they don't
    want the eeprom driver to bind to them. Likewise, feel free to add the
    SPD class to any bus driver I might have missed.

    Signed-off-by: Jean Delvare

    Jean Delvare
     

13 Jul, 2008

1 commit


12 May, 2008

1 commit

  • Alter the mpc i2c driver to use the NO_IRQ symbol instead of the constant
    zero when checking for valid interrupts. NO_IRQ=-1 on ppc and NO_IRQ=0 on
    powerpc so the checks against zero are not correct.

    Signed-off-by: Jon Smirl
    Signed-off-by: Jean Delvare

    Jon Smirl
     

23 Apr, 2008

1 commit

  • Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform
    modalias is prefixed with "platform:". Add MODULE_ALIAS() to the
    hotpluggable I2C platform drivers, to allow module auto loading.

    [ db: add some more drivers ]

    Signed-off-by: Kay Sievers
    Signed-off-by: David Brownell
    Signed-off-by: Jean Delvare

    Kay Sievers
     

28 Jan, 2008

2 commits


15 Aug, 2007

2 commits


12 Jul, 2007

2 commits

  • Work around a problem reported on:
    http://ozlabs.org/pipermail/linuxppc-embedded/2005-July/019038.html
    Without this patch I2C on mpc5200 becomes unusable after a while.
    Tested on mpc5200 boards by Matthias Fechner and me.

    Signed-off-by: Domen Puncer
    Signed-off-by: Jean Delvare

    Domen Puncer
     
  • Move the i2c-mpc driver over to using the new i2c infrastructure.
    Specifically, it now uses i2c_add_numbered_adapter so that the bus number
    can be determined ahead of time and used to register i2c clients before
    the bus is instantiated.

    Tested on an MPC5200 based board

    Signed-off-by: Grant Likely
    Signed-off-by: Jean Delvare

    Grant Likely
     

03 May, 2007

1 commit

  • I noticed that many source files include while they do
    not appear to need it. Here is an attempt to clean it all up.

    In order to find all possibly affected files, I searched for all
    files including but without any other occurence of "pci"
    or "PCI". I removed the include statement from all of these, then I
    compiled an allmodconfig kernel on both i386 and x86_64 and fixed the
    false positives manually.

    My tests covered 66% of the affected files, so there could be false
    positives remaining. Untested files are:

    arch/alpha/kernel/err_common.c
    arch/alpha/kernel/err_ev6.c
    arch/alpha/kernel/err_ev7.c
    arch/ia64/sn/kernel/huberror.c
    arch/ia64/sn/kernel/xpnet.c
    arch/m68knommu/kernel/dma.c
    arch/mips/lib/iomap.c
    arch/powerpc/platforms/pseries/ras.c
    arch/ppc/8260_io/enet.c
    arch/ppc/8260_io/fcc_enet.c
    arch/ppc/8xx_io/enet.c
    arch/ppc/syslib/ppc4xx_sgdma.c
    arch/sh64/mach-cayman/iomap.c
    arch/xtensa/kernel/xtensa_ksyms.c
    arch/xtensa/platform-iss/setup.c
    drivers/i2c/busses/i2c-at91.c
    drivers/i2c/busses/i2c-mpc.c
    drivers/media/video/saa711x.c
    drivers/misc/hdpuftrs/hdpu_cpustate.c
    drivers/misc/hdpuftrs/hdpu_nexus.c
    drivers/net/au1000_eth.c
    drivers/net/fec_8xx/fec_main.c
    drivers/net/fec_8xx/fec_mii.c
    drivers/net/fs_enet/fs_enet-main.c
    drivers/net/fs_enet/mac-fcc.c
    drivers/net/fs_enet/mac-fec.c
    drivers/net/fs_enet/mac-scc.c
    drivers/net/fs_enet/mii-bitbang.c
    drivers/net/fs_enet/mii-fec.c
    drivers/net/ibm_emac/ibm_emac_core.c
    drivers/net/lasi_82596.c
    drivers/parisc/hppb.c
    drivers/sbus/sbus.c
    drivers/video/g364fb.c
    drivers/video/platinumfb.c
    drivers/video/stifb.c
    drivers/video/valkyriefb.c
    include/asm-arm/arch-ixp4xx/dma.h
    sound/oss/au1550_ac97.c

    I would welcome test reports for these files. I am fine with removing
    the untested files from the patch if the general opinion is that these
    changes aren't safe. The tested part would still be nice to have.

    Note that this patch depends on another header fixup patch I submitted
    to LKML yesterday:
    [PATCH] scatterlist.h needs types.h
    http://lkml.org/lkml/2007/3/01/141

    Signed-off-by: Jean Delvare
    Cc: Badari Pulavarty
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare