summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRomain Naour <[email protected]>2024-10-08 09:54:31 +0200
committerTom Rini <[email protected]>2024-10-27 10:19:44 -0600
commitd164577fdbb3e49b3d93ab170753a7ab94790490 (patch)
treedafe438f8f2577cd0d21c02cc5efc5def6e8137a /drivers
parent8a63113de037a5d1f86d0b7081ad88f87e86787d (diff)
net: ksz9477: prepare ksz9477 without I2C support
With the upcoming ksz9477 SPI support added, the I2C support will be optional. Either the I2C or the SPI bus will be used. For now, DM_I2C is still mandatory. Signed-off-by: Romain Naour <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ksz9477.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/ksz9477.c b/drivers/net/ksz9477.c
index 82db533c4ec..1190b591fcb 100644
--- a/drivers/net/ksz9477.c
+++ b/drivers/net/ksz9477.c
@@ -11,7 +11,9 @@
#include <eth_phy.h>
#include <linux/delay.h>
#include <miiphy.h>
-#include <i2c.h>
+#if CONFIG_IS_ENABLED(DM_I2C)
+# include <i2c.h>
+#endif
#include <net/dsa.h>
#include <asm-generic/gpio.h>
@@ -105,6 +107,7 @@ struct ksz_dsa_priv {
u32 features; /* chip specific features */
};
+#if CONFIG_IS_ENABLED(DM_I2C)
static inline int ksz_i2c_read(struct udevice *dev, u32 reg, u8 *val, int len)
{
return dm_i2c_read(dev, reg, val, len);
@@ -119,6 +122,7 @@ static struct ksz_phy_ops phy_i2c_ops = {
.read = ksz_i2c_read,
.write = ksz_i2c_write,
};
+#endif
static inline int ksz_read8(struct udevice *dev, u32 reg, u8 *val)
{
@@ -587,6 +591,7 @@ static int ksz_probe(struct udevice *dev)
parent_id = device_get_uclass_id(dev_get_parent(dev));
switch (parent_id) {
+#if CONFIG_IS_ENABLED(DM_I2C)
case UCLASS_I2C: {
ksz_ops_register(dev, &phy_i2c_ops);
@@ -597,6 +602,7 @@ static int ksz_probe(struct udevice *dev)
}
break;
}
+#endif
default:
dev_err(dev, "invalid parent bus (%s)\n",
uclass_get_name(parent_id));