-
Notifications
You must be signed in to change notification settings - Fork 8.2k
drivers: wifi: infineon: Add SPI support to AIROC WiFi driver #78773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6d7c6f2
dts: bindings: wifi: Support SPI for Infineon AIROC driver
ThreeEights 9dcc459
drivers: wifi: infineon: Add SPI support to AIROC driver
ThreeEights 4d0bd9a
boards: rpi_pico: WiFi configuration for Pico W
ThreeEights 35d8d0f
manifest: Update hal_infineon to latest version
ThreeEights File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,67 @@ | ||
| /* | ||
| * Copyright (c) 2023 Dave Rensberger - Beechwoods Software | ||
| * Copyright (c) 2024 Steve Boylan <[email protected]> | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /dts-v1/; | ||
|
|
||
| #include "rpi_pico-common.dtsi" | ||
|
|
||
| &pinctrl { | ||
| pio0_spi0_default: pio0_spi0_default { | ||
| /* gpio 25 is used for chip select, not assigned to the PIO */ | ||
| group1 { | ||
| pinmux = <PIO0_P29>; | ||
| }; | ||
| }; | ||
|
|
||
| airoc_wifi_default: airoc_wifi_default { | ||
| /* Control of GPIO24 is done through the WiFi driver */ | ||
| group1 { | ||
| pinmux = <PIO0_P24>; | ||
| input-enable; | ||
| }; | ||
| }; | ||
|
|
||
| airoc_wifi_host_wake: airoc_wifi_host_wake { | ||
| /* Assign GPIO24 to SIO (GPIO) for use as an interrupt source */ | ||
| group1 { | ||
| /* Lacking a specific SIO pin definition, use the RP2040_PINMUX macro */ | ||
| pinmux = <RP2040_PINMUX(24, RP2_PINCTRL_GPIO_FUNC_SIO)>; | ||
| input-enable; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| &pio0 { | ||
| status = "okay"; | ||
|
|
||
| pio0_spi0: pio0_spi0 { | ||
| compatible = "raspberrypi,pico-spi-pio"; | ||
| clocks = < &clocks RPI_PICO_CLKID_CLK_SYS >; | ||
| #address-cells = <1>; | ||
| #size-cells = <0>; | ||
| cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; | ||
| clk-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; | ||
| sio-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>; | ||
| pinctrl-0 = <&pio0_spi0_default>; | ||
| pinctrl-names = "default"; | ||
| status = "okay"; | ||
| airoc-wifi@0 { | ||
| compatible = "infineon,airoc-wifi"; | ||
| reg = < 0 >; | ||
| wifi-reg-on-gpios = < &gpio0 23 GPIO_ACTIVE_HIGH >; | ||
| bus-select-gpios = < &gpio0 24 GPIO_ACTIVE_HIGH >; | ||
| wifi-host-wake-gpios = < &gpio0 24 GPIO_ACTIVE_HIGH >; | ||
| spi-max-frequency = < 10000000 >; | ||
| spi-half-duplex; | ||
| spi-data-irq-shared; | ||
| pinctrl-0 = <&airoc_wifi_default>; | ||
| pinctrl-1 = <&airoc_wifi_host_wake>; | ||
| pinctrl-names = "default", "host_wake"; | ||
| status = "okay"; | ||
| }; | ||
| }; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /* | ||
| * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) or | ||
| * an affiliate of Cypress Semiconductor Corporation | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #include "airoc_whd_hal_common.h" | ||
| #include "airoc_wifi.h" | ||
|
|
||
| #include <zephyr/kernel.h> | ||
| #include <zephyr/drivers/gpio.h> | ||
|
|
||
| LOG_MODULE_DECLARE(infineon_airoc_wifi, CONFIG_WIFI_LOG_LEVEL); | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
ThreeEights marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #endif | ||
|
|
||
| /****************************************************** | ||
| * Function | ||
ThreeEights marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ******************************************************/ | ||
|
|
||
| int airoc_wifi_power_on(const struct device *dev) | ||
| { | ||
| #if DT_INST_NODE_HAS_PROP(0, wifi_reg_on_gpios) | ||
| int ret; | ||
| const struct airoc_wifi_config *config = dev->config; | ||
|
|
||
| /* Check WIFI REG_ON gpio instance */ | ||
| if (!device_is_ready(config->wifi_reg_on_gpio.port)) { | ||
| LOG_ERR("Error: failed to configure wifi_reg_on %s pin %d", | ||
| config->wifi_reg_on_gpio.port->name, config->wifi_reg_on_gpio.pin); | ||
| return -EIO; | ||
| } | ||
|
|
||
| /* Configure wifi_reg_on as output */ | ||
| ret = gpio_pin_configure_dt(&config->wifi_reg_on_gpio, GPIO_OUTPUT); | ||
| if (ret) { | ||
| LOG_ERR("Error %d: failed to configure wifi_reg_on %s pin %d", ret, | ||
| config->wifi_reg_on_gpio.port->name, config->wifi_reg_on_gpio.pin); | ||
| return ret; | ||
| } | ||
| ret = gpio_pin_set_dt(&config->wifi_reg_on_gpio, 0); | ||
| if (ret) { | ||
| return ret; | ||
| } | ||
|
|
||
| /* Allow CBUCK regulator to discharge */ | ||
| k_msleep(WLAN_CBUCK_DISCHARGE_MS); | ||
|
|
||
| /* WIFI power on */ | ||
| ret = gpio_pin_set_dt(&config->wifi_reg_on_gpio, 1); | ||
| if (ret) { | ||
| return ret; | ||
| } | ||
| k_msleep(WLAN_POWER_UP_DELAY_MS); | ||
| #endif /* DT_INST_NODE_HAS_PROP(0, reg_on_gpios) */ | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| /* | ||
| * Implement WHD memory wrappers | ||
| */ | ||
|
|
||
| void *whd_mem_malloc(size_t size) | ||
| { | ||
| return k_malloc(size); | ||
| } | ||
|
|
||
| void *whd_mem_calloc(size_t nitems, size_t size) | ||
| { | ||
| return k_calloc(nitems, size); | ||
| } | ||
|
|
||
| void whd_mem_free(void *ptr) | ||
| { | ||
| k_free(ptr); | ||
| } | ||
|
|
||
| #ifdef __cplusplus | ||
| } /* extern "C" */ | ||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) or | ||
| * an affiliate of Cypress Semiconductor Corporation | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #include <whd.h> | ||
| #include <zephyr/device.h> | ||
|
|
||
| /** Defines the amount of stack memory available for the wifi thread. */ | ||
| #if !defined(CY_WIFI_THREAD_STACK_SIZE) | ||
| #define CY_WIFI_THREAD_STACK_SIZE (5120) | ||
| #endif | ||
|
|
||
| /** Defines the priority of the thread that services wifi packets. Legal values are defined by the | ||
| * RTOS being used. | ||
| */ | ||
| #if !defined(CY_WIFI_THREAD_PRIORITY) | ||
| #define CY_WIFI_THREAD_PRIORITY (CY_RTOS_PRIORITY_HIGH) | ||
| #endif | ||
|
|
||
| /** Defines the country this will operate in for wifi initialization parameters. See the | ||
| * wifi-host-driver's whd_country_code_t for legal options. | ||
| */ | ||
| #if !defined(CY_WIFI_COUNTRY) | ||
| #define CY_WIFI_COUNTRY (WHD_COUNTRY_AUSTRALIA) | ||
| #endif | ||
|
|
||
| /** Defines the priority of the interrupt that handles out-of-band notifications from the wifi | ||
| * chip. Legal values are defined by the MCU running this code. | ||
| */ | ||
| #if !defined(CY_WIFI_OOB_INTR_PRIORITY) | ||
| #define CY_WIFI_OOB_INTR_PRIORITY (2) | ||
| #endif | ||
|
|
||
| /** Defines whether to use the out-of-band pin to allow the WIFI chip to wake up the MCU. */ | ||
| #if defined(CY_WIFI_HOST_WAKE_SW_FORCE) | ||
| #define CY_USE_OOB_INTR (CY_WIFI_HOST_WAKE_SW_FORCE) | ||
| #else | ||
| #define CY_USE_OOB_INTR (1u) | ||
| #endif /* defined(CY_WIFI_HOST_WAKE_SW_FORCE) */ | ||
|
|
||
| #define CY_WIFI_HOST_WAKE_IRQ_EVENT GPIO_INT_TRIG_LOW | ||
| #define DEFAULT_OOB_PIN (0) | ||
| #define WLAN_POWER_UP_DELAY_MS (250) | ||
| #define WLAN_CBUCK_DISCHARGE_MS (10) | ||
|
|
||
| extern whd_resource_source_t resource_ops; | ||
|
|
||
| int airoc_wifi_power_on(const struct device *dev); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.