Commit graph

463 commits

Author SHA1 Message Date
Armand Ciejak 309916930f drivers: eth: mcux: Fix wrong base address for second controller
Copy paste error, base address of second controller was set to the
same as the first one, corrected to ENET2.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 7f4043099a drivers: eth: mcux: Print interface name instead of base register address
With Ethernet controller base address is not straight forward
to figure out if it is ENET or ENET2l, using name is much better.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 7cddc83737 drivers: eth: mcux: Add eth1 for i.MXRT1060 family
Instantiate a second Ethernet device if CONFIG_ETH_MCUX_1 is set.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 2ef7d4d66c drivers: eth: mcux: Add PHY address to eth_context
This will allow having a different PHY address for each controller.
It also avoids for the PHY address to be hard-coded in several
functions.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 162ec3f9d5 drivers: eth: mcux: Add generate_mac function pointer to eth_context
This will allow for different configuration between ENET and ENET2.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 0e31ed4912 drivers: eth: mcux: Add config_func to eth_context structure
This will allow having a different function for the second
port.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak b56043c530 drivers: eth: mcux: Add ENET base address to eth_context structure
This will allow using either ENET or ENET2.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak e8cb6c69ab drivers: eth: mcux: Add ETH_MCUX_1 config
Add new config allowing to enable the second Ethernet port
on i.MX RT1060 SoC family.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Carles Cufi 4b37a8f3a4 Revert "global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()"
This reverts commit 8739517107.

Pull Request #23437 was merged by mistake with an invalid manifest.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-03-19 18:45:13 +01:00
Oleg Zhurakivskyy 8739517107 global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()
Replace all occurences of BUILD_ASSERT_MSG() with BUILD_ASSERT()
as a result of merging BUILD_ASSERT() and BUILD_ASSERT_MSG().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-19 15:47:53 +01:00
Jukka Rissanen 36ddeaceca drivers: eth: stm32: Add VLAN support
Add Virtual LAN support to stm32 Ethernet driver. Refactor the
eth_iface_init() and move device configuration settings to
eth_initialize() as the eth_iface_init() is called multiple
times (once / configured VLAN).

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-18 12:44:19 +02:00
Jukka Rissanen 330eb0f6f9 drivers: ethernet: stm32: Remove frag debug print in RX
The RX fragment debug print does not work (compile error)
if memory allocation debugging is enabled, so disable it
for time being.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-17 13:13:58 +02:00
Andrew Boie 760644041c net: purge NET_STACK and other stack APIs
The current design of the network-specific stack dumping APIs
is fundamentally unsafe. You cannot properly dump stack data
without information which is only available in the thread object.

In addition, this infrastructure is unnecessary. There is already
a core shell command which dumps stack information for all
active threads.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-14 13:10:19 -04:00
Kumar Gala dbcd856dc1 drivers: ethernet: stellaris: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-12 04:54:04 -06:00
Kumar Gala 836b485377 drivers: ethernet: e1000: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 16:36:21 -06:00
Jukka Rissanen c03336e442 cmake: Allow change of the QEMU Ethernet interface name
Instead of hardcoding the "zeth" network interface name, use the
name defined in Kconfig so that user can change it if needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-10 14:38:28 +02:00
Luuk Bosma 63b22d7015 drivers/ethernet/eth_gecko: auto-negotiate after link up
Move auto-negotiate sequence from driver initialization to link up event
Previously when booting without ethernet cable connected the
initialization would fail and never recover.
Now we can connect the ethernet cable any time and multiple times.

This also drastically reduces boot time to main.

Logging Link up and Link down events.
Logging speed and duplex from eth_gecko logger instead of eth_gecko_phy.

Signed-off-by: Luuk Bosma <l.bosma@interay.com>
2020-03-10 14:08:51 +02:00
Armand Ciejak 38a2e2cf89 drivers: eth: mcux: Write correct data into override register
Do not use the content of the status register to write into the
override register because it may have unpredictable effect,
instead to a read/modify/write on the override register.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-07 09:23:47 +02:00
Armand Ciejak a3d413c51a drivers: eth: mcux: Fix PHY access in eth_mcux_phy_setup
It is necessary to poll the ENET_EIR_MII bit before reading
the data register as explained in the i.MX RT1060 reference
manual in chapter 41.7.17.4.
Use PHY_* functions from NXP HAL to correctly access the PHY
registers.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-07 09:23:47 +02:00
Gerson Fernando Budke f7564323f5 drivers: eth: sam_gmac: Add priority queue checks
Improve priority queue conditional build. Now priority queue code is
enabled only if device have support to it. This enables GMAC driver
for devices with only one queue for RX/TX.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-04 23:11:42 +02:00
Gerson Fernando Budke 51f7fc8fba drivers: eth: eth_sam_gmac: Move queue init block
Move queue init block to avoid add many defines on code.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-04 23:11:42 +02:00
Gerson Fernando Budke 04e6045505 drivers: eth: eth_sam_gmac: Fix priority queues
The Atmel SAM SoC with ethernet port uses same GMAC driver. However,
there are differences between SoC GMAC implementation. Some SoCs have
priority queue and system can configure 0 up to 5, depending of SoC
version. This update current GMAC driver adding missing definitions.

Co-authored-by: Stephanos Ioannidis <root@stephanos.io>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-04 23:11:42 +02:00
Gerson Fernando Budke dc277a8733 drivers: eth: Kconfig.sam_gmac: Fix queue definitions
Add missing queue entries for sam gmac. This update the queue selection
to proper handle all supported SAM SoC that uses GMAC driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-04 23:11:42 +02:00
Daniel Glöckner 47ea3c4e2c drivers: eth: sam-e70: revision B has more queues
The first revision of the SAM E70 soc had three queues. The current
revision B has six queues. If we don't initialize all queues, the DMA
engine gets stuck when trying to read a descriptor from NULL. To enable
the initialization of the additional queues, the correct soc has to be
selected in the config options, f.ex. CONFIG_SOC_PART_NUMBER_SAME70Q21B
instead of CONFIG_SOC_PART_NUMBER_SAME70Q21.

Also rename GMAC_QUEUE_NO to GMAC_QUEUE_NUM as requested during review.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
2020-03-04 23:11:42 +02:00
Andrei Gansari a410486dca drivers: eth_mcux phy_setup moved after SMI init
SMI initialization is required to enable PHY communication.
PHY setups needs to run after SMI initialization.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-02-25 20:41:04 +02:00
Ulf Magnusson 378d6b137a kconfig: Replace non-defconfig single-symbol 'if's with 'depends on'
Same deal as in commit eddd98f811 ("kconfig: Replace some single-symbol
'if's with 'depends on'"), for the remaining cases outside defconfig
files. See that commit for an explanation.

Will do the defconfigs separately in case there are any complaints
there.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-12 10:32:34 -06:00
Peter Bigot 37239dbcbf gpio: rename typedef for devicetree flags
gpio_dt_flags_t is shorter and consistent with DT_ prefix.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 91fad730a6 drivers: enc28j60: convert to new GPIO API
Convert ENC28J60 controller driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Johann Fischer d3da608535 drivers: enc424j600: convert to new GPIO API
Convert ENC424J600 controller driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Jukka Rissanen 92481765a2 drivers: ethernet: Set the context iface ptr to main interface
If the Ethernet driver has VLAN enabled (only native_posix, mcux
or gmac has VLAN supported), then the iface pointer in ethernet
context should contain the main network interface. This is needed
so that the interface will get link address set to it properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-01-30 09:42:07 +02:00
Peter Bigot 0b0d2e640b treewide: use full path to clock_control/stm32_clock_control.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Oane Kingma 437587af20 drivers/ethernet: Add support for SiLabs Giant Gecko GG11
Ethernet MAC present in Silicon Labs EFM32GG11B4xx and
EFM32GG11B8xx SoCs.

DMA based driver with support for link up/down detection.

Signed-off-by: Oane Kingma <o.kingma@interay.com>
2020-01-24 10:28:33 -06:00
Ruslan Mstoi c2542eacbd drivers: eth: native_posix: Yield to avoid deadlocks in RX
TCP segment with several EOL TCP options causes echo server to block and
use 100% of CPU. This patch fixes that issue by using k_yield to let
also other threads to run.

Fixes #21949

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2020-01-17 10:02:18 +02:00
Oleg Zhurakivskyy 5e54a8f1c4 drivers: eth: e1000: Include sys/types.h for ssize_t
echo_server app doesn't compile (it uses minimal libc which lacks
unistd.h), let's switch to a more fine-grained include here.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-01-08 15:42:16 +02:00
Jukka Rissanen 2a1eabecc6 drivers: eth: mcux: Disable HW accel checksum calc
Do not enable hardware accelerated checksum calculation by
default. It does not work for frdm-k64f and is causing
confusion among users.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-01-07 12:29:49 +02:00
Jonas Norling d7d3462d91 drivers: eth: native_posix: Don't sleep when there is data to read
Don't sleep 50ms after each received packet, sleep only when there
wasn't anything to receive. Otherwise data could get stuck for a long
time if there was more than 20 packets coming in per second. The
read() call on a TUN/TAP device returns only a single packet per call.

Also remove the call to eth_stats_update_errors_rx() because this else
clause isn't actually a receive error, we're just waiting for more
packets.

Signed-off-by: Jonas Norling <jonas.norling@greeneggs.se>
2020-01-06 17:03:13 +02:00
Oleg Zhurakivskyy fdd29717f5 drivers: eth: e1000: Add a hexdump of the received/sent data
In case ETH_E1000_VERBOSE_DEBUG is enabled, hexdump
the received/sent data.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-01-02 16:58:27 -05:00
Oleg Zhurakivskyy 2552400533 drivers: eth: e1000: Sanitize the RX descriptor length
Add an error handling of the invalid RX descriptor length (<= 4).

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-01-02 16:58:27 -05:00
Oleg Zhurakivskyy 1453b316cb drivers: eth: e1000: Minor cleanup of the naming in e1000_rx()
Use buf and len for consistency.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-01-02 16:58:27 -05:00
Oleg Zhurakivskyy 4b74f69eb3 drivers: eth: e1000: Minor cleanup of the naming in e1000_tx()
Use buf and len for consistency.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-01-02 16:58:27 -05:00
Ulf Magnusson 41713244b3 kconfig: Remove '# Hidden' comments on promptless symbols
How prompts work is better documented nowadays, and these comments might
not be that helpful if you don't know.

There are lots promptless symbols that don't have a comment.

Also fix up some comments in arch/Kconfig that seem misplaced/redundant,
and clean up some whitespace (no blank line after a comment makes it
look like it only applies to the symbol directly after it to me).

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-21 10:30:33 -05:00
Andrei Gansari 6adde8c137 drivers: eth_mcux enable checksum and autonegotiation
Enable ETHERNET_HW_TX_CHKSUM_OFFLOAD, ETHERNET_HW_RX_CHKSUM_OFFLOAD,
ETHERNET_AUTO_NEGOTIATION_SET and the equivalent driver configuration
in eth_mcux driver.
Autonegoitiation was done at driver initialization.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-12-20 12:35:21 +02:00
Jukka Rissanen e124c1cd34 eth: mcux: Do not set carrier ON if interface is not known
It is possible that the network interface is not yet initialized
when status of the PHY changes. In this case we must not call
net_eth_carrier_on() as that will cause a crash.
This was noticed with mimxrt1050_evk board.

Fixes: #21257

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-12-12 09:50:29 +02:00
Kumar Gala 24ae1b1aa7 include: Fix use of <misc/FOO.h> -> <sys/FOO.h>
Fix #include <misc/FOO.h> as misc/FOO.h has been deprecated and
should be #include <sys/FOO.h>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-12-10 08:39:37 -05:00
Ulf Magnusson 87e917a925 kconfig: Remove redundant 'default n' and 'prompt' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.

Also replace some

    config
    	prompt "foo"
    	bool/int

with the more common shorthand

    config
    	bool/int "foo"

See the 'Style recommendations and shorthands' section in
https://docs.zephyrproject.org/latest/guides/kconfig/index.html.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-09 16:14:50 +01:00
Johann Fischer 324938b5b2 drivers: eth_enc424j600: check received frame length
Check received frame length.

Fixes: #20493
Coverity-CID: 205668

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-11-20 17:00:38 +01:00
Jukka Rissanen e7be6e12d4 drivers: eth: enc424j600: Set carrier status by link up/down
Set the network interface up / down according to link status.
This means that we call Ethernet carrier on/off function in
proper places.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-11-07 14:50:52 +01:00
Stephanos Ioannidis 2d7460482d headers: Refactor kernel and arch headers.
This commit refactors kernel and arch headers to establish a boundary
between private and public interface headers.

The refactoring strategy used in this commit is detailed in the issue

This commit introduces the following major changes:

1. Establish a clear boundary between private and public headers by
  removing "kernel/include" and "arch/*/include" from the global
  include paths. Ideally, only kernel/ and arch/*/ source files should
  reference the headers in these directories. If these headers must be
  used by a component, these include paths shall be manually added to
  the CMakeLists.txt file of the component. This is intended to
  discourage applications from including private kernel and arch
  headers either knowingly and unknowingly.

  - kernel/include/ (PRIVATE)
    This directory contains the private headers that provide private
   kernel definitions which should not be visible outside the kernel
   and arch source code. All public kernel definitions must be added
   to an appropriate header located under include/.

  - arch/*/include/ (PRIVATE)
    This directory contains the private headers that provide private
   architecture-specific definitions which should not be visible
   outside the arch and kernel source code. All public architecture-
   specific definitions must be added to an appropriate header located
   under include/arch/*/.

  - include/ AND include/sys/ (PUBLIC)
    This directory contains the public headers that provide public
   kernel definitions which can be referenced by both kernel and
   application code.

  - include/arch/*/ (PUBLIC)
    This directory contains the public headers that provide public
   architecture-specific definitions which can be referenced by both
   kernel and application code.

2. Split arch_interface.h into "kernel-to-arch interface" and "public
  arch interface" divisions.

  - kernel/include/kernel_arch_interface.h
    * provides private "kernel-to-arch interface" definition.
    * includes arch/*/include/kernel_arch_func.h to ensure that the
     interface function implementations are always available.
    * includes sys/arch_interface.h so that public arch interface
     definitions are automatically included when including this file.

  - arch/*/include/kernel_arch_func.h
    * provides architecture-specific "kernel-to-arch interface"
     implementation.
    * only the functions that will be used in kernel and arch source
     files are defined here.

  - include/sys/arch_interface.h
    * provides "public arch interface" definition.
    * includes include/arch/arch_inlines.h to ensure that the
     architecture-specific public inline interface function
     implementations are always available.

  - include/arch/arch_inlines.h
    * includes architecture-specific arch_inlines.h in
     include/arch/*/arch_inline.h.

  - include/arch/*/arch_inline.h
    * provides architecture-specific "public arch interface" inline
     function implementation.
    * supersedes include/sys/arch_inline.h.

3. Refactor kernel and the existing architecture implementations.

  - Remove circular dependency of kernel and arch headers. The
   following general rules should be observed:

    * Never include any private headers from public headers
    * Never include kernel_internal.h in kernel_arch_data.h
    * Always include kernel_arch_data.h from kernel_arch_func.h
    * Never include kernel.h from kernel_struct.h either directly or
     indirectly. Only add the kernel structures that must be referenced
     from public arch headers in this file.

  - Relocate syscall_handler.h to include/ so it can be used in the
   public code. This is necessary because many user-mode public codes
   reference the functions defined in this header.

  - Relocate kernel_arch_thread.h to include/arch/*/thread.h. This is
   necessary to provide architecture-specific thread definition for
   'struct k_thread' in kernel.h.

  - Remove any private header dependencies from public headers using
   the following methods:

    * If dependency is not required, simply omit
    * If dependency is required,
      - Relocate a portion of the required dependencies from the
       private header to an appropriate public header OR
      - Relocate the required private header to make it public.

This commit supersedes #20047, addresses #19666, and fixes #3056.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-11-06 16:07:32 -08:00
Ulf Magnusson bd6e04411e kconfig: Clean up header comments and make them consistent
Use this short header style in all Kconfig files:

    # <description>

    # <copyright>
    # <license>

    ...

Also change all <description>s from

    # Kconfig[.extension] - Foo-related options

to just

    # Foo-related options

It's clear enough that it's about Kconfig.

The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)

    git ls-files '*Kconfig*' | \
        xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-04 17:31:27 -05:00
Ulf Magnusson 975de21858 kconfig: Global whitespace/consistency cleanup
Clean up space errors and use a consistent style throughout the Kconfig
files. This makes reading the Kconfig files more distraction-free, helps
with grepping, and encourages the same style getting copied around
everywhere (meaning another pass hopefully won't be needed).

Go for the most common style:

 - Indent properties with a single tab, including for choices.

   Properties on choices work exactly the same syntactically as
   properties on symbols, so not sure how the no-indentation thing
   happened.

 - Indent help texts with a tab followed by two spaces

 - Put a space between 'config' and the symbol name, not a tab. This
   also helps when grepping for definitions.

 - Do '# A comment' instead of '#A comment'

I tweaked Kconfiglib a bit to find most of the stuff.

Some help texts were reflowed to 79 columns with 'gq' in Vim as well,
though not all, because I was afraid I'd accidentally mess up
formatting.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-11-01 15:53:23 +01:00
Johann Fischer 2011f73718 drivers: eth: initialize ethernet stack in enc424j600 and enc28j60
Initialize ethernet stack in drivers enc424j600 and enc28j60.

Fixes: #19398

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-10-21 14:01:52 +03:00
Peter Bigot 6e5db350b2 coccinelle: standardize k_sleep calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments to
k_sleep to use the standard timeout macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Sebastian Bøe e169818b68 cmake: Cleanup ethernet include directory handling
The zephyr/subsys/net/l2 include directory has been added through the
'zephyr_library_' API to modify the 'zephyr' library, when the
'zephyr_' API should have been used.

This patch fixes this problem. Using 'zephyr_library_' in this context
works by accident when 'zephyr' is the current library but has no
guarantees of working in the future.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-10-01 18:05:58 -04:00
Markus Fuchs 8c69941642 drivers: ethernet: stm32: Add MAC address configuration support
This patch adds support for configuring the MAC address through the
Network Management API to the STM32 Ethernet driver.

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
2019-09-19 20:46:56 -04:00
Erwin Rol c0ae674630 drivers: ethernet: stm32, sam, mcux: correctly set LAA bit
When randomly generating MAC addresses they will always be
locally administrated addresses, so the LAA bit should be set.
The LAA bit is the 2nd bit of the 1st byte of the MAC address
not the 2nd bit of the 4th byte.

Fixes: #16452

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2019-09-18 19:14:39 +03:00
Markus Fuchs f08caaf677 drivers: ethernet: stm32: Add carrier state detection
This patch adds carrier state detection to the STM32 Ethernet driver.

Fixes #16097

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
2019-09-16 15:27:11 -05:00
Johann Fischer d8d7782790 drivers: eth: add driver for ENC424J600 Ethernet Controller
Add driver for ENC424J600 Ethernet Controller.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-09-12 11:30:19 +03:00
Charles E. Youse cda625b726 drivers/ethernet/eth_dw: remove DesignWare Ethernet driver
This was only used on the Quark SoCs. It is no longer used, can no
longer be tested, and it's reliant upon the deprecated legacy PCI
subsystem. Remove it to prevent bitrot.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Alexander Wachter d864f5de5b net: l2: canbus: Add support for canbus Ethernet translator
This commit adds support for a 6LoCAN Ethernet border translator.
CAN frames with the translator CAN address are translated and forwarded
to Ethernet. Ethernet frames with the first 34 bits matching the MAC
address of the translator are translated and forwarded to 6LoCAN.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +03:00
Andrei Gansari ef9fdc3137 drivers: eth_mcux: event corrected init->reset
Redoes ENET device bootup event sequence (K6x enters reset).

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2019-08-08 09:52:55 +02:00
Ulf Magnusson f754143699 drivers: ethernet: Remove redundant NET_L2_ETHERNET dep. from ETH_LITETH
ETH_LITEETH is defined in drivers/ethernet/Kconfig.liteeth, which is
source'd within a menu that has 'depends on ETH_LITEETH', in
drivers/ethernet/Kconfig.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-08-07 10:50:19 +03:00
Mateusz Holenko ebd349091a dts: riscv32: fix reg-names for liteeth
Liteeth exposes two memory regions:
* set of rx/tx buffers (aka slots) to exchange packets,
* control and status registers.

Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2019-07-23 10:51:21 +02:00
Mariusz Glebocki 35edfedf68 drivers: ethernet: Add LiteEth driver
Add LiteX Ethernet driver with bindings for this device.

Signed-off-by: Mariusz Glebocki <mglebocki@antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2019-07-22 15:28:54 +03:00
Alexander Wachter 0fbaaa1350 drivers: ethernet: stm32: Put DMA buffer to DTCM section
For STM32F7 MCU the actual implementation doesn't work when the
DMA buffers are placed in the SRAM.
This might be a problem with caches.
To overcome this problem, the buffer is moved to the DTCM.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-19 10:05:46 +02:00
Peter A. Bigot 7f00f38dfe drivers: eth_stellaris: update for dts change to local-mac-address
uint8_array values are now generated as structure initializers.  Update
the code accordingly.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-11 06:50:27 -04:00
Peter A. Bigot ec2ba8d968 drivers: eth_mcux: update for dts change to local-mac-address
uint8_array values are now generated as structure initializers.  Update
the code accordingly.  The implementation assumes that existing
devicetree source does not provide the correct OUI so preserves the
in-driver override of the value provided by devicetree and its setting
for random/unique addresses.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-11 06:50:27 -04:00
Peter A. Bigot 388460ac14 drivers: eth_enc28j60: update for dts change to local-mac-address
uint8_array values are now generated as structure initializers.  Update
the code accordingly.  The implementation assumes that existing
devicetree source does not provide the correct OUI so preserves the
in-driver override of the value provided by devicetree.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-11 06:50:27 -04:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 5eb90ec169 cleanup: include/: move misc/__assert.h to sys/__assert.h
move misc/__assert.h to sys/__assert.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif bd70f6f1ed cleanup: include/: move spi.h to drivers/spi.h
move spi.h to drivers/spi.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 8f692c7d38 cleanup: include/: move i2c.h to drivers/i2c.h
move i2c.h to drivers/i2c.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 6aa9c3a68f cleanup: include/: move gpio.h to drivers/gpio.h
move gpio.h to drivers/gpio.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 17ddd1714c cleanup: include/: move clock_control.h to drivers/clock_control.h
move clock_control.h to drivers/clock_control.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif ef281c4237 cleanup: include/: move sys_io.h to sys/sys_io.h
move sys_io.h to sys/sys_io.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Kumar Gala a614a026b7 dts: Rename DT_.*_GPIO_* to DT_.*_GPIOS_*
Convert DT_.*_GPIO_{CONTROLLER,PIN,FLAGS} ->
	DT_.*_GPIOS_{CONTROLLER,PIN,FLAGS)

Used the following commands to make these conversions:

git grep -l DT_.*_GPIO_CONTROLLER | xargs sed -i 's/DT_\(.*\)_GPIO_CONTROLLER/DT_\1_GPIOS_CONTROLLER/g'
git grep -l DT_.*_GPIO_PIN | xargs sed -i 's/DT_\(.*\)_GPIO_PIN/DT_\1_GPIOS_PIN/g'
git grep -l DT_.*_GPIO_FLAGS | xargs sed -i 's/DT_\(.*\)_GPIO_FLAGS/DT_\1_GPIOS_FLAGS/g'

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-27 13:02:34 -05:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Kumar Gala d4a0c3a2aa dts: Convert new/missed DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-15 07:14:12 -04:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Loic Poulain e72e457360 eth: eth_mcux: Register mDNS multicast address
If mDNS is in use, add the mDNS multicast MAC address to white list.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2019-05-27 13:05:14 +08:00
Ravi kumar Veeramally 686830bbda drivers: native_posix: Add VLAN tag strip feature
This is mainly testing purpose from native_posize ethernet
driver. Enable CONFIG_ETH_NATIVE_POSIX_VLAN_TAG_STRIP to have
VLAN tag strip feature on ethernet Rx frames.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-04-26 10:46:27 +03:00
Charles Youse 8e307a3ad9 ethernet/eth_e1000.c: change to new PCI(e) functions
Migrate from "legacy" PCI support (drivers/pci) to new PCI(e) support.

The e1000 driver is merely for testing with QEMU and so should not be
a model for the use of PCI(e) functions. Consult instead "real-world"
PCI(e) drivers like the NS16550 UART (drivers/serial/uart_ns16550.c).

Signed-off-by: Charles Youse <charles.youse@intel.com>
2019-04-22 09:34:00 -07:00
Tomasz Gorochowik a000ba797c drivers: eth: gmac: Fix MAC address info log
Each MAC byte should be printed with the %02x format.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2019-04-17 10:34:22 -05:00
Vijay Kumar B a69cb036c4 ethernet: eth_stellaris: data_len should not include header size
As part of the ll_reserve refactoring effort, the packet length now
includes header size as well. Before the refactor, when the packet
length was written to the device, it did not include the header size,
which is the required value as per the LM3S6965 datasheet. After the
refactor the packet length includes the header size as well. The
header size has to subtracted from the packet length before writing to
the device. Fixes #13943.

Signed-off-by: Vijay Kumar B <vijaykumar@zilogic.com>
2019-04-11 18:04:05 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Patrik Flykt 97b3bd11a7 drivers: Rename reserved function names
Rename reserved function names in drivers/ subdirectory. Update
function macros concatenatenating function names with '##'. As
there is a conflict between the existing gpio_sch_manage_callback()
and _gpio_sch_manage_callback() names, leave the latter unmodified.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Ravi kumar Veeramally ecdef39223 drivers: sam_gmac: Fix compilation warning
Line continuation was missing for #error macro.

Fixes  #15096

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-04-03 09:32:55 -04:00
Daniel Leung 3926710f64 ethernet/smsc911x: mark static to function smsc_enable_xmit()
When building with -fno-inline, the compiler complains about
undefined reference to this function. This happens when
building for code coverage. Since this function is only called
within the file, mark it static also.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-04-02 09:39:44 -04:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Kumar Gala c6662826b7 net/pkt: Fix a few left over cases of net_pkt_read_new
In the conversion of net_pkt_read_new to net_pkt_read, we missed
changing the function in the eth_smsc911x and eswifi_offload.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-03-20 15:26:30 -05:00
Tomasz Bursztyka cf322c44db net: Switch usage of net_pkt_get_reserve to net_pkt_alloc
Some places were still using the old allocator. Using the new one does
not change any behavior. This will help to remove the useless data_len
attribute in net_pkt which legacy allocator was still setting.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka d6d52ce9e5 net/pkt: Remove _new suffix to net_pkt_write functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka a25f054cbd net/pkt: Remove _new suffix to net_pkt_read functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Andrei Emeltchenko 99403c5b13 net: ethernet: Define and use Ethernet frame and datagram size
Remove magic numbers from Ethernet drivers and tests by defining
NET_ETH_MAX_DATAGRAM_SIZE and NET_ETH_MAX_FRAME_SIZE.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-15 06:44:13 -05:00
Tomasz Gorochowik f6a95a02ed drivers: eth: gmac: fix qav bandwidth sharing issues
Removing the TX timeout handling in the GMAC driver (commit 18b07e09e0)
revealed some issues with the way hardware priority queues work.

For cases with both hardware priority queues enabled, with the default
recommended delta bandwidths (0% - 75%), the lower priority queue (0%)
is hardly able to send any packets. This became visible, because without
the timeout mechanism, we quickly ran out of available TX buffers if
there were multiple packets being queued to the queue.

Here is an excerpt from 802.1Q, chapter 34.3.1 which describes how Qav
bandwidth sharing SHOULD work:

  The deltaBandwidth(N) for a given N, plus the deltaBandwidth(N) values
  for any higher priority queues (larger values of N) defines the total
  percentage of the Port’s bandwidth that can be reserved for that queue
  and all higher priority queues. For the highest priority queue, this
  means that the maximum value of operIdleSlope(N) is deltaBandwidth(N)%
  of portTransmitRate. However, if operIdleSlope(N) is actually less
  than this maximum value, any lower priority queue that supports the
  credit-based shaper algorithm can make use of the reservable bandwidth
  that is unused by the higher priority queue. So, for queue N-1, the
  maximum value of (operIdleSlope(N) + operIdleSlope(N-1)) is
  (deltaBandwidth(N) + deltaBandwidth(N1))% of portTransmitRate.

However in reality, the lower priority queues (N-1) on the SAM GMAC
hardware DO NOT use the bandwidth available from the higher priority
queues (N).

This commits fixes the issue by changing the defaults. These are still
set to the recommended 75% (total), but this percentage is split between
the priority queues manually.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2019-03-13 06:00:04 -05:00
Tomasz Gorochowik 3c0c92ab3f drivers: eth: gmac: normalize queue init messages
There is a log message printed for the non-priority queue (Queue 0). Add
the same message for the priority queues too when they are enabled, and
a corresponding message when the queue is not used (set to idle).

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2019-03-13 06:00:04 -05:00
Tomasz Gorochowik 21aaa9958e drivers: eth: gmac: Swap Qav queue registers
Throughout the manual, the queues GMAC is equipped with are identified
by a number - Queue 0, Queue 1 and Queue 2.

However in the context of Qav, the queues are identified with a
character (note that there are only two queues as Qav is not used for
the non-priority queue) - Queue A and Queue B.

Queue B and Queue 2 are also called "the highest priority queues".

Based on that, the previous implementation was using the following
mapping:

  Queue 1 - Queue A
  Queue 2 - Queue B

However when running some specific tests, that is for example forcing
all the traffic to Queue 1, it showed that this queue is actually
affected by the Queue B registers. Similarly, Queue 2 seems to be
affected by the Queue A registers.

Based on that observation, this commit changes the registers used to
work with the following mapping:

  Queue 1 - Queue B
  Queue 2 - Queue A

Note that this is based solely on observations, there is nothing in the
datasheet that confirms this, and the "highest priority" label suggests
it is otherwise.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2019-03-13 06:00:04 -05:00
Tomasz Gorochowik b54f528951 drivers: eth: gmac: Add option to force packets to a specific queue
This option is meant to be used only for debugging. Use it to force all
traffic to be routed through a specific hardware queue. With this option
enabled it is easier to verify whether the chosen hardware queue
actually works.
This works only if there are four or fewer RX traffic classes enabled as
the SAM GMAC hardware supports screening up to four traffic classes.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2019-03-13 06:00:04 -05:00
Jukka Rissanen 179d520777 drivers: eth: native_posix: Null terminate interface name
The interface name is IFNAMSIZ long so we must not copy it
full which would overwrite the terminating null byte.

Coverity-CID: 195770
Fixes #14419

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-13 05:34:03 -05:00
Andrei Emeltchenko fba09bffb2 net: lldp: Move LLDP structure definition to lldp
Move duplicated structure definitions to lldp subsystem from
drivers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-03-09 16:02:11 -05:00