Commit graph

388 commits

Author SHA1 Message Date
Kumar Gala 77149642f6 driver: wifi: eswifi: Fix how we get SPI bus
We were hard coding the SPI bus name to "SPI_3".  Instead we should use
DT_INVENTEK_ESWIFI_ESWIFI0_BUS_NAME as its generated from the device
tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 16:01:13 -05:00
Kumar Gala 9f88c0d471 driver: wifi: eswifi: Use DT_ prefixed names
The driver was using the straight alias generated defines, however we
want to use DT_ prefixed defines so its clear that the values are coming
from DT.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-21 16:01:13 -05:00
Kumar Gala 9730ca1852 wifi: winc1500: Add Device Tree support
Add a dts binding for the Atmel WINC1500 WIFI chip.  Update the
quark_se_c1000_devboard to utilize this binding as well as the wifi
sample app.

We now get all the GPIOs related to the Atmel WINC1500 from the device
tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-13 14:12:18 -05:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Gil Pitney 508c941d32 drivers: wifi: simplelink: fix Coverity issue in getaddrinfo()
Check for case where host == NULL but service != NULL
could have resulted later in a NULL dereference.

Coverity-CID: 189516
Fixes #11090

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-11-08 23:23:23 +02:00
Kumar Gala aa2bdbe322 drivers: Remove board.h include
We either don't need board.h in the driver or we should be include soc.h
instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-01 13:21:11 -04:00
Niranjhana N 9e895acf4e drivers: wifi: fix an unchecked return
Log error and return false if recv()
has not received packet in the buffer.

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2018-10-30 14:18:28 +02:00
Loic Poulain 25120f3cc2 boards: disco_l475_iot1: Enable es-WiFi driver
Automatically enable es-WiFI driver when WIFI is enabled.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Loic Poulain 0b8fde39e4 driver: wifi: Add inventek es-WiFi driver
es-WiFi compatible modules use IWIN AT command set.
This driver is split into several layers:
- bus layer: interface to transmit AT commands (SPI, USB, UART...)
- core layer: es-WiFi module management (state, scan...)
- offload layer: TCP/IP offload operations (connect, listen...)

This driver has been tested with stm32l4 disco iot board
(disco_l475_iot1) and the wifi sample:

$ select wifi
$ scan
$ connect "CISCO" 5 password
$ select net
$ tcp connect 192.168.1.21 4242
$ tcp send HelloWorld!

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-10-29 16:38:02 +02:00
Sebastian Bøe 1422a20093 drivers: wifi: Don't include ti/drivers/net/wifi/bsd from simplelink
Adding 'bsd' to the include path causes problems when gnuarmemb is
used. The wrong errno.h will be used in the build, causing unresolved
references to ENOTSUP.

See PR #10554 for more details.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-10-16 12:11:48 -05:00
Gil Pitney 1022b85c0f drivers: wifi: simplelink: Implement offloaded getaddrinfo()
This offloads the getaddrinfo() socket operation to the
simplelink WiFi driver, via a socket_offload hook.

This was validated using http_get on cc3220sf_launchxl.

Also implements freeaddrinfo().

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-12 13:06:53 +03:00
Gil Pitney 0633a1c294 drivers: wifi: simplelink: More fixes after logging update
Previously, '\n' in LOG_DBG statements were added to
improve readability, by ensuring IP address weren't printed
across typical console terminal line boundaries.

But with the logging updates, '\n' is no longer
getting automatically expanded to \r\n, and a new timestamp
is automatically added, throwing off attempts at alignment.

This patch finally just removes the '\n''s from the log messages,
and cuts a few longer messages into separate messages.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-11 15:51:57 +03:00
Gil Pitney c2cdbbafd7 net: sockets: Get socket offload to build after net logging overhaul.
Also, defines one LOG_MODULE_NAME for the simplelink WiFi driver, and
uses the same name for all files in this driver (module).

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-11 15:51:57 +03:00
Gil Pitney 7520bb21bc drivers: wifi: simplelink: Move NWP configuration to iface_init
Previously, the NWP (Network Coprocessor) was configured during
simplelink_init().

Since the SimpleLink "FastConnect" feature was added,
meaning an automatic reconnect can occur at this time, this
results in early callbacks into the network stack
before it was fully initialized, resulting in a NULL iface
ptr being sent in as argument.

Now, for safety, the NWP startup is moved later to iface_init,
where it more logically belongs.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-11 14:32:48 +03:00
Anas Nashif c1d2930471 drivers: wifi: move to new logger
Move drivers to new logger and change samples enabling logging in
prj.conf.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-10 10:22:01 -04:00
Jukka Rissanen 69eeddd8a9 drivers: wifi: Convert to use new logging
Convert the wifi drivers to use the new logging system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-10-05 10:08:32 -04:00
Gil Pitney be64964f1e driver: wifi: simplelink: Fix socket offload after s_addr cleanup
The commit 8592501828
("net: Remove s_addr/s6_addr defines from in_addr/in6_addr")

did a (welcomed) removal of a #define s_addr for which the SimpleLink
SDK was checking, breaking the socket_offload driver build.

This patch fixes the driver to work with this new, better
s_addr symbol definition.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-10-04 07:42:12 -05:00
Joakim Andre Tønnesen d6e0fdca8c net: sockets: Add getaddrinfo and freeaddrinfo to socket offloading
Adds getaddrinfo and freeaddrinfo to the offloaded API.

Signed-off-by: Joakim Andre Tønnesen <joakim.tonnesen@nordicsemi.no>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-10-02 11:11:15 +03:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Gil Pitney 71182cb294 driver: wifi: simplelink: Register socket offload operations.
If the SimpleLink WiFi driver is configured, and socket offload
enabled, this revectors the Zephyr BSD socket APIs to the SimpleLink
WiFi host driver BSD socket APIs, providing a
direct offload of the TCP/IP stack to the CC3220SF network
coprocessor.

Fixes #3706

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-09-11 18:42:34 +03:00
Gil Pitney e189f59031 drivers: wifi: simplelink: enable Fast Connect policy
This enables the cc3220sf_launchxl to automatically
reconnect to the last good known access point (AP).

This method avoids the need to:
- perform a wifi scan for access points on bootup (saving power);
- include hard-coded SSID/passwords in the wifi application.
- include the wifi shell in the wifi application.
- rely on more complex provisioning methods;

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-07-26 13:57:34 +03:00
Gil Pitney 42f51ef08d drivers: wifi: winc1500: Use offload_context instead of user_data.
The wifi_winc1500 driver's socket id is stored in
net_context->user_data, which may be overwritten later at
the socket layer, which also uses the net_context->user_data
field to store socket flags.

This patch introduces a dedicated offload_context field
for use by offload drivers, and updates the wifi_winc1500 offload
driver to use this field instead of user_data.

Fixes #8820

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-07-18 07:47:45 -04:00
Gil Pitney c90170c5c5 drivers: wifi: simplelink: move files into a dedicated subdir
Place simplelink driver files into a subdirectory on par with
winc1500 subdirectory, to effect a better file organization.

No functional change in this patch.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-07-12 19:17:45 -05:00
Ulf Magnusson 21d4adef93 drivers: wifi: Kconfig: Remove redundant 'default n' 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, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
Gil Pitney 3bc77e88fb net: drivers: wifi: SimpleLink WiFi Offload Driver (wifi_mgmt only)
Initiate a SimpleLink WiFi Driver, implemented to the WiFi management
offload APIs for scan, connect, disconnect.

Also registers the DHCP-obtained IPv4 address upon connect.

This was validated on a cc3220sf_launchxl using the wifi
shell module from the Zephyr shell_module sample.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2018-06-15 10:01:21 -04:00
David B. Kinder 44383a394b doc: fix misspellings in Kconfig files
Found some misspellings missed during normal reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-23 16:57:20 -04:00
Tomasz Bursztyka ce947431e2 drivers/wifi: Move all winc1500 related code to its own directory
There will be other drivers, and mixing up all these files together will
create a mess so better having a dedicated place for winc1500, at least.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 2145503273 drivers/winc1500: Implement wifi mgmt offloaded API
Scan, connect and disconnect for now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 5f9ccad97f drivers/wifi: Switch info level to debug level in winc1500 driver
These output are fine while debugging, but useless otherwise.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 569e70aaae drivers/wifi: Split case logic into functions in winc1500 driver
This cleans up the callback functions and isolate each part to a
relevant handler to improve readability.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 1e4ba8231d drivers/wifi: Remove useless gpio configuration call in winc1500 driver
This call is already made in nm_bus_wrapper along with SPI.
In nm_bus_wrapper however: moving the call out of #ifdefsf as it is
generic call, whatever bus would be choosen.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 8e65f6ab2a drivers/wifi: Let's go away from SPI legacy API in WINC1500
As legacy API is meant to be removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 0294c67349 drivers/wifi: Move configure macros to Kconfig
There is no point having undocumented and local config options when
Kconfig can be used to expose these relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka 2a1d222adc drivers/wifi: Generalize GPIO configuration for the WINC1500 driver
Previous way was cumbersome (based on an old way for cc2520 actually),
so moving towards the more recent and proper way.

This will enable anybody to actually provide gpio configuration for a
winc1500 out of any board specific location.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Dario Pennisi 9bdf1cdb0e drivers/wifi: Add winc1500 WiFi driver
Adding support for WINC1500 WiFi chip.

It introduces the wifi drivers sub-directory.

It provides a Full-MAC for 802.11 and an offloaded network stack as
well. The driver uses Atmel's winc1500 HAL.

Signed-off-by: Dario Pennisi <dario@iptronix.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Massimiliano Agneni <massimiliano.agneni@iptronix.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-05-17 10:46:26 +03:00
Tomasz Bursztyka eab3f168fd net/mgmt/wifi: Add dedicated net mgmt hooks for WiFi offload devices
Exposing connect, disconnect and scan for now.

In case the iface is an instance of a WiFi offload device, the way it
manages scanning, connecting and disconnecting will be specific to that
device (not the mgmt interface obviously). In such case the device will
have to export relevantly a dedicated bunch of function to serve the
mgmt interface in a generic way.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-12 09:56:07 -04:00
Tomasz Bursztyka 8b839b4e0c drivers/wifi: Add files skeleton for adding WiFi drivers
This will help not to collide within drivers implementations and/or
avoid dependency from one driver to another one.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-04-12 09:56:07 -04:00