2009-06-26 16:49:42 MAX3100 driver problem/fix
Todor Mollov (UNITED STATES)
Message: 76411
Hi,
I've recently been trying to get the max3100 spi to uart bridge working on a custom bf534 board, and I found a problem in the driver. The driver was doing a cpu to big endian conversion before passing the transfer data over to the spi bus driver, which was also doing a cpu to big endian conversion with the end result of little endian data being put on the lines.
The following is the max3100_sr() function I'm currently using that correctly controls the device.
drivers/serial/max3100.c@line 193
static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)
{
struct spi_message message;
u16 etx, erx;
int status;
struct spi_transfer tran = {
.tx_buf = &etx,
.rx_buf = &erx,
.len = 2,
.bits_per_word = 16,
};
//etx = cpu_to_be16(tx);
etx = tx;
spi_message_init(&message);
spi_message_add_tail(&tran, &message);
status = spi_sync(s->spi, &message);
if (status) {
dev_warn(&s->spi->dev, "error while calling spi_sync\n");
return -EIO;
}
//*rx = be16_to_cpu(erx);
*rx = erx;
s->tx_empty = (*rx & MAX3100_T) > 0;
dev_dbg(&s->spi->dev, "%04x - %04x\n", tx, *rx);
return 0;
}
It needs to be cleaned up for a patch, but I have deadlines to meet right now =/. Hope this helps someone.
(I'm working off of the r8353 uclinux-distro snapshot so I'm not sure of the exact kernel revision, but it's a pretty fresh snapshot.)
QuoteReplyEditDelete
2009-06-26 17:02:22 Re: MAX3100 driver problem/fix
Mike Frysinger (UNITED STATES)
Message: 76412
Christian Pellegrin <chripell@evolware.org> is the guy who maintains that driver ... maybe try sending him an e-mail