Commit graph

41120 commits

Author SHA1 Message Date
Oleg Zhurakivskyy
d11c92b60b samples: echo_client: Add overlays for debugging
Add overlays that might be useful for debugging:

- overlay-log.conf
   Enable debug log for socket, context, connection, TCP/TCP2.
- overlay-debug.conf
   Disable optimization and compile with debug information.
- overlay-max-stacks.conf
   Overlay to quickly sort out insufficient stack problems.
- overlay-e1000.conf

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
fad38b12a3 net: tcp2: Update test protocol functions
After removing the test windows, update test protocol
functions for the TTCN-3 sanity check.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
615d73b2c9 net: tcp2: Set TCP connection endpoints in net_tcp_connect()
Initialize and set IPv4/IPv6 connection endpoints in net_tcp_connect().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
a156d76f8e net: tcp2: Do not base the incoming data evaluation on PSH
Do not base the incoming data evaluation on PSH.

Also, reduce the condition branches.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
f149eb7b14 net: tcp2: Remove obsolete test window functions
These test receive windows were used by TTCN-3 sanity check,
but it's possible to do without them.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
16b8244cf8 net: tcp2: Eliminate the need for a test send window
In order to drop dependency on a heap, drop the
test send window.

Use net_tcp_queue_data() to receive the outgoing data
from the socket layer.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
b25faa6159 net: tcp2: Eliminate the need for a test receive window
In order to drop dependency on a heap, drop the test
receive window.

The receive window was needed for TTCN-3 sanity check,
but it's possible to do without it.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
71a225d76f samples: echo_server: Add overlays for debugging
Add overlays that might be useful for debugging:

- overlay-log.conf
   Enable debug log for socket, context, connection, TCP/TCP2.
- overlay-debug.conf
   Disable optimization and compile with debug information.
- overlay-max-stacks.conf
   Overlay to quickly sort out insufficient stack problems.
- overlay-e1000.conf

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
4c81935c2e net: tcp2: Don't instantiate an extra connection on SYN+ACK
On incoming SYN+ACK, use the existing TCP connection.

This problem was overlooked earlier and was found while
testing TCP2 client side.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
b0381bc80e net: tcp2: Check the ack number in SYN_SENT
In SYN_SENT check the ack number of the incoming TCP message
against our sequence number.

This problem was overlooked earlier and was found while
testing TCP2 client side.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
038618dbc8 net: tcp2: Guard against th_get() on NULL pkt
This problem was overlooked earlier and was found while
testing TCP2 client side.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
1eccf22526 net: tcp2: Add log_strdup() where necessary
In case the log output involves the content of the static
buffer, add log_strdup().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
ebbb7f3d56 net: tcp2: Don't instantiate an extra connection on connect
Don't erroneously instantiate an extra TCP connection
on TCP connect.

This problem was overlooked earlier and found while testing
TCP2 client side.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
d6f1937fbb net: tcp2: Switch from k_timer to k_delayed_work
k_timer callback is executed from ISR context, which isn't
currenty compatible with Zephyr's shell implementation.

This problem was found while testing TCP2 client side.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
bab5e7bd96 net: tp: Add IPv6 support for test protocol
In order to suport using test protocol over IPv6,
add IPv6 support.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
27a12b78cb net: tcp2: Drop obsolete ip_get(), ip6_get() macros
After adding IPv6 support, there's no need for them.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
e301397af1 net: tcp2: Use net_tcp_finalize() for checksum calculation
In order to support IPv6, use net_tcp_finalize() for checksum
calculation.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
9292ce9efc net: tcp2: Add IPv6 support for outgoing packets
Add IPv6 support for outgoing packets.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
75820c9bdf net: tcp2: Register test inputs for TTCN-3 based TCP2 sanity check
In order to support TTCN-3 based TCP2 sanity check,
register test inputs with net_conn_register() and adjust
test functions to account for this.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
f5c1ee03b8 net: tcp2: Add support for a IPv6
In order to support IPv4/IPv6, work with packet through
net_pkt_ip_hdr_len(), net_pkt_ip_opts_len() which account
for IPv4/IPv6, IPv4 options and IPv6 extension headers.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
6be5935f17 net: ipv4: Remove temporary interception of TCP, UDP for TCP2
Remove temporary interception of TCP, UDP for TTCN-3 based
TCP2 sanity check.

As a part of adding IPv6 support, TCP2 will register test
callbacks/inputs with net_conn_register().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Oleg Zhurakivskyy
e0c151b9cf samples: net: sockets: tcp: Add a TCP sample and instructions
In order to run the TTCN-3 based sanity check, add a TCP
sample app and instructions for running the sanity check.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-11 16:24:52 +02:00
Patrik Flykt
794b32a4fc net: tcp2: Allocate endpoints before using
Allocate tcp2.c endpoints before storing port numbers or addresses.
Select the IPv4 source address since net_context_create_ipv4_new()
is not currently called on packet output.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-03-11 16:24:52 +02:00
Daniel Leung
4700c93f3c soc: mec1501: wait for PLL to lock coming out of deep sleep
The 48MHz PLL on MEC1501 is shut off during deep sleep (i.e. heavy
sleep in datasheet). When coming out of deep sleep, this PLL needs
about 3ms to lock. Most peripherals are using this PLL as clock
source and timing would be off before PLL is locked. Example of
this is seen on serial console where garbage characters are sent
as the UART block is not pushing characters out at the configured
baud rate. This likely affects all other peripherals such as I2C
and eSPI. Luckily, there is a register to indicate whether the PLL
is ready. So spin on it when coming out of deep sleep.

Fixes #23207

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-11 10:13:41 -04:00
Kumar Gala
490494c58f drivers: entropy: sam: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
70d78412f7 drivers: watchdog: sam: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
76e0cf63b3 drivers: ps2: mchp_xec: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
22246f89dc dts: microchip,xec-ps2: Add properties for GIRQ info
Add girq and girq-bit to encode per device information.  This allows the
driver to get any device unique info from device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
c68a1d427d drivers: espi: mchp_xec: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.  The driver mostly used DT_INST_ defines but
a few IRQ priority defines needed conversion.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
9a8831b781 drivers: counter: mchp_xec: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

As part of this change we utilize the device tree for GIRQ info and
rename timer3 to 2 since we are doing this by instance number.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
9ed4f39110 dts: microchip,xec-timer: Add properties for GIRQ info
Add girq and girq-bit to encode per device information.  This allows the
driver to get any device unique info from device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
d6b6ebe522 drivers: counter: mchp_xec: Fix dts prop type for max-value
The max-value should just be an int and not an array.  Change the type
to 'int' in the binding and fixup the driver to match.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
61d30ed927 drivers: intc: plic: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
c998b12652 drivers: clock_control: rv32m1_pcc: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
0353d22202 kconfig: Add dt_nodelabel_enabled function
Add a function takes a 'label' and returns "y" if we find an
"enabled" node that has a 'nodelabel' of 'label' in the EDT
otherwise we return "n"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Martí Bolívar
7846fd103d edtlib: add 'labels' attribute to Node class
This corresponds to the attribute by the same name in dtlib.Node.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
3b7ddc83d1 scripts: gen_defines: tweak out_define() whitespace
Pad node identifiers to 60 characters. This results in better
alignment in practice than the current value of 40, which is a bit
low.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
47073fd11c scripts: gen_defines: remove out()'s aliases kwarg
Write the same results explicitly in its only remaining caller.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
3939556fc3 scripts: gen_defines: re-work write_bus() with augmented nodes
This too is an attempt to reimplement the previous behavior exactly,
modulo the order in which things are defined.

This is the last function which is calling into the previous
implementation's out_node and node_*_alias() functions, so these can
be removed now.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
0471199e63 scripts: gen_defines: re-work write_spi_dev() with augmented nodes
This uses augmented nodes in the same way as done previously.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
86645aafdf scripts: gen_defines: re-work write_props() with augmented nodes
This is similar to the work already done for regs.

Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.

We're intentionally leaving some of the helpers in module scope here
to use some of the subroutines elsewhere later on when reworking
write_spi_dev().

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
c048f872d7 scripts: gen_defines: re-work write_clocks() with augmented nodes
Mirror the change already done to write_regs().

Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
f68da76d36 scripts: gen_defines: re-work write_irqs() with augmented nodes
Use augmented nodes to print macros grouped by namespace.

Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
ba1c8b523c scripts: gen_defines: re-work write_regs() with augmented nodes
Group the macros together by namespace rather than putting all the
BASE_ADDRESS macros together and all the SIZE macros together. E.g.,
all the DT_INST_<x> namespace macros for each node now appear
consecutively.

Add a comment making it clear that this output comes from "regs",
since "BASE_ADDRESS" and "SIZE" are not property names.

Other than the order in which they appear and comments, the output
before and after this patch should be exactly the same.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Martí Bolívar
dd1d58cad6 scripts: gen_defines: augment edtlib nodes
Add additional attributes to each edtlib.Node we process, before
calling into the write_foo() routines.

This includes the identifier returned by node_ident(), which is used
as the primary identifier for the node, as well as lists for instance
and aliases nodes, and a catchall list that contains all the other
identifiers in addition to the primary one.

Use this information in a new for_each_ident(node, ident) def that
will be put to use in the various write_foo() routines.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Ulf Magnusson
8cacb9fd8c dts: edtlib: Turn global spi_dev_cs_gpio() into Node.spi_cs_gpio
spi_dev_cs_gpio() takes a Node and returns the chip select GPIO for it.
Having that information available directly from Node is neater, so turn
it into a Node.spi_cs_gpio property instead.

That gets rid of the only public global function in edtlib, which might
make the API design clearer too.

Tested with the sensortile_box board, which uses SPI chip select.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-03-11 07:59:38 -06:00
Kumar Gala
e2d71c9c77 driver: interrupt_controller: dw: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
69c5aa0b32 driver: spi: dw: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
bdcf87956b driver: gpio: dw: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala
5d332c974e board: hsdk: Convert defines into dts for display
The ILITEK ILI9340 should have been in the dts and added as #defines in
dts_fixup.h.  Fix this by adding a display node in the dts.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00