18 Oct, 2015

1 commit


29 May, 2015

1 commit

  • It's a common operation for device drivers to retrive the data
    member from of_device_id struct in their probe function.

    Most driver end up doing:
    const struct of_device_id *match;
    match = of_match_device(driver_of_match, &pdev->dev);
    driver->data = match->data;

    With the of_device_get_match_data helper function all this can
    done in one go.

    Signed-off-by: Joachim Eastwood
    [robh: add missing inline to dummmy declaration]
    Signed-off-by: Rob Herring

    Joachim Eastwood
     

13 Mar, 2015

1 commit

  • Calculate the dma_mask and coherent_dma_mask based on the dma-range values
    set in DT for the device.

    Limit the mask to lower of the default mask and mask calculated.

    Signed-off-by: Murali Karicheri
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Catalin Marinas
    CC: Joerg Roedel
    CC: Grant Likely
    CC: Rob Herring
    CC: Will Deacon
    CC: Russell King
    CC: Arnd Bergmann
    CC: Suravee Suthikulpanit

    Murali Karicheri
     

04 Mar, 2015

2 commits

  • Fix the dma-range size when the DT attribute is missing, i.e., set size to
    dev->coherent_dma_mask + 1 instead of dev->coherent_dma_mask. Also add
    code to check invalid values of size configured in DT and log error.

    Tested-by: Suravee Suthikulpanit (AMD Seattle)
    Signed-off-by: Murali Karicheri
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Catalin Marinas
    Acked-by: Will Deacon
    CC: Joerg Roedel
    CC: Grant Likely
    CC: Rob Herring
    CC: Russell King
    CC: Arnd Bergmann

    Murali Karicheri
     
  • Move of_dma_configure() to device.c so it can be re-used for PCI devices to
    obtain DMA configuration from DT. Also add a second argument so that for
    PCI, the DT node of root bus host bridge can be used to obtain the DMA
    configuration for the slave PCI device.

    Tested-by: Suravee Suthikulpanit (AMD Seattle)
    Signed-off-by: Murali Karicheri
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Catalin Marinas
    Acked-by: Will Deacon
    Acked-by: Rob Herring
    CC: Joerg Roedel
    CC: Grant Likely
    CC: Russell King
    CC: Arnd Bergmann

    Murali Karicheri
     

07 Jul, 2014

1 commit


17 Jan, 2014

1 commit


06 Feb, 2013

1 commit

  • In some situations, userspace may want to resolve a
    device by function and logical number (ie, "serial0")
    rather than by the base address or full device path. Being
    able to resolve a device by alias frees userspace from the
    burden of otherwise having to maintain a mapping between
    device addresses and their logical assignments on each
    platform when multiple instances of the same hardware block
    are present in the system.

    Although the uevent device attribute contains devicetree
    compatible information and the full device path, the uevent
    does not list the alises that may have been defined for the
    device.

    Signed-off-by: Stepan Moskovchenko
    [grant.likely: Removed OF_ALIAS_N field; I don't think it's needed]
    [grant.likely: Added #ifndef _LINUX_OF_PRIVATE_H wrapper]
    Signed-off-by: Grant Likely

    Stepan Moskovchenko
     

02 Feb, 2012

1 commit

  • When userspace needs to find a specific device, it currently isn't easy to
    resolve a /sys/devices/ path from a specific device tree node. Nor is it
    easy to obtain the compatible list for devices.

    This patch generalizes the code that inserts OF_* values into the uevent
    device attribute so that any device that is attached to an OF node will
    have that information exported to userspace. Without this patch only
    platform devices and some powerpc-specific busses have access to this
    data.

    The original function also creates a MODALIAS property for the compatible
    list, but that code has not been generalized into the common case because
    it has the potential to break module loading on a lot of bus types. Bus
    types are still responsible for their own MODALIAS properties.

    Boot tested on ARM and compile tested on PowerPC and SPARC.

    Signed-off-by: Grant Likely
    Acked-by: Greg Kroah-Hartman
    Cc: Tobias Klauser
    Cc: Frederic Lambert
    Cc: Rob Herring
    Cc: Mark Brown
    Cc: "David S. Miller"
    Cc: Benjamin Herrenschmidt

    Grant Likely
     

28 Feb, 2011

1 commit

  • arch/powerpc/kernel/ibmebus.c is the only remaining user of the
    of_bus_type support code for initializing the bus and registering
    drivers. All others have either been switched to the vanilla platform
    bus or already have their own infrastructure.

    This patch moves the functionality that ibmebus is using out of
    drivers/of/{platform,device}.c and into ibmebus.c where it is actually
    used. Also renames the moved symbols from of_platform_* to
    ibmebus_bus_* to reflect the actual usage.

    This patch is part of moving all of the of_platform_bus_type users
    over to the platform_bus_type.

    Signed-off-by: Grant Likely

    Grant Likely
     

22 Oct, 2010

1 commit

  • The current code allocates and manages platform_devices created from
    the device tree manually. It also uses an unsafe shortcut for
    allocating the platform_device and the resource table at the same
    time. (which I added in the last rework; sorry).

    This patch refactors the code to use platform_device_alloc() for
    allocating new devices. This reduces the amount of custom code
    implemented by of_platform, eliminates the unsafe alloc trick, and has
    the side benefit of letting the platform_bus code manage freeing the
    device data and resources when the device is freed.

    Signed-off-by: Grant Likely
    Cc: Benjamin Herrenschmidt
    Cc: Greg Kroah-Hartman
    Cc: "David S. Miller"
    Cc: Michal Simek

    Grant Likely
     

06 Aug, 2010

1 commit

  • 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
     

24 Jul, 2010

2 commits

  • of_device is currently just an #define alias to platform_device until it
    gets removed entirely. This patch removes references to it from the
    include directories and the core drivers/of code.

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

    Grant Likely
     
  • of_platform_bus was being used in the same manner as the platform_bus.
    The only difference being that of_platform_bus devices are generated
    from data in the device tree, and platform_bus devices are usually
    statically allocated in platform code. Having them separate causes
    the problem of device drivers having to be registered twice if it
    was possible for the same device to appear on either bus.

    This patch removes of_platform_bus_type and registers all of_platform
    bus devices and drivers on the platform bus instead. A previous patch
    made the of_device structure an alias for the platform_device structure,
    and a shim is used to adapt of_platform_drivers to the platform bus.

    After all of of_platform_bus drivers are converted to be normal platform
    drivers, the shim code can be removed.

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

    Grant Likely
     

06 Jul, 2010

3 commits

  • Add of_driver_match_device() helper function. This function can be used
    by bus types to determine if a driver works with a device when using OF
    style matching. If CONFIG_OF is unselected, then it is a nop.

    Signed-off-by: Grant Likely
    CC: Greg Kroah-Hartman
    CC: Michal Simek
    CC: Grant Likely
    CC: Benjamin Herrenschmidt
    CC: Stephen Rothwell
    CC: linux-kernel@vger.kernel.org
    CC: microblaze-uclinux@itee.uq.edu.au
    CC: linuxppc-dev@ozlabs.org
    CC: devicetree-discuss@lists.ozlabs.org

    Grant Likely
     
  • Now that the of_node pointer is part of struct device,
    of_device_get_modalias could be used on any struct device
    that has the device node pointer set. This patch changes
    of_device_get_modalias to accept a struct device instead
    of a struct of_device.

    Signed-off-by: Grant Likely
    CC: Michal Simek
    CC: Benjamin Herrenschmidt
    CC: Wolfram Sang
    CC: Stephen Rothwell
    CC: microblaze-uclinux@itee.uq.edu.au
    CC: linuxppc-dev@ozlabs.org

    Grant Likely
     
  • Merge common code between powerpc and microblaze

    Signed-off-by: Grant Likely
    CC: Michal Simek
    CC: Wolfram Sang
    CC: Stephen Rothwell
    CC: Benjamin Herrenschmidt
    CC: microblaze-uclinux@itee.uq.edu.au
    CC: linuxppc-dev@ozlabs.org

    Grant Likely
     

22 May, 2010

1 commit


19 May, 2010

1 commit


31 Oct, 2008

1 commit

  • Currently, the numa_node of OF-devices will be overwritten during
    device_register, which simply sets the node to -1. On cell machines,
    this means that devices can't find their IOMMU, which is referenced
    through the device's numa node.

    Set the numa node for OF devices with no parent, and use the
    lower-level device_initialize and device_add functions, so that the
    node is preserved.

    We can remove the call to set_dev_node in of_device_alloc, as it
    will be overwritten during register.

    Signed-off-by: Jeremy Kerr
    Signed-off-by: Paul Mackerras

    Jeremy Kerr
     

20 Aug, 2008

1 commit

  • Recent of_platform changes made of_bus_type_init() overwrite the bus
    type's .dev_attrs list, meaning that the "name" attribute that ibmebus
    devices previously had is no longer present. This is a user-visible
    regression which breaks the userspace eHCA support, since the eHCA
    userspace driver relies on the name attribute to check for valid
    adapters.

    This fixes it by providing the "name" attribute in the generic OF
    device code instead. Tested on POWER.

    Signed-off-by: Joachim Fenkes
    Signed-off-by: Paul Mackerras

    Joachim Fenkes
     

16 May, 2008

1 commit

  • Commit 140b932f8cb6cced10b96860651a198b1b89cbb9 ("Create modalias file
    in sysfs for of_platform bus") needs this to avoid breaking the sparc
    builds.

    Just move the code and add whitespace around some binary operators.

    Signed-off-by: Stephen Rothwell
    Acked-by: David S. Miller
    Signed-off-by: Paul Mackerras

    Stephen Rothwell
     

14 May, 2008

1 commit

  • Create /sys/bus/of_platform/devices/*/modalias file to allow autoloading
    of modules. Modalias files are already present for many other bus types.
    This adds also a newline to the devspec files.

    Also create a devspec file for mac-io devices. They were created as a
    side effect. Use correct buffer size for mac-io modalias buffer.

    Tested on iBook1 and Efika.

    Signed-off-by: Olaf Hering
    Signed-off-by: Paul Mackerras

    Olaf Hering
     

17 Jan, 2008

1 commit

  • Similar to of_find_compatible_node(), of_find_matching_node() and
    for_each_matching_node() allow you to iterate over the device tree
    looking for specific nodes, except that they take of_device_id
    tables instead of strings.

    This also moves of_match_node() from driver/of/device.c to
    driver/of/base.c to colocate it with the of_find_matching_node which
    depends on it.

    Signed-off-by: Grant Likely
    Signed-off-by: Paul Mackerras

    Grant Likely
     

20 Jul, 2007

2 commits

  • This just moves the common stuff from the arch of_device.h files to
    linux/of_device.h.

    Signed-off-by: Stephen Rothwell
    Acked-by: Paul Mackerras
    Acked-by: David S. Miller

    Stephen Rothwell
     
  • This moves all the common parts for the Sparc, Sparc64 and PowerPC
    of_device.c files into drivers/of/device.c.

    Apart from the simple move, Sparc gains of_match_node() and a call to
    of_node_put in of_release_dev(). PowerPC gains better recovery if
    device_create_file() fails in of_device_register().

    Signed-off-by: Stephen Rothwell
    Acked-by: Paul Mackerras
    Acked-by: David S. Miller

    Stephen Rothwell