summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Kconfig28
-rw-r--r--drivers/misc/Makefile2
-rw-r--r--drivers/misc/cros_ec.c2
-rw-r--r--drivers/misc/irq-uclass.c10
-rw-r--r--drivers/misc/irq_sandbox.c15
-rw-r--r--drivers/misc/irq_sandbox_test.c22
-rw-r--r--drivers/misc/misc-uclass.c2
-rw-r--r--drivers/misc/p2sb-uclass.c20
8 files changed, 48 insertions, 53 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 997b7132211..099ff293489 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -398,36 +398,12 @@ config SPL_I2C_EEPROM
This option is an SPL-variant of the I2C_EEPROM option.
See the help of I2C_EEPROM for details.
-if I2C_EEPROM
-
config SYS_I2C_EEPROM_ADDR
hex "Chip address of the EEPROM device"
+ depends on ID_EEPROM || I2C_EEPROM || SPL_I2C_EEPROM || CMD_EEPROM || ENV_IS_IN_EEPROM
default 0
-config SYS_I2C_EEPROM_BUS
- int "I2C bus of the EEPROM device."
- default 0
-
-config SYS_EEPROM_SIZE
- int "Size in bytes of the EEPROM device"
- default 256
-
-config SYS_EEPROM_PAGE_WRITE_BITS
- int "Number of bits used to address bytes in a single page"
- default 0
- help
- The EEPROM page size is 2^SYS_EEPROM_PAGE_WRITE_BITS.
- A 64 byte page, for example would require six bits.
-
-config SYS_EEPROM_PAGE_WRITE_DELAY_MS
- int "Number of milliseconds to delay between page writes"
- default 0
-
-config SYS_I2C_EEPROM_ADDR_LEN
- int "Length in bytes of the EEPROM memory array address"
- default 1
- help
- Note: This is NOT the chip address length!
+if I2C_EEPROM
config SYS_I2C_EEPROM_ADDR_OVERFLOW
hex "EEPROM Address Overflow"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index b64cd2a4de9..c16a77c34c4 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -42,7 +42,7 @@ obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o
obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
obj-$(CONFIG_GDSYS_SOC) += gdsys_soc.o
obj-$(CONFIG_IRQ) += irq-uclass.o
-obj-$(CONFIG_SANDBOX) += irq_sandbox.o
+obj-$(CONFIG_SANDBOX) += irq_sandbox.o irq_sandbox_test.o
obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o
obj-$(CONFIG_IHS_FPGA) += ihs_fpga.o
obj-$(CONFIG_IMX8) += imx8/
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index 2a15094d20a..1bbc0f98ae8 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -1671,7 +1671,7 @@ UCLASS_DRIVER(cros_ec) = {
.id = UCLASS_CROS_EC,
.name = "cros-ec",
.per_device_auto = sizeof(struct cros_ec_dev),
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
.post_bind = dm_scan_fdt_dev,
#endif
.flags = DM_UC_FLAG_ALLOC_PRIV_DMA,
diff --git a/drivers/misc/irq-uclass.c b/drivers/misc/irq-uclass.c
index 3aa26f61d9e..eb9f3b902f4 100644
--- a/drivers/misc/irq-uclass.c
+++ b/drivers/misc/irq-uclass.c
@@ -64,8 +64,8 @@ int irq_read_and_clear(struct irq *irq)
}
#if CONFIG_IS_ENABLED(OF_PLATDATA)
-int irq_get_by_driver_info(struct udevice *dev,
- struct phandle_1_arg *cells, struct irq *irq)
+int irq_get_by_phandle(struct udevice *dev, const struct phandle_2_arg *cells,
+ struct irq *irq)
{
int ret;
@@ -74,6 +74,12 @@ int irq_get_by_driver_info(struct udevice *dev,
return ret;
irq->id = cells->arg[0];
+ /*
+ * Note: we could call irq_of_xlate_default() here to do this properly.
+ * For now, this is good enough for existing cases.
+ */
+ irq->flags = cells->arg[1];
+
return 0;
}
#else
diff --git a/drivers/misc/irq_sandbox.c b/drivers/misc/irq_sandbox.c
index 1f7e62e6614..8b5573fcadd 100644
--- a/drivers/misc/irq_sandbox.c
+++ b/drivers/misc/irq_sandbox.c
@@ -9,19 +9,9 @@
#include <dm.h>
#include <irq.h>
#include <acpi/acpi_device.h>
+#include <asm/irq.h>
#include <asm/test.h>
-/**
- * struct sandbox_irq_priv - private data for this driver
- *
- * @count: Counts the number calls to the read_and_clear() method
- * @pending: true if an interrupt is pending, else false
- */
-struct sandbox_irq_priv {
- int count;
- bool pending;
-};
-
static int sandbox_set_polarity(struct udevice *dev, uint irq, bool active_low)
{
if (irq > 10)
@@ -103,10 +93,11 @@ static const struct udevice_id sandbox_irq_ids[] = {
{ }
};
-U_BOOT_DRIVER(sandbox_irq_drv) = {
+U_BOOT_DRIVER(sandbox_irq) = {
.name = "sandbox_irq",
.id = UCLASS_IRQ,
.of_match = sandbox_irq_ids,
.ops = &sandbox_irq_ops,
.priv_auto = sizeof(struct sandbox_irq_priv),
+ DM_HEADER(<asm/irq.h>)
};
diff --git a/drivers/misc/irq_sandbox_test.c b/drivers/misc/irq_sandbox_test.c
new file mode 100644
index 00000000000..95c45c24edb
--- /dev/null
+++ b/drivers/misc/irq_sandbox_test.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Sandbox driver for testing interrupts with of-platdata
+ *
+ * Copyright 2021 Google LLC
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <irq.h>
+#include <asm/irq.h>
+
+static const struct udevice_id sandbox_irq_test_ids[] = {
+ { .compatible = "sandbox,irq-test" },
+ { }
+};
+
+U_BOOT_DRIVER(sandbox_irq_test) = {
+ .name = "sandbox_irq_test",
+ .id = UCLASS_MISC,
+ .of_match = sandbox_irq_test_ids,
+};
diff --git a/drivers/misc/misc-uclass.c b/drivers/misc/misc-uclass.c
index 72720b0e590..cbfacc3801a 100644
--- a/drivers/misc/misc-uclass.c
+++ b/drivers/misc/misc-uclass.c
@@ -70,7 +70,7 @@ int misc_set_enabled(struct udevice *dev, bool val)
UCLASS_DRIVER(misc) = {
.id = UCLASS_MISC,
.name = "misc",
-#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
.post_bind = dm_scan_fdt_dev,
#endif
};
diff --git a/drivers/misc/p2sb-uclass.c b/drivers/misc/p2sb-uclass.c
index 94d273de9b3..f24857a1515 100644
--- a/drivers/misc/p2sb-uclass.c
+++ b/drivers/misc/p2sb-uclass.c
@@ -183,16 +183,16 @@ int p2sb_set_port_id(struct udevice *dev, int portid)
static int p2sb_child_post_bind(struct udevice *dev)
{
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
- struct p2sb_child_plat *pplat = dev_get_parent_plat(dev);
- int ret;
- u32 pid;
-
- ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid);
- if (ret)
- return ret;
- pplat->pid = pid;
-#endif
+ if (CONFIG_IS_ENABLED(OF_REAL)) {
+ struct p2sb_child_plat *pplat = dev_get_parent_plat(dev);
+ int ret;
+ u32 pid;
+
+ ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid);
+ if (ret)
+ return ret;
+ pplat->pid = pid;
+ }
return 0;
}