11 Nov, 2015

1 commit

  • If OF_ADDRESS is not configured, builds can fail with errors such as

    drivers/net/ethernet/hisilicon/hns_mdio.c:
    In function 'hns_mdio_bus_name':
    drivers/net/ethernet/hisilicon/hns_mdio.c:411:3:
    error: implicit declaration of function 'of_translate_address'

    as currently seen when building sparc:allmodconfig.

    Introduce a static inline function if OF_ADDRESS is not configured to fix
    the build failure. Return OF_BAD_ADDR in this case. For this to work, the
    definition of OF_BAD_ADDR has to be moved outside CONFIG_OF conditional
    code.

    Fixes: 876133d3161d ("net: hisilicon: add OF dependency")
    Cc: Arnd Bergmann
    Signed-off-by: Guenter Roeck
    Reviewed-by: Arnd Bergmann
    Reviewed-by: Frank Rowand
    Signed-off-by: Rob Herring

    Guenter Roeck
     

26 Aug, 2015

1 commit

  • Potentially one of platform can support both ACPI and OF. In that case when we
    call to_of_node() for non-OF fwnode types we will get non-NULL result, which is
    wrong. Check for the type and return a correspondent result.

    Signed-off-by: Andy Shevchenko
    Reviewed-by: Mika Westerberg
    Signed-off-by: Rafael J. Wysocki

    Andy Shevchenko
     

02 Jul, 2015

1 commit

  • Pull devicetree updates from Grant Likely:
    "A whole lot of bug fixes.

    Nothing stands out here except the ability to enable CONFIG_OF on
    every architecture, and an import of a newer version of dtc"

    * tag 'devicetree-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux: (22 commits)
    of/irq: Rename "intc_desc" to "of_intc_desc" to fix OF on sh
    of/irq: Fix pSeries boot failure
    Documentation: DT: Fix a typo in the filename "lantiq,-pinumx.txt"
    of: define of_find_node_by_phandle for !CONFIG_OF
    of/address: use atomic allocation in pci_register_io_range()
    of: Add vendor prefix for Zodiac Inflight Innovations
    dt/fdt: add empty versions of early_init_dt_*_memory_arch
    of: clean-up unnecessary libfdt include paths
    of: make unittest select OF_EARLY_FLATTREE instead of depend on it
    of: make CONFIG_OF user selectable
    MIPS: prepare for user enabling of CONFIG_OF
    of/fdt: fix argument name and add comments of unflatten_dt_node()
    of: return NUMA_NO_NODE from fallback of_node_to_nid()
    tps6507x.txt: Remove executable permission
    of/overlay: Grammar s/an negative/a negative/
    of/fdt: Make fdt blob input parameters of unflatten functions const
    of: add helper function to retrive match data
    of: Grammar s/property exist/property exists/
    of: Move OF flags to be visible even when !CONFIG_OF
    scripts/dtc: Update to upstream version 9d3649bd3be245c9
    ...

    Linus Torvalds
     

30 Jun, 2015

1 commit


25 Jun, 2015

1 commit

  • Commit 8a0662d9 introduced of_node and acpi_node symbols in global namespace
    but there were already ~63 of_node local variables or function parameters
    (no single acpi_node though, but anyway).

    After debugging undefined but used of_node local varible (which turned out
    to reference static function of_node() instead) it became clear that the names
    for the functions are too short and too generic for global scope.

    Signed-off-by: Alexander Sverdlin
    Signed-off-by: Rafael J. Wysocki

    Alexander Sverdlin
     

23 Jun, 2015

1 commit

  • Define stub implementation for of_find_node_by_phandle() API
    so that users of this API can build properly even when CONFIG_OF
    is not defined.

    Fixes x86 randconfig build failure of remoteproc.

    Signed-off-by: Suman Anna
    [robh: add details on fixing remoteproc compile]
    Signed-off-by: Rob Herring

    Suman Anna
     

04 Jun, 2015

1 commit


28 May, 2015

2 commits


27 May, 2015

1 commit

  • Commit 5590f3196b29 ("drivers/core/of: Add symlink to device-tree from
    devices with an OF node") adds the symlink `of_node` for each device
    pointing to it's device tree node while creating/initialising it.

    However the devicetree sysfs is created and setup in of_init which is
    executed at core_initcall level. For all the devices created before
    of_init, the following error is thrown:
    "Error -2(-ENOENT) creating of_node link"

    Like many other components in driver model, initialize the sysfs support
    for OF/devicetree from driver_init so that it's ready before any devices
    are created.

    Fixes: 5590f3196b29 ("drivers/core/of: Add symlink to device-tree from
    devices with an OF node")
    Suggested-by: Rob Herring
    Cc: Grant Likely
    Cc: Pawel Moll
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Sudeep Holla
    Tested-by: Robert Schwebel
    Acked-by: Rob Herring
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     

24 Apr, 2015

1 commit

  • Pull second batch of devicetree updates from Rob Herring:
    "As Grant mentioned in the first devicetree pull request, here is the
    2nd batch of DT changes for 4.1. The main remaining item here is the
    endianness bindings and related 8250 driver support.

    - DT endianness specification bindings

    - big-endian 8250 serial support

    - DT overlay unittest updates

    - various DT doc updates

    - compile fixes for OF_IRQ=n"

    * tag 'devicetree-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
    frv: add io{read,write}{16,32}be functions
    mn10300: add io{read,write}{16,32}be functions
    Documentation: DT bindings: add doc for Altera's SoCFPGA platform
    of: base: improve of_get_next_child() kernel-doc
    Doc: dt: arch_timer: discourage clock-frequency use
    of: unittest: overlay: Keep track of created overlays
    of/fdt: fix allocation size for device node path
    serial: of_serial: Support big-endian register accesses
    serial: 8250: Add support for big-endian MMIO accesses
    of: Document {little,big,native}-endian bindings
    of/fdt: Add endianness helper function for early init code
    of: Add helper function to check MMIO register endianness
    of/fdt: Remove "reg" data prints from early_init_dt_scan_memory
    of: add vendor prefix for Artesyn
    of: Add dummy of_irq_to_resource_table() for IRQ_OF=n
    of: OF_IRQ should depend on IRQ_DOMAIN

    Linus Torvalds
     

18 Apr, 2015

1 commit

  • Pull devicetree changes from Grant Likely:
    "Here are the devicetree changes queued up for v4.1. Nothing really
    exciting here. Rob has another few commits for big-endian attached
    UARTs, but those will be sent in a separate merge request since they
    haven't been as thoroughly tested as this batch.

    Here are the highlights:

    - lots of unittest cleanup from Frank Rowand

    - bugfixes and updates to the of_graph code

    - tighten up of_get_mac_address() code

    - documentation updates"

    * tag 'devicetree-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux:
    of/unittest: Fix of_platform_depopulate test case
    of/unittest: early return from test skips tests
    of/unittest: breadcrumbs to reduce pain of future maintainers
    of/unittest: reduce checkpatch noise - line after declarations
    of/unittest: typo in error string
    of/unittest: add const where needed
    of_net: factor out repetitive code from of_get_mac_address()
    drivers/of: Add empty ranges quirk for PA-Semi
    of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST
    of: Empty node & property flag accessors when !OF
    of: Explicitly include linux/types.h in of_graph.h
    dt-bindings: brcm: rationalize Broadcom documentation naming
    of/unittest: replace 'selftest' with 'unittest'
    Documentation: rename of_selftest.txt to of_unittest.txt
    Documentation: update the of_selftest.txt
    dt: OF_UNITTEST make dependency broken
    MAINTAINERS: Pantelis Antoniou device tree overlay maintainer
    of: Add of_graph_get_port_by_id function
    of: Add for_each_endpoint_of_node helper macro
    of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint

    Linus Torvalds
     

15 Apr, 2015

1 commit

  • SoC peripherals can come in several different flavors:

    - little-endian: registers always need to be accessed in LE mode (so the
    kernel should perform a swap if the CPU is running BE)

    - big-endian: registers always need to be accessed in BE mode (so the
    kernel should perform a swap if the CPU is running LE)

    - native-endian: the bus will automatically swap accesses, so the kernel
    should never swap

    Introduce a function that checks an OF device node to see whether it
    contains a "big-endian" or "native-endian" property. For the former case,
    always return true. For the latter case, return true iff the kernel was
    built for BE (implying that the BE MMIO accessors do not perform a swap).
    Otherwise return false, assuming LE registers.

    LE registers are assumed by default because most existing drivers (libahci,
    serial8250, usb) always use readl/writel in the absence of instructions
    to the contrary, so that will be our fallback.

    Signed-off-by: Kevin Cernekee
    Reviewed-by: Peter Hurley
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Rob Herring

    Kevin Cernekee
     

28 Mar, 2015

1 commit


18 Mar, 2015

1 commit

  • I2C supports adding adapters using either a dynamic or fixed id. The
    latter is provided by aliases in the DT case. To prevent id collisions
    of those two types, install this function which gives us the highest
    fixed id, so we can then let the dynamically created ones come after
    this highest number.

    Signed-off-by: Wolfram Sang
    Acked-by: Rob Herring
    Signed-off-by: Wolfram Sang

    Wolfram Sang
     

12 Dec, 2014

2 commits

  • Pull devicetree changes from Grant Likely:
    "Lots of activity in the devicetree code for v3.18. Most of it is
    related to getting all of the overlay support code in place, but there
    are other important things in there.

    Highlights:

    - OF_RECONFIG notifiers for SPI, I2C and Platform devices. Those
    subsystems can now respond to live changes to the device tree.

    - CONFIG_OF_OVERLAY method for applying live changes to the device
    tree

    - Removal of the of_allnodes list. This used to be used to iterate
    over all the nodes in the device tree, but it is unnecessary
    because the same thing can be done by iterating over the list of
    child pointers. Getting rid of of_allnodes saves some memory and
    avoids the possibility of of_allnodes being sorted differently from
    the child lists.

    - Support for retrieving original DTB blob via sysfs. Needed by
    kexec.

    - More unittests

    - Documentation and minor bug fixes"

    * tag 'devicetree-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux: (42 commits)
    of: Delete unnecessary check before calling "of_node_put()"
    of: Drop ->next pointer from struct device_node
    spi: Check for spi_of_notifier when CONFIG_OF_DYNAMIC=y
    of: support passing console options with stdout-path
    of: add optional options parameter to of_find_node_by_path()
    of: Add bindings for chosen node, stdout-path
    of: Remove unneeded and incorrect MODULE_DEVICE_TABLE
    ARM: dt: fix up PL011 device tree bindings
    of: base, fix of_property_read_string_helper kernel-doc
    of: remove select of non-existant OF_DEVICE config symbol
    spi/of: Add OF notifier handler
    spi/of: Create new device registration method and accessors
    i2c/of: Add OF_RECONFIG notifier handler
    i2c/of: Factor out Devicetree registration code
    of/overlay: Add overlay unittests
    of/overlay: Introduce DT overlay support
    of/reconfig: Add OF_DYNAMIC notifier for platform_bus_type
    of/reconfig: Always use the same structure for notifiers
    of/reconfig: Add debug output for OF_RECONFIG notifiers
    of/reconfig: Add empty stubs for the of_reconfig methods
    ...

    Linus Torvalds
     
  • Pull fbdev updates from Tomi Valkeinen:
    - support for mx6sl and mx6sx
    - OMAP HDMI audio rewrite to make it finally work
    - OMAP video PLL work to prepare for new DRA7xx SoCs
    - simplefb DT related improvements

    * tag 'fbdev-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (81 commits)
    video: uvesafb: Deletion of an unnecessary check before the function call "platform_device_put"
    video: fbdev-VIA: Deletion of an unnecessary check before the function call "framebuffer_release"
    video: fbdev-MMP: Deletion of an unnecessary check before the function call "mmp_unregister_path"
    video: mx3fb: Deletion of an unnecessary check before the function call "backlight_device_unregister"
    video: fbdev-OMAP2: Deletion of unnecessary checks before the function call "i2c_put_adapter"
    video: fbdev-SIS: Deletion of unnecessary checks before the function call "pci_dev_put"
    video: smscufx: Deletion of unnecessary checks before the function call "vfree"
    video: udlfb: Deletion of unnecessary checks before the function call "vfree"
    video: uvesafb: Deletion of an unnecessary check before the function call "uvesafb_free"
    video: fbdev-LCDC: Deletion of an unnecessary check before the function call "vfree"
    video: fbdev: arkfb: suppress build warning
    video: fbdev: s3fb: suppress build warning
    video: fbdev: vt8623fb: suppress build warning
    OMAPDSS: hdmi5: Fix bit field for IEC958_AES2_CON_SOURCE
    OMAPDSS: hdmi: Remove __exit qualifier from hdmi_uninit_output()
    OMAPDSS: hdmi5: Change hdmi_wp idlemode to to no_idle for audio playback
    OMAPDSS: Remove all references to obsolete HDMI audio callbacks
    ASoC: omap: Remove obsolete HDMI audio code and Kconfig options
    OMAPDSS: hdmi5: Register ASoC platform device for omap hdmi audio
    OMAPDSS: hdmi5: Remove callbacks for the old ASoC DAI driver
    ...

    Linus Torvalds
     

11 Dec, 2014

1 commit

  • Pull ACPI and power management updates from Rafael Wysocki:
    "This time we have some more new material than we used to have during
    the last couple of development cycles.

    The most important part of it to me is the introduction of a unified
    interface for accessing device properties provided by platform
    firmware. It works with Device Trees and ACPI in a uniform way and
    drivers using it need not worry about where the properties come from
    as long as the platform firmware (either DT or ACPI) makes them
    available. It covers both devices and "bare" device node objects
    without struct device representation as that turns out to be necessary
    in some cases. This has been in the works for quite a few months (and
    development cycles) and has been approved by all of the relevant
    maintainers.

    On top of that, some drivers are switched over to the new interface
    (at25, leds-gpio, gpio_keys_polled) and some additional changes are
    made to the core GPIO subsystem to allow device drivers to manipulate
    GPIOs in the "canonical" way on platforms that provide GPIO
    information in their ACPI tables, but don't assign names to GPIO lines
    (in which case the driver needs to do that on the basis of what it
    knows about the device in question). That also has been approved by
    the GPIO core maintainers and the rfkill driver is now going to use
    it.

    Second is support for hardware P-states in the intel_pstate driver.
    It uses CPUID to detect whether or not the feature is supported by the
    processor in which case it will be enabled by default. However, it
    can be disabled entirely from the kernel command line if necessary.

    Next is support for a platform firmware interface based on ACPI
    operation regions used by the PMIC (Power Management Integrated
    Circuit) chips on the Intel Baytrail-T and Baytrail-T-CR platforms.
    That interface is used for manipulating power resources and for
    thermal management: sensor temperature reporting, trip point setting
    and so on.

    Also the ACPI core is now going to support the _DEP configuration
    information in a limited way. Basically, _DEP it supposed to reflect
    off-the-hierarchy dependencies between devices which may be very
    indirect, like when AML for one device accesses locations in an
    operation region handled by another device's driver (usually, the
    device depended on this way is a serial bus or GPIO controller). The
    support added this time is sufficient to make the ACPI battery driver
    work on Asus T100A, but it is general enough to be able to cover some
    other use cases in the future.

    Finally, we have a new cpufreq driver for the Loongson1B processor.

    In addition to the above, there are fixes and cleanups all over the
    place as usual and a traditional ACPICA update to a recent upstream
    release.

    As far as the fixes go, the ACPI LPSS (Low-power Subsystem) driver for
    Intel platforms should be able to handle power management of the DMA
    engine correctly, the cpufreq-dt driver should interact with the
    thermal subsystem in a better way and the ACPI backlight driver should
    handle some more corner cases, among other things.

    On top of the ACPICA update there are fixes for race conditions in the
    ACPICA's interrupt handling code which might lead to some random and
    strange looking failures on some systems.

    In the cleanups department the most visible part is the series of
    commits targeted at getting rid of the CONFIG_PM_RUNTIME configuration
    option. That was triggered by a discussion regarding the generic
    power domains code during which we realized that trying to support
    certain combinations of PM config options was painful and not really
    worth it, because nobody would use them in production anyway. For
    this reason, we decided to make CONFIG_PM_SLEEP select
    CONFIG_PM_RUNTIME and that lead to the conclusion that the latter
    became redundant and CONFIG_PM could be used instead of it. The
    material here makes that replacement in a major part of the tree, but
    there will be at least one more batch of that in the second part of
    the merge window.

    Specifics:

    - Support for retrieving device properties information from ACPI _DSD
    device configuration objects and a unified device properties
    interface for device drivers (and subsystems) on top of that. As
    stated above, this works with Device Trees and ACPI and allows
    device drivers to be written in a platform firmware (DT or ACPI)
    agnostic way. The at25, leds-gpio and gpio_keys_polled drivers are
    now going to use this new interface and the GPIO subsystem is
    additionally modified to allow device drivers to assign names to
    GPIO resources returned by ACPI _CRS objects (in case _DSD is not
    present or does not provide the expected data). The changes in
    this set are mostly from Mika Westerberg, Rafael J Wysocki, Aaron
    Lu, and Darren Hart with some fixes from others (Fabio Estevam,
    Geert Uytterhoeven).

    - Support for Hardware Managed Performance States (HWP) as described
    in Volume 3, section 14.4, of the Intel SDM in the intel_pstate
    driver. CPUID is used to detect whether or not the feature is
    supported by the processor. If supported, it will be enabled
    automatically unless the intel_pstate=no_hwp switch is present in
    the kernel command line. From Dirk Brandewie.

    - New Intel Broadwell-H ID for intel_pstate (Dirk Brandewie).

    - Support for firmware interface based on ACPI operation regions used
    by the PMIC chips on the Intel Baytrail-T and Baytrail-T-CR
    platforms for power resource control and thermal management (Aaron
    Lu).

    - Limited support for retrieving off-the-hierarchy dependencies
    between devices from ACPI _DEP device configuration objects and
    deferred probing support for the ACPI battery driver based on the
    _DEP information to make that driver work on Asus T100A (Lan
    Tianyu).

    - New cpufreq driver for the Loongson1B processor (Kelvin Cheung).

    - ACPICA update to upstream revision 20141107 which only affects
    tools (Bob Moore).

    - Fixes for race conditions in the ACPICA's interrupt handling code
    and in the ACPI code related to system suspend and resume (Lv Zheng
    and Rafael J Wysocki).

    - ACPI core fix for an RCU-related issue in the ioremap() regions
    management code that slowed down significantly after CPUs had been
    allowed to enter idle states even if they'd had RCU callbakcs
    queued and triggered some problems in certain proprietary graphics
    driver (and elsewhere). The fix replaces synchronize_rcu() in that
    code with synchronize_rcu_expedited() which makes the issue go
    away. From Konstantin Khlebnikov.

    - ACPI LPSS (Low-Power Subsystem) driver fix to handle power
    management of the DMA engine included into the LPSS correctly. The
    problem is that the DMA engine doesn't have ACPI PM support of its
    own and it simply is turned off when the last LPSS device having
    ACPI PM support goes into D3cold. To work around that, the PM
    domain used by the ACPI LPSS driver is redesigned so at least one
    device with ACPI PM support will be on as long as the DMA engine is
    in use. From Andy Shevchenko.

    - ACPI backlight driver fix to avoid using it on "Win8-compatible"
    systems where it doesn't work and where it was used by default by
    mistake (Aaron Lu).

    - Assorted minor ACPI core fixes and cleanups from Tomasz Nowicki,
    Sudeep Holla, Huang Rui, Hanjun Guo, Fabian Frederick, and Ashwin
    Chaugule (mostly related to the upcoming ARM64 support).

    - Intel RAPL (Running Average Power Limit) power capping driver fixes
    and improvements including new processor IDs (Jacob Pan).

    - Generic power domains modification to power up domains after
    attaching devices to them to meet the expectations of device
    drivers and bus types assuming devices to be accessible at probe
    time (Ulf Hansson).

    - Preliminary support for controlling device clocks from the generic
    power domains core code and modifications of the ARM/shmobile
    platform to use that feature (Ulf Hansson).

    - Assorted minor fixes and cleanups of the generic power domains core
    code (Ulf Hansson, Geert Uytterhoeven).

    - Assorted minor fixes and cleanups of the device clocks control code
    in the PM core (Geert Uytterhoeven, Grygorii Strashko).

    - Consolidation of device power management Kconfig options by making
    CONFIG_PM_SLEEP select CONFIG_PM_RUNTIME and removing the latter
    which is now redundant (Rafael J Wysocki and Kevin Hilman). That
    is the first batch of the changes needed for this purpose.

    - Core device runtime power management support code cleanup related
    to the execution of callbacks (Andrzej Hajda).

    - cpuidle ARM support improvements (Lorenzo Pieralisi).

    - cpuidle cleanup related to the CPUIDLE_FLAG_TIME_VALID flag and a
    new MAINTAINERS entry for ARM Exynos cpuidle (Daniel Lezcano and
    Bartlomiej Zolnierkiewicz).

    - New cpufreq driver callback (->ready) to be executed when the
    cpufreq core is ready to use a given policy object and cpufreq-dt
    driver modification to use that callback for cooling device
    registration (Viresh Kumar).

    - cpufreq core fixes and cleanups (Viresh Kumar, Vince Hsu, James
    Geboski, Tomeu Vizoso).

    - Assorted fixes and cleanups in the cpufreq-pcc, intel_pstate,
    cpufreq-dt, pxa2xx cpufreq drivers (Lenny Szubowicz, Ethan Zhao,
    Stefan Wahren, Petr Cvek).

    - OPP (Operating Performance Points) framework modification to allow
    OPPs to be removed too and update of a few cpufreq drivers
    (cpufreq-dt, exynos5440, imx6q, cpufreq) to remove OPPs (added
    during initialization) on driver removal (Viresh Kumar).

    - Hibernation core fixes and cleanups (Tina Ruchandani and Markus
    Elfring).

    - PM Kconfig fix related to CPU power management (Pankaj Dubey).

    - cpupower tool fix (Prarit Bhargava)"

    * tag 'pm+acpi-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (120 commits)
    i2c-omap / PM: Drop CONFIG_PM_RUNTIME from i2c-omap.c
    dmaengine / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    tools: cpupower: fix return checks for sysfs_get_idlestate_count()
    drivers: sh / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    e1000e / igb / PM: Eliminate CONFIG_PM_RUNTIME
    MMC / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    MFD / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    misc / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    media / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    input / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    leds: leds-gpio: Fix multiple instances registration without 'label' property
    iio / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    hsi / OMAP / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    i2c-hid / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    drm / exynos / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    gpio / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    hwrandom / exynos / PM: Use CONFIG_PM in #ifdef
    block / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
    USB / PM: Drop CONFIG_PM_RUNTIME from the USB core
    PM: Merge the SET*_RUNTIME_PM_OPS() macros
    ...

    Linus Torvalds
     

05 Dec, 2014

1 commit


04 Dec, 2014

2 commits

  • The ->next pointer in struct device_node is a hanger-on from when it was
    used to iterate over the whole tree by a particular device_type property
    value. Those days are long over, but the fdt unflattening code still
    uses it to put nodes in the unflattened tree into the same order as node
    in the flat tree. By reworking the unflattening code to reverse the list
    after unflattening all the children of a node, the pointer can be
    dropped which gives a small amount of memory savings.

    Signed-off-by: Grant Likely
    Acked-by: Frank Rowand
    Cc: Gaurav Minocha

    Grant Likely
     
  • Update of_find_node_by_path():
    1) Rename function to of_find_node_opts_by_path(), adding an optional
    pointer argument. Provide a static inline wrapper version of
    of_find_node_by_path() which calls the new function with NULL as
    the optional argument.
    2) Ignore any part of the path beyond and including the ':' separator.
    3) Set the new provided pointer argument to the beginning of the string
    following the ':' separator.
    4: Add tests.

    Signed-off-by: Leif Lindholm
    Signed-off-by: Grant Likely

    Leif Lindholm
     

02 Dec, 2014

1 commit

  • It reverts commit a4b4e0461ec5 ("of: Add standard property for poweroff capability").
    As discussed on the mailing list, it makes more sense to rename back to the
    old established property name, without the vendor prefix. Problem being that
    the word "source" usually tends to be used for inputs and that is out of control
    of the OS. The poweroff capability is an output which simply turns the
    system-power off. Also, this property might be used by drivers which power-off
    the system and power back on subsequent RTC alarms. This seems to suggest to
    remove "poweroff" from the property name and to choose "system-power-controller"
    as the more generic name. This patchs adds the required renaming changes and
    defines an helper function which checks if this property is set.

    Signed-off-by: Romain Perier
    Acked-by: Grant Likely
    Acked-by: Johan Hovold
    Signed-off-by: Mark Brown

    Romain Perier
     

25 Nov, 2014

4 commits

  • Overlays are a method to dynamically modify part of the kernel's
    device tree with dynamically loaded data. Add the core functionality to
    parse, apply and remove an overlay changeset. The core functionality
    takes care of managing the overlay data format and performing the add
    and remove. Drivers are expected to use the overlay functionality to
    support custom expansion busses commonly found on consumer development
    boards like the BeagleBone or Raspberry Pi.

    The overlay code uses CONFIG_OF_DYNAMIC changesets to perform the low
    level work of modifying the devicetree.

    Documentation about internal and APIs is provided in
    Documentation/devicetree/overlay-notes.txt

    v2:
    - Switch from __of_node_alloc() to __of_node_dup()
    - Documentation fixups
    - Remove 2-pass processing of properties
    - Remove separate ov_lock; just use the DT mutex.
    v1:
    - Drop delete capability using '-' prefix. The '-' prefixed names
    are valid properties and nodes and there is no need for it just yet.
    - Do not update special properties - name & phandle ones.
    - Change order of node attachment, so that the special property update
    works.

    Signed-off-by: Pantelis Antoniou
    Signed-off-by: Grant Likely

    Pantelis Antoniou
     
  • The OF_RECONFIG notifier callback uses a different structure depending
    on whether it is a node change or a property change. This is silly, and
    not very safe. Rework the code to use the same data structure regardless
    of the type of notifier.

    Signed-off-by: Grant Likely
    Cc: Benjamin Herrenschmidt
    Cc: Rob Herring
    Cc: Pantelis Antoniou
    Cc:

    Grant Likely
     
  • To simplify subsystem setup code, make empty stubs for the
    of_reconfig_*() methods. This is particularly useful for registering and
    unregistering the notifiers so that it doesn't impact the flow of the
    subsystem setup code.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • Introduce of_reconfig_get_state_change() which allows an of notifier
    to query about device state changes.

    Signed-off-by: Pantelis Antoniou
    Signed-off-by: Grant Likely

    Pantelis Antoniou
     

19 Nov, 2014

1 commit


14 Nov, 2014

1 commit

  • Keep the extern declaration of of_allnodes and friends, when building without
    of support, this way code using them can be written like this:

    if (IS_ENABLED(CONFIG_OF_PLATFORM) && of_chosen) {
    for_each_child_of_node(of_chosen, np)
    ...
    }

    And rely on the compiler optimizing it away, avoiding the need for #ifdef-ery.

    Signed-off-by: Hans de Goede
    Signed-off-by: Tomi Valkeinen

    Hans de Goede
     

05 Nov, 2014

3 commits

  • Add new generic routines are provided for retrieving properties from
    device description objects in the platform firmware in case there are
    no struct device objects for them (either those objects have not been
    created yet or they do not exist at all).

    The following functions are provided:

    fwnode_property_present()
    fwnode_property_read_u8()
    fwnode_property_read_u16()
    fwnode_property_read_u32()
    fwnode_property_read_u64()
    fwnode_property_read_string()
    fwnode_property_read_u8_array()
    fwnode_property_read_u16_array()
    fwnode_property_read_u32_array()
    fwnode_property_read_u64_array()
    fwnode_property_read_string_array()

    in analogy with the corresponding functions for struct device added
    previously. For all of them, the first argument is a pointer to struct
    fwnode_handle (new type) that allows a device description object
    (depending on what platform firmware interface is in use) to be
    obtained.

    Add a new macro device_for_each_child_node() for iterating over the
    children of the device description object associated with a given
    device and a new function device_get_child_node_count() returning the
    number of a given device's child nodes.

    The interface covers both ACPI and Device Trees.

    Suggested-by: Grant Likely
    Acked-by: Greg Kroah-Hartman
    Acked-by: Grant Likely
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Add a uniform interface by which device drivers can request device
    properties from the platform firmware by providing a property name
    and the corresponding data type. The purpose of it is to help to
    write portable code that won't depend on any particular platform
    firmware interface.

    The following general helper functions are added:

    device_property_present()
    device_property_read_u8()
    device_property_read_u16()
    device_property_read_u32()
    device_property_read_u64()
    device_property_read_string()
    device_property_read_u8_array()
    device_property_read_u16_array()
    device_property_read_u32_array()
    device_property_read_u64_array()
    device_property_read_string_array()

    The first one allows the caller to check if the given property is
    present. The next 5 of them allow single-valued properties of
    various types to be retrieved in a uniform way. The remaining 5 are
    for reading properties with multiple values (arrays of either numbers
    or strings).

    The interface covers both ACPI and Device Trees.

    This change set includes material from Mika Westerberg and Aaron Lu.

    Signed-off-by: Aaron Lu
    Signed-off-by: Mika Westerberg
    Acked-by: Greg Kroah-Hartman
    Acked-by: Grant Likely
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Signed-off-by: Thierry Reding
    Signed-off-by: Grant Likely

    Thierry Reding
     

04 Nov, 2014

3 commits

  • The device tree structure is composed of two lists; the 'allnodes' list
    which is a singly linked list containing every node in the tree, and the
    child->parent structure where each parent node has a singly linked list
    of children. All of the data in the allnodes list can be easily
    reproduced with the parent-child lists, so of_allnodes is actually
    unnecessary. Remove it entirely which saves a bit of memory and
    simplifies the data structure quite a lot.

    Signed-off-by: Grant Likely
    Cc: Rob Herring
    Cc: Gaurav Minocha
    Cc: Pantelis Antoniou

    Grant Likely
     
  • Introduce signed 32bit integer of_property_read method.

    Signed-off-by: Sebastian Reichel
    Signed-off-by: Grant Likely

    Sebastian Reichel
     
  • The string property read helpers will run off the end of the buffer if
    it is handed a malformed string property. Rework the parsers to make
    sure that doesn't happen. At the same time add new test cases to make
    sure the functions behave themselves.

    The original implementations of of_property_read_string_index() and
    of_property_count_strings() both open-coded the same block of parsing
    code, each with it's own subtly different bugs. The fix here merges
    functions into a single helper and makes the original functions static
    inline wrappers around the helper.

    One non-bugfix aspect of this patch is the addition of a new wrapper,
    of_property_read_string_array(). The new wrapper is needed by the
    device_properties feature that Rafael is working on and planning to
    merge for v3.19. The implementation is identical both with and without
    the new static inline wrapper, so it just got left in to reduce the
    churn on the header file.

    Signed-off-by: Grant Likely
    Cc: Rafael J. Wysocki
    Cc: Mika Westerberg
    Cc: Rob Herring
    Cc: Arnd Bergmann
    Cc: Darren Hart
    Cc: # v3.3+: Drop selftest hunks that don't apply

    Grant Likely
     

22 Oct, 2014

1 commit

  • Several drivers create their own devicetree property when they register
    poweroff capabilities. This is for example the case for mfd, regulator
    or power drivers which define "vendor,system-power-controller" property.
    This patch adds support for a standard property "poweroff-source"
    which marks the device as able to shutdown the system.

    Signed-off-by: Romain Perier
    Acked-by: Grant Likely
    Signed-off-by: Mark Brown

    Romain Perier
     

05 Oct, 2014

1 commit

  • Introduce support for dynamic device tree resolution.
    Using it, it is possible to prepare a device tree that's
    been loaded on runtime to be modified and inserted at the kernel
    live tree.

    Export of of_resolve and bug fix of double free by
    Guenter Roeck

    Signed-off-by: Pantelis Antoniou
    [grant.likely: Don't need to select CONFIG_OF_DYNAMIC and CONFIG_OF_DEVICE]
    [grant.likely: Don't need to depend on OF or !SPARC]
    [grant.likely: Factor out duplicate code blocks into single function]
    Signed-off-by: Grant Likely

    Pantelis Antoniou
     

11 Aug, 2014

1 commit


24 Jul, 2014

3 commits

  • Introducing DT transactional support.

    A DT transaction is a method which allows one to apply changes
    in the live tree, in such a way that either the full set of changes
    take effect, or the state of the tree can be rolled-back to the
    state it was before it was attempted. An applied transaction
    can be rolled-back at any time.

    Documentation is in
    Documentation/devicetree/changesets.txt

    Signed-off-by: Pantelis Antoniou
    [glikely: Removed device notifiers and reworked to be more consistent]
    Signed-off-by: Grant Likely

    Pantelis Antoniou
     
  • Currently, devicetree reconfig notifiers get emitted before the change
    is applied to the tree, but that behaviour is problematic if the
    receiver wants the determine the new state of the tree. The current
    users don't care, but the changeset code to follow will be making
    multiple changes at once. Reorder notifiers to get emitted after the
    change has been applied to the tree so that callbacks see the new tree
    state.

    At the same time, fixup the existing callbacks to expect the new order.
    There are a few callbacks that compare the old and new values of a
    changed property. Put both property pointers into the of_prop_reconfig
    structure.

    The current notifiers also allow the notifier callback to fail and
    cancel the change to the tree, but that feature isn't actually used.
    It really isn't valid to ignore a tree modification provided by firmware
    anyway, so remove the ability to cancel a change to the tree.

    Signed-off-by: Grant Likely
    Cc: Nathan Fontenot

    Grant Likely
     
  • All of the DT modification functions are split into two parts, the first
    part manipulates the DT data structure, and the second part updates
    sysfs, but the code isn't very consistent about how the second half is
    called. They don't all enforce the same rules about when it is valid to
    update sysfs, and there isn't any clarity on locking.

    The transactional DT modification feature that is coming also needs
    access to these functions so that it can perform all the structure
    changes together, and then all the sysfs updates as a second stage
    instead of doing each one at a time.

    Fix up the second have by creating a separate __of_*_sysfs() function
    for each of the helpers. The new functions have consistent naming (ie.
    of_node_add() becomes __of_attach_node_sysfs()) and all of them now
    defer if of_init hasn't been called yet.

    Callers of the new functions must hold the of_mutex to ensure there are
    no race conditions with of_init(). The mutex ensures that there will
    only ever be one writer to the tree at any given time. There can still
    be any number of readers and the raw_spin_lock is still used to make
    sure access to the data structure is still consistent.

    Finally, put the function prototypes into of_private.h so they are
    accessible to the transaction code.

    Signed-off-by: Pantelis Antoniou
    [grant.likely: Changed suffix from _post to _sysfs to match existing code]
    [grant.likely: Reorganized to eliminate trivial wrappers]
    Signed-off-by: Grant Likely

    Grant Likely