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;
129 static int kempld_create_platform_device(const struct dmi_system_id *id)
131 const struct kempld_platform_data *pdata = id->driver_data;
134 kempld_pdev = platform_device_alloc("kempld", -1);
138 ret = platform_device_add_data(kempld_pdev, pdata, sizeof(*pdata));
142 ret = platform_device_add_resources(kempld_pdev, pdata->ioresource, 1);
146 ret = platform_device_add(kempld_pdev);
152 platform_device_put(kempld_pdev);
157 * kempld_read8 - read 8 bit register
158 * @pld: kempld_device_data structure describing the PLD
159 * @index: register index on the chip
161 * kempld_get_mutex must be called prior to calling this function.
163 u8 kempld_read8(struct kempld_device_data *pld, u8 index)
165 iowrite8(index, pld->io_index);
166 return ioread8(pld->io_data);
168 EXPORT_SYMBOL_GPL(kempld_read8);
171 * kempld_write8 - write 8 bit register
172 * @pld: kempld_device_data structure describing the PLD
173 * @index: register index on the chip
174 * @data: new register value
176 * kempld_get_mutex must be called prior to calling this function.
178 void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data)
180 iowrite8(index, pld->io_index);
181 iowrite8(data, pld->io_data);
183 EXPORT_SYMBOL_GPL(kempld_write8);
186 * kempld_read16 - read 16 bit register
187 * @pld: kempld_device_data structure describing the PLD
188 * @index: register index on the chip
190 * kempld_get_mutex must be called prior to calling this function.
192 u16 kempld_read16(struct kempld_device_data *pld, u8 index)
194 return kempld_read8(pld, index) | kempld_read8(pld, index + 1) << 8;
196 EXPORT_SYMBOL_GPL(kempld_read16);
199 * kempld_write16 - write 16 bit register
200 * @pld: kempld_device_data structure describing the PLD
201 * @index: register index on the chip
202 * @data: new register value
204 * kempld_get_mutex must be called prior to calling this function.
206 void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data)
208 kempld_write8(pld, index, (u8)data);
209 kempld_write8(pld, index + 1, (u8)(data >> 8));
211 EXPORT_SYMBOL_GPL(kempld_write16);
214 * kempld_read32 - read 32 bit register
215 * @pld: kempld_device_data structure describing the PLD
216 * @index: register index on the chip
218 * kempld_get_mutex must be called prior to calling this function.
220 u32 kempld_read32(struct kempld_device_data *pld, u8 index)
222 return kempld_read16(pld, index) | kempld_read16(pld, index + 2) << 16;
224 EXPORT_SYMBOL_GPL(kempld_read32);
227 * kempld_write32 - write 32 bit register
228 * @pld: kempld_device_data structure describing the PLD
229 * @index: register index on the chip
230 * @data: new register value
232 * kempld_get_mutex must be called prior to calling this function.
234 void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data)
236 kempld_write16(pld, index, (u16)data);
237 kempld_write16(pld, index + 2, (u16)(data >> 16));
239 EXPORT_SYMBOL_GPL(kempld_write32);
242 * kempld_get_mutex - acquire PLD mutex
243 * @pld: kempld_device_data structure describing the PLD
245 void kempld_get_mutex(struct kempld_device_data *pld)
247 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
249 mutex_lock(&pld->lock);
250 pdata->get_hardware_mutex(pld);
252 EXPORT_SYMBOL_GPL(kempld_get_mutex);
255 * kempld_release_mutex - release PLD mutex
256 * @pld: kempld_device_data structure describing the PLD
258 void kempld_release_mutex(struct kempld_device_data *pld)
260 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
262 pdata->release_hardware_mutex(pld);
263 mutex_unlock(&pld->lock);
265 EXPORT_SYMBOL_GPL(kempld_release_mutex);
268 * kempld_get_info - update device specific information
269 * @pld: kempld_device_data structure describing the PLD
271 * This function calls the configured board specific kempld_get_info_XXXX
272 * function which is responsible for gathering information about the specific
273 * hardware. The information is then stored within the pld structure.
275 static int kempld_get_info(struct kempld_device_data *pld)
278 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
281 ret = pdata->get_info(pld);
285 /* The Kontron PLD firmware version string has the following format:
288 * w: PLD number - 1 hex digit
289 * x: Major version - 1 alphanumerical digit (0-9A-V)
290 * y: Minor version - 1 alphanumerical digit (0-9A-V)
291 * zzzz: Build number - 4 zero padded hex digits */
293 if (pld->info.major < 10)
294 major = pld->info.major + '0';
296 major = (pld->info.major - 10) + 'A';
297 if (pld->info.minor < 10)
298 minor = pld->info.minor + '0';
300 minor = (pld->info.minor - 10) + 'A';
302 ret = scnprintf(pld->info.version, sizeof(pld->info.version),
303 "P%X%c%c.%04X", pld->info.number, major, minor,
312 * kempld_register_cells - register cell drivers
314 * This function registers cell drivers for the detected hardware by calling
315 * the configured kempld_register_cells_XXXX function which is responsible
316 * to detect and register the needed cell drivers.
318 static int kempld_register_cells(struct kempld_device_data *pld)
320 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
322 return pdata->register_cells(pld);
325 static const char *kempld_get_type_string(struct kempld_device_data *pld)
327 const char *version_type;
329 switch (pld->info.type) {
331 version_type = "release";
334 version_type = "debug";
337 version_type = "custom";
340 version_type = "unspecified";
347 static ssize_t pld_version_show(struct device *dev,
348 struct device_attribute *attr, char *buf)
350 struct kempld_device_data *pld = dev_get_drvdata(dev);
352 return sysfs_emit(buf, "%s\n", pld->info.version);
355 static ssize_t pld_specification_show(struct device *dev,
356 struct device_attribute *attr, char *buf)
358 struct kempld_device_data *pld = dev_get_drvdata(dev);
360 return sysfs_emit(buf, "%d.%d\n", pld->info.spec_major, pld->info.spec_minor);
363 static ssize_t pld_type_show(struct device *dev,
364 struct device_attribute *attr, char *buf)
366 struct kempld_device_data *pld = dev_get_drvdata(dev);
368 return sysfs_emit(buf, "%s\n", kempld_get_type_string(pld));
371 static DEVICE_ATTR_RO(pld_version);
372 static DEVICE_ATTR_RO(pld_specification);
373 static DEVICE_ATTR_RO(pld_type);
375 static struct attribute *pld_attributes[] = {
376 &dev_attr_pld_version.attr,
377 &dev_attr_pld_specification.attr,
378 &dev_attr_pld_type.attr,
382 static const struct attribute_group pld_attr_group = {
383 .attrs = pld_attributes,
386 static int kempld_detect_device(struct kempld_device_data *pld)
391 mutex_lock(&pld->lock);
393 /* Check for empty IO space */
394 index_reg = ioread8(pld->io_index);
395 if (index_reg == 0xff && ioread8(pld->io_data) == 0xff) {
396 mutex_unlock(&pld->lock);
400 /* Release hardware mutex if acquired */
401 if (!(index_reg & KEMPLD_MUTEX_KEY)) {
402 iowrite8(KEMPLD_MUTEX_KEY, pld->io_index);
403 /* PXT and COMe-cPC2 boards may require a second release */
404 iowrite8(KEMPLD_MUTEX_KEY, pld->io_index);
407 mutex_unlock(&pld->lock);
409 ret = kempld_get_info(pld);
413 dev_info(pld->dev, "Found Kontron PLD - %s (%s), spec %d.%d\n",
414 pld->info.version, kempld_get_type_string(pld),
415 pld->info.spec_major, pld->info.spec_minor);
417 ret = sysfs_create_group(&pld->dev->kobj, &pld_attr_group);
421 ret = kempld_register_cells(pld);
423 sysfs_remove_group(&pld->dev->kobj, &pld_attr_group);
429 static int kempld_get_acpi_data(struct platform_device *pdev)
431 struct list_head resource_list;
432 struct resource *resources;
433 struct resource_entry *rentry;
434 struct device *dev = &pdev->dev;
435 struct acpi_device *acpi_dev = ACPI_COMPANION(dev);
436 const struct kempld_platform_data *pdata;
440 pdata = acpi_device_get_match_data(dev);
441 ret = platform_device_add_data(pdev, pdata,
442 sizeof(struct kempld_platform_data));
446 INIT_LIST_HEAD(&resource_list);
447 ret = acpi_dev_get_resources(acpi_dev, &resource_list, NULL, NULL);
454 ret = platform_device_add_resources(pdev, pdata->ioresource, 1);
458 resources = devm_kcalloc(&acpi_dev->dev, count, sizeof(*resources),
466 list_for_each_entry(rentry, &resource_list, node) {
467 memcpy(&resources[count], rentry->res,
471 ret = platform_device_add_resources(pdev, resources, count);
474 acpi_dev_free_resource_list(&resource_list);
479 static int kempld_get_acpi_data(struct platform_device *pdev)
483 #endif /* CONFIG_ACPI */
485 static int kempld_probe(struct platform_device *pdev)
487 const struct kempld_platform_data *pdata;
488 struct device *dev = &pdev->dev;
489 struct kempld_device_data *pld;
490 struct resource *ioport;
493 if (kempld_pdev == NULL) {
495 * No kempld_pdev device has been registered in kempld_init,
496 * so we seem to be probing an ACPI platform device.
498 ret = kempld_get_acpi_data(pdev);
501 } else if (kempld_pdev != pdev) {
503 * The platform device we are probing is not the one we
504 * registered in kempld_init using the DMI table, so this one
506 * As we can only probe one - abort here and use the DMI
509 dev_notice(dev, "platform device exists - not using ACPI\n");
512 pdata = dev_get_platdata(dev);
514 pld = devm_kzalloc(dev, sizeof(*pld), GFP_KERNEL);
518 ioport = platform_get_resource(pdev, IORESOURCE_IO, 0);
522 pld->io_base = devm_ioport_map(dev, ioport->start,
523 resource_size(ioport));
527 pld->io_index = pld->io_base;
528 pld->io_data = pld->io_base + 1;
529 pld->pld_clock = pdata->pld_clock;
532 mutex_init(&pld->lock);
533 platform_set_drvdata(pdev, pld);
535 return kempld_detect_device(pld);
538 static void kempld_remove(struct platform_device *pdev)
540 struct kempld_device_data *pld = platform_get_drvdata(pdev);
541 const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev);
543 sysfs_remove_group(&pld->dev->kobj, &pld_attr_group);
545 mfd_remove_devices(&pdev->dev);
546 pdata->release_hardware_mutex(pld);
550 static const struct acpi_device_id kempld_acpi_table[] = {
551 { "KEM0000", (kernel_ulong_t)&kempld_platform_data_generic },
552 { "KEM0001", (kernel_ulong_t)&kempld_platform_data_generic },
555 MODULE_DEVICE_TABLE(acpi, kempld_acpi_table);
558 static struct platform_driver kempld_driver = {
561 .acpi_match_table = ACPI_PTR(kempld_acpi_table),
563 .probe = kempld_probe,
564 .remove_new = kempld_remove,
567 static const struct dmi_system_id kempld_dmi_table[] __initconst = {
571 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
572 DMI_MATCH(DMI_BOARD_NAME, "COMe-bBD"),
574 .driver_data = (void *)&kempld_platform_data_generic,
575 .callback = kempld_create_platform_device,
579 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
580 DMI_MATCH(DMI_BOARD_NAME, "COMe-bBL6"),
582 .driver_data = (void *)&kempld_platform_data_generic,
583 .callback = kempld_create_platform_device,
587 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
588 DMI_MATCH(DMI_BOARD_NAME, "COMe-bDV7"),
590 .driver_data = (void *)&kempld_platform_data_generic,
591 .callback = kempld_create_platform_device,
595 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
596 DMI_MATCH(DMI_BOARD_NAME, "COMe-bHL6"),
598 .driver_data = (void *)&kempld_platform_data_generic,
599 .callback = kempld_create_platform_device,
603 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
604 DMI_MATCH(DMI_BOARD_NAME, "COMe-bKL6"),
606 .driver_data = (void *)&kempld_platform_data_generic,
607 .callback = kempld_create_platform_device,
611 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
612 DMI_MATCH(DMI_BOARD_NAME, "COMe-bSL6"),
614 .driver_data = (void *)&kempld_platform_data_generic,
615 .callback = kempld_create_platform_device,
619 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
620 DMI_MATCH(DMI_BOARD_NAME, "COMe-cAL"),
622 .driver_data = (void *)&kempld_platform_data_generic,
623 .callback = kempld_create_platform_device,
627 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
628 DMI_MATCH(DMI_BOARD_NAME, "COMe-cBL6"),
630 .driver_data = (void *)&kempld_platform_data_generic,
631 .callback = kempld_create_platform_device,
635 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
636 DMI_MATCH(DMI_BOARD_NAME, "COMe-cBW6"),
638 .driver_data = (void *)&kempld_platform_data_generic,
639 .callback = kempld_create_platform_device,
643 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
644 DMI_MATCH(DMI_BOARD_NAME, "COMe-bIP2"),
646 .driver_data = (void *)&kempld_platform_data_generic,
647 .callback = kempld_create_platform_device,
651 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
652 DMI_MATCH(DMI_BOARD_NAME, "COMe-bIP6"),
654 .driver_data = (void *)&kempld_platform_data_generic,
655 .callback = kempld_create_platform_device,
659 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
660 DMI_MATCH(DMI_BOARD_NAME, "COMe-cDV7"),
662 .driver_data = (void *)&kempld_platform_data_generic,
663 .callback = kempld_create_platform_device,
667 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
668 DMI_MATCH(DMI_BOARD_NAME, "COMe-cHL6"),
670 .driver_data = (void *)&kempld_platform_data_generic,
671 .callback = kempld_create_platform_device,
675 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
676 DMI_MATCH(DMI_BOARD_NAME, "ETXexpress-SC T2"),
678 .driver_data = (void *)&kempld_platform_data_generic,
679 .callback = kempld_create_platform_device,
683 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
684 DMI_MATCH(DMI_BOARD_NAME, "ETXe-SC T2"),
686 .driver_data = (void *)&kempld_platform_data_generic,
687 .callback = kempld_create_platform_device,
691 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
692 DMI_MATCH(DMI_BOARD_NAME, "COMe-bSC2"),
694 .driver_data = (void *)&kempld_platform_data_generic,
695 .callback = kempld_create_platform_device,
699 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
700 DMI_MATCH(DMI_BOARD_NAME, "ETXexpress-SC T6"),
702 .driver_data = (void *)&kempld_platform_data_generic,
703 .callback = kempld_create_platform_device,
707 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
708 DMI_MATCH(DMI_BOARD_NAME, "ETXe-SC T6"),
710 .driver_data = (void *)&kempld_platform_data_generic,
711 .callback = kempld_create_platform_device,
715 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
716 DMI_MATCH(DMI_BOARD_NAME, "COMe-bSC6"),
718 .driver_data = (void *)&kempld_platform_data_generic,
719 .callback = kempld_create_platform_device,
723 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
724 DMI_MATCH(DMI_BOARD_NAME, "COMe-cKL6"),
726 .driver_data = (void *)&kempld_platform_data_generic,
727 .callback = kempld_create_platform_device,
731 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
732 DMI_MATCH(DMI_BOARD_NAME, "ETXexpress-PC"),
734 .driver_data = (void *)&kempld_platform_data_generic,
735 .callback = kempld_create_platform_device,
739 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
740 DMI_MATCH(DMI_BOARD_NAME, "COMe-bPC2"),
742 .driver_data = (void *)&kempld_platform_data_generic,
743 .callback = kempld_create_platform_device,
747 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
748 DMI_MATCH(DMI_BOARD_NAME, "PXT"),
750 .driver_data = (void *)&kempld_platform_data_generic,
751 .callback = kempld_create_platform_device,
755 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
756 DMI_MATCH(DMI_BOARD_NAME, "COMe-cSL6"),
758 .driver_data = (void *)&kempld_platform_data_generic,
759 .callback = kempld_create_platform_device,
763 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
764 DMI_MATCH(DMI_BOARD_NAME, "COMe-cBT"),
766 .driver_data = (void *)&kempld_platform_data_generic,
767 .callback = kempld_create_platform_device,
771 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
772 DMI_MATCH(DMI_BIOS_VERSION, "FRI2"),
774 .driver_data = (void *)&kempld_platform_data_generic,
775 .callback = kempld_create_platform_device,
779 DMI_MATCH(DMI_PRODUCT_NAME, "Fish River Island II"),
781 .driver_data = (void *)&kempld_platform_data_generic,
782 .callback = kempld_create_platform_device,
786 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
787 DMI_MATCH(DMI_BOARD_NAME, "KBox A-203"),
789 .driver_data = (void *)&kempld_platform_data_generic,
790 .callback = kempld_create_platform_device,
794 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
795 DMI_MATCH(DMI_BOARD_NAME, "COMe-m4AL"),
797 .driver_data = (void *)&kempld_platform_data_generic,
798 .callback = kempld_create_platform_device,
802 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
803 DMI_MATCH(DMI_BOARD_NAME, "COMe-mAL10"),
805 .driver_data = (void *)&kempld_platform_data_generic,
806 .callback = kempld_create_platform_device,
810 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
811 DMI_MATCH(DMI_BOARD_NAME, "mITX-APL"),
813 .driver_data = (void *)&kempld_platform_data_generic,
814 .callback = kempld_create_platform_device,
818 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
819 DMI_MATCH(DMI_BOARD_NAME, "ETX-OH"),
821 .driver_data = (void *)&kempld_platform_data_generic,
822 .callback = kempld_create_platform_device,
826 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
827 DMI_MATCH(DMI_BOARD_NAME, "COMe-mBT"),
829 .driver_data = (void *)&kempld_platform_data_generic,
830 .callback = kempld_create_platform_device,
834 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
835 DMI_MATCH(DMI_BOARD_NAME, "nanoETXexpress-TT"),
837 .driver_data = (void *)&kempld_platform_data_generic,
838 .callback = kempld_create_platform_device,
842 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
843 DMI_MATCH(DMI_BOARD_NAME, "nETXe-TT"),
845 .driver_data = (void *)&kempld_platform_data_generic,
846 .callback = kempld_create_platform_device,
850 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
851 DMI_MATCH(DMI_BOARD_NAME, "COMe-mTT"),
853 .driver_data = (void *)&kempld_platform_data_generic,
854 .callback = kempld_create_platform_device,
858 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
859 DMI_MATCH(DMI_BOARD_NAME, "COMe-mCT"),
861 .driver_data = (void *)&kempld_platform_data_generic,
862 .callback = kempld_create_platform_device,
866 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
867 DMI_MATCH(DMI_BOARD_NAME, "pITX-APL"),
869 .driver_data = (void *)&kempld_platform_data_generic,
870 .callback = kempld_create_platform_device,
874 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
875 DMI_MATCH(DMI_BOARD_NAME, "SMARC-sXAL"),
877 .driver_data = (void *)&kempld_platform_data_generic,
878 .callback = kempld_create_platform_device,
882 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
883 DMI_MATCH(DMI_BOARD_NAME, "SMARC-sXA4"),
885 .driver_data = (void *)&kempld_platform_data_generic,
886 .callback = kempld_create_platform_device,
890 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
891 DMI_MATCH(DMI_BOARD_NAME, "microETXexpress-DC"),
893 .driver_data = (void *)&kempld_platform_data_generic,
894 .callback = kempld_create_platform_device,
898 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
899 DMI_MATCH(DMI_BOARD_NAME, "COMe-cDC2"),
901 .driver_data = (void *)&kempld_platform_data_generic,
902 .callback = kempld_create_platform_device,
906 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
907 DMI_MATCH(DMI_BOARD_NAME, "microETXexpress-PC"),
909 .driver_data = (void *)&kempld_platform_data_generic,
910 .callback = kempld_create_platform_device,
914 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
915 DMI_MATCH(DMI_BOARD_NAME, "COMe-cPC2"),
917 .driver_data = (void *)&kempld_platform_data_generic,
918 .callback = kempld_create_platform_device,
922 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
923 DMI_MATCH(DMI_BOARD_NAME, "COMe-cCT6"),
925 .driver_data = (void *)&kempld_platform_data_generic,
926 .callback = kempld_create_platform_device,
930 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
931 DMI_MATCH(DMI_BOARD_NAME, "COMe-cTH6"),
933 .driver_data = (void *)&kempld_platform_data_generic,
934 .callback = kempld_create_platform_device,
938 DMI_MATCH(DMI_BOARD_VENDOR, "Kontron"),
939 DMI_MATCH(DMI_BOARD_NAME, "Qseven-Q7AL"),
941 .driver_data = (void *)&kempld_platform_data_generic,
942 .callback = kempld_create_platform_device,
946 MODULE_DEVICE_TABLE(dmi, kempld_dmi_table);
948 static int __init kempld_init(void)
950 const struct dmi_system_id *id;
952 if (force_device_id[0]) {
953 for (id = kempld_dmi_table;
954 id->matches[0].slot != DMI_NONE; id++)
955 if (strstr(id->ident, force_device_id))
956 if (id->callback && !id->callback(id))
958 if (id->matches[0].slot == DMI_NONE)
961 dmi_check_system(kempld_dmi_table);
964 return platform_driver_register(&kempld_driver);
967 static void __exit kempld_exit(void)
970 platform_device_unregister(kempld_pdev);
972 platform_driver_unregister(&kempld_driver);
975 module_init(kempld_init);
976 module_exit(kempld_exit);
978 MODULE_DESCRIPTION("KEM PLD Core Driver");
979 MODULE_AUTHOR("Michael Brunner <michael.brunner@kontron.com>");
980 MODULE_LICENSE("GPL");
981 MODULE_ALIAS("platform:kempld-core");