All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v2 16/37] sandbox: i2c: Move platdata structs to header files
Date: Wed,  3 Feb 2021 09:43:32 -0700	[thread overview]
Message-ID: <20210203164353.2577985-6-sjg@chromium.org> (raw)
In-Reply-To: <20210203164353.2577985-1-sjg@chromium.org>

At present the structs used by these drivers are declared in the C files
and so are not accessible to dtoc. Move them to header files, as required.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 arch/sandbox/include/asm/i2c.h | 15 +++++++++++++++
 arch/sandbox/include/asm/rtc.h | 24 ++++++++++++++++++++++++
 drivers/i2c/i2c-emul-uclass.c  | 13 +------------
 drivers/rtc/i2c_rtc_emul.c     | 19 -------------------
 4 files changed, 40 insertions(+), 31 deletions(-)

diff --git a/arch/sandbox/include/asm/i2c.h b/arch/sandbox/include/asm/i2c.h
index b482be485ca..4fc190be4bd 100644
--- a/arch/sandbox/include/asm/i2c.h
+++ b/arch/sandbox/include/asm/i2c.h
@@ -11,4 +11,19 @@ struct sandbox_i2c_priv {
 	bool test_mode;
 };
 
+/**
+ * struct i2c_emul_uc_plat - information about the emulator for this device
+ *
+ * This is used by devices in UCLASS_I2C_EMUL to record information about the
+ * device being emulated. It is accessible with dev_get_uclass_plat()
+ *
+ * @dev: Device being emulated
+ * @idx: of-platdata index, set up by the device's bind() method if of-platdata
+ *	is in use
+ */
+struct i2c_emul_uc_plat {
+	struct udevice *dev;
+	int idx;
+};
+
 #endif /* __asn_i2c_h */
diff --git a/arch/sandbox/include/asm/rtc.h b/arch/sandbox/include/asm/rtc.h
index 5bb032f59f2..025cd6c67cf 100644
--- a/arch/sandbox/include/asm/rtc.h
+++ b/arch/sandbox/include/asm/rtc.h
@@ -9,6 +9,8 @@
 #ifndef __asm_rtc_h
 #define __asm_rtc_h
 
+#include <dt-structs.h>
+
 /* Register numbers in the sandbox RTC */
 enum {
 	REG_SEC		= 5,
@@ -29,4 +31,26 @@ enum {
 	REG_COUNT	= 0x80,
 };
 
+/**
+ * struct sandbox_i2c_rtc_plat_data - platform data for the RTC
+ *
+ * @base_time:		Base system time when RTC device was bound
+ * @offset:		RTC offset from current system time
+ * @use_system_time:	true to use system time, false to use @base_time
+ * @reg:		Register values
+ */
+struct sandbox_i2c_rtc_plat_data {
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
+	struct dtd_sandbox_i2c_rtc_emul dtplat;
+#endif
+	long base_time;
+	long offset;
+	bool use_system_time;
+	u8 reg[REG_COUNT];
+};
+
+struct sandbox_i2c_rtc {
+	unsigned int offset_secs;
+};
+
 #endif
diff --git a/drivers/i2c/i2c-emul-uclass.c b/drivers/i2c/i2c-emul-uclass.c
index 75d79883380..9ef4651fa43 100644
--- a/drivers/i2c/i2c-emul-uclass.c
+++ b/drivers/i2c/i2c-emul-uclass.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <i2c.h>
 #include <log.h>
+#include <asm/i2c.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
 
@@ -23,18 +24,6 @@
  * uclass so avoid having strange devices on the I2C bus.
  */
 
-/**
- * struct i2c_emul_uc_plat - information about the emulator for this device
- *
- * This is used by devices in UCLASS_I2C_EMUL to record information about the
- * device being emulated. It is accessible with dev_get_uclass_plat()
- *
- * @dev: Device being emulated
- */
-struct i2c_emul_uc_plat {
-	struct udevice *dev;
-};
-
 struct udevice *i2c_emul_get_device(struct udevice *emul)
 {
 	struct i2c_emul_uc_plat *uc_plat = dev_get_uclass_plat(emul);
diff --git a/drivers/rtc/i2c_rtc_emul.c b/drivers/rtc/i2c_rtc_emul.c
index fdc885c518b..ba418c25daf 100644
--- a/drivers/rtc/i2c_rtc_emul.c
+++ b/drivers/rtc/i2c_rtc_emul.c
@@ -28,25 +28,6 @@
 #define debug_buffer(x, ...)
 #endif
 
-/**
- * struct sandbox_i2c_rtc_plat_data - platform data for the RTC
- *
- * @base_time:		Base system time when RTC device was bound
- * @offset:		RTC offset from current system time
- * @use_system_time:	true to use system time, false to use @base_time
- * @reg:		Register values
- */
-struct sandbox_i2c_rtc_plat_data {
-	long base_time;
-	long offset;
-	bool use_system_time;
-	u8 reg[REG_COUNT];
-};
-
-struct sandbox_i2c_rtc {
-	unsigned int offset_secs;
-};
-
 long sandbox_i2c_rtc_set_offset(struct udevice *dev, bool use_system_time,
 				int offset)
 {
-- 
2.30.0.365.g02bc693789-goog

  parent reply	other threads:[~2021-02-03 16:43 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 16:43 [PATCH v2 00/37] dm: Implement OF_PLATDATA_INST in driver model (part E) Simon Glass
2021-02-03 16:43 ` [PATCH v2 01/37] sandbox: Drop debug message in os_spl_to_uboot() Simon Glass
2021-02-04 13:36   ` Heinrich Schuchardt
2021-02-03 16:43 ` [PATCH v2 02/37] linker_lists: Allow use in data structures Simon Glass
2021-02-04 13:54   ` Heinrich Schuchardt
2021-02-07 14:37     ` Simon Glass
2021-02-03 16:43 ` [PATCH v2 03/37] dm: core: Add macros to access the new linker lists Simon Glass
2021-02-04 13:46   ` Heinrich Schuchardt
2021-02-03 16:43 ` [PATCH v2 04/37] dm: core: Allow dropping run-time binding of devices Simon Glass
2021-02-04 13:57   ` Heinrich Schuchardt
2021-02-03 16:43 ` [PATCH v2 05/37] dm: core: Adjust uclass setup with of-platdata Simon Glass
2021-02-03 16:43 ` [PATCH v2 06/37] dm: core: Set up driver model for OF_PLATDATA_INST Simon Glass
2021-02-03 16:43 ` [PATCH v2 07/37] dm: core: Skip adding uclasses with OF_PLATDATA_INST Simon Glass
2021-02-03 16:43 ` [PATCH v2 08/37] dm: Add the new dtoc-generated files to the build Simon Glass
2021-02-03 16:43 ` [PATCH v2 09/37] dm: core: Include dt-decl.h automatically Simon Glass
2021-02-03 16:43 ` [PATCH v2 10/37] dm: test: Avoid destroying uclasses with of-platdata-inst Simon Glass
2021-02-03 16:43 ` [PATCH v2 11/37] clk: sandbox: Move priv/plat data to a header file Simon Glass
2021-02-03 16:43 ` [PATCH v2 12/37] clk: fixed-rate: Export driver parts for OF_PLATDATA_INST Simon Glass
2021-02-03 16:43 ` [PATCH v2 13/37] clk: sandbox: Create a special fixed-rate driver Simon Glass
2021-02-03 16:43 ` [PATCH v2 14/37] dm: core: Drop device_get_by_driver_info() Simon Glass
2021-02-03 16:43 ` [PATCH v2 15/37] dm: core: Drop uclass_find_device_by_phandle() with of-platdata Simon Glass
2021-02-03 16:43 ` Simon Glass [this message]
2021-02-03 16:43 ` [PATCH v2 17/37] dm: Rename device_get_by_driver_info_idx() Simon Glass
2021-02-03 16:43 ` [PATCH v2 18/37] sandbox_spl: Increase SPL malloc() size Simon Glass
2021-02-04 14:01   ` Heinrich Schuchardt
2021-02-03 16:43 ` [PATCH v2 19/37] sandbox: i2c: Support i2c emulation with of-platdata Simon Glass
2021-02-03 16:43 ` [PATCH v2 20/37] Revert "sandbox: Disable I2C emulators in SPL" Simon Glass
2021-02-03 16:43 ` [PATCH v2 21/37] sandbox: Create a new sandbox_noinst build Simon Glass
2021-02-03 16:43 ` [PATCH v2 22/37] test: Run sandbox_spl tests on sandbox_noinst Simon Glass
2021-02-03 16:43 ` [PATCH v2 23/37] azure/gitlab: Add tests for sandbox_noinst Simon Glass
2021-02-03 16:43 ` [PATCH v2 24/37] dm: core: Add an option to support SPL in read-only memory Simon Glass
2021-02-03 16:43 ` [PATCH v2 25/37] dm: core: Create a struct for device runtime info Simon Glass
2021-02-03 16:43 ` [PATCH v2 26/37] dm: core: Move flags to device-runtime info Simon Glass
2021-02-03 16:43 ` [PATCH v2 27/37] dm: core: Allow storing priv/plat data separately Simon Glass
2021-02-03 16:43 ` [PATCH v2 28/37] sandbox: Define a region for device priv/plat data Simon Glass
2021-02-03 16:43 ` [PATCH v2 29/37] dm: core: Use separate priv/plat data region Simon Glass
2021-02-03 16:43 ` [PATCH v2 30/37] x86: Define a region for device priv/plat data Simon Glass
2021-02-03 16:43 ` [PATCH v2 31/37] x86: apl: Fix the header order in pmc Simon Glass
2021-02-03 16:43 ` [PATCH v2 32/37] x86: apl: Tell of-platdata about a required header file Simon Glass
2021-02-03 16:43 ` [PATCH v2 33/37] x86: itss: Tidy up bind() for of-platdata-inst Simon Glass
2021-02-03 16:43 ` [PATCH v2 34/37] x86: Support a fake PCI device with of-platdata-inst Simon Glass
2021-02-03 16:43 ` [PATCH v2 35/37] x86: Don't include reset driver in SPL Simon Glass
2021-02-03 16:43 ` [PATCH v2 36/37] x86: coral: Drop ACPI properties from of-platdata Simon Glass
2021-02-03 16:43 ` [PATCH v2 37/37] x86: apl: Use read-only SPL and new of-platdata Simon Glass
2021-02-04  7:48 ` [PATCH v2 00/37] dm: Implement OF_PLATDATA_INST in driver model (part E) Heinrich Schuchardt
2021-02-04 15:08   ` Simon Glass

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=20210203164353.2577985-6-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.