From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 00/19] dm: core: Fully separate ofdata_to_platdata() from probe()
Date: Sun, 29 Dec 2019 21:19:09 -0700 [thread overview]
Message-ID: <20191230041928.74874-1-sjg@chromium.org> (raw)
At present ofdata_to_platdata() is done as part of device_probe(). Drivers
are supposed to read their platdata in the ofdata_to_platdata method() but
this requirement is not always followed.
Having these methods separate helps deal with of-platdata, where the
probe() method is common to both DT/of-platdata operation, but the
ofdata_to_platdata() method is implemented differently.
Another case has come up where this separate is useful. Generation of ACPI
tables uses the of-platdata but does not want to probe the device. Probing
would cause U-Boot to violate one of its design principles, viz that it
should only probe devices that are used. For ACPI we want to generate a
table for each device, even if U-Boot does not use it. In fact it may not
even be possible to probe the device - e.g. an SD card which is not
present will cause an error on probe, yet we still must tell Linux about
the SD card connector in case it is used while Linux is running.
This series splits out the ofdata_to_platdata() part of device_probe() so
that it can be used separately from device_probe(). Thus devices now go
through two distinct states when probing: reading platform data and
actually touching the hardware to bring the device up.
This should not break existing boards since the operations still happen in
mostly the same order. The main change is that parents and uclasses are
probed after ofdata_to_platdata() is called.
HOWEVER it is quite possible that some boards break the rules and due to
a series of unfortunate events, something will break. Two boards were
found in this category already. SO this series may require some tidying up
from board maintainers, if problems arise.
Note that there are cases where devices must be probed in the
ofdata_to_platdata() method. An example is where a GPIO is selected - this
obviously requires that the GPIO device is probed.
One board was found to burst its size limit with this series, despite the
very small size increase. The patches to remove use of BUG_ON() are to
ensure that this series passes tests.
Simon Glass (19):
common: Add a noisy assert()
dm: core: Use assert_noisy() in devres
usb: Drop use of BUG_ON() and WARN_ON()
x86: apl: Avoid accessing the PCI bus before it is probed
pci: Print a warning if the bus is accessed before probing
aspeed: ast2500: Read clock ofdata in the correct method
dm: core: Don't clear active flag twice when probe() fails
dm: core: Move ofdata_to_platdata() call earlier
dm: core: Allocate parent data separate from probing parent
dm: core: Add a comment for DM_FLAG_OF_PLATDATA
dm: core: Export a new function to read platdata
dm: core: Add a new flag to track platform data
dm: devres: Create a new devres header file
test: Add functions to find the amount of allocated memory
dm: devres: Convert to use logging
dm: test: Add a test driver for devres
dm: devres: Add tests
dm: devres: Use an enum for the allocation phase
dm: devres: Add a new OFDATA phase
arch/sandbox/dts/test.dts | 4 +
arch/x86/cpu/apollolake/p2sb.c | 20 +-
arch/x86/cpu/apollolake/pmc.c | 20 +-
drivers/clk/aspeed/clk_ast2500.c | 4 +-
drivers/core/device-remove.c | 1 +
drivers/core/device.c | 56 +++--
drivers/core/devres.c | 57 ++++-
drivers/pci/pci-uclass.c | 13 ++
drivers/usb/gadget/composite.c | 4 +
drivers/usb/gadget/f_mass_storage.c | 4 +
drivers/usb/musb-new/musb_core.c | 4 +
drivers/usb/musb-new/musb_gadget_ep0.c | 2 +-
include/dm/device-internal.h | 16 ++
include/dm/device.h | 259 +---------------------
include/dm/devres.h | 289 +++++++++++++++++++++++++
include/dm/uclass-id.h | 1 +
include/log.h | 15 ++
include/test/test.h | 10 +
include/test/ut.h | 16 ++
test/dm/Makefile | 1 +
test/dm/devres.c | 186 ++++++++++++++++
test/dm/test-fdt.c | 58 +++++
test/ut.c | 14 ++
23 files changed, 760 insertions(+), 294 deletions(-)
create mode 100644 include/dm/devres.h
create mode 100644 test/dm/devres.c
--
2.24.1.735.g03f4e72817-goog
next reply other threads:[~2019-12-30 4:19 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-30 4:19 Simon Glass [this message]
2019-12-30 4:19 ` [PATCH 01/19] common: Add a noisy assert() Simon Glass
2019-12-30 4:19 ` [PATCH 02/19] dm: core: Use assert_noisy() in devres Simon Glass
2019-12-30 4:19 ` [PATCH 03/19] usb: Drop use of BUG_ON() and WARN_ON() Simon Glass
2019-12-30 4:19 ` [PATCH 04/19] x86: apl: Avoid accessing the PCI bus before it is probed Simon Glass
2019-12-30 4:19 ` [PATCH 05/19] pci: Print a warning if the bus is accessed before probing Simon Glass
2019-12-30 4:19 ` [PATCH 06/19] aspeed: ast2500: Read clock ofdata in the correct method Simon Glass
2020-01-07 8:20 ` Cédric Le Goater
2020-01-09 20:04 ` Simon Glass
2020-01-10 8:57 ` sjg at google.com
2019-12-30 4:19 ` [PATCH 07/19] dm: core: Don't clear active flag twice when probe() fails Simon Glass
2019-12-30 4:19 ` [PATCH 08/19] dm: core: Move ofdata_to_platdata() call earlier Simon Glass
2019-12-30 4:19 ` [PATCH 09/19] dm: core: Allocate parent data separate from probing parent Simon Glass
2019-12-30 4:19 ` [PATCH 10/19] dm: core: Add a comment for DM_FLAG_OF_PLATDATA Simon Glass
2019-12-30 4:19 ` [PATCH 11/19] dm: core: Export a new function to read platdata Simon Glass
2019-12-30 4:19 ` [PATCH 12/19] dm: core: Add a new flag to track platform data Simon Glass
2019-12-30 4:19 ` [PATCH 13/19] dm: devres: Create a new devres header file Simon Glass
2019-12-30 4:19 ` [PATCH 14/19] test: Add functions to find the amount of allocated memory Simon Glass
2019-12-30 4:19 ` [PATCH 15/19] dm: devres: Convert to use logging Simon Glass
2019-12-30 4:19 ` [PATCH 16/19] dm: test: Add a test driver for devres Simon Glass
2019-12-30 4:19 ` [PATCH 17/19] dm: devres: Add tests Simon Glass
2019-12-30 4:19 ` [PATCH 18/19] dm: devres: Use an enum for the allocation phase Simon Glass
2019-12-30 4:19 ` [PATCH 19/19] dm: devres: Add a new OFDATA phase Simon Glass
2020-01-10 8:57 ` [PATCH 18/19] dm: devres: Use an enum for the allocation phase sjg at google.com
2020-01-10 8:57 ` [PATCH 19/19] dm: devres: Add a new OFDATA phase sjg at google.com
2020-01-10 8:57 ` [PATCH 17/19] dm: devres: Add tests sjg at google.com
2020-01-10 8:57 ` [PATCH 16/19] dm: test: Add a test driver for devres sjg at google.com
2020-01-10 8:57 ` [PATCH 14/19] test: Add functions to find the amount of allocated memory sjg at google.com
2020-01-10 8:57 ` [PATCH 15/19] dm: devres: Convert to use logging sjg at google.com
2020-01-10 8:57 ` [PATCH 13/19] dm: devres: Create a new devres header file sjg at google.com
2020-01-10 8:57 ` [PATCH 12/19] dm: core: Add a new flag to track platform data sjg at google.com
2020-01-10 8:57 ` [PATCH 11/19] dm: core: Export a new function to read platdata sjg at google.com
2020-01-10 8:57 ` [PATCH 10/19] dm: core: Add a comment for DM_FLAG_OF_PLATDATA sjg at google.com
2020-01-10 8:57 ` [PATCH 09/19] dm: core: Allocate parent data separate from probing parent sjg at google.com
2020-01-10 8:57 ` [PATCH 08/19] dm: core: Move ofdata_to_platdata() call earlier sjg at google.com
2020-01-10 8:57 ` [PATCH 07/19] dm: core: Don't clear active flag twice when probe() fails sjg at google.com
2020-01-10 8:57 ` [PATCH 05/19] pci: Print a warning if the bus is accessed before probing sjg at google.com
2020-01-10 8:57 ` [PATCH 04/19] x86: apl: Avoid accessing the PCI bus before it is probed sjg at google.com
2020-01-10 8:57 ` [PATCH 03/19] usb: Drop use of BUG_ON() and WARN_ON() sjg at google.com
2020-01-10 8:57 ` [PATCH 02/19] dm: core: Use assert_noisy() in devres sjg at google.com
2020-01-10 8:57 ` [PATCH 01/19] common: Add a noisy assert() sjg at google.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191230041928.74874-1-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.