Commit graph

145 commits

Author SHA1 Message Date
Tobias Svehagen 7ea0c19c55 drivers: wifi: esp: Retry command for getting IP settings
If AT_CIPSTA? command fails it is retried again after 5 seconds.

Fixes #25741

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-24 12:01:30 +02:00
Parthiban Nallathambi d8e63e7161 drivers: wifi: eswifi: enable NET_SOCKETS_OFFLOAD by default
Enable NET_SOCKETS_OFFLOAD is default option for eswifi.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Parthiban Nallathambi 13808b7d83 drivers: wifi: eswifi: fix compilation warnings
Fix compilation warnings when CONFIG_NET_SOCKETS_OFFLOAD enabled

warning: passing argument 5 of '__eswifi_socket_new' makes pointer
 from integer without a cast [-Wint-conversion]
  395 |  idx = __eswifi_socket_new(eswifi, family, type, proto, 0x50CE);
      |                                                         ^~~~~~
      |                                                         |
      |                                                         int
eswifi.h:137:21: note: expected 'void *' but argument is of type 'int'
  137 |    int proto, void *context);
      |               ~~~~~~^~~~~~~
In function 'eswifi_socket_bind':
warning: comparison between pointer and integer
  461 |  if ((addrlen == NULL) || (addr == NULL) ||
      |

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Parthiban Nallathambi 0725719ada drivers: wifi: eswifi: Convert raw timeout values to use K_MSEC()
Use K_MSEC instead of raw timeout value.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Parthiban Nallathambi 1cb20aee34 driver: wifi: eswifi: use common log module
use common log module across all eswifi sources, which allows
to compile with CONFIG_NET_SOCKETS_OFFLOAD.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Tobias Svehagen 71e7cd3f99 drivers: wifi: esp: Fix issue with incorrect tx timeout
It can happen that the command '>' is received between
modem_cmd_send_nolock and modem_cmd_handler_update_cmds. Since the
command handler for '>' is not set, sem_tx_ready will not be given
and _sock_send will timeout. Make sure the command handlers are set
before the send by also passing them to modem_cmd_send_nolock.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-22 15:06:41 +03:00
Vincent Wan 53f408afe8 drivers: wifi: simplelink: enable IPv6 support
IPv6 support was not fully implemented in the driver and was disabled.
This commit completes the implementation and enables it when
configured.

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-07-21 15:08:56 +02:00
Marcin Niestroj 967f485f38 drivers: wifi: simplelink: fix typo in logged option name
Fix typo in logged Kconfig option name that is missing in used
configuration. This one was mostly problematic for developers wanting to
find such option in source tree using grep - NET_SOCKET_OFFLOAD was not
found in Kconfig files.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-16 07:19:56 -05:00
Raja D.Singh bbabefb764 drivers: wifi: winc1500: Update to work with new timeouts
Change the driver to work without CONFIG_LEGACY_TIMEOUT_API option.

Signed-off-by: Raja D.Singh <rdsingh@iotwizards.com>
2020-07-08 15:38:43 -05:00
Marcin Niestroj 8ab0d153a2 drivers: wifi: esp: fix reset control logic and respect reset dts flags
wifi-reset-gpios flags were not respected so far. This means that
setting reset as active low (which is required in most cases for ESP
modules/chips) was done inside esp driver with inverted logic. Use dts
flags instead, so "active low" property is configured the same way as
for other drivers (i.e. in device-tree instead of driver).

This change also allows to configure reset as active high, in case where
ESP's nRST signal is somehow inverted on the board (behaving as RST
signal instead).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-08 15:17:26 -05:00
Parthiban Nallathambi 3e62d73368 drivers: wifi: eswifi: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.
ISM43362 chip select is ACTIVE_LOW.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-06 08:24:18 -05:00
Tobias Svehagen 822df6eef6 drivers: wifi: esp: Improvements to ESP driver
- Fix passive mode protocol selection depending on AT versions
- Use Kconfig value for reset timeout
- Fix bug with parsing security from scan result
- Re-order some AT commands during init due to some commands having
  dependency on other commands

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-02 08:52:28 -04:00
Tobias Svehagen edcee97346 drivers: wifi: esp: Fix bug with net_pkt_unref in tx path
The driver should only call net_pkt_unref on packets that get
successfully handled, ie where send/sendto return 0. If the packet
cannot be handled, net_context layer still owns the packet and should
take care or the unref.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-02 08:44:55 -04:00
Jordan Yates ab3e778f47 wifi: winc1500: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Adam Porter 722a85aea2 drivers: wifi: remove dependency on NET_SOCKETS_POSIX_NAMES
This change removes references to raw POSIX types and functions,
allowing the drivers to build without NET_SOCKETS_POSIX_NAMES.

After this, the dependency between NET_SOCKETS_OFFLOAD and
NET_SOCKETS_POSIX_NAMES can be removed.

See issue #26033 for additional context

Signed-off-by: Adam Porter <porter.adam@gmail.com>
2020-06-15 16:59:36 +02:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Bilal Wasim 64d5192f60 drivers: wifi: eswifi: Fully populate sockaddr_in on async msg
Updating the eswifi driver to provide port information (along with
IP / net context) whenever an async message is received. This is
needed to fully populate the "remote" info in "net_context"
required whenever net_context_send is called.

Also adding code to populate "remote" info in "net_context"..

Tested with STM32 disco IOT kit. Fixes #25621

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-26 21:40:23 +02:00
Gerson Fernando Budke 9a37154151 drivers: wifi: esp: Update to new timeout api
Update to new timeout api.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-05-12 17:18:34 +02:00
Xavier Chapron 2a8ff02ef2 drivers: Replace printf by printk when applicable
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-05-09 21:25:33 +02:00
Kumar Gala db725c0ec9 drivers: Replace GPIO_CS Kconfig with devicetree detection
Use DT_INST_SPI_DEV_HAS_CS_GPIOS() in drivers to determine if we should
utilize CS_GPIO base SPI chipselect handling.  This allows us to remove
Kconfig option for this feature.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 13:07:05 +02:00
Bilal Wasim 1966d48498 drivers: wifi: eswifi: WiFi Scan completion indication
Updating the eswifi driver to indicate "scan completion"
to WiFi Management once scanning is done.

Tested with STM32 disco IOT kit.

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-09 13:06:26 +02:00
Peter Bigot 93884a4fe1 coccinelle: run int_ms_to_timeout conversion semantic patch
This fixes some cases where an integer timeout received as a parameter
was not converted to a timeout before being used in standard API.

Changes to the POSIX library were not included as that's being
reworked in a separate PR.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-07 19:46:03 +02:00
Carles Cufi c61faf6c55 drivers: wifi: Port the simplelink wifi to the new timeouts API
Port the code so it uses the new timeouts API.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Jukka Rissanen affe21c826 driver: wifi: eswifi: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Gerson Fernando Budke 351719ae0f drivers: wifi: esp: Add esp at version choice name
Add WIFI_ESP_AT_VERSION choice name to allows select version on
*.defconfig files.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-30 16:08:35 +03:00
Marcin Niestroj 91fe6534da drivers: wifi: esp: Fix wifi-reset-gpios handling
wifi-reset-gpios is currently ignored after conversion to DT_INST
macros. Use wifi_reset_gpios instead of reset_gpios to fix the problem.

Fixes: a464ae7163 ("drivers: wifi: esp: Convert to new DT_INST
  macros")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-04-06 10:29:58 -05:00
Tobias Svehagen ac53a8788e drivers: wifi: esp: Use UART settings from bus node
With the introduction of the new device-tree macros it is now possible
to use the settings for speed and flow-control from the bus node instead
of having the same properties on the esp node itself.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-04-06 09:12:58 -05:00
Peter Bigot ecf3bdb5b3 coccinelle: re-run timeout conversion semantic patch
Run the int_literal_to_timeout Coccinelle script to fix places where
it is clear that an integer duration is being passed where a timeout
value is required.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-02 19:47:51 +03:00
Tobias Svehagen 3b246fea6e drivers: wifi: esp: Fix DT_DRV_COMPAT to match binding
Change DT_DRV_COMPAT to espressif_esp to match the dts binding
"espressif,esp".

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-04-02 06:41:39 -05:00
Kumar Gala 7ea5f79ae2 drivers: wifi: winc1500: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 13:15:43 -05:00
Kumar Gala 7264946c4a drivers: wifi: eswifi: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 11:05:19 -05:00
Torsten Rasmussen d7862cf776 cmake: using ${ZEPHYR_BASE} instead of $ENV{ZEPHYR_BASE}
With the introduction of ZephyrConfig.cmake all parts of CMake code
should rely on the CMake ZEPHYR_BASE variable instead of the environment
setting.

This ensures that after the first CMake invocation, then all subsequent
invocation in same build folder will use same zephyr base.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Tomasz Bursztyka 4ae72db135 net: Enable PM settings on network devices
By changing the various *NET_DEVICE* macros. It is up to the device
drivers to either set a proper PM function or, if not supported or PM
disabled, to use device_pm_control_nop relevantly.

All existing macro calls are updated. Since no PM support was added so
far, device_pm_control_nop is used as the default everywhere.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-03-27 14:48:30 +02:00
Kumar Gala a464ae7163 drivers: wifi: esp: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 04:51:58 -05:00
Tobias Svehagen 7b5f6bc660 drivers: wifi: Add ESP8266 and ESP32 wifi modem driver
This adds support for the Espressif ESP8266 and ESP32 devices to be used
as peripherals on a UART.

There are two main AT command versions that can be selected, 1.7 and
2.0. Since they behave a bit different it is important to select the
one that matches the used in the firmware on your device.

When downloading large amounts of data it is highly recommended to
enable CONFIG_ESP_PASSIVE_TCP and flow control on the UART so that
data is not lost due to UART speed or receive buffer size.

Currently unsupported:
- Changing UDP endpoint with a sendto()
- Bind to a specific local port
- Server socket operations, ie listen() and accept()

Official AT firmware for ESP8266 and ESP32 can be found at:
https://github.com/espressif/esp-at

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-03-21 19:08:02 +02:00
Carles Cufi 6574efa232 drivers: Add missing debug/stack.h include
In order to use log_stack_usage(), inclusion of <debug/stack.h> is
required.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-03-19 18:45:13 +01:00
Andrew Boie 2b38b3b33b drivers: winc1500: do not use net_analyze_stack
This API is unsafe. Use log_stack_usage() instead and
set the thread name.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-14 13:10:19 -04:00
Kumar Gala 46fe3046fe drivers: wifi: eswifi: Convert to use DT_INST defines
Use DT_INST define as this is the preferred set of defines to utilize
for drivers.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Peter Bigot ddc3f0699f gpio: replace gpio pin write/read with set/get
This API will be deprecated in favor of the new API that clearly
specifies whether it works on logical or physical levels.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Tomasz Bursztyka a40e9d3762 drivers/wifi: Switch WINC1500 to new GPIO API
Use new API to configure and interact with GPIOs.  Move GPIO
initialization from sample into driver.  The existing physical/line
level control has been kept rather than converting to logical level
signals.

Also improve error messages.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Erwan Gouriou e2721fee6f drivers/wifi: eswifi: Update to new GPIO API
Update to new GPIO API.
Tested on disco_l475_iot1


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-05 12:00:36 +01:00
Robert Lubos aa17850455 drivers: wifi: eswifi: Rework offloading mechanism
Switch to `NET_SOCKET_REGISTER` mechanism over the offloaded API
registration.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-01-31 11:36:02 -05:00
Robert Lubos ece552c644 drivers: wifi: simplelink: Rework offloading mechanism
Switch to `NET_SOCKET_REGISTER` mechanism over the offloaded API
registration.

Including the following fixes from the review:

* The fd returned by the socket accept call needs to be finalized,
  similar to how it is done for socket creation.

* sl_RecvFrom() in TI SimpleLink Host driver does not support NULL
  pointers for 'from' address and address length, and sl_SendTo() does
  not ignore the destination address when in connection mode, so passing
  NULL would cause a failure. These issues have been reported to TI
  (CC3X20SDK-1970, CC3X20SDK-1971).

  Let's use sl_Recv and sl_Send to implement recvfrom/sendto in the case
  of NULL addresses.

* simplelink_poll() should not process negative file descriptors in the
  fds array after sl_Selecti() returns. A negative fd value indicates
  that the entry is invalid and should be ignored.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-01-31 11:36:02 -05:00
Peter Bigot 344c109f02 treewide: use full path to wifi/winc1500.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
NavinSankar Velliangiri e5328b8931 drivers: wifi: Fix the use of net_pkt_write() in eswifi driver
net_pkt_write() function returns 0 on success. But in this driver a
warning is thrown when zero is returned. Hence fix the driver to throw
the warning only when the negative value is returned.

Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
2019-12-18 21:58:21 +01: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
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
Peter Bigot ab91eef23b coccinelle: standardize kernel API timeout arguments
Use the int_literal_to_timeout Coccinelle script to convert literal
integer arguments for kernel API timeout parameters to the standard
timeout value representations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-03 11:55:44 -07:00
Saravanan Sekar 1aa696bc2b wifi: eswifi: Implement TCP/UDP socket offload with TLS
Newly implement socket based communication on eswifi mainly to
achive TLS. Tested with Inventek ISM43362-M3G-L44.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
2019-09-13 16:54:57 +03:00