[U-Boot] [PATCH 00/20] dm: rtc: Add driver model support for real-time clocks

Simon Glass sjg at chromium.org
Mon Apr 20 20:37:11 CEST 2015


When driver model is used for I2C, the real-time clock functionality does
not work (e.g. the 'date' command gives build errors when CONFIG_DM_I2C is
defined). It is possible to work around this by using driver model I2C
functions. But what is really needed is an RTC uclass.

This series:
- renames some RTC functions to have an rtc_ prefix
- adds sandbox support for RTC and an emulated I2C RTC device
- adds a driver model RTC uclass and associated tests
- corrects various minor driver model I2C issues that were discovered

With this it should be fairly easy to convert an existing RTC driver to
driver model, but this series does not include that as I'm not sure if any
of the boards I have include an RTC.


Simon Glass (20):
  dm: spi: Correct the comment on spi_get_ops()
  dm: i2c: sandbox: Add debugging to the speed limit
  dm: i2c: Add functions to read and write a register
  dm: i2c: Add an explicit test mode to the sandbox I2C driver
  fdt: Correct warning in fdt_setup_simplefb_node()
  dm: rtc: Rename gregorian day function
  dm: rtc: Rename to_tm() to rtc_to_tm() and add error code
  dm: rtc: Rename mktime() and reduce the number of parameters
  dm: Remove unnecessary types in bcd.h
  dm: rtc: Split structure definition into its own file
  dm: sandbox: Add os_localtime() to obtain the system time
  dm: rtc: Add a uclass for real-time clocks
  dm: rtc: sandbox: Add an emulated I2C RTC device
  dm: rtc: sandbox: Add a driver for the sandbox I2C RTC
  dm: rtc: Convert 'date' command to support driver model
  dm: net: rtc: Support using driver model for rtc in sntp
  dm: sandbox: dts: Add a real-time clock attached to I2C
  dm: rtc: sandbox: Enable real-time clock support
  dm: test: dts: Sort the aliases in the test device tree file
  dm: rtc: Add tests for real-time clocks

 arch/sandbox/cpu/os.c           |  18 +++
 arch/sandbox/dts/sandbox.dts    |  12 +-
 arch/sandbox/include/asm/rtc.h  |  28 +++++
 arch/sandbox/include/asm/test.h |  31 ++++++
 common/cmd_date.c               |  55 +++++++---
 common/fdt_support.c            |   2 +-
 common/image.c                  |   2 +-
 configs/sandbox_defconfig       |   1 +
 drivers/i2c/i2c-uclass.c        |  19 ++++
 drivers/i2c/sandbox_i2c.c       |  34 ++++--
 drivers/rtc/Kconfig             |   8 ++
 drivers/rtc/Makefile            |   4 +
 drivers/rtc/at91sam9_rtt.c      |   5 +-
 drivers/rtc/bfin_rtc.c          |   5 +-
 drivers/rtc/date.c              |  38 ++++---
 drivers/rtc/ds1306.c            |   5 +-
 drivers/rtc/ds1374.c            |   6 +-
 drivers/rtc/ftrtc010.c          |   5 +-
 drivers/rtc/i2c_rtc_emul.c      | 236 ++++++++++++++++++++++++++++++++++++++++
 drivers/rtc/imxdi.c             |   5 +-
 drivers/rtc/mc13xxx-rtc.c       |   5 +-
 drivers/rtc/mcfrtc.c            |   2 +-
 drivers/rtc/mpc8xx.c            |   5 +-
 drivers/rtc/mx27rtc.c           |   5 +-
 drivers/rtc/mxsrtc.c            |   5 +-
 drivers/rtc/pl031.c             |   5 +-
 drivers/rtc/rtc-uclass.c        |  96 ++++++++++++++++
 drivers/rtc/sandbox_rtc.c       | 106 ++++++++++++++++++
 include/bcd.h                   |   8 +-
 include/configs/sandbox.h       |   1 +
 include/dm/uclass-id.h          |   1 +
 include/i2c.h                   |  22 ++++
 include/os.h                    |  11 ++
 include/rtc.h                   | 197 ++++++++++++++++++++++++++++-----
 include/rtc_def.h               |  36 ++++++
 include/spi.h                   |   2 +-
 net/sntp.c                      |  14 ++-
 post/drivers/rtc.c              |  28 +++--
 test/dm/Makefile                |   1 +
 test/dm/i2c.c                   |   8 ++
 test/dm/rtc.c                   | 175 +++++++++++++++++++++++++++++
 test/dm/test.dts                |  26 ++++-
 42 files changed, 1155 insertions(+), 123 deletions(-)
 create mode 100644 arch/sandbox/include/asm/rtc.h
 create mode 100644 drivers/rtc/i2c_rtc_emul.c
 create mode 100644 drivers/rtc/rtc-uclass.c
 create mode 100644 drivers/rtc/sandbox_rtc.c
 create mode 100644 include/rtc_def.h
 create mode 100644 test/dm/rtc.c

-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list