From: Angelo Dureghello <angelo@sysam.it>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] drivers; add DM_NO_OF Kconfig option
Date: Fri, 4 May 2018 00:01:18 +0200 [thread overview]
Message-ID: <20180503220117.GA1986@jerusalem> (raw)
To be able to build spi driver with DM support, a new config
option has been introduced (DM_NO_OF) since m68k architecture
does not support fdt.
---
Changes from v1:
- split into 2 patches
Signed-off-by: Angelo Dureghello <angelo@sysam.it>
---
arch/Kconfig | 1 +
drivers/core/Kconfig | 4 ++++
drivers/spi/spi-uclass.c | 12 +++++++-----
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index dd5a887001..c96cbfa2bd 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -28,6 +28,7 @@ config M68K
select HAVE_PRIVATE_LIBGCC
select SYS_BOOT_GET_CMDLINE
select SYS_BOOT_GET_KBD
+ select DM_NO_OF
config MICROBLAZE
bool "MicroBlaze architecture"
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index e8ba20ca82..47960a8a6a 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -244,4 +244,8 @@ config DM_DEV_READ_INLINE
bool
default y if !OF_LIVE
+config DM_NO_OF
+ bool
+ default n
+
endmenu
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 15d90a54a1..908be1d4cf 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -107,7 +107,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
return dm_spi_xfer(slave->dev, bitlen, dout, din, flags);
}
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if !CONFIG_IS_ENABLED(OF_PLATDATA) && !defined(CONFIG_DM_NO_OF)
static int spi_child_post_bind(struct udevice *dev)
{
struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
@@ -121,7 +121,7 @@ static int spi_child_post_bind(struct udevice *dev)
static int spi_post_probe(struct udevice *bus)
{
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if !CONFIG_IS_ENABLED(OF_PLATDATA) && !defined(CONFIG_DM_NO_OF)
struct dm_spi_bus *spi = dev_get_uclass_priv(bus);
spi->max_hz = dev_read_u32_default(bus, "spi-max-frequency", 0);
@@ -274,7 +274,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
bool created = false;
int ret;
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || defined(CONFIG_DM_NO_OF)
ret = uclass_first_device_err(UCLASS_SPI, &bus);
#else
ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
@@ -283,6 +283,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
printf("Invalid bus %d (err=%d)\n", busnum, ret);
return ret;
}
+
ret = spi_find_chip_select(bus, cs, &dev);
/*
@@ -321,6 +322,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
}
plat = dev_get_parent_platdata(dev);
+
if (!speed) {
speed = plat->max_hz;
mode = plat->mode;
@@ -427,7 +429,7 @@ UCLASS_DRIVER(spi) = {
.id = UCLASS_SPI,
.name = "spi",
.flags = DM_UC_FLAG_SEQ_ALIAS,
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if !CONFIG_IS_ENABLED(OF_PLATDATA) && !defined(CONFIG_DM_NO_OF)
.post_bind = dm_scan_fdt_dev,
#endif
.post_probe = spi_post_probe,
@@ -436,7 +438,7 @@ UCLASS_DRIVER(spi) = {
.per_child_auto_alloc_size = sizeof(struct spi_slave),
.per_child_platdata_auto_alloc_size =
sizeof(struct dm_spi_slave_platdata),
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if !CONFIG_IS_ENABLED(OF_PLATDATA) && !defined(CONFIG_DM_NO_OF)
.child_post_bind = spi_child_post_bind,
#endif
};
--
2.17.0
next reply other threads:[~2018-05-03 22:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 22:01 Angelo Dureghello [this message]
2018-05-26 22:18 ` [U-Boot] [PATCH v2 1/2] drivers; add DM_NO_OF Kconfig option Simon Glass
2018-05-27 7:22 ` Angelo Dureghello
2018-05-28 1:45 ` Simon Glass
2018-05-29 0:59 ` Tom Rini
2018-05-29 8:20 ` Angelo Dureghello
2018-05-30 19:58 ` Angelo Dureghello
2018-05-31 13:01 ` Simon Glass
2018-06-01 1:51 ` Tom Rini
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=20180503220117.GA1986@jerusalem \
--to=angelo@sysam.it \
--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.