Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223607
b: refs/heads/master
c: e6289d6
h: refs/heads/master
i:
  223605: 6295f2a
  223603: ac8514d
  223599: 0bd990a
v: v3
  • Loading branch information
Mingkai Hu authored and Grant Likely committed Dec 24, 2010
1 parent cbf4722 commit b299628
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 020862648445d7c1b12ea213c152f27def703f3b
refs/heads/master: e6289d63a6f39237a027dcee46366ba158cb8406
19 changes: 16 additions & 3 deletions trunk/drivers/spi/spi_fsl_espi.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,29 @@ void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events)

/* We need handle RX first */
if (events & SPIE_NE) {
u32 rx_data;
u32 rx_data, tmp;
u8 rx_data_8;

/* Spin until RX is done */
while (SPIE_RXCNT(events) < min(4, mspi->len)) {
cpu_relax();
events = mpc8xxx_spi_read_reg(&reg_base->event);
}
mspi->len -= 4;

rx_data = mpc8xxx_spi_read_reg(&reg_base->receive);
if (mspi->len >= 4) {
rx_data = mpc8xxx_spi_read_reg(&reg_base->receive);
} else {
tmp = mspi->len;
rx_data = 0;
while (tmp--) {
rx_data_8 = in_8((u8 *)&reg_base->receive);
rx_data |= (rx_data_8 << (tmp * 8));
}

rx_data <<= (4 - mspi->len) * 8;
}

mspi->len -= 4;

if (mspi->rx)
mspi->get_rx(rx_data, mspi);
Expand Down

0 comments on commit b299628

Please sign in to comment.