""
};
+static int msp430_xfer(const void *dout, void *din)
+{
+ int err;
+
+ err = spi_xfer(NULL, MTC_TRANSFER_SIZE, dout, din,
+ SPI_XFER_BEGIN | SPI_XFER_END);
+
+ /* The MSP chip needs time to ready itself for the next command */
+ udelay(1000);
+
+ return err;
+}
+
static void mtc_calculate_checksum(tx_msp_cmd *packet)
{
int i;
{
tx_msp_cmd pcmd;
rx_msp_cmd prx;
- int err = 0;
+ int err;
int i;
if (argc < 2) {
pcmd.cmd_val2 = 0;
mtc_calculate_checksum(&pcmd);
- err = spi_xfer(NULL, MTC_TRANSFER_SIZE, &pcmd, &prx,
- SPI_XFER_BEGIN | SPI_XFER_END);
+ err = msp430_xfer(&pcmd, &prx);
return err;
}
{
tx_msp_cmd pcmd;
rx_msp_cmd prx;
- int err = 0;
+ int err;
memset(&pcmd, 0, sizeof(pcmd));
memset(&prx, 0, sizeof(prx));
pcmd.cmd = CMD_GET_VIM;
mtc_calculate_checksum(&pcmd);
- err = spi_xfer(NULL, MTC_TRANSFER_SIZE, &pcmd, &prx,
- SPI_XFER_BEGIN | SPI_XFER_END);
+ err = msp430_xfer(&pcmd, &prx);
if (!err) {
/* function returns '0' if key is pressed */
{
tx_msp_cmd pcmd;
rx_msp_cmd prx;
- int err = 0;
+ int err;
uchar channel_mask = 0;
if (argc < 3) {
pcmd.user_out = channel_mask;
mtc_calculate_checksum(&pcmd);
- err = spi_xfer(NULL, MTC_TRANSFER_SIZE, &pcmd, &prx,
- SPI_XFER_BEGIN | SPI_XFER_END);
+ err = msp430_xfer(&pcmd, &prx);
return err;
}
{
tx_msp_cmd pcmd;
rx_msp_cmd prx;
- int err = 0;
+ int err;
uchar channel_num = 0;
if (argc < 2) {
pcmd.cmd = CMD_GET_VIM;
mtc_calculate_checksum(&pcmd);
- err = spi_xfer(NULL, MTC_TRANSFER_SIZE, &pcmd, &prx,
- SPI_XFER_BEGIN | SPI_XFER_END);
+ err = msp430_xfer(&pcmd, &prx);
if (!err) {
/* function returns '0' when digin is on */
pcmd.cmd_val2 = 0; /* =0 means read appreg */
mtc_calculate_checksum(&pcmd);
- err = spi_xfer(NULL, MTC_TRANSFER_SIZE, &pcmd, &prx,
- SPI_XFER_BEGIN | SPI_XFER_END);
+ err = msp430_xfer(&pcmd, &prx);
+
if (!err) {
sprintf(buf, "%d", prx.ack2);
setenv("appreg", buf);
{
tx_msp_cmd pcmd;
rx_msp_cmd prx;
- int err = 0;
+ int err;
memset(&pcmd, 0, sizeof(pcmd));
memset(&prx, 0, sizeof(prx));
pcmd.cmd = CMD_FW_VERSION;
mtc_calculate_checksum(&pcmd);
- err = spi_xfer(NULL, MTC_TRANSFER_SIZE, &pcmd, &prx,
- SPI_XFER_BEGIN | SPI_XFER_END);
+ err = msp430_xfer(&pcmd, &prx);
if (!err) {
printf("FW V%d.%d.%d / HW %d\n",
{
tx_msp_cmd pcmd;
rx_msp_cmd prx;
- int err = 0;
+ int err;
memset(&pcmd, 0, sizeof(pcmd));
memset(&prx, 0, sizeof(prx));
pcmd.cmd_val2 = 1;
mtc_calculate_checksum(&pcmd);
- err = spi_xfer(NULL, MTC_TRANSFER_SIZE, &pcmd, &prx,
- SPI_XFER_BEGIN | SPI_XFER_END);
+ err = msp430_xfer(&pcmd, &prx);
if (!err) {
printf("State %02Xh\n", prx.state);