2 * Kontron PLD MFD core driver
4 * Copyright (c) 2010-2013 Kontron Europe GmbH
5 * Author: Michael Brunner <michael.brunner@kontron.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License 2 as published
9 * by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <linux/platform_device.h>
18 #include <linux/mfd/core.h>
19 #include <linux/mfd/kempld.h>
20 #include <linux/module.h>
21 #include <linux/dmi.h>
23 #include <linux/delay.h>
26 static char force_device_id
[MAX_ID_LEN
+ 1] = "";
27 module_param_string(force_device_id
, force_device_id
,
28 sizeof(force_device_id
), 0);
29 MODULE_PARM_DESC(force_device_id
, "Override detected product");
32 * Get hardware mutex to block firmware from accessing the pld.
33 * It is possible for the firmware may hold the mutex for an extended length of
34 * time. This function will block until access has been granted.
36 static void kempld_get_hardware_mutex(struct kempld_device_data
*pld
)
38 /* The mutex bit will read 1 until access has been granted */
39 while (ioread8(pld
->io_index
) & KEMPLD_MUTEX_KEY
)
40 usleep_range(1000, 3000);
43 static void kempld_release_hardware_mutex(struct kempld_device_data
*pld
)
45 /* The harware mutex is released when 1 is written to the mutex bit. */
46 iowrite8(KEMPLD_MUTEX_KEY
, pld
->io_index
);
49 static int kempld_get_info_generic(struct kempld_device_data
*pld
)
54 kempld_get_mutex(pld
);
56 version
= kempld_read16(pld
, KEMPLD_VERSION
);
57 spec
= kempld_read8(pld
, KEMPLD_SPEC
);
58 pld
->info
.buildnr
= kempld_read16(pld
, KEMPLD_BUILDNR
);
60 pld
->info
.minor
= KEMPLD_VERSION_GET_MINOR(version
);
61 pld
->info
.major
= KEMPLD_VERSION_GET_MAJOR(version
);
62 pld
->info
.number
= KEMPLD_VERSION_GET_NUMBER(version
);
63 pld
->info
.type
= KEMPLD_VERSION_GET_TYPE(version
);
66 pld
->info
.spec_minor
= 0;
67 pld
->info
.spec_major
= 1;
69 pld
->info
.spec_minor
= KEMPLD_SPEC_GET_MINOR(spec
);
70 pld
->info
.spec_major
= KEMPLD_SPEC_GET_MAJOR(spec
);
73 if (pld
->info
.spec_major
> 0)
74 pld
->feature_mask
= kempld_read16(pld
, KEMPLD_FEATURE
);
76 pld
->feature_mask
= 0;
78 kempld_release_mutex(pld
);
90 static const struct mfd_cell kempld_devs
[] = {
98 .name
= "kempld-gpio",
101 .name
= "kempld-uart",
105 #define KEMPLD_MAX_DEVS ARRAY_SIZE(kempld_devs)
107 static int kempld_register_cells_generic(struct kempld_device_data
*pld
)
109 struct mfd_cell devs
[KEMPLD_MAX_DEVS
];
112 if (pld
->feature_mask
& KEMPLD_FEATURE_BIT_I2C
)
113 devs
[i
++] = kempld_devs
[KEMPLD_I2C
];
115 if (pld
->feature_mask
& KEMPLD_FEATURE_BIT_WATCHDOG
)
116 devs
[i
++] = kempld_devs
[KEMPLD_WDT
];
118 if (pld
->feature_mask
& KEMPLD_FEATURE_BIT_GPIO
)
119 devs
[i
++] = kempld_devs
[KEMPLD_GPIO
];
121 if (pld
->feature_mask
& KEMPLD_FEATURE_MASK_UART
)
122 devs
[i
++] = kempld_devs
[KEMPLD_UART
];
124 return mfd_add_devices(pld
->dev
, -1, devs
, i
, NULL
, 0, NULL
);
127 static struct resource kempld_ioresource
= {
128 .start
= KEMPLD_IOINDEX
,
129 .end
= KEMPLD_IODATA
,
130 .flags
= IORESOURCE_IO
,
133 static const struct kempld_platform_data kempld_platform_data_generic
= {
134 .pld_clock
= KEMPLD_CLK
,
135 .ioresource
= &kempld_ioresource
,
136 .get_hardware_mutex
= kempld_get_hardware_mutex
,
137 .release_hardware_mutex
= kempld_release_hardware_mutex
,
138 .get_info
= kempld_get_info_generic
,
139 .register_cells
= kempld_register_cells_generic
,
142 static struct platform_device
*kempld_pdev
;
144 static int kempld_create_platform_device(const struct dmi_system_id
*id
)
146 const struct kempld_platform_data
*pdata
= id
->driver_data
;
149 kempld_pdev
= platform_device_alloc("kempld", -1);
153 ret
= platform_device_add_data(kempld_pdev
, pdata
, sizeof(*pdata
));
157 ret
= platform_device_add_resources(kempld_pdev
, pdata
->ioresource
, 1);
161 ret
= platform_device_add(kempld_pdev
);
167 platform_device_put(kempld_pdev
);
172 * kempld_read8 - read 8 bit register
173 * @pld: kempld_device_data structure describing the PLD
174 * @index: register index on the chip
176 * kempld_get_mutex must be called prior to calling this function.
178 u8
kempld_read8(struct kempld_device_data
*pld
, u8 index
)
180 iowrite8(index
, pld
->io_index
);
181 return ioread8(pld
->io_data
);
183 EXPORT_SYMBOL_GPL(kempld_read8
);
186 * kempld_write8 - write 8 bit register
187 * @pld: kempld_device_data structure describing the PLD
188 * @index: register index on the chip
189 * @data: new register value
191 * kempld_get_mutex must be called prior to calling this function.
193 void kempld_write8(struct kempld_device_data
*pld
, u8 index
, u8 data
)
195 iowrite8(index
, pld
->io_index
);
196 iowrite8(data
, pld
->io_data
);
198 EXPORT_SYMBOL_GPL(kempld_write8
);
201 * kempld_read16 - read 16 bit register
202 * @pld: kempld_device_data structure describing the PLD
203 * @index: register index on the chip
205 * kempld_get_mutex must be called prior to calling this function.
207 u16
kempld_read16(struct kempld_device_data
*pld
, u8 index
)
209 return kempld_read8(pld
, index
) | kempld_read8(pld
, index
+ 1) << 8;
211 EXPORT_SYMBOL_GPL(kempld_read16
);
214 * kempld_write16 - write 16 bit register
215 * @pld: kempld_device_data structure describing the PLD
216 * @index: register index on the chip
217 * @data: new register value
219 * kempld_get_mutex must be called prior to calling this function.
221 void kempld_write16(struct kempld_device_data
*pld
, u8 index
, u16 data
)
223 kempld_write8(pld
, index
, (u8
)data
);
224 kempld_write8(pld
, index
+ 1, (u8
)(data
>> 8));
226 EXPORT_SYMBOL_GPL(kempld_write16
);
229 * kempld_read32 - read 32 bit register
230 * @pld: kempld_device_data structure describing the PLD
231 * @index: register index on the chip
233 * kempld_get_mutex must be called prior to calling this function.
235 u32
kempld_read32(struct kempld_device_data
*pld
, u8 index
)
237 return kempld_read16(pld
, index
) | kempld_read16(pld
, index
+ 2) << 16;
239 EXPORT_SYMBOL_GPL(kempld_read32
);
242 * kempld_write32 - write 32 bit register
243 * @pld: kempld_device_data structure describing the PLD
244 * @index: register index on the chip
245 * @data: new register value
247 * kempld_get_mutex must be called prior to calling this function.
249 void kempld_write32(struct kempld_device_data
*pld
, u8 index
, u32 data
)
251 kempld_write16(pld
, index
, (u16
)data
);
252 kempld_write16(pld
, index
+ 2, (u16
)(data
>> 16));
254 EXPORT_SYMBOL_GPL(kempld_write32
);
257 * kempld_get_mutex - acquire PLD mutex
258 * @pld: kempld_device_data structure describing the PLD
260 void kempld_get_mutex(struct kempld_device_data
*pld
)
262 const struct kempld_platform_data
*pdata
= dev_get_platdata(pld
->dev
);
264 mutex_lock(&pld
->lock
);
265 pdata
->get_hardware_mutex(pld
);
267 EXPORT_SYMBOL_GPL(kempld_get_mutex
);
270 * kempld_release_mutex - release PLD mutex
271 * @pld: kempld_device_data structure describing the PLD
273 void kempld_release_mutex(struct kempld_device_data
*pld
)
275 const struct kempld_platform_data
*pdata
= dev_get_platdata(pld
->dev
);
277 pdata
->release_hardware_mutex(pld
);
278 mutex_unlock(&pld
->lock
);
280 EXPORT_SYMBOL_GPL(kempld_release_mutex
);
283 * kempld_get_info - update device specific information
284 * @pld: kempld_device_data structure describing the PLD
286 * This function calls the configured board specific kempld_get_info_XXXX
287 * function which is responsible for gathering information about the specific
288 * hardware. The information is then stored within the pld structure.
290 static int kempld_get_info(struct kempld_device_data
*pld
)
293 const struct kempld_platform_data
*pdata
= dev_get_platdata(pld
->dev
);
296 ret
= pdata
->get_info(pld
);
300 /* The Kontron PLD firmware version string has the following format:
303 * w: PLD number - 1 hex digit
304 * x: Major version - 1 alphanumerical digit (0-9A-V)
305 * y: Minor version - 1 alphanumerical digit (0-9A-V)
306 * zzzz: Build number - 4 zero padded hex digits */
308 if (pld
->info
.major
< 10)
309 major
= pld
->info
.major
+ '0';
311 major
= (pld
->info
.major
- 10) + 'A';
312 if (pld
->info
.minor
< 10)
313 minor
= pld
->info
.minor
+ '0';
315 minor
= (pld
->info
.minor
- 10) + 'A';
317 ret
= scnprintf(pld
->info
.version
, sizeof(pld
->info
.version
),
318 "P%X%c%c.%04X", pld
->info
.number
, major
, minor
,
327 * kempld_register_cells - register cell drivers
329 * This function registers cell drivers for the detected hardware by calling
330 * the configured kempld_register_cells_XXXX function which is responsible
331 * to detect and register the needed cell drivers.
333 static int kempld_register_cells(struct kempld_device_data
*pld
)
335 const struct kempld_platform_data
*pdata
= dev_get_platdata(pld
->dev
);
337 return pdata
->register_cells(pld
);
340 static const char *kempld_get_type_string(struct kempld_device_data
*pld
)
342 const char *version_type
;
344 switch (pld
->info
.type
) {
346 version_type
= "release";
349 version_type
= "debug";
352 version_type
= "custom";
355 version_type
= "unspecified";
362 static ssize_t
kempld_version_show(struct device
*dev
,
363 struct device_attribute
*attr
, char *buf
)
365 struct kempld_device_data
*pld
= dev_get_drvdata(dev
);
367 return scnprintf(buf
, PAGE_SIZE
, "%s\n", pld
->info
.version
);
370 static ssize_t
kempld_specification_show(struct device
*dev
,
371 struct device_attribute
*attr
, char *buf
)
373 struct kempld_device_data
*pld
= dev_get_drvdata(dev
);
375 return scnprintf(buf
, PAGE_SIZE
, "%d.%d\n", pld
->info
.spec_major
,
376 pld
->info
.spec_minor
);
379 static ssize_t
kempld_type_show(struct device
*dev
,
380 struct device_attribute
*attr
, char *buf
)
382 struct kempld_device_data
*pld
= dev_get_drvdata(dev
);
384 return scnprintf(buf
, PAGE_SIZE
, "%s\n", kempld_get_type_string(pld
));
387 static DEVICE_ATTR(pld_version
, S_IRUGO
, kempld_version_show
, NULL
);
388 static DEVICE_ATTR(pld_specification
, S_IRUGO
, kempld_specification_show
,
390 static DEVICE_ATTR(pld_type
, S_IRUGO
, kempld_type_show
, NULL
);
392 static struct attribute
*pld_attributes
[] = {
393 &dev_attr_pld_version
.attr
,
394 &dev_attr_pld_specification
.attr
,
395 &dev_attr_pld_type
.attr
,
399 static const struct attribute_group pld_attr_group
= {
400 .attrs
= pld_attributes
,
403 static int kempld_detect_device(struct kempld_device_data
*pld
)
408 mutex_lock(&pld
->lock
);
410 /* Check for empty IO space */
411 index_reg
= ioread8(pld
->io_index
);
412 if (index_reg
== 0xff && ioread8(pld
->io_data
) == 0xff) {
413 mutex_unlock(&pld
->lock
);
417 /* Release hardware mutex if acquired */
418 if (!(index_reg
& KEMPLD_MUTEX_KEY
)) {
419 iowrite8(KEMPLD_MUTEX_KEY
, pld
->io_index
);
420 /* PXT and COMe-cPC2 boards may require a second release */
421 iowrite8(KEMPLD_MUTEX_KEY
, pld
->io_index
);
424 mutex_unlock(&pld
->lock
);
426 ret
= kempld_get_info(pld
);
430 dev_info(pld
->dev
, "Found Kontron PLD - %s (%s), spec %d.%d\n",
431 pld
->info
.version
, kempld_get_type_string(pld
),
432 pld
->info
.spec_major
, pld
->info
.spec_minor
);
434 ret
= sysfs_create_group(&pld
->dev
->kobj
, &pld_attr_group
);
438 ret
= kempld_register_cells(pld
);
440 sysfs_remove_group(&pld
->dev
->kobj
, &pld_attr_group
);
445 static int kempld_probe(struct platform_device
*pdev
)
447 const struct kempld_platform_data
*pdata
=
448 dev_get_platdata(&pdev
->dev
);
449 struct device
*dev
= &pdev
->dev
;
450 struct kempld_device_data
*pld
;
451 struct resource
*ioport
;
453 pld
= devm_kzalloc(dev
, sizeof(*pld
), GFP_KERNEL
);
457 ioport
= platform_get_resource(pdev
, IORESOURCE_IO
, 0);
461 pld
->io_base
= devm_ioport_map(dev
, ioport
->start
,
462 resource_size(ioport
));
466 pld
->io_index
= pld
->io_base
;
467 pld
->io_data
= pld
->io_base
+ 1;
468 pld
->pld_clock
= pdata
->pld_clock
;
471 mutex_init(&pld
->lock
);
472 platform_set_drvdata(pdev
, pld
);
474 return kempld_detect_device(pld
);
477 static int kempld_remove(struct platform_device
*pdev
)
479 struct kempld_device_data
*pld
= platform_get_drvdata(pdev
);
480 const struct kempld_platform_data
*pdata
= dev_get_platdata(pld
->dev
);
482 sysfs_remove_group(&pld
->dev
->kobj
, &pld_attr_group
);
484 mfd_remove_devices(&pdev
->dev
);
485 pdata
->release_hardware_mutex(pld
);
490 static struct platform_driver kempld_driver
= {
494 .probe
= kempld_probe
,
495 .remove
= kempld_remove
,
498 static const struct dmi_system_id kempld_dmi_table
[] __initconst
= {
502 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
503 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bBD"),
505 .driver_data
= (void *)&kempld_platform_data_generic
,
506 .callback
= kempld_create_platform_device
,
510 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
511 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bBL6"),
513 .driver_data
= (void *)&kempld_platform_data_generic
,
514 .callback
= kempld_create_platform_device
,
518 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
519 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bHL6"),
521 .driver_data
= (void *)&kempld_platform_data_generic
,
522 .callback
= kempld_create_platform_device
,
526 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
527 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bKL6"),
529 .driver_data
= (void *)&kempld_platform_data_generic
,
530 .callback
= kempld_create_platform_device
,
534 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
535 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bSL6"),
537 .driver_data
= (void *)&kempld_platform_data_generic
,
538 .callback
= kempld_create_platform_device
,
542 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
543 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cAL"),
545 .driver_data
= (void *)&kempld_platform_data_generic
,
546 .callback
= kempld_create_platform_device
,
550 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
551 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cBL6"),
553 .driver_data
= (void *)&kempld_platform_data_generic
,
554 .callback
= kempld_create_platform_device
,
558 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
559 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cBW6"),
561 .driver_data
= (void *)&kempld_platform_data_generic
,
562 .callback
= kempld_create_platform_device
,
566 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
567 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bIP2"),
569 .driver_data
= (void *)&kempld_platform_data_generic
,
570 .callback
= kempld_create_platform_device
,
574 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
575 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bIP6"),
577 .driver_data
= (void *)&kempld_platform_data_generic
,
578 .callback
= kempld_create_platform_device
,
582 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
583 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cHL6"),
585 .driver_data
= (void *)&kempld_platform_data_generic
,
586 .callback
= kempld_create_platform_device
,
590 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
591 DMI_MATCH(DMI_BOARD_NAME
, "ETXexpress-SC T2"),
593 .driver_data
= (void *)&kempld_platform_data_generic
,
594 .callback
= kempld_create_platform_device
,
598 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
599 DMI_MATCH(DMI_BOARD_NAME
, "ETXe-SC T2"),
601 .driver_data
= (void *)&kempld_platform_data_generic
,
602 .callback
= kempld_create_platform_device
,
606 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
607 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bSC2"),
609 .driver_data
= (void *)&kempld_platform_data_generic
,
610 .callback
= kempld_create_platform_device
,
614 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
615 DMI_MATCH(DMI_BOARD_NAME
, "ETXexpress-SC T6"),
617 .driver_data
= (void *)&kempld_platform_data_generic
,
618 .callback
= kempld_create_platform_device
,
622 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
623 DMI_MATCH(DMI_BOARD_NAME
, "ETXe-SC T6"),
625 .driver_data
= (void *)&kempld_platform_data_generic
,
626 .callback
= kempld_create_platform_device
,
630 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
631 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bSC6"),
633 .driver_data
= (void *)&kempld_platform_data_generic
,
634 .callback
= kempld_create_platform_device
,
638 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
639 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cKL6"),
641 .driver_data
= (void *)&kempld_platform_data_generic
,
642 .callback
= kempld_create_platform_device
,
646 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
647 DMI_MATCH(DMI_BOARD_NAME
, "ETXexpress-PC"),
649 .driver_data
= (void *)&kempld_platform_data_generic
,
650 .callback
= kempld_create_platform_device
,
654 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
655 DMI_MATCH(DMI_BOARD_NAME
, "COMe-bPC2"),
657 .driver_data
= (void *)&kempld_platform_data_generic
,
658 .callback
= kempld_create_platform_device
,
662 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
663 DMI_MATCH(DMI_BOARD_NAME
, "PXT"),
665 .driver_data
= (void *)&kempld_platform_data_generic
,
666 .callback
= kempld_create_platform_device
,
670 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
671 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cSL6"),
673 .driver_data
= (void *)&kempld_platform_data_generic
,
674 .callback
= kempld_create_platform_device
,
678 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
679 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cBT"),
681 .driver_data
= (void *)&kempld_platform_data_generic
,
682 .callback
= kempld_create_platform_device
,
686 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
687 DMI_MATCH(DMI_BIOS_VERSION
, "FRI2"),
689 .driver_data
= (void *)&kempld_platform_data_generic
,
690 .callback
= kempld_create_platform_device
,
694 DMI_MATCH(DMI_PRODUCT_NAME
, "Fish River Island II"),
696 .driver_data
= (void *)&kempld_platform_data_generic
,
697 .callback
= kempld_create_platform_device
,
701 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
702 DMI_MATCH(DMI_BOARD_NAME
, "COMe-mAL10"),
704 .driver_data
= (void *)&kempld_platform_data_generic
,
705 .callback
= kempld_create_platform_device
,
709 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
710 DMI_MATCH(DMI_BOARD_NAME
, "ETX-OH"),
712 .driver_data
= (void *)&kempld_platform_data_generic
,
713 .callback
= kempld_create_platform_device
,
717 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
718 DMI_MATCH(DMI_BOARD_NAME
, "COMe-mBT"),
720 .driver_data
= (void *)&kempld_platform_data_generic
,
721 .callback
= kempld_create_platform_device
,
725 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
726 DMI_MATCH(DMI_BOARD_NAME
, "nanoETXexpress-TT"),
728 .driver_data
= (void *)&kempld_platform_data_generic
,
729 .callback
= kempld_create_platform_device
,
733 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
734 DMI_MATCH(DMI_BOARD_NAME
, "nETXe-TT"),
736 .driver_data
= (void *)&kempld_platform_data_generic
,
737 .callback
= kempld_create_platform_device
,
741 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
742 DMI_MATCH(DMI_BOARD_NAME
, "COMe-mTT"),
744 .driver_data
= (void *)&kempld_platform_data_generic
,
745 .callback
= kempld_create_platform_device
,
749 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
750 DMI_MATCH(DMI_BOARD_NAME
, "COMe-mCT"),
752 .driver_data
= (void *)&kempld_platform_data_generic
,
753 .callback
= kempld_create_platform_device
,
757 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
758 DMI_MATCH(DMI_BOARD_NAME
, "microETXexpress-DC"),
760 .driver_data
= (void *)&kempld_platform_data_generic
,
761 .callback
= kempld_create_platform_device
,
765 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
766 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cDC2"),
768 .driver_data
= (void *)&kempld_platform_data_generic
,
769 .callback
= kempld_create_platform_device
,
773 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
774 DMI_MATCH(DMI_BOARD_NAME
, "microETXexpress-PC"),
776 .driver_data
= (void *)&kempld_platform_data_generic
,
777 .callback
= kempld_create_platform_device
,
781 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
782 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cPC2"),
784 .driver_data
= (void *)&kempld_platform_data_generic
,
785 .callback
= kempld_create_platform_device
,
789 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
790 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cCT6"),
792 .driver_data
= (void *)&kempld_platform_data_generic
,
793 .callback
= kempld_create_platform_device
,
798 DMI_MATCH(DMI_BOARD_VENDOR
, "Kontron"),
799 DMI_MATCH(DMI_BOARD_NAME
, "COMe-cTH6"),
801 .driver_data
= (void *)&kempld_platform_data_generic
,
802 .callback
= kempld_create_platform_device
,
806 MODULE_DEVICE_TABLE(dmi
, kempld_dmi_table
);
808 static int __init
kempld_init(void)
810 const struct dmi_system_id
*id
;
812 if (force_device_id
[0]) {
813 for (id
= kempld_dmi_table
;
814 id
->matches
[0].slot
!= DMI_NONE
; id
++)
815 if (strstr(id
->ident
, force_device_id
))
816 if (id
->callback
&& !id
->callback(id
))
818 if (id
->matches
[0].slot
== DMI_NONE
)
821 if (!dmi_check_system(kempld_dmi_table
))
825 return platform_driver_register(&kempld_driver
);
828 static void __exit
kempld_exit(void)
831 platform_device_unregister(kempld_pdev
);
833 platform_driver_unregister(&kempld_driver
);
836 module_init(kempld_init
);
837 module_exit(kempld_exit
);
839 MODULE_DESCRIPTION("KEM PLD Core Driver");
840 MODULE_AUTHOR("Michael Brunner <michael.brunner@kontron.com>");
841 MODULE_LICENSE("GPL");
842 MODULE_ALIAS("platform:kempld-core");