All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/26] dm: Add additional bus functionality
@ 2015-01-25 15:26 Simon Glass
  2015-01-25 15:26 ` [U-Boot] [PATCH v3 01/26] dm: i2c: Provide an offset length parameter where needed Simon Glass
                   ` (26 more replies)
  0 siblings, 27 replies; 61+ messages in thread
From: Simon Glass @ 2015-01-25 15:26 UTC (permalink / raw)
  To: u-boot

The current bus implementation is simple but leaves some things to drivers
which are better handled in the uclass.

At present uclasses cannot provide a common way of dealing with children
(i.e. devices on the bus), so we have duplication in the drivers. The same
code is repeated in each driver when it would be better to put it in the
uclass.

Secondly, we don't have the concept of per-child platform data for devices
on the bus. Instead the per-child data can only exist when the child is
actually probed. This is not really suitable. Examples of things we want to
know before a child is probed are:

   - chip address (for I2C)
   - chip select (for SPI)
   - device address (for PCI)

These things are static and do not change when the device is probed and
removed. In some cases (such as SPI mode and maximum speed), the data may
be copied to run-time data when the device is probed. It may then be changed
while the driver is active, but the original platform data is never changed
by drivers once it is set up.

To address these issues, additional functions are added:

- per-child platform data, which can be defined by the uclass and (if
necessary) overriden by the bus driver. This allows the bus's uclass to
provide some consistency here
- per-child post-bind and pre-probe methods in the uclass. These allow the
bus uclass to set up the per-child platform data, and also to do any
last-minute adjustments before the child is probed.

With these changes, some code can be removed from the existing I2C and SPI
drivers and this has been done as part of this series.

With this series I2C and SPI are tested on:
- jetson-tk1 (Tegra 124)
- beaver (Tegra 30)
- seaboard (Tegra 20, I2C only)
- trimslice (Tegra 20, SPI only)
- snow (Exynos 5250)
- pit (Exynos 5420, note I2C probe is previously broken)
- link (x86)
- sandbox

Note: Some of these changes were previously included in the DM PCI RFC. This
series is available at u-boot-dm/i2c-working.

Changes in v3:
- Add missing 'static' to two functions
- Change variable name from parent_drv to uc_drv
- Fix comment to say 'node references' instead of 'phandles'
- Fix stale comment in device_probe_child()
- Fix typo in commit subject
- Remove unnecessary check that dev->parent_platdata is NULL
- Remove unnecessary per_child_auto_alloc_size value

Changes in v2:
- Add a TODO to remove struct dm_spi_bus
- Add additional comments to spi.h
- Add new patch to provide an offset length parameter where needed
- Add patches to tidy up cros_ec using new I2C/SPI features
- Copy max_hz and mode from platdata to spi_slave when probing
- Drop RFC prefix since this series has been properly tested now
- Tidy up soft_spi driver also
- Update commit message to describe immuatable platform data
- Update the spi-howto docs

Simon Glass (26):
  dm: i2c: Provide an offset length parameter where needed
  dm: Don't run tests if U-Boot cannot be built
  dm: core: Improve comments for uclass_first/next_device()
  dm: core: Set device tree node for root device
  dm: core: Tidy up error handling in device_bind()
  dm: core: Allocate platform data when binding a device
  dm: core: Allow parents to have platform data for their children
  dm: core: Allow uclasses to specify platdata for a device's children
  dm: core: Add a post_bind method for parents
  dm: core: Add a function to get a device's uclass ID
  dm: core: Add a flag to control sequence numbering
  dm: core: Allow uclasses to specify private data for a device's
    children
  dm: spi: Move the per-child data size to the uclass
  dm: core: Allow the uclass to set up a device's child after binding
  dm: sandbox: sf: Tidy up the error handling in sandbox_sf_probe()
  dm: core: Allow uclass to set up a device's child before it is probed
  dm: spi: Set up the spi_slave device pointer in child_pre_probe()
  dm: spi: Move slave details to child platdata
  dm: i2c: Move slave details to child platdata
  dm: tegra: Drop unused COMPAT features for I2C, SPI
  dm: exynos: Drop unused COMPAT features for SPI
  dm: core: Ignore disabled devices when binding
  dm: cros_ec: Don't require protocol 3 support
  dm: cros_ec: Move cros_ec_i2c over to driver model
  dm: cros_ec_spi: Remove old pre-driver-model code
  dm: Update documentation for new bus features

 arch/arm/cpu/tegra20-common/pmu.c         |   2 +-
 board/avionic-design/common/tamonten-ng.c |   2 +-
 board/nvidia/cardhu/cardhu.c              |   4 +-
 board/nvidia/dalmore/dalmore.c            |   4 +-
 board/nvidia/whistler/whistler.c          |   4 +-
 board/toradex/apalis_t30/apalis_t30.c     |   2 +-
 common/cmd_i2c.c                          |   2 +-
 doc/driver-model/README.txt               |  91 +++++------
 doc/driver-model/spi-howto.txt            |  40 ++++-
 drivers/core/device-remove.c              |  16 +-
 drivers/core/device.c                     | 121 +++++++++++----
 drivers/core/root.c                       |   8 +
 drivers/core/uclass.c                     |  34 +++-
 drivers/i2c/i2c-uclass-compat.c           |   2 +-
 drivers/i2c/i2c-uclass.c                  |  69 +++++----
 drivers/i2c/i2c-uniphier-f.c              |  12 --
 drivers/i2c/i2c-uniphier.c                |  12 --
 drivers/i2c/s3c24x0_i2c.c                 |  12 --
 drivers/i2c/sandbox_i2c.c                 |  30 +---
 drivers/i2c/tegra_i2c.c                   |  18 ---
 drivers/misc/cros_ec.c                    |  10 +-
 drivers/misc/cros_ec_i2c.c                | 107 +++++--------
 drivers/misc/cros_ec_spi.c                |  70 +--------
 drivers/mtd/spi/sandbox.c                 |  12 +-
 drivers/mtd/spi/sf_probe.c                |   3 +-
 drivers/power/as3722.c                    |   2 +-
 drivers/serial/serial-uclass.c            |   1 +
 drivers/spi/cadence_qspi.c                |   1 -
 drivers/spi/designware_spi.c              |   1 -
 drivers/spi/exynos_spi.c                  |   1 -
 drivers/spi/sandbox_spi.c                 |   1 -
 drivers/spi/soft_spi.c                    |  10 --
 drivers/spi/spi-uclass.c                  |  95 ++++++++----
 drivers/spi/tegra114_spi.c                |   1 -
 drivers/spi/tegra20_sflash.c              |   1 -
 drivers/spi/tegra20_slink.c               |   1 -
 include/configs/snow.h                    |   5 +
 include/dm/device.h                       |  29 ++++
 include/dm/test.h                         |   3 +
 include/dm/uclass-internal.h              |  11 ++
 include/dm/uclass.h                       |  21 +++
 include/fdtdec.h                          |   7 -
 include/i2c.h                             |  12 +-
 include/spi.h                             |  42 +++--
 lib/fdtdec.c                              |   7 -
 test/dm/bus.c                             | 250 +++++++++++++++++++++++++++++-
 test/dm/core.c                            |  11 ++
 test/dm/i2c.c                             |  10 +-
 test/dm/spi.c                             |   6 +-
 test/dm/test-dm.sh                        |   9 +-
 test/dm/test-fdt.c                        |  20 ++-
 test/dm/test.dts                          |  16 ++
 52 files changed, 813 insertions(+), 448 deletions(-)

-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2015-01-27  0:17 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-25 15:26 [U-Boot] [PATCH v3 0/26] dm: Add additional bus functionality Simon Glass
2015-01-25 15:26 ` [U-Boot] [PATCH v3 01/26] dm: i2c: Provide an offset length parameter where needed Simon Glass
2015-01-26 20:09   ` Simon Glass
2015-01-25 15:26 ` [U-Boot] [PATCH v3 02/26] dm: Don't run tests if U-Boot cannot be built Simon Glass
2015-01-26 20:09   ` Simon Glass
2015-01-25 15:26 ` [U-Boot] [PATCH v3 03/26] dm: core: Improve comments for uclass_first/next_device() Simon Glass
2015-01-26 20:09   ` Simon Glass
2015-01-25 15:26 ` [U-Boot] [PATCH v3 04/26] dm: core: Set device tree node for root device Simon Glass
2015-01-26 20:09   ` Simon Glass
2015-01-25 15:26 ` [U-Boot] [PATCH v3 05/26] dm: core: Tidy up error handling in device_bind() Simon Glass
2015-01-26 20:09   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 06/26] dm: core: Allocate platform data when binding a device Simon Glass
2015-01-26  1:57   ` Masahiro Yamada
2015-01-26 20:09     ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 07/26] dm: core: Allow parents to have platform data for their children Simon Glass
2015-01-26  1:56   ` Masahiro Yamada
2015-01-26 20:10     ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 08/26] dm: core: Allow uclasses to specify platdata for a device's children Simon Glass
2015-01-26 20:10   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 09/26] dm: core: Add a post_bind method for parents Simon Glass
2015-01-26 20:10   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 10/26] dm: core: Add a function to get a device's uclass ID Simon Glass
2015-01-26  1:58   ` Masahiro Yamada
2015-01-26 20:10     ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 11/26] dm: core: Add a flag to control sequence numbering Simon Glass
2015-01-26 20:10   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 12/26] dm: core: Allow uclasses to specify private data for a device's children Simon Glass
2015-01-26  2:00   ` Masahiro Yamada
2015-01-26 20:11     ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 13/26] dm: spi: Move the per-child data size to the uclass Simon Glass
2015-01-26 20:11   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 14/26] dm: core: Allow the uclass to set up a device's child after binding Simon Glass
2015-01-26 20:12   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 15/26] dm: sandbox: sf: Tidy up the error handling in sandbox_sf_probe() Simon Glass
2015-01-26 20:12   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 16/26] dm: core: Allow uclass to set up a device's child before it is probed Simon Glass
2015-01-26 20:13   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 17/26] dm: spi: Set up the spi_slave device pointer in child_pre_probe() Simon Glass
2015-01-26 20:13   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 18/26] dm: spi: Move slave details to child platdata Simon Glass
2015-01-26 20:13   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 19/26] dm: i2c: " Simon Glass
2015-01-26  2:05   ` Masahiro Yamada
2015-01-26 20:13     ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 20/26] dm: tegra: Drop unused COMPAT features for I2C, SPI Simon Glass
2015-01-26 20:13   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 21/26] dm: exynos: Drop unused COMPAT features for SPI Simon Glass
2015-01-26  6:53   ` Minkyu Kang
2015-01-26 20:13     ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 22/26] dm: core: Ignore disabled devices when binding Simon Glass
2015-01-26 20:14   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 23/26] dm: cros_ec: Don't require protocol 3 support Simon Glass
2015-01-26 20:14   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 24/26] dm: cros_ec: Move cros_ec_i2c over to driver model Simon Glass
2015-01-26 20:14   ` Simon Glass
2015-01-27  0:17     ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 25/26] dm: cros_ec_spi: Remove old pre-driver-model code Simon Glass
2015-01-26 20:14   ` Simon Glass
2015-01-25 15:27 ` [U-Boot] [PATCH v3 26/26] dm: Update documentation for new bus features Simon Glass
2015-01-26 20:14   ` Simon Glass
2015-01-26  2:08 ` [U-Boot] [PATCH v3 0/26] dm: Add additional bus functionality Masahiro Yamada

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.