Skip to content

LPC55xxx SPI fixes #26371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions drivers/ethernet/eth_enc28j60.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@ static int eth_enc28j60_rx(struct device *dev, uint16_t *vlan_tag)
struct eth_enc28j60_runtime *context = dev->driver_data;
uint16_t lengthfr;
uint8_t counter;
uint8_t dummy[4];

/* Errata 6. The Receive Packet Pending Interrupt Flag (EIR.PKTIF)
* does not reliably/accurately report the status of pending packet.
Expand Down Expand Up @@ -601,13 +600,13 @@ static int eth_enc28j60_rx(struct device *dev, uint16_t *vlan_tag)
} while (frm_len > 0);

/* Let's pop the useless CRC */
eth_enc28j60_read_mem(dev, dummy, 4);
eth_enc28j60_read_mem(dev, NULL, 4);

/* Pops one padding byte from spi circular buffer
* introduced by the device when the frame length is odd
*/
if (lengthfr & 0x01) {
eth_enc28j60_read_mem(dev, dummy, 1);
eth_enc28j60_read_mem(dev, NULL, 1);
}

#if defined(CONFIG_NET_VLAN)
Expand Down
6 changes: 1 addition & 5 deletions drivers/spi/spi_mcux_flexcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,22 @@ static void spi_mcux_transfer_next_packet(struct device *dev)
return;
}

transfer.configFlags = 0;
if (ctx->tx_len == 0) {
/* rx only, nothing to tx */
transfer.txData = NULL;
transfer.rxData = ctx->rx_buf;
transfer.dataSize = ctx->rx_len;
transfer.configFlags = kSPI_FrameAssert;
} else if (ctx->rx_len == 0) {
/* tx only, nothing to rx */
transfer.txData = (uint8_t *) ctx->tx_buf;
transfer.rxData = NULL;
transfer.dataSize = ctx->tx_len;
transfer.configFlags = kSPI_FrameAssert;
} else if (ctx->tx_len == ctx->rx_len) {
/* rx and tx are the same length */
transfer.txData = (uint8_t *) ctx->tx_buf;
transfer.rxData = ctx->rx_buf;
transfer.dataSize = ctx->tx_len;
transfer.configFlags = kSPI_FrameAssert;
} else if (ctx->tx_len > ctx->rx_len) {
/* Break up the tx into multiple transfers so we don't have to
* rx into a longer intermediate buffer. Leave chip select
Expand All @@ -72,7 +70,6 @@ static void spi_mcux_transfer_next_packet(struct device *dev)
transfer.txData = (uint8_t *) ctx->tx_buf;
transfer.rxData = ctx->rx_buf;
transfer.dataSize = ctx->rx_len;
transfer.configFlags = 0;
} else {
/* Break up the rx into multiple transfers so we don't have to
* tx from a longer intermediate buffer. Leave chip select
Expand All @@ -81,7 +78,6 @@ static void spi_mcux_transfer_next_packet(struct device *dev)
transfer.txData = (uint8_t *) ctx->tx_buf;
transfer.rxData = ctx->rx_buf;
transfer.dataSize = ctx->tx_len;
transfer.configFlags = 0;
}

if (ctx->tx_count <= 1 && ctx->rx_count <= 1) {
Expand Down
6 changes: 4 additions & 2 deletions dts/arm/nxp/nxp_lpc55S6x_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,12 @@

hs_lspi: spi@9f000 {
compatible = "nxp,lpc-spi";
cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>,
/* Enabling cs-gpios below will allow using GPIO CS,
rather than Flexcomm SS */
/* cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>,
<&gpio1 1 GPIO_ACTIVE_LOW>,
<&gpio1 12 GPIO_ACTIVE_LOW>,
<&gpio1 26 GPIO_ACTIVE_LOW>;
<&gpio1 26 GPIO_ACTIVE_LOW>; */
reg = <0x9f000 0x1000>;
interrupts = <59 0>;
label = "HS_LSPI";
Expand Down