diff options
author | Nathan Williams <nathan@traverse.com.au> | 2012-12-19 06:01:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-12-19 17:53:53 -0500 |
commit | 13af816469db3449c072afbae6c4c1bd9ccecccb (patch) | |
tree | 5088fa6c519cf1c7e47ee76d59a5724d9d246da2 /drivers/atm | |
parent | 7fbdadb5e951e4f0c0fc991ff5f50295568786e6 (diff) |
solos-pci: add firmware upgrade support for new models
Signed-off-by: Nathan Williams <nathan@traverse.com.au>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm')
-rw-r--r-- | drivers/atm/solos-pci.c | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 50e5c561b7c4..aa4f35d52a92 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -42,7 +42,8 @@ | |||
42 | #include <linux/swab.h> | 42 | #include <linux/swab.h> |
43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
44 | 44 | ||
45 | #define VERSION "0.07" | 45 | #define VERSION "1.04" |
46 | #define DRIVER_VERSION 0x01 | ||
46 | #define PTAG "solos-pci" | 47 | #define PTAG "solos-pci" |
47 | 48 | ||
48 | #define CONFIG_RAM_SIZE 128 | 49 | #define CONFIG_RAM_SIZE 128 |
@@ -57,16 +58,20 @@ | |||
57 | #define FPGA_MODE 0x5C | 58 | #define FPGA_MODE 0x5C |
58 | #define FLASH_MODE 0x58 | 59 | #define FLASH_MODE 0x58 |
59 | #define GPIO_STATUS 0x54 | 60 | #define GPIO_STATUS 0x54 |
61 | #define DRIVER_VER 0x50 | ||
60 | #define TX_DMA_ADDR(port) (0x40 + (4 * (port))) | 62 | #define TX_DMA_ADDR(port) (0x40 + (4 * (port))) |
61 | #define RX_DMA_ADDR(port) (0x30 + (4 * (port))) | 63 | #define RX_DMA_ADDR(port) (0x30 + (4 * (port))) |
62 | 64 | ||
63 | #define DATA_RAM_SIZE 32768 | 65 | #define DATA_RAM_SIZE 32768 |
64 | #define BUF_SIZE 2048 | 66 | #define BUF_SIZE 2048 |
65 | #define OLD_BUF_SIZE 4096 /* For FPGA versions <= 2*/ | 67 | #define OLD_BUF_SIZE 4096 /* For FPGA versions <= 2*/ |
66 | #define FPGA_PAGE 528 /* FPGA flash page size*/ | 68 | /* Old boards use ATMEL AD45DB161D flash */ |
67 | #define SOLOS_PAGE 512 /* Solos flash page size*/ | 69 | #define ATMEL_FPGA_PAGE 528 /* FPGA flash page size*/ |
68 | #define FPGA_BLOCK (FPGA_PAGE * 8) /* FPGA flash block size*/ | 70 | #define ATMEL_SOLOS_PAGE 512 /* Solos flash page size*/ |
69 | #define SOLOS_BLOCK (SOLOS_PAGE * 8) /* Solos flash block size*/ | 71 | #define ATMEL_FPGA_BLOCK (ATMEL_FPGA_PAGE * 8) /* FPGA block size*/ |
72 | #define ATMEL_SOLOS_BLOCK (ATMEL_SOLOS_PAGE * 8) /* Solos block size*/ | ||
73 | /* Current boards use M25P/M25PE SPI flash */ | ||
74 | #define SPI_FLASH_BLOCK (256 * 64) | ||
70 | 75 | ||
71 | #define RX_BUF(card, nr) ((card->buffers) + (nr)*(card->buffer_size)*2) | 76 | #define RX_BUF(card, nr) ((card->buffers) + (nr)*(card->buffer_size)*2) |
72 | #define TX_BUF(card, nr) ((card->buffers) + (nr)*(card->buffer_size)*2 + (card->buffer_size)) | 77 | #define TX_BUF(card, nr) ((card->buffers) + (nr)*(card->buffer_size)*2 + (card->buffer_size)) |
@@ -128,6 +133,7 @@ struct solos_card { | |||
128 | int using_dma; | 133 | int using_dma; |
129 | int fpga_version; | 134 | int fpga_version; |
130 | int buffer_size; | 135 | int buffer_size; |
136 | int atmel_flash; | ||
131 | }; | 137 | }; |
132 | 138 | ||
133 | 139 | ||
@@ -630,16 +636,25 @@ static int flash_upgrade(struct solos_card *card, int chip) | |||
630 | switch (chip) { | 636 | switch (chip) { |
631 | case 0: | 637 | case 0: |
632 | fw_name = "solos-FPGA.bin"; | 638 | fw_name = "solos-FPGA.bin"; |
633 | blocksize = FPGA_BLOCK; | 639 | if (card->atmel_flash) |
640 | blocksize = ATMEL_FPGA_BLOCK; | ||
641 | else | ||
642 | blocksize = SPI_FLASH_BLOCK; | ||
634 | break; | 643 | break; |
635 | case 1: | 644 | case 1: |
636 | fw_name = "solos-Firmware.bin"; | 645 | fw_name = "solos-Firmware.bin"; |
637 | blocksize = SOLOS_BLOCK; | 646 | if (card->atmel_flash) |
647 | blocksize = ATMEL_SOLOS_BLOCK; | ||
648 | else | ||
649 | blocksize = SPI_FLASH_BLOCK; | ||
638 | break; | 650 | break; |
639 | case 2: | 651 | case 2: |
640 | if (card->fpga_version > LEGACY_BUFFERS){ | 652 | if (card->fpga_version > LEGACY_BUFFERS){ |
641 | fw_name = "solos-db-FPGA.bin"; | 653 | fw_name = "solos-db-FPGA.bin"; |
642 | blocksize = FPGA_BLOCK; | 654 | if (card->atmel_flash) |
655 | blocksize = ATMEL_FPGA_BLOCK; | ||
656 | else | ||
657 | blocksize = SPI_FLASH_BLOCK; | ||
643 | } else { | 658 | } else { |
644 | dev_info(&card->dev->dev, "FPGA version doesn't support" | 659 | dev_info(&card->dev->dev, "FPGA version doesn't support" |
645 | " daughter board upgrades\n"); | 660 | " daughter board upgrades\n"); |
@@ -649,7 +664,10 @@ static int flash_upgrade(struct solos_card *card, int chip) | |||
649 | case 3: | 664 | case 3: |
650 | if (card->fpga_version > LEGACY_BUFFERS){ | 665 | if (card->fpga_version > LEGACY_BUFFERS){ |
651 | fw_name = "solos-Firmware.bin"; | 666 | fw_name = "solos-Firmware.bin"; |
652 | blocksize = SOLOS_BLOCK; | 667 | if (card->atmel_flash) |
668 | blocksize = ATMEL_SOLOS_BLOCK; | ||
669 | else | ||
670 | blocksize = SPI_FLASH_BLOCK; | ||
653 | } else { | 671 | } else { |
654 | dev_info(&card->dev->dev, "FPGA version doesn't support" | 672 | dev_info(&card->dev->dev, "FPGA version doesn't support" |
655 | " daughter board upgrades\n"); | 673 | " daughter board upgrades\n"); |
@@ -665,6 +683,9 @@ static int flash_upgrade(struct solos_card *card, int chip) | |||
665 | 683 | ||
666 | dev_info(&card->dev->dev, "Flash upgrade starting\n"); | 684 | dev_info(&card->dev->dev, "Flash upgrade starting\n"); |
667 | 685 | ||
686 | /* New FPGAs require driver version before permitting flash upgrades */ | ||
687 | iowrite32(DRIVER_VERSION, card->config_regs + DRIVER_VER); | ||
688 | |||
668 | numblocks = fw->size / blocksize; | 689 | numblocks = fw->size / blocksize; |
669 | dev_info(&card->dev->dev, "Firmware size: %zd\n", fw->size); | 690 | dev_info(&card->dev->dev, "Firmware size: %zd\n", fw->size); |
670 | dev_info(&card->dev->dev, "Number of blocks: %d\n", numblocks); | 691 | dev_info(&card->dev->dev, "Number of blocks: %d\n", numblocks); |
@@ -694,9 +715,13 @@ static int flash_upgrade(struct solos_card *card, int chip) | |||
694 | /* dev_info(&card->dev->dev, "Set FPGA Flash mode to Block Write\n"); */ | 715 | /* dev_info(&card->dev->dev, "Set FPGA Flash mode to Block Write\n"); */ |
695 | iowrite32(((chip * 2) + 1), card->config_regs + FLASH_MODE); | 716 | iowrite32(((chip * 2) + 1), card->config_regs + FLASH_MODE); |
696 | 717 | ||
697 | /* Copy block to buffer, swapping each 16 bits */ | 718 | /* Copy block to buffer, swapping each 16 bits for Atmel flash */ |
698 | for(i = 0; i < blocksize; i += 4) { | 719 | for(i = 0; i < blocksize; i += 4) { |
699 | uint32_t word = swahb32p((uint32_t *)(fw->data + offset + i)); | 720 | uint32_t word; |
721 | if (card->atmel_flash) | ||
722 | word = swahb32p((uint32_t *)(fw->data + offset + i)); | ||
723 | else | ||
724 | word = *(uint32_t *)(fw->data + offset + i); | ||
700 | if(card->fpga_version > LEGACY_BUFFERS) | 725 | if(card->fpga_version > LEGACY_BUFFERS) |
701 | iowrite32(word, FLASH_BUF + i); | 726 | iowrite32(word, FLASH_BUF + i); |
702 | else | 727 | else |
@@ -1230,6 +1255,12 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1230 | db_fpga_upgrade = db_firmware_upgrade = 0; | 1255 | db_fpga_upgrade = db_firmware_upgrade = 0; |
1231 | } | 1256 | } |
1232 | 1257 | ||
1258 | /* Stopped using Atmel flash after 0.03-38 */ | ||
1259 | if (fpga_ver < 39) | ||
1260 | card->atmel_flash = 1; | ||
1261 | else | ||
1262 | card->atmel_flash = 0; | ||
1263 | |||
1233 | if (card->fpga_version >= DMA_SUPPORTED) { | 1264 | if (card->fpga_version >= DMA_SUPPORTED) { |
1234 | pci_set_master(dev); | 1265 | pci_set_master(dev); |
1235 | card->using_dma = 1; | 1266 | card->using_dma = 1; |