- /* initialize low byte for jtag */
- buf[0] = 0x80; /* command "set data bits low byte" */
- buf[1] = low_output; /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
- buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in */
- LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
+ /* initialize low byte for jtag */
+ if (ft2232_set_data_bits_low_byte(low_output, low_direction) != ERROR_OK) {
+ LOG_ERROR("couldn't initialize FT2232 with 'sheevaplug' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ nTRSTnOE = 0x1;
+ nTRST = 0x02;
+ nSRSTnOE = 0x4;
+ nSRST = 0x08;
+
+ high_output = 0x0;
+ high_direction = 0x0f;
+
+ /* nTRST is always push-pull */
+ high_output &= ~nTRSTnOE;
+ high_output |= nTRST;
+
+ /* nSRST is always open-drain */
+ high_output |= nSRSTnOE;
+ high_output &= ~nSRST;
+
+ /* initialize high byte for jtag */
+ if (ft2232_set_data_bits_high_byte(high_output, high_direction) != ERROR_OK) {
+ LOG_ERROR("couldn't initialize FT2232 with 'sheevaplug' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ return ERROR_OK;
+}
+
+static int cortino_jtag_init(void)
+{
+ low_output = 0x08;
+ low_direction = 0x1b;
+
+ /* initialize low byte for jtag */
+ if (ft2232_set_data_bits_low_byte(low_output, low_direction) != ERROR_OK) {
+ LOG_ERROR("couldn't initialize FT2232 with 'cortino' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ nTRST = 0x01;
+ nTRSTnOE = 0x00; /* no output enable for nTRST */
+ nSRST = 0x02;
+ nSRSTnOE = 0x00; /* no output enable for nSRST */
+
+ high_output = 0x03;
+ high_direction = 0x03;
+
+ /* initialize high byte for jtag */
+ if (ft2232_set_data_bits_high_byte(high_output, high_direction) != ERROR_OK) {
+ LOG_ERROR("couldn't initialize FT2232 with 'cortino' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ return ERROR_OK;
+}
+
+static int lisa_l_init(void)
+{
+ ftx232_dbus_init();
+
+ nTRST = 0x10;
+ nTRSTnOE = 0x10;
+ nSRST = 0x40;
+ nSRSTnOE = 0x40;
+
+ high_output = 0x00;
+ high_direction = 0x18;