ftdi_eeprom: Fix flashing FT245R
authorRolf Fiedler <derRolf@gmx-topmail.de>
Mon, 6 Jun 2016 15:31:40 +0000 (17:31 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 6 Jun 2016 15:34:36 +0000 (17:34 +0200)
When we were trying to program FT245R, they were always flashed as FT232R.
The attached patch fixes the missing call to type2bit for TYPE_R.

src/ftdi.c

index 529b99e..f5d263c 100644 (file)
@@ -2646,6 +2646,15 @@ static unsigned char type2bit(unsigned char type, enum ftdi_chip_type chip)
                 default: return 0;
             }
         }
+        case TYPE_R:
+        {
+            switch (type)
+            {
+                case CHANNEL_IS_UART   : return 0;
+                case CHANNEL_IS_FIFO   : return 0x01;
+                default: return 0;
+            }
+        }
         case TYPE_230X: /* FT230X is only UART */
         default: return 0;
     }
@@ -2938,6 +2947,7 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             output[0x14] = eeprom->chip;
             break;
         case TYPE_R:
+            output[0x00] = type2bit(eeprom->channel_a_type, TYPE_R);
             if (eeprom->high_current == HIGH_CURRENT_DRIVE_R)
                 output[0x00] |= HIGH_CURRENT_DRIVE_R;
             if (eeprom->external_oscillator)