1 // SPDX-License-Identifier: GPL-2.0-only
3 * Kontron PLD MFD core driver
5 * Copyright (c) 2010-2013 Kontron Europe GmbH
6 * Author: Michael Brunner <michael.brunner@kontron.com>
9 #include <linux/platform_device.h>
10 #include <linux/mfd/core.h>
11 #include <linux/mfd/kempld.h>
12 #include <linux/module.h>
13 #include <linux/dmi.h>
15 #include <linux/delay.h>
16 #include <linux/acpi.h>
19 static char force_device_id[MAX_ID_LEN + 1] = "";
20 module_param_string(force_device_id, force_device_id,
21 sizeof(force_device_id), 0);
22 MODULE_PARM_DESC(force_device_id, "Override detected product");
25 * Get hardware mutex to block firmware from accessing the pld.
26 * It is possible for the firmware may hold the mutex for an extended length of
27 * time. This function will block until access has been granted.
29 static void kempld_get_hardware_mutex(struct kempld_device_data *pld)
31 /* The mutex bit will read 1 until access has been granted */
32 while (ioread8(pld->io_index) & KEMPLD_MUTEX_KEY)
33 usleep_range(1000, 3000);
36 static void kempld_release_hardware_mutex(struct kempld_device_data *pld)
38 /* The harware mutex is released when 1 is written to the mutex bit. */
39 iowrite8(KEMPLD_MUTEX_KEY, pld->io_index);
42 static int kempld_get_info_generic(struct kempld_device_data *pld)
47 kempld_get_mutex(pld);
49 version = kempld_read16(pld, KEMPLD_VERSION);
50 spec = kempld_read8(pld, KEMPLD_SPEC);
51 pld->info.buildnr = kempld_read16(pld, KEMPLD_BUILDNR);
53 pld->info.minor = KEMPLD_VERSION_GET_MINOR(version);
54 pld->info.major = KEMPLD_VERSION_GET_MAJOR(version);
55 pld->info.number = KEMPLD_VERSION_GET_NUMBER(version);
56 pld->info.type = KEMPLD_VERSION_GET_TYPE(version);
59 pld->info.spec_minor = 0;
60 pld->info.spec_major = 1;
62 pld->info.spec_minor = KEMPLD_SPEC_GET_MINOR(spec);
63 pld->info.spec_major = KEMPLD_SPEC_GET_MAJOR(spec);
66 if (pld->info.spec_major > 0)
67 pld->feature_mask = kempld_read16(pld, KEMPLD_FEATURE);
69 pld->feature_mask = 0;
71 kempld_release_mutex(pld);
83 static const char *kempld_dev_names[] = {
84 [KEMPLD_I2C] = "kempld-i2c",
85 [KEMPLD_WDT] = "kempld-wdt",
86 [KEMPLD_GPIO] = "kempld-gpio",
87 [KEMPLD_UART] = "kempld-uart",
90 #define KEMPLD_MAX_DEVS ARRAY_SIZE(kempld_dev_names)
92 static int kempld_register_cells_generic(struct kempld_device_data *pld)
94 struct mfd_cell devs[KEMPLD_MAX_DEVS] = {};
97 if (pld->feature_mask & KEMPLD_FEATURE_BIT_I2C)
98 devs[i++].name = kempld_dev_names[KEMPLD_I2C];
100 if (pld->feature_mask & KEMPLD_FEATURE_BIT_WATCHDOG)
101 devs[i++].name = kempld_dev_names[KEMPLD_WDT];
103 if (pld->feature_mask & KEMPLD_FEATURE_BIT_GPIO)
104 devs[i++].name = kempld_dev_names[KEMPLD_GPIO];
106 if (pld->feature_mask & KEMPLD_FEATURE_MASK_UART)
107 devs[i++].name = kempld_dev_names[KEMPLD_UART];
109 return mfd_add_devices(pld->dev, -1, devs, i, NULL, 0, NULL);
112 static struct resource kempld_ioresource = {
113 .start = KEMPLD_IOINDEX,
114 .end = KEMPLD_IODATA,
115 .flags = IORESOURCE_IO,
118 static const struct kempld_platform_data kempld_platform_data_generic = {
119 .pld_clock = KEMPLD_CLK,
120 .ioresource = &kempld_ioresource,
121 .get_hardware_mutex = kempld_get_hardware_mutex,
122 .release_hardware_mutex = kempld_release_hardware_mutex,
123 .get_info = kempld_get_info_generic,
124 .register_cells = kempld_register_cells_generic,
127 static struct platform_device *kempld_pdev;
128 static bool kempld_acpi_mode;
130 static int kempld_create_platform_device(const struct dmi_system_id *id)
132 const struct kempld_platform_data *pdata = id->driver_data;
135 kempld_pdev = platform_device_alloc("kempld", -1);
139 ret = platform_device_add_data(kempld_pdev, pdata, sizeof(*pdata));
143 ret = platform_device_add_resources(kempld_pdev, pdata->ioresource, 1);
147 ret = platform_device_add(kempld_pdev);
153 platform_device_put(kempld_pdev);
158 * kempld_read8 - read 8 bit register
159 * @pld: kempld_device_data structure describing the PLD
160 * @index: register index on the chip
162 * kempld_get_mutex must be called prior to calling this function.
164 u8 kempld_read8(struct kempld_device_data *pld, u8 index)
166 iowrite8(index, pld->io_index);
167 return ioread8(pld->io_data);
169 EXPORT_SYMBOL_GPL(kempld_read8);
172 * kempld_write8 - write 8 bit register
173 * @pld: kempld_device_data structure describing the PLD
174 * @index: register index on the chip
175 * @data: new register value
177 * kempld_get_mutex must be called prior to calling this function.
179 void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data)
181 iowrite8(index, pld->io_index);
182 iowrite8(data, pld->io_data);
184 EXPORT_SYMBOL_GPL(kempld_write8);
187 * kempld_read16 - read 16 bit register
188 * @pld: kempld_device_data structure describing the PLD
189 * @index: register index on the chip
191 * kempld_get_mutex must be called prior to calling this function.
193 u16 kempld_read16(struct kempld_device_data *pld, u8 index)
195 return kempld_read8(pld, index) | kempld_read8(pld, index + 1) << 8;
197 EXPORT_SYMBOL_GPL(kempld_read16);
200 * kempld_write16 - write 16 bit register
201 * @pld: kempld_device_data structure describing the PLD
202 * @index: register index on the chip
203 * @data: new register value
205 * kempld_get_mutex must be called prior to calling this function.
207 void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data)
209 kempld_write8(pld, index, (u8)data);
210 kempld_write8(pld, index + 1, (u8)(data >> 8));
212 EXPORT_SYMBOL_GPL(kempld_write16);
215 * kempld_read32 - read 32 bit register
216 * @pld: kempld_device_data structure describing the PLD
217 * @index: register index on the chip
219 * kempld_get_mutex must be called prior to calling this function.
221 u32 kempld_read32(struct kempld_device_data *pld, u8 index)
223 return kempld_read16(pld, index) | kempld_read16(pld, index + 2) << 16;
225 EXPORT_SYMBOL_GPL(kempld_read32);
228 * kempld_write32 - write 32 bit register
229 * @pld: kempld_device_data structure describing the PLD
230 * @index: register index on the chip
231 * @data: new register value
233 * kempld_get_mutex must be called prior to calling this function.
235 void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data)
237 kempld_write16(pld, index, (u16)data);
238 kempld_write16(pld, index + 2, (u16)(data >> 16));
240 EXPORT_SYMBOL_GPL(kempld_write32);
243 * kempld_get_mutex - acquire PLD mutex
244 * @pld: kempld_device_data structure describing the PLD
246 void kempld_get_mutex(struct kempld_device_data *pld)
248 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
250 mutex_lock(&pld->lock);
251 pdata->get_hardware_mutex(pld);
253 EXPORT_SYMBOL_GPL(kempld_get_mutex);
256 * kempld_release_mutex - release PLD mutex
257 * @pld: kempld_device_data structure describing the PLD
259 void kempld_release_mutex(struct kempld_device_data *pld)
261 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
263 pdata->release_hardware_mutex(pld);
264 mutex_unlock(&pld->lock);
266 EXPORT_SYMBOL_GPL(kempld_release_mutex);
269 * kempld_get_info - update device specific information
270 * @pld: kempld_device_data structure describing the PLD
272 * This function calls the configured board specific kempld_get_info_XXXX
273 * function which is responsible for gathering information about the specific
274 * hardware. The information is then stored within the pld structure.
276 static int kempld_get_info(struct kempld_device_data *pld)
279 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
282 ret = pdata->get_info(pld);
286 /* The Kontron PLD firmware version string has the following format:
289 * w: PLD number - 1 hex digit
290 * x: Major version - 1 alphanumerical digit (0-9A-V)
291 * y: Minor version - 1 alphanumerical digit (0-9A-V)
292 * zzzz: Build number - 4 zero padded hex digits */
294 if (pld->info.major < 10)
295 major = pld->info.major + '0';
297 major = (pld->info.major - 10) + 'A';
298 if (pld->info.minor < 10)
299 minor = pld->info.minor + '0';
301 minor = (pld->info.minor - 10) + 'A';
303 ret = scnprintf(pld->info.version, sizeof(pld->info.version),
304 "P%X%c%c.%04X", pld->info.number, major, minor,
313 * kempld_register_cells - register cell drivers
315 * This function registers cell drivers for the detected hardware by calling
316 * the configured kempld_register_cells_XXXX function which is responsible
317 * to detect and register the needed cell drivers.
319 static int kempld_register_cells(struct kempld_device_data *pld)
321 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
323 return pdata->register_cells(pld);
326 static const char *kempld_get_type_string(struct kempld_device_data *pld)
328 const char *version_type;
330 switch (pld->info.type) {
332 version_type = "release";
335 version_type = "debug";
338 version_type = "custom";
341 version_type = "unspecified";
348 static ssize_t kempld_version_show(struct device *dev,
349 struct device_attribute *attr, char *buf)
351 struct kempld_device_data *pld = dev_get_drvdata(dev);
353 return scnprintf(buf, PAGE_SIZE, "%s\n", pld->info.version);
356 static ssize_t kempld_specification_show(struct device *dev,
357 struct device_attribute *attr, char *buf)
359 struct kempld_device_data *pld = dev_get_drvdata(dev);
361 return scnprintf(buf, PAGE_SIZE, "%d.%d\n", pld->info.spec_major,
362 pld->info.spec_minor);
365 static ssize_t kempld_type_show(struct device *dev,
366 struct device_attribute *attr, char *buf)
368 struct kempld_device_data *pld = dev_get_drvdata(dev);
370 return scnprintf(buf, PAGE_SIZE, "%s\n", kempld_get_type_string(pld));
373 static DEVICE_ATTR(pld_version, S_IRUGO, kempld_version_show, NULL);
374 static DEVICE_ATTR(pld_specification, S_IRUGO, kempld_specification_show,
376 static DEVICE_ATTR(pld_type, S_IRUGO, kempld_type_show, NULL);
378 static struct attribute *pld_attributes[] = {
379 &dev_attr_pld_version.attr,
380 &dev_attr_pld_specification.attr,
381 &dev_attr_pld_type.attr,
385 static const struct attribute_group pld_attr_group = {
386 .attrs = pld_attributes,
389 static int kempld_detect_device(struct kempld_device_data *pld)
394 mutex_lock(&pld->lock);
396 /* Check for empty IO space */
397 index_reg = ioread8(pld->io_index);
398 if (index_reg == 0xff && ioread8(pld->io_data) == 0xff) {
399 mutex_unlock(&pld->lock);
403 /* Release hardware mutex if acquired */
404 if (!(index_reg & KEMPLD_MUTEX_KEY)) {
405 iowrite8(KEMPLD_MUTEX_KEY, pld->io_index);
406 /* PXT and COMe-cPC2 boards may require a second release */
407 iowrite8(KEMPLD_MUTEX_KEY, pld->io_index);
410 mutex_unlock(&pld->lock);
412 ret = kempld_get_info(pld);
416 dev_info(pld->dev, "Found Kontron PLD - %s (%s), spec %d.%d\n",
417 pld->info.version, kempld_get_type_string(pld),
418 pld->info.spec_major, pld->info.spec_minor);
420 ret = sysfs_create_group(&pld->dev->kobj, &pld_attr_group);
424 ret = kempld_register_cells(pld);
426 sysfs_remove_group(&pld->dev->kobj, &pld_attr_group);
432 static int kempld_get_acpi_data(struct platform_device *pdev)
434 struct list_head resource_list;
435 struct resource *resources;
436 struct resource_entry *rentry;
437 struct device *dev = &pdev->dev;
438 struct acpi_device *acpi_dev = ACPI_COMPANION(dev);
439 const struct kempld_platform_data *pdata;
443 pdata = acpi_device_get_match_data(dev);
444 ret = platform_device_add_data(pdev, pdata,
445 sizeof(struct kempld_platform_data));
449 INIT_LIST_HEAD(&resource_list);
450 ret = acpi_dev_get_resources(acpi_dev, &resource_list, NULL, NULL);
457 ret = platform_device_add_resources(pdev, pdata->ioresource, 1);
461 resources = devm_kcalloc(&acpi_dev->dev, count, sizeof(*resources),
469 list_for_each_entry(rentry, &resource_list, node) {
470 memcpy(&resources[count], rentry->res,
474 ret = platform_device_add_resources(pdev, resources, count);
477 acpi_dev_free_resource_list(&resource_list);
482 static int kempld_get_acpi_data(struct platform_device *pdev)
486 #endif /* CONFIG_ACPI */
488 static int kempld_probe(struct platform_device *pdev)
490 const struct kempld_platform_data *pdata;
491 struct device *dev = &pdev->dev;
492 struct kempld_device_data *pld;
493 struct resource *ioport;
496 if (kempld_pdev == NULL) {
498 * No kempld_pdev device has been registered in kempld_init,
499 * so we seem to be probing an ACPI platform device.
501 ret = kempld_get_acpi_data(pdev);
505 kempld_acpi_mode = true;
506 } else if (kempld_pdev != pdev) {
508 * The platform device we are probing is not the one we
509 * registered in kempld_init using the DMI table, so this one
511 * As we can only probe one - abort here and use the DMI
514 dev_notice(dev, "platform device exists - not using ACPI\n");
517 pdata = dev_get_platdata(dev);
519 pld = devm_kzalloc(dev, sizeof(*pld), GFP_KERNEL);
523 ioport = platform_get_resource(pdev, IORESOURCE_IO, 0);
527 pld->io_base = devm_ioport_map(dev, ioport->start,
528 resource_size(ioport));
532 pld->io_index = pld->io_base;
533 pld->io_data = pld->io_base + 1;
534 pld->pld_clock = pdata->pld_clock;
537 mutex_init(&pld->lock);
538 platform_set_drvdata(pdev, pld);
540 return kempld_detect_device(pld);
543 static int kempld_remove(struct platform_device *pdev)
545 struct kempld_device_data *pld = platform_get_drvdata(pdev);
546 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
548 sysfs_remove_group(&pld->dev->kobj, &pld_attr_group);
550 mfd_remove_devices(&pdev->dev);
551 pdata->release_hardware_mutex(pld);
557 static const struct acpi_device_id kempld_acpi_table[] = {
558 { "KEM0001", (kernel_ulong_t)&kempld_platform_data_generic },
561 MODULE_DEVICE_TABLE(acpi, kempld_acpi_table);
564 static struct platform_driver kempld_driver = {
567 .acpi_match_table = ACPI_PTR(kempld_acpi_table),
568 .probe_type = PROBE_FORCE_SYNCHRONOUS,
570 .probe = kempld_probe,
571 .remove = kempld_remove,
574 static const struct dmi_system_id kempld_dmi_table[] __initconst = {
578 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
579 DMI_MATCH(DMI_BOARD_NAME, "COMe-bBD"),
581 .driver_data = (void *)&kempld_platform_data_generic,
582 .callback = kempld_create_platform_device,
586 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
587 DMI_MATCH(DMI_BOARD_NAME, "COMe-bBL6"),
589 .driver_data = (void *)&kempld_platform_data_generic,
590 .callback = kempld_create_platform_device,
594 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
595 DMI_MATCH(DMI_BOARD_NAME, "COMe-bHL6"),
597 .driver_data = (void *)&kempld_platform_data_generic,
598 .callback = kempld_create_platform_device,
602 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
603 DMI_MATCH(DMI_BOARD_NAME, "COMe-bKL6"),
605 .driver_data = (void *)&kempld_platform_data_generic,
606 .callback = kempld_create_platform_device,
610 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
611 DMI_MATCH(DMI_BOARD_NAME, "COMe-bSL6"),
613 .driver_data = (void *)&kempld_platform_data_generic,
614 .callback = kempld_create_platform_device,
618 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
619 DMI_MATCH(DMI_BOARD_NAME, "COMe-cAL"),
621 .driver_data = (void *)&kempld_platform_data_generic,
622 .callback = kempld_create_platform_device,
626 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
627 DMI_MATCH(DMI_BOARD_NAME, "COMe-cBL6"),
629 .driver_data = (void *)&kempld_platform_data_generic,
630 .callback = kempld_create_platform_device,
634 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
635 DMI_MATCH(DMI_BOARD_NAME, "COMe-cBW6"),
637 .driver_data = (void *)&kempld_platform_data_generic,
638 .callback = kempld_create_platform_device,
642 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
643 DMI_MATCH(DMI_BOARD_NAME, "COMe-bIP2"),
645 .driver_data = (void *)&kempld_platform_data_generic,
646 .callback = kempld_create_platform_device,
650 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
651 DMI_MATCH(DMI_BOARD_NAME, "COMe-bIP6"),
653 .driver_data = (void *)&kempld_platform_data_generic,
654 .callback = kempld_create_platform_device,
658 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
659 DMI_MATCH(DMI_BOARD_NAME, "COMe-cHL6"),
661 .driver_data = (void *)&kempld_platform_data_generic,
662 .callback = kempld_create_platform_device,
666 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
667 DMI_MATCH(DMI_BOARD_NAME, "ETXexpress-SC T2"),
669 .driver_data = (void *)&kempld_platform_data_generic,
670 .callback = kempld_create_platform_device,
674 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
675 DMI_MATCH(DMI_BOARD_NAME, "ETXe-SC T2"),
677 .driver_data = (void *)&kempld_platform_data_generic,
678 .callback = kempld_create_platform_device,
682 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
683 DMI_MATCH(DMI_BOARD_NAME, "COMe-bSC2"),
685 .driver_data = (void *)&kempld_platform_data_generic,
686 .callback = kempld_create_platform_device,
690 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
691 DMI_MATCH(DMI_BOARD_NAME, "ETXexpress-SC T6"),
693 .driver_data = (void *)&kempld_platform_data_generic,
694 .callback = kempld_create_platform_device,
698 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
699 DMI_MATCH(DMI_BOARD_NAME, "ETXe-SC T6"),
701 .driver_data = (void *)&kempld_platform_data_generic,
702 .callback = kempld_create_platform_device,
706 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
707 DMI_MATCH(DMI_BOARD_NAME, "COMe-bSC6"),
709 .driver_data = (void *)&kempld_platform_data_generic,
710 .callback = kempld_create_platform_device,
714 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
715 DMI_MATCH(DMI_BOARD_NAME, "COMe-cKL6"),
717 .driver_data = (void *)&kempld_platform_data_generic,
718 .callback = kempld_create_platform_device,
722 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
723 DMI_MATCH(DMI_BOARD_NAME, "ETXexpress-PC"),
725 .driver_data = (void *)&kempld_platform_data_generic,
726 .callback = kempld_create_platform_device,
730 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
731 DMI_MATCH(DMI_BOARD_NAME, "COMe-bPC2"),
733 .driver_data = (void *)&kempld_platform_data_generic,
734 .callback = kempld_create_platform_device,
738 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
739 DMI_MATCH(DMI_BOARD_NAME, "PXT"),
741 .driver_data = (void *)&kempld_platform_data_generic,
742 .callback = kempld_create_platform_device,
746 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
747 DMI_MATCH(DMI_BOARD_NAME, "COMe-cSL6"),
749 .driver_data = (void *)&kempld_platform_data_generic,
750 .callback = kempld_create_platform_device,
754 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
755 DMI_MATCH(DMI_BOARD_NAME, "COMe-cBT"),
757 .driver_data = (void *)&kempld_platform_data_generic,
758 .callback = kempld_create_platform_device,
762 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
763 DMI_MATCH(DMI_BIOS_VERSION, "FRI2"),
765 .driver_data = (void *)&kempld_platform_data_generic,
766 .callback = kempld_create_platform_device,
770 DMI_MATCH(DMI_PRODUCT_NAME, "Fish River Island II"),
772 .driver_data = (void *)&kempld_platform_data_generic,
773 .callback = kempld_create_platform_device,
777 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
778 DMI_MATCH(DMI_BOARD_NAME, "COMe-mAL10"),
780 .driver_data = (void *)&kempld_platform_data_generic,
781 .callback = kempld_create_platform_device,
785 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
786 DMI_MATCH(DMI_BOARD_NAME, "ETX-OH"),
788 .driver_data = (void *)&kempld_platform_data_generic,
789 .callback = kempld_create_platform_device,
793 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
794 DMI_MATCH(DMI_BOARD_NAME, "COMe-mBT"),
796 .driver_data = (void *)&kempld_platform_data_generic,
797 .callback = kempld_create_platform_device,
801 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
802 DMI_MATCH(DMI_BOARD_NAME, "nanoETXexpress-TT"),
804 .driver_data = (void *)&kempld_platform_data_generic,
805 .callback = kempld_create_platform_device,
809 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
810 DMI_MATCH(DMI_BOARD_NAME, "nETXe-TT"),
812 .driver_data = (void *)&kempld_platform_data_generic,
813 .callback = kempld_create_platform_device,
817 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
818 DMI_MATCH(DMI_BOARD_NAME, "COMe-mTT"),
820 .driver_data = (void *)&kempld_platform_data_generic,
821 .callback = kempld_create_platform_device,
825 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
826 DMI_MATCH(DMI_BOARD_NAME, "COMe-mCT"),
828 .driver_data = (void *)&kempld_platform_data_generic,
829 .callback = kempld_create_platform_device,
833 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
834 DMI_MATCH(DMI_BOARD_NAME, "microETXexpress-DC"),
836 .driver_data = (void *)&kempld_platform_data_generic,
837 .callback = kempld_create_platform_device,
841 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
842 DMI_MATCH(DMI_BOARD_NAME, "COMe-cDC2"),
844 .driver_data = (void *)&kempld_platform_data_generic,
845 .callback = kempld_create_platform_device,
849 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
850 DMI_MATCH(DMI_BOARD_NAME, "microETXexpress-PC"),
852 .driver_data = (void *)&kempld_platform_data_generic,
853 .callback = kempld_create_platform_device,
857 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
858 DMI_MATCH(DMI_BOARD_NAME, "COMe-cPC2"),
860 .driver_data = (void *)&kempld_platform_data_generic,
861 .callback = kempld_create_platform_device,
865 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
866 DMI_MATCH(DMI_BOARD_NAME, "COMe-cCT6"),
868 .driver_data = (void *)&kempld_platform_data_generic,
869 .callback = kempld_create_platform_device,
874 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
875 DMI_MATCH(DMI_BOARD_NAME, "COMe-cTH6"),
877 .driver_data = (void *)&kempld_platform_data_generic,
878 .callback = kempld_create_platform_device,
882 MODULE_DEVICE_TABLE(dmi, kempld_dmi_table);
884 static int __init kempld_init(void)
886 const struct dmi_system_id *id;
889 if (force_device_id[0]) {
890 for (id = kempld_dmi_table;
891 id->matches[0].slot != DMI_NONE; id++)
892 if (strstr(id->ident, force_device_id))
893 if (id->callback && !id->callback(id))
895 if (id->matches[0].slot == DMI_NONE)
899 ret = platform_driver_register(&kempld_driver);
904 * With synchronous probing the device should already be probed now.
905 * If no device id is forced and also no ACPI definition for the
906 * device was found, scan DMI table as fallback.
908 * If drivers_autoprobing is disabled and the device is found here,
909 * only that device can be bound manually later.
911 if (!kempld_pdev && !kempld_acpi_mode)
912 dmi_check_system(kempld_dmi_table);
917 static void __exit kempld_exit(void)
920 platform_device_unregister(kempld_pdev);
922 platform_driver_unregister(&kempld_driver);
925 module_init(kempld_init);
926 module_exit(kempld_exit);
928 MODULE_DESCRIPTION("KEM PLD Core Driver");
929 MODULE_AUTHOR("Michael Brunner <michael.brunner@kontron.com>");
930 MODULE_LICENSE("GPL");
931 MODULE_ALIAS("platform:kempld-core");