Commit e12d73e4 authored by Mahavir Jain's avatar Mahavir Jain Committed by Jukka Rissanen
Browse files

ethernet: enc28j60: use unified kernel interface

Remove legacy kernel interface and use unified APIs

Change-Id: I8e99aa5399707a28a326e8abfa8725079de31be6
Signed-off-by: default avatarMahavir Jain <mjain@marvell.com>
parent 30285fd5
Loading
Loading
Loading
Loading
+37 −36
Changes for drivers/ethernet/eth_enc28j60.c: 37 added lines, 36 removed lines.
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@

#define D10D24S 11

static void enc28j60_fiber_main(int arg1, int unused);
static void enc28j60_thread_main(void *arg1, void *unused1, void *unused2);

static int eth_enc28j60_soft_reset(struct device *dev)
{
@@ -43,7 +43,7 @@ static void eth_enc28j60_set_bank(struct device *dev, uint16_t reg_addr)
	struct eth_enc28j60_runtime *context = dev->driver_data;
	uint8_t tx_buf[2];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	tx_buf[0] = ENC28J60_SPI_RCR | ENC28J60_REG_ECON1;
	tx_buf[1] = 0x0;
@@ -55,7 +55,7 @@ static void eth_enc28j60_set_bank(struct device *dev, uint16_t reg_addr)

	spi_write(context->spi, tx_buf, 2);

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_write_reg(struct device *dev, uint16_t reg_addr,
@@ -64,14 +64,14 @@ static void eth_enc28j60_write_reg(struct device *dev, uint16_t reg_addr,
	struct eth_enc28j60_runtime *context = dev->driver_data;
	uint8_t tx_buf[2];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	tx_buf[0] = ENC28J60_SPI_WCR | (reg_addr & 0xFF);
	tx_buf[1] = value;

	spi_write(context->spi, tx_buf, 2);

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_read_reg(struct device *dev, uint16_t reg_addr,
@@ -81,7 +81,7 @@ static void eth_enc28j60_read_reg(struct device *dev, uint16_t reg_addr,
	uint8_t tx_size = 2;
	uint8_t tx_buf[3];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	if (reg_addr & 0xF000) {
		tx_size = 3;
@@ -94,7 +94,7 @@ static void eth_enc28j60_read_reg(struct device *dev, uint16_t reg_addr,

	*value = tx_buf[tx_size - 1];

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_set_eth_reg(struct device *dev, uint16_t reg_addr,
@@ -103,14 +103,14 @@ static void eth_enc28j60_set_eth_reg(struct device *dev, uint16_t reg_addr,
	struct eth_enc28j60_runtime *context = dev->driver_data;
	uint8_t tx_buf[2];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	tx_buf[0] = ENC28J60_SPI_BFS | (reg_addr & 0xFF);
	tx_buf[1] = value;

	spi_write(context->spi, tx_buf, 2);

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}


@@ -120,14 +120,14 @@ static void eth_enc28j60_clear_eth_reg(struct device *dev, uint16_t reg_addr,
	struct eth_enc28j60_runtime *context = dev->driver_data;
	uint8_t tx_buf[2];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	tx_buf[0] = ENC28J60_SPI_BFC | (reg_addr & 0xFF);
	tx_buf[1] = value;

	spi_write(context->spi, tx_buf, 2);

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_write_mem(struct device *dev, uint8_t *data_buffer,
@@ -142,7 +142,7 @@ static void eth_enc28j60_write_mem(struct device *dev, uint8_t *data_buffer,
	num_segments = buf_len / MAX_BUFFER_LENGTH;
	num_remaining = buf_len - MAX_BUFFER_LENGTH * num_segments;

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	for (int i = 0; i < num_segments;
	     ++i, index_buf += MAX_BUFFER_LENGTH) {
@@ -158,7 +158,7 @@ static void eth_enc28j60_write_mem(struct device *dev, uint8_t *data_buffer,
		spi_write(context->spi, context->mem_buf, num_remaining + 1);
	}

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_read_mem(struct device *dev, uint8_t *data_buffer,
@@ -173,7 +173,7 @@ static void eth_enc28j60_read_mem(struct device *dev, uint8_t *data_buffer,
	num_segments = buf_len / MAX_BUFFER_LENGTH;
	num_remaining = buf_len - MAX_BUFFER_LENGTH * num_segments;

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	for (int i = 0; i < num_segments;
	     ++i, index_buf += MAX_BUFFER_LENGTH) {
@@ -192,7 +192,7 @@ static void eth_enc28j60_read_mem(struct device *dev, uint8_t *data_buffer,
		memcpy(index_buf, context->mem_buf + 1, num_remaining);
	}

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_write_phy(struct device *dev, uint16_t reg_addr,
@@ -208,7 +208,7 @@ static void eth_enc28j60_write_phy(struct device *dev, uint16_t reg_addr,

	do {
		/* wait 10.24 useconds */
		sys_thread_busy_wait(D10D24S);
		k_busy_wait(D10D24S);
		eth_enc28j60_read_reg(dev, ENC28J60_REG_MISTAT,
				      &data_mistat);
	} while ((data_mistat & ENC28J60_BIT_MISTAT_BUSY));
@@ -221,7 +221,7 @@ static void eth_enc28j60_gpio_callback(struct device *dev,
	struct eth_enc28j60_runtime *context =
		CONTAINER_OF(cb, struct eth_enc28j60_runtime, gpio_cb);

	nano_fiber_sem_give(&context->int_sem);
	k_sem_give(&context->int_sem);
}

static void eth_enc28j60_init_buffers(struct device *dev)
@@ -266,7 +266,7 @@ static void eth_enc28j60_init_buffers(struct device *dev)
	/* Waiting for OST */
	do {
		/* wait 10.24 useconds */
		sys_thread_busy_wait(D10D24S);
		k_busy_wait(D10D24S);
		eth_enc28j60_read_reg(dev, ENC28J60_REG_ESTAT, &data_estat);
	} while (!(data_estat & ENC28J60_BIT_ESTAT_CLKRDY));
}
@@ -338,8 +338,8 @@ static int eth_enc28j60_init(struct device *dev)
	struct eth_enc28j60_runtime *context = dev->driver_data;
	struct spi_config spi_cfg;

	nano_sem_init(&context->spi_sem);
	nano_fiber_sem_give(&context->spi_sem);
	k_sem_init(&context->spi_sem, 0, UINT_MAX);
	k_sem_give(&context->spi_sem);

	context->gpio = device_get_binding((char *)config->gpio_port);
	if (!context->gpio) {
@@ -388,7 +388,7 @@ static int eth_enc28j60_init(struct device *dev)
	}

	/* Errata B7/2 */
	sys_thread_busy_wait(D10D24S);
	k_busy_wait(D10D24S);

	eth_enc28j60_init_buffers(dev);
	eth_enc28j60_init_mac(dev);
@@ -403,14 +403,14 @@ static int eth_enc28j60_init(struct device *dev)
				 ENC28J60_BIT_ECON1_RXEN);

	/* Initialize semaphores */
	nano_sem_init(&context->tx_rx_sem);
	nano_sem_init(&context->int_sem);
	nano_sem_give(&context->tx_rx_sem);
	k_sem_init(&context->tx_rx_sem, 0, UINT_MAX);
	k_sem_init(&context->int_sem, 0, UINT_MAX);
	k_sem_give(&context->tx_rx_sem);

	/* Start interruption-poll fiber */
	fiber_start(context->fiber_stack, ENC28J60_FIBER_STACK_SIZE,
		    enc28j60_fiber_main, (int)dev, 0,
		    ENC28J60_FIBER_PRIORITY, 0);
	/* Start interruption-poll thread */
	k_thread_spawn(context->thread_stack, ENC28J60_THREAD_STACK_SIZE,
		    enc28j60_thread_main, (void *) dev, NULL, NULL,
		    K_PRIO_COOP(ENC28J60_THREAD_PRIORITY), 0, K_NO_WAIT);

	return 0;
}
@@ -426,7 +426,7 @@ static int eth_enc28j60_tx(struct device *dev, struct net_buf *buf,
	struct net_buf *frag;
	uint8_t tx_end;

	nano_fiber_sem_take(&context->tx_rx_sem, TICKS_UNLIMITED);
	k_sem_take(&context->tx_rx_sem, K_FOREVER);

	/* Latest errata sheet: DS80349C
	* always reset transmit logic (Errata Issue 12)
@@ -479,14 +479,14 @@ static int eth_enc28j60_tx(struct device *dev, struct net_buf *buf,

	do {
		/* wait 10.24 useconds */
		sys_thread_busy_wait(D10D24S);
		k_busy_wait(D10D24S);
		eth_enc28j60_read_reg(dev, ENC28J60_REG_EIR, &tx_end);
		tx_end &= ENC28J60_BIT_EIR_TXIF;
	} while (!tx_end);

	eth_enc28j60_read_reg(dev, ENC28J60_REG_ESTAT, &tx_end);

	nano_sem_give(&context->tx_rx_sem);
	k_sem_give(&context->tx_rx_sem);

	if (tx_end & ENC28J60_BIT_ESTAT_TXABRT) {
		return -EIO;
@@ -506,7 +506,7 @@ static int eth_enc28j60_rx(struct device *dev)
	 * Use EPKTCNT register instead.
	*/

	nano_fiber_sem_take(&context->tx_rx_sem, TICKS_UNLIMITED);
	k_sem_take(&context->tx_rx_sem, K_FOREVER);

	do {
		struct net_buf *last_frag;
@@ -604,23 +604,24 @@ done:
		eth_enc28j60_read_reg(dev, ENC28J60_REG_EPKTCNT, &counter);
	} while (counter);

	nano_sem_give(&context->tx_rx_sem);
	k_sem_give(&context->tx_rx_sem);

	return 0;
}

static void enc28j60_fiber_main(int arg1, int unused)
static void enc28j60_thread_main(void *arg1, void *unused1, void *unused2)
{
	struct device *dev = (struct device *) arg1;
	struct eth_enc28j60_runtime *context;
	uint8_t int_stat;

	ARG_UNUSED(unused);
	ARG_UNUSED(unused1);
	ARG_UNUSED(unused2);

	context = dev->driver_data;

	while (1) {
		nano_fiber_sem_take(&context->int_sem, TICKS_UNLIMITED);
		k_sem_take(&context->int_sem, K_FOREVER);
		eth_enc28j60_read_reg(dev, ENC28J60_REG_EIR, &int_stat);

		if (int_stat & ENC28J60_BIT_EIR_PKTIF) {
+37 −36
Changes for drivers/ethernet/eth_enc28j60_legacy.c: 37 added lines, 36 removed lines.
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
#define D10D24S 11

static int eth_net_tx(struct net_buf *buf);
static void enc28j60_fiber_main(int arg1, int unused);
static void enc28j60_thread_main(void *arg1, void *unused1, void *unused2);

static int eth_enc28j60_soft_reset(struct device *dev)
{
@@ -43,7 +43,7 @@ static void eth_enc28j60_set_bank(struct device *dev, uint16_t reg_addr)
	struct eth_enc28j60_runtime *context = dev->driver_data;
	uint8_t tx_buf[2];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	tx_buf[0] = ENC28J60_SPI_RCR | ENC28J60_REG_ECON1;
	tx_buf[1] = 0x0;
@@ -55,7 +55,7 @@ static void eth_enc28j60_set_bank(struct device *dev, uint16_t reg_addr)

	spi_write(context->spi, tx_buf, 2);

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_write_reg(struct device *dev, uint16_t reg_addr,
@@ -64,14 +64,14 @@ static void eth_enc28j60_write_reg(struct device *dev, uint16_t reg_addr,
	struct eth_enc28j60_runtime *context = dev->driver_data;
	uint8_t tx_buf[2];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	tx_buf[0] = ENC28J60_SPI_WCR | (reg_addr & 0xFF);
	tx_buf[1] = value;

	spi_write(context->spi, tx_buf, 2);

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_read_reg(struct device *dev, uint16_t reg_addr,
@@ -81,7 +81,7 @@ static void eth_enc28j60_read_reg(struct device *dev, uint16_t reg_addr,
	uint8_t tx_size = 2;
	uint8_t tx_buf[3];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	if (reg_addr & 0xF000) {
		tx_size = 3;
@@ -94,7 +94,7 @@ static void eth_enc28j60_read_reg(struct device *dev, uint16_t reg_addr,

	*value = tx_buf[tx_size - 1];

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_set_eth_reg(struct device *dev, uint16_t reg_addr,
@@ -103,14 +103,14 @@ static void eth_enc28j60_set_eth_reg(struct device *dev, uint16_t reg_addr,
	struct eth_enc28j60_runtime *context = dev->driver_data;
	uint8_t tx_buf[2];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	tx_buf[0] = ENC28J60_SPI_BFS | (reg_addr & 0xFF);
	tx_buf[1] = value;

	spi_write(context->spi, tx_buf, 2);

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}


@@ -120,14 +120,14 @@ static void eth_enc28j60_clear_eth_reg(struct device *dev, uint16_t reg_addr,
	struct eth_enc28j60_runtime *context = dev->driver_data;
	uint8_t tx_buf[2];

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	tx_buf[0] = ENC28J60_SPI_BFC | (reg_addr & 0xFF);
	tx_buf[1] = value;

	spi_write(context->spi, tx_buf, 2);

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_write_mem(struct device *dev, uint8_t *data_buffer,
@@ -143,7 +143,7 @@ static void eth_enc28j60_write_mem(struct device *dev, uint8_t *data_buffer,
	num_segments = buf_len / MAX_BUFFER_LENGTH;
	num_remanents = buf_len - MAX_BUFFER_LENGTH * num_segments;

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	for (int i = 0; i < num_segments;
	     ++i, index_buf += i * MAX_BUFFER_LENGTH) {
@@ -158,7 +158,7 @@ static void eth_enc28j60_write_mem(struct device *dev, uint8_t *data_buffer,
		spi_write(context->spi, tx_buf, num_remanents + 1);
	}

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_read_mem(struct device *dev, uint8_t *data_buffer,
@@ -174,7 +174,7 @@ static void eth_enc28j60_read_mem(struct device *dev, uint8_t *data_buffer,
	num_segments = buf_len / MAX_BUFFER_LENGTH;
	num_remanents = buf_len - MAX_BUFFER_LENGTH * num_segments;

	nano_fiber_sem_take(&context->spi_sem, TICKS_UNLIMITED);
	k_sem_take(&context->spi_sem, K_FOREVER);

	for (int i = 0; i < num_segments;
	     ++i, index_buf += i * MAX_BUFFER_LENGTH) {
@@ -191,7 +191,7 @@ static void eth_enc28j60_read_mem(struct device *dev, uint8_t *data_buffer,
		memcpy(index_buf, tx_buf + 1, num_remanents);
	}

	nano_fiber_sem_give(&context->spi_sem);
	k_sem_give(&context->spi_sem);
}

static void eth_enc28j60_write_phy(struct device *dev, uint16_t reg_addr,
@@ -207,7 +207,7 @@ static void eth_enc28j60_write_phy(struct device *dev, uint16_t reg_addr,

	do {
		/* wait 10.24 useconds */
		sys_thread_busy_wait(D10D24S);
		k_busy_wait(D10D24S);
		eth_enc28j60_read_reg(dev, ENC28J60_REG_MISTAT,
				      &data_mistat);
	} while ((data_mistat & ENC28J60_BIT_MISTAT_BUSY));
@@ -220,7 +220,7 @@ static void eth_enc28j60_gpio_callback(struct device *dev,
	struct eth_enc28j60_runtime *context =
		CONTAINER_OF(cb, struct eth_enc28j60_runtime, gpio_cb);

	nano_fiber_sem_give(&context->int_sem);
	k_sem_give(&context->int_sem);
}

static void eth_enc28j60_init_buffers(struct device *dev)
@@ -265,7 +265,7 @@ static void eth_enc28j60_init_buffers(struct device *dev)
	/* Waiting for OST */
	do {
		/* wait 10.24 useconds */
		sys_thread_busy_wait(D10D24S);
		k_busy_wait(D10D24S);
		eth_enc28j60_read_reg(dev, ENC28J60_REG_ESTAT, &data_estat);
	} while (!(data_estat & ENC28J60_BIT_ESTAT_CLKRDY));
}
@@ -346,8 +346,8 @@ static int eth_enc28j60_init(struct device *dev)
	struct eth_enc28j60_runtime *context = dev->driver_data;
	struct spi_config spi_cfg;

	nano_sem_init(&context->spi_sem);
	nano_fiber_sem_give(&context->spi_sem);
	k_sem_init(&context->spi_sem, 0, UINT_MAX);
	k_sem_give(&context->spi_sem);

	context->gpio = device_get_binding((char *)config->gpio_port);
	if (!context->gpio) {
@@ -396,7 +396,7 @@ static int eth_enc28j60_init(struct device *dev)
	}

	/* Errata B7/2 */
	sys_thread_busy_wait(D10D24S);
	k_busy_wait(D10D24S);

	eth_enc28j60_init_buffers(dev);
	eth_enc28j60_init_mac(dev);
@@ -414,14 +414,14 @@ static int eth_enc28j60_init(struct device *dev)
	net_driver_ethernet_register_tx(eth_net_tx);

	/* Initialize semaphores */
	nano_sem_init(&context->tx_rx_sem);
	nano_sem_init(&context->int_sem);
	nano_sem_give(&context->tx_rx_sem);
	k_sem_init(&context->tx_rx_sem, 0, UINT_MAX);
	k_sem_init(&context->int_sem, 0, UINT_MAX);
	k_sem_give(&context->tx_rx_sem);

	/* Start interruption-poll fiber */
	fiber_start(context->fiber_stack, ENC28J60_FIBER_STACK_SIZE,
		    enc28j60_fiber_main, (int)dev, 0,
		    ENC28J60_FIBER_PRIORITY, 0);
	/* Start interruption-poll thread */
	k_thread_spawn(context->thread_stack, ENC28J60_THREAD_STACK_SIZE,
		    enc28j60_thread_main, (void *) dev, NULL, NULL,
		    K_PRIO_COOP(ENC28J60_THREAD_PRIORITY), 0, K_NO_WAIT);

	return 0;
}
@@ -434,7 +434,7 @@ static int eth_enc28j60_tx(struct device *dev, uint8_t *buf, uint16_t len)
	uint16_t tx_bufaddr_end;
	uint8_t tx_end;

	nano_fiber_sem_take(&context->tx_rx_sem, TICKS_UNLIMITED);
	k_sem_take(&context->tx_rx_sem, K_FOREVER);

	/* Latest errata sheet: DS80349C
	* always reset transmit logic (Errata Issue 12)
@@ -472,14 +472,14 @@ static int eth_enc28j60_tx(struct device *dev, uint8_t *buf, uint16_t len)

	do {
		/* wait 10.24 useconds */
		sys_thread_busy_wait(D10D24S);
		k_busy_wait(D10D24S);
		eth_enc28j60_read_reg(dev, ENC28J60_REG_EIR, &tx_end);
		tx_end &= ENC28J60_BIT_EIR_TXIF;
	} while (!tx_end);

	eth_enc28j60_read_reg(dev, ENC28J60_REG_ESTAT, &tx_end);

	nano_sem_give(&context->tx_rx_sem);
	k_sem_give(&context->tx_rx_sem);

	if (tx_end & ENC28J60_BIT_ESTAT_TXABRT)	{
		return -1;
@@ -498,7 +498,7 @@ static int eth_enc28j60_rx(struct device *dev)
	 * Use EPKTCNT register instead.
	*/

	nano_fiber_sem_take(&context->tx_rx_sem, TICKS_UNLIMITED);
	k_sem_take(&context->tx_rx_sem, K_FOREVER);

	do {
		uint8_t *reception_buf = NULL;
@@ -573,7 +573,7 @@ done:
		eth_enc28j60_read_reg(dev, ENC28J60_REG_EPKTCNT, &counter);
	} while (counter);

	nano_sem_give(&context->tx_rx_sem);
	k_sem_give(&context->tx_rx_sem);

	return 0;
}
@@ -586,18 +586,19 @@ void eth_enc28j60_reg_cb(struct device *dev,
	context->receive_callback = cb;
}

static void enc28j60_fiber_main(int arg1, int unused)
static void enc28j60_thread_main(void *arg1, void *unused1, void *unused2)
{
	struct device *dev = (struct device *) arg1;
	struct eth_enc28j60_runtime *context;
	uint8_t int_stat;

	ARG_UNUSED(unused);
	ARG_UNUSED(unused1);
	ARG_UNUSED(unused2);

	context = dev->driver_data;

	while (1) {
		nano_fiber_sem_take(&context->int_sem, TICKS_UNLIMITED);
		k_sem_take(&context->int_sem, K_FOREVER);
		eth_enc28j60_read_reg(dev, ENC28J60_REG_EIR, &int_stat);

		if (int_stat & ENC28J60_BIT_EIR_PKTIF) {
+8 −8
Changes for drivers/ethernet/eth_enc28j60_priv.h: 8 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 * limitations under the License.
 */

#include <nanokernel.h>
#include <kernel.h>
#include <gpio.h>

#ifndef _ENC28J60_
@@ -215,9 +215,9 @@
#define TSV_SIZE 7
#define RSV_SIZE 4

/* Fiber Configuration */
#define ENC28J60_FIBER_STACK_SIZE 512
#define ENC28J60_FIBER_PRIORITY   15
/* Thread Configuration */
#define ENC28J60_THREAD_STACK_SIZE 512
#define ENC28J60_THREAD_PRIORITY   15

/* Microchip's OUI*/
#define MICROCHIP_OUI_B0 0x00
@@ -239,16 +239,16 @@ struct eth_enc28j60_runtime {
#ifdef CONFIG_NET_YAIP
	struct net_if *iface;
#endif
	char __stack fiber_stack[ENC28J60_FIBER_STACK_SIZE];
	char __stack thread_stack[ENC28J60_THREAD_STACK_SIZE];
	struct device *gpio;
	struct device *spi;
	struct gpio_callback gpio_cb;
	uint8_t mem_buf[MAX_BUFFER_LENGTH + 1];
	uint8_t  tx_tsv[TSV_SIZE];
	uint8_t  rx_rsv[RSV_SIZE];
	struct nano_sem tx_rx_sem;
	struct nano_sem int_sem;
	struct nano_sem spi_sem;
	struct k_sem tx_rx_sem;
	struct k_sem int_sem;
	struct k_sem spi_sem;
#ifndef CONFIG_NET_YAIP
	void (*receive_callback)(uint8_t *buffer, uint16_t len);
#endif