|
|
|
@ -81,7 +81,7 @@ struct device_drv bitforce_drv;
@@ -81,7 +81,7 @@ struct device_drv bitforce_drv;
|
|
|
|
|
|
|
|
|
|
static void bitforce_initialise(struct cgpu_info *bitforce, bool lock) |
|
|
|
|
{ |
|
|
|
|
int err; |
|
|
|
|
int err, interface; |
|
|
|
|
|
|
|
|
|
if (lock) |
|
|
|
|
mutex_lock(&bitforce->device_mutex); |
|
|
|
@ -89,9 +89,10 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
@@ -89,9 +89,10 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|
|
|
|
if (bitforce->usbinfo.nodev) |
|
|
|
|
goto failed; |
|
|
|
|
|
|
|
|
|
interface = usb_interface(bitforce); |
|
|
|
|
// Reset
|
|
|
|
|
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, |
|
|
|
|
FTDI_VALUE_RESET, bitforce->usbdev->found->interface, C_RESET); |
|
|
|
|
FTDI_VALUE_RESET, interface, C_RESET); |
|
|
|
|
if (opt_debug) |
|
|
|
|
applog(LOG_DEBUG, "%s%i: reset got err %d", |
|
|
|
|
bitforce->drv->name, bitforce->device_id, err); |
|
|
|
@ -101,7 +102,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
@@ -101,7 +102,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|
|
|
|
|
|
|
|
|
// Set data control
|
|
|
|
|
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_DATA, |
|
|
|
|
FTDI_VALUE_DATA_BFL, bitforce->usbdev->found->interface, C_SETDATA); |
|
|
|
|
FTDI_VALUE_DATA_BFL, interface, C_SETDATA); |
|
|
|
|
if (opt_debug) |
|
|
|
|
applog(LOG_DEBUG, "%s%i: setdata got err %d", |
|
|
|
|
bitforce->drv->name, bitforce->device_id, err); |
|
|
|
@ -111,7 +112,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
@@ -111,7 +112,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|
|
|
|
|
|
|
|
|
// Set the baud
|
|
|
|
|
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_BAUD, FTDI_VALUE_BAUD_BFL, |
|
|
|
|
(FTDI_INDEX_BAUD_BFL & 0xff00) | bitforce->usbdev->found->interface, |
|
|
|
|
(FTDI_INDEX_BAUD_BFL & 0xff00) | interface, |
|
|
|
|
C_SETBAUD); |
|
|
|
|
if (opt_debug) |
|
|
|
|
applog(LOG_DEBUG, "%s%i: setbaud got err %d", |
|
|
|
@ -122,7 +123,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
@@ -122,7 +123,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|
|
|
|
|
|
|
|
|
// Set Flow Control
|
|
|
|
|
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_FLOW, |
|
|
|
|
FTDI_VALUE_FLOW, bitforce->usbdev->found->interface, C_SETFLOW); |
|
|
|
|
FTDI_VALUE_FLOW, interface, C_SETFLOW); |
|
|
|
|
if (opt_debug) |
|
|
|
|
applog(LOG_DEBUG, "%s%i: setflowctrl got err %d", |
|
|
|
|
bitforce->drv->name, bitforce->device_id, err); |
|
|
|
@ -132,7 +133,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
@@ -132,7 +133,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|
|
|
|
|
|
|
|
|
// Set Modem Control
|
|
|
|
|
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_MODEM, |
|
|
|
|
FTDI_VALUE_MODEM, bitforce->usbdev->found->interface, C_SETMODEM); |
|
|
|
|
FTDI_VALUE_MODEM, interface, C_SETMODEM); |
|
|
|
|
if (opt_debug) |
|
|
|
|
applog(LOG_DEBUG, "%s%i: setmodemctrl got err %d", |
|
|
|
|
bitforce->drv->name, bitforce->device_id, err); |
|
|
|
@ -142,7 +143,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
@@ -142,7 +143,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|
|
|
|
|
|
|
|
|
// Clear any sent data
|
|
|
|
|
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, |
|
|
|
|
FTDI_VALUE_PURGE_TX, bitforce->usbdev->found->interface, C_PURGETX); |
|
|
|
|
FTDI_VALUE_PURGE_TX, interface, C_PURGETX); |
|
|
|
|
if (opt_debug) |
|
|
|
|
applog(LOG_DEBUG, "%s%i: purgetx got err %d", |
|
|
|
|
bitforce->drv->name, bitforce->device_id, err); |
|
|
|
@ -152,7 +153,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
@@ -152,7 +153,7 @@ static void bitforce_initialise(struct cgpu_info *bitforce, bool lock)
|
|
|
|
|
|
|
|
|
|
// Clear any received data
|
|
|
|
|
err = usb_transfer(bitforce, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, |
|
|
|
|
FTDI_VALUE_PURGE_RX, bitforce->usbdev->found->interface, C_PURGERX); |
|
|
|
|
FTDI_VALUE_PURGE_RX, interface, C_PURGERX); |
|
|
|
|
if (opt_debug) |
|
|
|
|
applog(LOG_DEBUG, "%s%i: purgerx got err %d", |
|
|
|
|
bitforce->drv->name, bitforce->device_id, err); |
|
|
|
|