Skip to content

Commit 0ad575f

Browse files
committed
Merge branch 'master' of ssh://47.105.117.50:2224/wzedmund/evm_publish_final
2 parents 876d9df + c1cb616 commit 0ad575f

File tree

15 files changed

+95
-18
lines changed

15 files changed

+95
-18
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit e88113bbebe34ff2ccc6627ffae885cfeed6fdfd
1+
Subproject commit 80a76f4af4314635bef83272779ddbed6021fc32
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 821154171b246f64eaeef3ccc267f58d8274739a
1+
Subproject commit cf7020eb4c7ef93319f2d6d2403a21e12a879bf6
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 3c3c9ec83bbb99390e34f8f2ba273ec86cf2b67c
1+
Subproject commit 60f40977eccb7e067a83933cec859e266bff4849
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit aad89bf0531a30dcd6c87e4065f1b973fb31c11f
1+
Subproject commit 688cb7deebd5910357e35843595149b3feba2184
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 742d8fb839406951ef7f95d0132bfa8c2635343f
1+
Subproject commit 1ebfdf148b2ca1d9ab9267ab2cd64cc00f32d505

components/zephyr-rtos/modules/hal/st

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 5b3ec3e182d4310e8943cc34c6c70ae57d9711da
1+
Subproject commit fa481784b3c49780f18d50bafe00390ccb62b2ec
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit d1bc80d021f4ebc31f6e8b36f14b738cc26c7b03
1+
Subproject commit 37dcc0e120bb2bb99d3ee3b99dbbcf2bffe50258

components/zephyr-rtos/modules/hal/ti

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 15b76302bf27c307e2250467116b0f95f506ba4b
1+
Subproject commit 7dcbff2d5994bc48dc3aa2a6af619dadf91d88db
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 5885efb7cabf7b566577b73129c9d277d7d8848d
1+
Subproject commit 1843fdce2b008b45f9cc8b38dd9a57a575ab50f6
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 724f7e2a4519d7e1d40ef330042682dea950c991
1+
Subproject commit 5720c73ef3bd885824b2d2184f606443e03f73c4
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit a83d18cf18bc8cd431ad6704ad0bf0e6d08c99d7
1+
Subproject commit 2ac83762b87b9cbb7072e3bca663ac13708c17d9

components/zephyr-rtos/tools/ci-tools

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit da9a2df574094f52d87a03f6393928bdc7dce17c
1+
Subproject commit cf55a47d52d38af655f3efa6d38ff105b727358a
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 1c4fdba512b268033a4cf926bddd323866c3261a
1+
Subproject commit 1080094bc246357c6c35e80e8b2d5d0ce7e0d963

drivers/zephyr/ethernet/w5500/driver_w5500.c

+63-5
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,31 @@ static void spi_read_burst(uint8_t *buf, uint16_t len)
126126

127127
static void spi_cris_enter(void)
128128
{
129-
129+
struct w5500_runtime *context = wiz_dev->driver_data;
130+
const struct w5500_config *config = wiz_dev->config_info;
131+
132+
z_impl_gpio_disable_callback(context->gpio,config->gpio_pin);
130133
}
131134

132135
static void spi_cris_exit(void)
133136
{
134-
137+
struct w5500_runtime *context = wiz_dev->driver_data;
138+
const struct w5500_config *config = wiz_dev->config_info;
139+
140+
z_impl_gpio_enable_callback(context->gpio,config->gpio_pin);
135141
}
136142

137143
static void spi_cs_select(void)
138144
{
139-
145+
struct w5500_runtime *context = wiz_dev->driver_data;
146+
gpio_pin_set(context->spi_cs.gpio_dev,context->spi_cs.gpio_pin,0);
140147
}
141148

142149
static void spi_cs_deselect(void)
143150
{
144-
151+
struct w5500_runtime *context = wiz_dev->driver_data;
152+
153+
gpio_pin_set(context->spi_cs.gpio_dev,context->spi_cs.gpio_pin,0);
145154
}
146155

147156
/* register TCP communication related callback function */
@@ -174,7 +183,7 @@ static void w5500_gpio_callback(struct device *dev,
174183
struct w5500_runtime *context =
175184
CONTAINER_OF(cb, struct w5500_runtime, gpio_cb);
176185

177-
k_sem_give(&context->int_sem);
186+
k_sem_give(&context->int_sem);
178187
}
179188

180189
static int w5500_tx(struct device *dev, struct net_pkt *pkt)
@@ -277,6 +286,20 @@ static enum ethernet_hw_caps w5500_get_capabilities(struct device *dev)
277286
return ETHERNET_LINK_10BASE_T | ETHERNET_LINK_100BASE_T;
278287
}
279288

289+
static void w5500_init_phy(struct device *dev)
290+
{
291+
const struct w5500_config *config = dev->config_info;
292+
293+
uint8_t tmp = 0;
294+
295+
if (config->full_duplex) {
296+
tmp |= PHYCFGR_OPMDC_100F;
297+
} else {
298+
tmp |= PHYCFGR_OPMDC_100H;
299+
}
300+
setPHYCFGR(tmp);
301+
}
302+
280303
static void w5500_iface_init(struct net_if *iface)
281304
{
282305
struct device *dev = net_if_get_device(iface);
@@ -301,6 +324,8 @@ static const struct ethernet_api api_funcs = {
301324

302325
static int w5500_init(struct device *dev)
303326
{
327+
wiz_dev = dev;
328+
304329
const struct w5500_config *config = dev->config_info;
305330
struct w5500_runtime *context = dev->driver_data;
306331

@@ -326,6 +351,36 @@ static int w5500_init(struct device *dev)
326351
context->spi_cs.gpio_pin = config->spi_cs_pin;
327352
context->spi_cfg.cs = &context->spi_cs;
328353
#endif
354+
355+
/* Initialize GPIO */
356+
context->gpio = device_get_binding((char *)config->gpio_port);
357+
if (!context->gpio) {
358+
LOG_ERR("GPIO port %s not found", config->gpio_port);
359+
return -EINVAL;
360+
}
361+
362+
if (gpio_pin_configure(context->gpio, config->gpio_pin,
363+
GPIO_INPUT | config->gpio_flags)) {
364+
LOG_ERR("Unable to configure GPIO pin %u", config->gpio_pin);
365+
return -EINVAL;
366+
}
367+
368+
gpio_init_callback(&(context->gpio_cb), w5500_gpio_callback,
369+
BIT(config->gpio_pin));
370+
371+
if (gpio_add_callback(context->gpio, &(context->gpio_cb))) {
372+
return -EINVAL;
373+
}
374+
375+
gpio_pin_interrupt_configure(context->gpio,
376+
config->gpio_pin,
377+
GPIO_INT_EDGE_TO_ACTIVE);
378+
379+
wiz_callback_register();
380+
/* read MAC address */
381+
getPHAR(context->mac_address);
382+
w5500_init_phy(dev);
383+
329384
/* Start interruption-poll thread */
330385
k_thread_create(&context->thread, context->thread_stack,
331386
CONFIG_ETH_W5500_RX_THREAD_STACK_SIZE,
@@ -347,6 +402,9 @@ static struct w5500_runtime w5500_0_runtime = {
347402
};
348403

349404
static const struct w5500_config w5500_0_config = {
405+
.gpio_port = DT_INST_GPIO_LABEL(0, int_gpios),
406+
.gpio_pin = DT_INST_GPIO_PIN(0, int_gpios),
407+
.gpio_flags = DT_INST_GPIO_FLAGS(0, int_gpios),
350408
.spi_port = DT_INST_BUS_LABEL(0),
351409
.spi_freq = DT_INST_PROP(0, spi_max_frequency),
352410
.spi_slave = DT_INST_REG_ADDR(0),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2019, Phytec Messtechnik GmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: |
5+
W5500 standalone 100BASE-T Ethernet controller with SPI interface
6+
7+
compatible: "wiznet,w5500"
8+
9+
include: [spi-device.yaml, ethernet.yaml]
10+
11+
properties:
12+
int-gpios:
13+
type: phandle-array
14+
required: true
15+
description: Interrupt pin.
16+
17+
The interrupt pin of ENC424J600 is active low.
18+
If connected directly the MCU pin should be configured
19+
as active low.

0 commit comments

Comments
 (0)