23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/pci.h>
28 #include <linux/slab.h>
32 #include <linux/i2c.h>
51 #define DRIVER_NAME "timberdale"
73 .platform_data = &timberdale_tsc2007_platform_data,
79 timberdale_xiic_platform_data = {
80 .devices = timberdale_i2c_board_info,
81 .num_devices =
ARRAY_SIZE(timberdale_i2c_board_info)
85 timberdale_ocores_platform_data = {
88 .devices = timberdale_i2c_board_info,
89 .num_devices =
ARRAY_SIZE(timberdale_i2c_board_info)
126 static struct spi_board_info timberdale_spi_16bit_board_info[] = {
128 .modalias =
"max7301",
129 .max_speed_hz = 26000,
132 .platform_data = &timberdale_max7301_platform_data
138 .modalias =
"mc33880",
139 .max_speed_hz = 4000,
142 .platform_data = &timberdale_mc33880_platform_data
148 .little_endian =
true,
168 timberdale_ks8842_platform_data = {
187 timberdale_gpio_platform_data = {
257 timberdale_video_platform_data = {
261 .info = &timberdale_adv7180_i2c_board_info
266 timberdale_radio_resources[] = {
288 timberdale_radio_platform_data = {
290 .tuner = &timberdale_tef6868_i2c_board_info,
291 .dsp = &timberdale_saa7706_i2c_board_info
313 .descriptor_elements = 1
319 .descriptor_elements = 1
325 .descriptor_elements = 1
331 .descriptor_elements = 1
336 .bytes_per_line = 1440,
338 .descriptor_elements = 16
354 .descriptor_elements = 1
360 .descriptor_elements = 1
381 .num_resources =
ARRAY_SIZE(timberdale_dma_resources),
382 .resources = timberdale_dma_resources,
383 .platform_data = &timb_dma_platform_data,
384 .pdata_size =
sizeof(timb_dma_platform_data),
388 .num_resources =
ARRAY_SIZE(timberdale_uart_resources),
389 .resources = timberdale_uart_resources,
393 .num_resources =
ARRAY_SIZE(timberdale_xiic_resources),
394 .resources = timberdale_xiic_resources,
395 .platform_data = &timberdale_xiic_platform_data,
396 .pdata_size =
sizeof(timberdale_xiic_platform_data),
400 .num_resources =
ARRAY_SIZE(timberdale_gpio_resources),
401 .resources = timberdale_gpio_resources,
402 .platform_data = &timberdale_gpio_platform_data,
403 .pdata_size =
sizeof(timberdale_gpio_platform_data),
406 .name =
"timb-video",
407 .num_resources =
ARRAY_SIZE(timberdale_video_resources),
408 .resources = timberdale_video_resources,
409 .platform_data = &timberdale_video_platform_data,
410 .pdata_size =
sizeof(timberdale_video_platform_data),
413 .name =
"timb-radio",
414 .num_resources =
ARRAY_SIZE(timberdale_radio_resources),
415 .resources = timberdale_radio_resources,
416 .platform_data = &timberdale_radio_platform_data,
417 .pdata_size =
sizeof(timberdale_radio_platform_data),
420 .name =
"xilinx_spi",
421 .num_resources =
ARRAY_SIZE(timberdale_spi_resources),
422 .resources = timberdale_spi_resources,
423 .platform_data = &timberdale_xspi_platform_data,
424 .pdata_size =
sizeof(timberdale_xspi_platform_data),
428 .num_resources =
ARRAY_SIZE(timberdale_eth_resources),
429 .resources = timberdale_eth_resources,
430 .platform_data = &timberdale_ks8842_platform_data,
431 .pdata_size =
sizeof(timberdale_ks8842_platform_data),
438 .num_resources =
ARRAY_SIZE(timberdale_dma_resources),
439 .resources = timberdale_dma_resources,
440 .platform_data = &timb_dma_platform_data,
441 .pdata_size =
sizeof(timb_dma_platform_data),
445 .num_resources =
ARRAY_SIZE(timberdale_uart_resources),
446 .resources = timberdale_uart_resources,
450 .num_resources =
ARRAY_SIZE(timberdale_uartlite_resources),
451 .resources = timberdale_uartlite_resources,
455 .num_resources =
ARRAY_SIZE(timberdale_xiic_resources),
456 .resources = timberdale_xiic_resources,
457 .platform_data = &timberdale_xiic_platform_data,
458 .pdata_size =
sizeof(timberdale_xiic_platform_data),
462 .num_resources =
ARRAY_SIZE(timberdale_gpio_resources),
463 .resources = timberdale_gpio_resources,
464 .platform_data = &timberdale_gpio_platform_data,
465 .pdata_size =
sizeof(timberdale_gpio_platform_data),
468 .name =
"timb-mlogicore",
469 .num_resources =
ARRAY_SIZE(timberdale_mlogicore_resources),
470 .resources = timberdale_mlogicore_resources,
473 .
name =
"timb-video",
474 .num_resources =
ARRAY_SIZE(timberdale_video_resources),
475 .resources = timberdale_video_resources,
476 .platform_data = &timberdale_video_platform_data,
477 .pdata_size =
sizeof(timberdale_video_platform_data),
480 .name =
"timb-radio",
481 .num_resources =
ARRAY_SIZE(timberdale_radio_resources),
482 .resources = timberdale_radio_resources,
483 .platform_data = &timberdale_radio_platform_data,
484 .pdata_size =
sizeof(timberdale_radio_platform_data),
487 .name =
"xilinx_spi",
488 .num_resources =
ARRAY_SIZE(timberdale_spi_resources),
489 .resources = timberdale_spi_resources,
490 .platform_data = &timberdale_xspi_platform_data,
491 .pdata_size =
sizeof(timberdale_xspi_platform_data),
495 .num_resources =
ARRAY_SIZE(timberdale_eth_resources),
496 .resources = timberdale_eth_resources,
497 .platform_data = &timberdale_ks8842_platform_data,
498 .pdata_size =
sizeof(timberdale_ks8842_platform_data),
505 .num_resources =
ARRAY_SIZE(timberdale_dma_resources),
506 .resources = timberdale_dma_resources,
507 .platform_data = &timb_dma_platform_data,
508 .pdata_size =
sizeof(timb_dma_platform_data),
512 .num_resources =
ARRAY_SIZE(timberdale_uart_resources),
513 .resources = timberdale_uart_resources,
517 .num_resources =
ARRAY_SIZE(timberdale_xiic_resources),
518 .resources = timberdale_xiic_resources,
519 .platform_data = &timberdale_xiic_platform_data,
520 .pdata_size =
sizeof(timberdale_xiic_platform_data),
524 .num_resources =
ARRAY_SIZE(timberdale_gpio_resources),
525 .resources = timberdale_gpio_resources,
526 .platform_data = &timberdale_gpio_platform_data,
527 .pdata_size =
sizeof(timberdale_gpio_platform_data),
530 .name =
"timb-video",
531 .num_resources =
ARRAY_SIZE(timberdale_video_resources),
532 .resources = timberdale_video_resources,
533 .platform_data = &timberdale_video_platform_data,
534 .pdata_size =
sizeof(timberdale_video_platform_data),
537 .name =
"timb-radio",
538 .num_resources =
ARRAY_SIZE(timberdale_radio_resources),
539 .resources = timberdale_radio_resources,
540 .platform_data = &timberdale_radio_platform_data,
541 .pdata_size =
sizeof(timberdale_radio_platform_data),
544 .name =
"xilinx_spi",
545 .num_resources =
ARRAY_SIZE(timberdale_spi_resources),
546 .resources = timberdale_spi_resources,
547 .platform_data = &timberdale_xspi_platform_data,
548 .pdata_size =
sizeof(timberdale_xspi_platform_data),
555 .num_resources =
ARRAY_SIZE(timberdale_dma_resources),
556 .resources = timberdale_dma_resources,
557 .platform_data = &timb_dma_platform_data,
558 .pdata_size =
sizeof(timb_dma_platform_data),
562 .num_resources =
ARRAY_SIZE(timberdale_uart_resources),
563 .resources = timberdale_uart_resources,
566 .
name =
"ocores-i2c",
567 .num_resources =
ARRAY_SIZE(timberdale_ocores_resources),
568 .resources = timberdale_ocores_resources,
569 .platform_data = &timberdale_ocores_platform_data,
570 .pdata_size =
sizeof(timberdale_ocores_platform_data),
574 .num_resources =
ARRAY_SIZE(timberdale_gpio_resources),
575 .resources = timberdale_gpio_resources,
576 .platform_data = &timberdale_gpio_platform_data,
577 .pdata_size =
sizeof(timberdale_gpio_platform_data),
580 .name =
"timb-video",
581 .num_resources =
ARRAY_SIZE(timberdale_video_resources),
582 .resources = timberdale_video_resources,
583 .platform_data = &timberdale_video_platform_data,
584 .pdata_size =
sizeof(timberdale_video_platform_data),
587 .name =
"timb-radio",
588 .num_resources =
ARRAY_SIZE(timberdale_radio_resources),
589 .resources = timberdale_radio_resources,
590 .platform_data = &timberdale_radio_platform_data,
591 .pdata_size =
sizeof(timberdale_radio_platform_data),
594 .name =
"xilinx_spi",
595 .num_resources =
ARRAY_SIZE(timberdale_spi_resources),
596 .resources = timberdale_spi_resources,
597 .platform_data = &timberdale_xspi_platform_data,
598 .pdata_size =
sizeof(timberdale_xspi_platform_data),
602 .num_resources =
ARRAY_SIZE(timberdale_eth_resources),
603 .resources = timberdale_eth_resources,
604 .platform_data = &timberdale_ks8842_platform_data,
605 .pdata_size =
sizeof(timberdale_ks8842_platform_data),
626 .num_resources =
ARRAY_SIZE(timberdale_sdhc_resources),
627 .resources = timberdale_sdhc_resources,
634 .num_resources =
ARRAY_SIZE(timberdale_sdhc_resources),
635 .resources = timberdale_sdhc_resources,
645 return sprintf(buf,
"%d.%d.%d\n", priv->
fw.major, priv->
fw.minor,
659 struct msix_entry *msix_entries =
NULL;
666 pci_set_drvdata(dev, priv);
681 dev_err(&dev->
dev,
"Failed to request ctl mem\n");
687 dev_err(&dev->
dev,
"ioremap failed for ctl mem\n");
697 dev_err(&dev->
dev,
"The driver supports an older "
698 "version of the FPGA, please update the driver to "
699 "support %d.%d\n", priv->
fw.major, priv->
fw.minor);
704 dev_err(&dev->
dev,
"The FPGA image is too old (%d.%d), "
705 "please upgrade the FPGA to at least: %d.%d\n",
706 priv->
fw.major, priv->
fw.minor,
717 msix_entries[i].
entry = i;
722 "MSI-X init failed: %d, expected entries: %d\n",
723 err, TIMBERDALE_NR_IRQS);
729 goto err_create_file;
735 for (i = 0; i <
ARRAY_SIZE(timberdale_i2c_board_info); i++)
736 timberdale_i2c_board_info[i].irq =
737 msix_entries[timberdale_i2c_board_info[i].irq].
vector;
742 timberdale_xspi_platform_data.
devices =
743 timberdale_spi_8bit_board_info;
748 timberdale_xspi_platform_data.
devices =
749 timberdale_spi_16bit_board_info;
758 timberdale_cells_bar0_cfg0,
764 timberdale_cells_bar0_cfg1,
770 timberdale_cells_bar0_cfg2,
776 timberdale_cells_bar0_cfg3,
781 dev_err(&dev->
dev,
"Uknown IP setup: %d.%d.%d\n",
782 priv->
fw.major, priv->
fw.minor, ip_setup);
789 dev_err(&dev->
dev,
"mfd_add_devices failed: %d\n", err);
794 timberdale_cells_bar1,
ARRAY_SIZE(timberdale_cells_bar1),
797 dev_err(&dev->
dev,
"mfd_add_devices failed: %d\n", err);
808 dev_err(&dev->
dev,
"mfd_add_devices failed: %d\n", err);
816 "Found Timberdale Card. Rev: %d.%d, HW config: 0x%02x\n",
817 priv->
fw.major, priv->
fw.minor, priv->
fw.config);
834 pci_set_drvdata(dev,
NULL);
839 pci_set_drvdata(dev,
NULL);
856 pci_set_drvdata(dev,
NULL);
866 static struct pci_driver timberdale_pci_driver = {
868 .id_table = timberdale_pci_tbl,
873 static int __init timberdale_init(
void)
877 err = pci_register_driver(&timberdale_pci_driver);
880 "Failed to register PCI driver for %s device.\n",
881 timberdale_pci_driver.
name);
886 timberdale_pci_driver.
name);
891 static void __exit timberdale_exit(
void)
895 printk(
KERN_INFO "Driver for %s has been successfully unregistered.\n",
896 timberdale_pci_driver.
name);