[U-Boot] [PATCH v2 14/21] pci: sandbox: swap_case: Declare dynamic driver matching

Bin Meng bmeng.cn at gmail.com
Sun Jul 29 13:37:05 UTC 2018


This adds a U_BOOT_PCI_DEVICE() declaration to the swap_case driver.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

Changes in v2: None

 arch/sandbox/include/asm/test.h | 4 ++++
 drivers/misc/swap_case.c        | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 08863bf..57aeca8 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -16,6 +16,10 @@
 #define SANDBOX_PCI_CLASS_CODE		PCI_CLASS_CODE_COMM
 #define SANDBOX_PCI_CLASS_SUB_CODE	PCI_CLASS_SUB_CODE_COMM_SERIAL
 
+/* Useful for PCI_VDEVICE() macro */
+#define PCI_VENDOR_ID_SANDBOX		SANDBOX_PCI_VENDOR_ID
+#define SWAP_CASE_DRV_DATA		0x55aa
+
 #define SANDBOX_CLK_RATE		32768
 
 /* System controller driver data */
diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c
index 80ccb9f..790bb0c 100644
--- a/drivers/misc/swap_case.c
+++ b/drivers/misc/swap_case.c
@@ -285,3 +285,10 @@ U_BOOT_DRIVER(sandbox_swap_case_emul) = {
 	.priv_auto_alloc_size = sizeof(struct swap_case_priv),
 	.platdata_auto_alloc_size = sizeof(struct swap_case_platdata),
 };
+
+static struct pci_device_id sandbox_swap_case_supported[] = {
+	{ PCI_VDEVICE(SANDBOX, SANDBOX_PCI_DEVICE_ID), SWAP_CASE_DRV_DATA },
+	{},
+};
+
+U_BOOT_PCI_DEVICE(sandbox_swap_case_emul, sandbox_swap_case_supported);
-- 
2.7.4



More information about the U-Boot mailing list