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
     

01 Aug, 2010

1 commit

  • Currently there are some drivers in tree which register both a
    platform_driver and an of_platform_driver with the same name. This is
    a temporary situation until all the relevant of_platform_drivers are
    converted to be normal platform_drivers. Until then, this patch gives
    all the of_platform_drivers an "of:" prefix to protect against bogus
    matches and namespace conflicts.

    Grant Likely
     

30 Jul, 2010

2 commits


25 Jul, 2010

3 commits


24 Jul, 2010

5 commits

  • This list used was by only two platforms with all other platforms defining an
    own list of valid bus id's to pass to of_platform_bus_probe. This patch:

    i) copies the default list to the two platforms that depended on it (powerpc)
    ii) remove the usage of of_default_bus_ids in of_platform_bus_probe
    iii) removes the definition of the list from all architectures that defined it

    Passing a NULL 'matches' parameter to of_platform_bus_probe is still valid; the
    function returns no error in that case as the NULL value is equivalent to an
    empty list.

    Signed-off-by: Jonas Bonn
    [grant.likely@secretlab.ca: added __initdata annotations, warn on and return error on missing match table, and fix whitespace errors]
    Signed-off-by: Grant Likely

    Jonas Bonn
     
  • There's no need for this function to be architecture specific and all four
    architectures defining it had the same definition. The function has been
    moved to drivers/of/platform.c.

    Signed-off-by: Jonas Bonn
    [grant.likely@secretlab.ca: moved to drivers/of/platform.c, simplified code, and added kerneldoc comment]
    Signed-off-by: Grant Likely
    Acked-by: David S. Miller

    Jonas Bonn
     
  • 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
     
  • There is an unlikely chance of this situation is occurring, but it is
    easy to protect against. If a matching entry cannot be found in the
    of_match_table, then don't bind the driver.

    Signed-off-by: Grant Likely

    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
     

19 Jul, 2010

2 commits


15 Jul, 2010

2 commits

  • There's no reason to use the powerpc-specific _ALIGN macro in the fdt
    code. Replace it with ALIGN() from kernel.h

    Signed-off-by: Grant Likely
    Acked-By: Jeremy Kerr
    Acked-by: Benjamin Herrenschmidt

    Grant Likely
     
  • Commit 94c0931983ee9d1cd96c32d52ac64c17464f0bbd (of:
    Merge of_device_alloc() and of_device_make_bus_id()) moved code that
    does calls a dcr routine without including the correct header which
    causes the following build error on some powerpc configurations:

    drivers/of/platform.c: In function 'of_device_make_bus_id':
    drivers/of/platform.c:437: error: implicit declaration of function 'of_translate_dcr_address'

    This patch adds the appropriate header to drivers/of/platform.c

    Signed-off-by: Grant Likely

    Grant Likely
     

06 Jul, 2010

24 commits

  • Microblaze and PPC both use PROC_DEVICETREE, and OLPC will as well.. put
    the Kconfig option into fs/ rather than in arch/*/Kconfig.

    Signed-off-by: Andres Salomon
    [grant.likely@secretlab.ca: changed depends to PROC_FS && !SPARC]
    [grant.likely@secretlab.ca: moved to drivers/of/Kconfig]
    Signed-off-by: Grant Likely

    Andres Salomon
     
  • All of the options in drivers/of/Kconfig depend on CONFIG_OF. Putting
    all of them inside a menu block simplifies the dependency statements.
    It also creates a logical group for adding user selectable OF options.

    This patch also changes (PPC_OF || MICROBLAZE) statements to (!SPARC)
    so that those options are available to other architectures (and in
    fact the !SPARC conditions should probably be re-evalutated since the
    code is more generic now)

    This patch also moves the definition of CONFIG_DTC from arch/* to
    drivers/of/Kconfig

    Signed-off-by: Grant Likely

    Grant Likely
     
  • Signed-off-by: Stephen Rothwell
    Signed-off-by: Grant Likely

    Stephen Rothwell
     
  • Fix a build failure on ARM

    Signed-off-by: Grant Likely

    Grant Likely
     
  • This patch tightens up the behaviour of of_modalias_node() to be more
    predicatable and to eliminate the explicit of_modalias_tablep[] that
    is currently used to override the first entry in the compatible list
    of a device. The override table was needed originally because spi
    and i2c drivers had no way to do of-style matching. Now that all
    devices can have an of_node pointer, and all drivers can have an
    of_match_table, the explicit override table is no longer needed
    because each driver can specify its own OF-style match data.

    The mpc8349emitx-mcu driver is modified to explicitly specify the
    correct device to bind against.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • This patch cleans up the i2c OF support code to make it selectable by
    all architectures and allow for automatic registration of i2c devices.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • 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
     
  • drivers/of/gpio.c is missing includes for of_irq and struct device which
    cause build failures on ARM. This patch adds the correct include files
    and removes the unneeded kernel.h include

    Signed-off-by: Grant Likely

    Grant Likely
     
  • Implement generic OF gpio hooks and thus make device-enabled GPIO chips
    (i.e. the ones that have gpio_chip->dev specified) automatically attach
    to the OpenFirmware subsystem. Which means that now we can handle I2C and
    SPI GPIO chips almost* transparently.

    * "Almost" because some chips still require platform data, and for these
    chips OF-glue is still needed, though with this change the glue will
    be much smaller.

    Signed-off-by: Anton Vorontsov
    Signed-off-by: Grant Likely
    Cc: David Brownell
    Cc: Bill Gatliff
    Cc: Dmitry Eremin-Solenikov
    Cc: Benjamin Herrenschmidt
    Cc: Jean Delvare
    Cc: Andrew Morton
    CC: linux-kernel@vger.kernel.org
    CC: devicetree-discuss@lists.ozlabs.org

    Anton Vorontsov
     
  • Currently the kernel uses the struct device_node.data pointer to resolve
    a struct gpio_chip pointer from a device tree node. However, the .data
    member doesn't provide any type checking and there aren't any rules
    enforced on what it should be used for. There's no guarantee that the
    data stored in it actually points to an gpio_chip pointer.

    Instead of relying on the .data pointer, this patch modifies the code
    to add a lookup function which scans through the registered gpio_chips
    and returns the gpio_chip that has a pointer to the specified
    device_node.

    Signed-off-by: Grant Likely
    CC: Andrew Morton
    CC: Anton Vorontsov
    CC: Grant Likely
    CC: David Brownell
    CC: Bill Gatliff
    CC: Dmitry Eremin-Solenikov
    CC: Benjamin Herrenschmidt
    CC: Jean Delvare
    CC: linux-kernel@vger.kernel.org
    CC: devicetree-discuss@lists.ozlabs.org

    Grant Likely
     
  • The OF gpio infrastructure is great for describing GPIO connections within
    the device tree. However, using a GPIO binding still requires changes to
    the gpio controller just to add an of_gpio structure. In most cases, the
    gpio controller doesn't actually need any special support and the simple
    OF gpio mapping function is more than sufficient. Additional, the current
    scheme of using of_gpio_chip requires a convoluted scheme to maintain
    1:1 mappings between of_gpio_chip and gpio_chip instances.

    If the struct of_gpio_chip data members were moved into struct gpio_chip,
    then it would simplify the processing of OF gpio bindings, and it would
    make it trivial to use device tree OF connections on existing gpiolib
    controller drivers.

    This patch eliminates the of_gpio_chip structure and moves the relevant
    fields into struct gpio_chip (conditional on CONFIG_OF_GPIO). This move
    simplifies the existing code and prepares for adding automatic device tree
    support to existing drivers.

    Signed-off-by: Grant Likely
    Cc: Andrew Morton
    Cc: Anton Vorontsov
    Cc: Grant Likely
    Cc: David Brownell
    Cc: Bill Gatliff
    Cc: Dmitry Eremin-Solenikov
    Cc: Benjamin Herrenschmidt
    Cc: Jean Delvare

    Anton Vorontsov
     
  • When allocating a platform_device to represent an OF node, also allocate
    space for the resource table and populate it with IRQ and reg property
    information. This change is in preparation for merging the
    of_platform_bus_type with the platform_bus_type so that existing
    platform_driver code can retrieve base addresses and IRQs data.

    Background: a previous commit removed struct of_device and made it a
    #define alias for platform_device.

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

    Grant Likely
     
  • This patch merges the common routines of_device_alloc() and
    of_device_make_bus_id() from powerpc and microblaze.

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

    Grant Likely
     
  • Merge common code between PowerPC and microblaze. This patch merges
    the code that scans the tree and registers devices. The functions
    merged are of_platform_bus_probe(), of_platform_bus_create(), and
    of_platform_device_create().

    This patch also move the of_default_bus_ids[] table out of a Microblaze
    header file and makes it non-static. The device ids table isn't merged
    because powerpc and microblaze use different default data.

    Signed-off-by: Grant Likely
    CC: Michal Simek
    CC: Grant Likely
    CC: Benjamin Herrenschmidt
    CC: Stephen Rothwell
    CC: microblaze-uclinux@itee.uq.edu.au
    CC: linuxppc-dev@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
     
  • Resource names appear in human readable output, so when extracting IRQ
    and address resources from a device tree node, use the full node name
    to give proper context in places like /proc/iomem.

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

    Grant Likely
     
  • Certain Apple machines don't use the ranges property correctly, but the
    workaround should not be applied on other architectures. This patch
    disables the workaround for non-powerpc architectures.

    Signed-off-by: Grant Likely
    Acked-by: Benjamin Herrenschmidt
    CC: Stephen Rothwell

    Grant Likely
     
  • Fix some endian issues in the OF address translation code.

    Signed-off-by: Grant Likely
    Acked-by: Benjamin Herrenschmidt
    CC: Michal Simek
    CC: Stephen Rothwell

    Grant Likely
     
  • Microblaze and PowerPC share a large chunk of code for translating
    OF device tree data into usable addresses. Differences between the two
    consist of cosmetic differences, and the addition of dma-ranges support
    code to powerpc but not microblaze. This patch moves the powerpc
    version into common code and applies many of the cosmetic (non-functional)
    changes from the microblaze version.

    Signed-off-by: Grant Likely
    Acked-by: Benjamin Herrenschmidt
    CC: Michal Simek
    CC: Wolfram Sang
    CC: Stephen Rothwell

    Grant Likely
     
  • Merge common code between PowerPC and Microblaze. This patch also
    moves the prototype of pci_address_to_pio() out of pci-bridge.h and
    into prom.h because the only user of pci_address_to_pio() is
    of_address_to_resource().

    Signed-off-by: Grant Likely
    Acked-by: Benjamin Herrenschmidt
    CC: Michal Simek
    CC: Stephen Rothwell

    Grant Likely
     
  • Merge common code between Microblaze and PowerPC. This patch creates
    new of_address.h and address.c files to containing address translation
    and mapping routines. First routine to be moved it of_iomap()

    Signed-off-by: Grant Likely
    Acked-by: Benjamin Herrenschmidt
    CC: Michal Simek
    CC: Stephen Rothwell

    Grant Likely
     
  • Fix some endian issues in the irq mapping OF code.

    Signed-off-by: Rob Herring
    Signed-off-by: Grant Likely
    CC: Michal Simek
    CC: Wolfram Sang
    CC: Stephen Rothwell
    CC: Benjamin Herrenschmidt

    Rob Herring
     
  • Merge common irq mapping code between PowerPC and Microblaze.

    This patch merges of_irq_find_parent(), of_irq_map_raw() and
    of_irq_map_one(). The functions are dependent on one another, so all
    three are merged in a single patch. Other than cosmetic difference
    (ie. DBG() vs. pr_debug()), the implementations are identical.

    of_irq_to_resource() is also merged, but in this case the
    implementations are different. This patch drops the microblaze version
    and uses the powerpc implementation unchanged. The microblaze version
    essentially open-coded irq_of_parse_and_map() which it does not need
    to do. Therefore the powerpc version is safe to adopt.

    Signed-off-by: Grant Likely
    CC: Michal Simek
    CC: Benjamin Herrenschmidt
    CC: Stephen Rothwell

    Grant Likely