media: mgb4: Added support for T200 card variant
authorMartin Tůma <martin.tuma@digiteqautomotive.com>
Wed, 25 Oct 2023 16:51:47 +0000 (18:51 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 16 Nov 2023 12:59:31 +0000 (13:59 +0100)
T200 card variants use the XC7A200T FPGA instead of XC7A100T. The SPI FLASH
memory layout is different as the FPGA requires bigger FW images.

Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/pci/mgb4/mgb4_core.c

index 3efb33fbf40ccb0a316d57ac710d740027ad290f..5bfb8a06202e99f698408c7bce279ffb938aa7b8 100644 (file)
 
 #define MGB4_USER_IRQS 16
 
+#define DIGITEQ_VID 0x1ed8
+#define T100_DID    0x0101
+#define T200_DID    0x0201
+
 ATTRIBUTE_GROUPS(mgb4_pci);
 
 static int flashid;
@@ -151,7 +155,7 @@ static struct spi_master *get_spi_adap(struct platform_device *pdev)
        return dev ? container_of(dev, struct spi_master, dev) : NULL;
 }
 
-static int init_spi(struct mgb4_dev *mgbdev)
+static int init_spi(struct mgb4_dev *mgbdev, u32 devid)
 {
        struct resource spi_resources[] = {
                {
@@ -213,8 +217,13 @@ static int init_spi(struct mgb4_dev *mgbdev)
        snprintf(mgbdev->fw_part_name, sizeof(mgbdev->fw_part_name),
                 "mgb4-fw.%d", flashid);
        mgbdev->partitions[0].name = mgbdev->fw_part_name;
-       mgbdev->partitions[0].size = 0x400000;
-       mgbdev->partitions[0].offset = 0x400000;
+       if (devid == T200_DID) {
+               mgbdev->partitions[0].size = 0x950000;
+               mgbdev->partitions[0].offset = 0x1000000;
+       } else {
+               mgbdev->partitions[0].size = 0x400000;
+               mgbdev->partitions[0].offset = 0x400000;
+       }
        mgbdev->partitions[0].mask_flags = 0;
 
        snprintf(mgbdev->data_part_name, sizeof(mgbdev->data_part_name),
@@ -551,7 +560,7 @@ static int mgb4_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto err_video_regs;
 
        /* SPI FLASH */
-       rv = init_spi(mgbdev);
+       rv = init_spi(mgbdev, id->device);
        if (rv < 0)
                goto err_cmt_regs;
 
@@ -666,7 +675,8 @@ static void mgb4_remove(struct pci_dev *pdev)
 }
 
 static const struct pci_device_id mgb4_pci_ids[] = {
-       { PCI_DEVICE(0x1ed8, 0x0101), },
+       { PCI_DEVICE(DIGITEQ_VID, T100_DID), },
+       { PCI_DEVICE(DIGITEQ_VID, T200_DID), },
        { 0, }
 };
 MODULE_DEVICE_TABLE(pci, mgb4_pci_ids);