Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions boards/x86/panther/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,47 @@ endif
config BLUETOOTH_MONITOR_ON_DEV_NAME
default UART_QMSI_1_NAME if BLUETOOTH_DEBUG_MONITOR

if WIFI_WINC1500

config SPI
def_bool y
config GPIO
def_bool y

if GPIO_QMSI

config WINC1500_GPIO_0_NAME
default GPIO_QMSI_0_NAME
config WINC1500_GPIO_1_NAME
default GPIO_QMSI_1_NAME

endif # GPIO_QMSI

if SPI_QMSI
config SPI_CS_GPIO
def_bool y
config SPI_1_CS_GPIO_PORT
default GPIO_QMSI_0_NAME
config SPI_1_CS_GPIO_PIN
default 11
config WINC1500_GPIO_0_NAME
string
default GPIO_QMSI_0_NAME
config WINC1500_GPIO_1_NAME
string
default GPIO_QMSI_1_NAME
endif

endif # WIFI_WINC1500



config LEDS_GPIO_NAME
string
default GPIO_QMSI_0_NAME

config SPI_0
def_bool n


endif # BOARD_PANTHER
41 changes: 41 additions & 0 deletions boards/x86/panther/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,44 @@ static int uart_switch(struct device *port)

SYS_INIT(uart_switch, POST_KERNEL, CONFIG_UART_CONSOLE_INIT_PRIORITY);
#endif

#if defined(CONFIG_WIFI_WINC1500)

static struct device *winc1500_gpio_config[WINC1500_GPIO_IDX_LAST_ENTRY];

struct device **winc1500_configure_gpios(void)
{
struct device *gpio;
const int flags_noint_out = GPIO_DIR_OUT;

gpio = device_get_binding(CONFIG_WINC1500_GPIO_1_NAME);

gpio_pin_configure(gpio, CONFIG_WINC1500_GPIO_RESET_N, flags_noint_out);
winc1500_gpio_config[WINC1500_GPIO_IDX_RESET_N] = gpio;

gpio = device_get_binding(CONFIG_WINC1500_GPIO_0_NAME);

gpio_pin_configure(gpio, CONFIG_WINC1500_GPIO_CHIP_EN, flags_noint_out);
winc1500_gpio_config[WINC1500_GPIO_IDX_CHIP_EN] = gpio;

gpio_pin_configure(gpio, CONFIG_WINC1500_GPIO_WAKE, flags_noint_out);
winc1500_gpio_config[WINC1500_GPIO_IDX_WAKE] = gpio;

return winc1500_gpio_config;
}

void winc1500_configure_intgpios(void)
{
struct device *gpio;

const int flags_int_in = (GPIO_DIR_IN | GPIO_INT |
GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE |
GPIO_INT_EDGE);

gpio = device_get_binding(CONFIG_WINC1500_GPIO_0_NAME);

gpio_pin_configure(gpio, CONFIG_WINC1500_GPIO_IRQN, flags_int_in);
winc1500_gpio_config[WINC1500_GPIO_IDX_IRQN] = gpio;

}
#endif /* CONFIG_WIFI_WINC1500 */
28 changes: 28 additions & 0 deletions boards/x86/panther/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,32 @@
#define USB_VUSB_EN_GPIO 28
#endif


#if defined(CONFIG_WIFI_WINC1500)

/* GPIO numbers where the WINC1500 module is connected to */
#define CONFIG_WINC1500_GPIO_CHIP_EN 6 /* AP_GPIO6_ADC6 EXTERNAL_PAD_6 Out */
#define CONFIG_WINC1500_GPIO_WAKE 5 /* AP_GPIO5_ADC5 EXTERNAL_PAD_5 Out */
#define CONFIG_WINC1500_GPIO_IRQN 4 /* AP_GPIO4_ADC4 EXTERNAL_PAD_4 In Irq */
#define CONFIG_WINC1500_GPIO_RESET_N 0 /* AP_GPIO_AON0 AON_GPIO_PAD_0 Out */

enum winc1500_gpio_index {
/* If all the GPIOs can be served by same driver, then you
* can set the values to be the same. The first enum should
* always have a value of 0.
*/
WINC1500_GPIO_IDX_CHIP_EN = 0,
WINC1500_GPIO_IDX_WAKE = 0,
WINC1500_GPIO_IDX_IRQN = 0,

WINC1500_GPIO_IDX_RESET_N = 1,

WINC1500_GPIO_IDX_LAST_ENTRY
};

struct device **winc1500_configure_gpios(void);
void winc1500_configure_intgpios(void);

#endif /* CONFIG_WIFI_WINC1500 */

#endif /* __BOARD_H__ */
2 changes: 1 addition & 1 deletion boards/x86/panther/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static void _pinmux_defaults(u32_t base)
PIN_CONFIG(mux_config, 9, PINMUX_FUNC_C);
PIN_CONFIG(mux_config, 16, PINMUX_FUNC_C);
PIN_CONFIG(mux_config, 17, PINMUX_FUNC_C);
PIN_CONFIG(mux_config, 33, PINMUX_FUNC_A);
PIN_CONFIG(mux_config, 33, PINMUX_FUNC_B);
PIN_CONFIG(mux_config, 40, PINMUX_FUNC_B);
PIN_CONFIG(mux_config, 41, PINMUX_FUNC_B);
PIN_CONFIG(mux_config, 42, PINMUX_FUNC_B);
Expand Down
1 change: 1 addition & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ source "drivers/crypto/Kconfig"

source "drivers/display/Kconfig"

source "drivers/wifi/Kconfig"
endmenu
1 change: 1 addition & 0 deletions drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ obj-$(CONFIG_DMA) += dma/
obj-$(CONFIG_USB) += usb/
obj-$(CONFIG_CRYPTO) += crypto/
obj-y += crc/
obj-$(CONFIG_WIFI) += wifi/
30 changes: 30 additions & 0 deletions drivers/wifi/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Kconfig - drivers configuration options

#
# Copyright (c) 2015 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#




menuconfig WIFI
bool "add support for WIFI Drivers"
default n

if WIFI

config WIFI_INIT_PRIORITY
int "WiFi driver init priority"
depends on WIFI
default 80
help
WiFi device driver initialization priority.
Do not mess with it unless you know what you are doing.
Note that the priority needs to be lower than the net stack
so that it can start before the networking sub-system.

source "drivers/wifi/winc1500/Kconfig"

endif # WIFI
1 change: 1 addition & 0 deletions drivers/wifi/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj-$(CONFIG_WIFI_WINC1500) += winc1500/
39 changes: 39 additions & 0 deletions drivers/wifi/winc1500/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Kconfig - Atmel WINC1500 BSP and BUS configuration options
#
# WINC1500 options
#

menuconfig WIFI_WINC1500
bool
prompt "WINC1500 driver HAL Configuration"
default n
depends on WIFI

if WIFI_WINC1500

config WINC1500_SPI_DRV_NAME
string "SPI device where WINC1500 is connected"
depends on WIFI_WINC1500
default "SPI_1"
help
Specify the device name of the SPI device to which WINC1500 is
connected.

config WINC1500_SPI_SLAVE
int "SPI Slave Select where WINC1500 is connected"
depends on WIFI_WINC1500
default 1
help
Specify the slave select pin of the SPI to which WINC1500 is
connected.

config WINC1500_SPI_FREQ
int "SPI frequency to use with WINC1500"
depends on WIFI_WINC1500
default 4
help
SPI frequency to use with WINC1500

# TODO GPIO

endif # WIFI_WINC1500
7 changes: 7 additions & 0 deletions drivers/wifi/winc1500/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ZEPHYRINCLUDE +=-I${srctree}/ext/drivers/atmel/winc1500
ZEPHYRINCLUDE +=-I${srctree}/drivers/wifi/winc1500

obj-$(CONFIG_WIFI_WINC1500) += \
bsp/source/nm_bsp.o \
bus_wrapper/source/nm_bus_wrapper.o \
winc1500.o
100 changes: 100 additions & 0 deletions drivers/wifi/winc1500/bsp/include/nm_bsp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* Copyright (c) 2017 IpTronix
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Initialization for BSP such as Reset and Chip Enable Pins for WINC, delays, register ISR, enable/disable IRQ for WINC, ...etc. You must use this function in the head of your application to
* enable WINC and Host Driver communicate each other.
*/

#ifndef _NM_BSP_H_
#define _NM_BSP_H_

#include <zephyr/types.h>

#define NMI_API

/*!
* @fn sint8 nm_bsp_init(void);
* @note Implementation of this function is host dependent.
* @warning Missing use will lead to unavailability of host communication.\n
*
* @return The function returns @ref M2M_SUCCESS for successful operations and a negative value otherwise.
*/
s8_t nm_bsp_init(void);

/*!
* De-initialization for BSP (Board Support Package)
* @fn sint8 nm_bsp_deinit(void);
* @pre Initialize \ref nm_bsp_init first
* @note Implementation of this function is host dependent.
* @warning Missing use may lead to unknown behavior in case of soft reset.\n
* @see nm_bsp_init
* @return The function returns 0 for successful operations and
* a negative value otherwise.
*/
s8_t nm_bsp_deinit(void);

/*!
* Resetting NMC1500 SoC by setting CHIP_EN and RESET_N signals low,
* then after specific delay the function will put CHIP_EN high then
* RESET_N high, for the timing between signals please review the
* WINC data-sheet
*
* @fn void nm_bsp_reset(void);
* @param [in] None
* @pre Initialize \ref nm_bsp_init first
* @note Implementation of this function is host dependent and called by HIF layer.
* @see nm_bsp_init
* @return None
*/
void nm_bsp_reset(void);

/*!
* Sleep in units of milliseconds.\n
* This function used by HIF Layer according to different situations.
* @fn void nm_bsp_sleep(uint32);
* @brief
* @param [in] u32TimeMsec
* Time unit in milliseconds
* @pre Initialize \ref nm_bsp_init first
* @warning Maximum value must nor exceed 4294967295 milliseconds
* which is equal to 4294967.295 seconds.\n
* @note Implementation of this function is host dependent.
* @see nm_bsp_init
* @return None
*/
void nm_bsp_sleep(u32_t time_msec);

/*!
* Register ISR (Interrupt Service Routine) in the initialization
* of HIF (Host Interface) Layer.
* When the interrupt trigger the BSP layer should call the isr_fun
* function once inside the interrupt.
* @fn void nm_bsp_register_isr(tpfNmBspIsr);
* @param [in] tpfNmBspIsr pfIsr
* Pointer to ISR handler in HIF
* @warning Make sure that ISR for IRQ pin for WINC is disabled by
* default in your implementation.
* @note Implementation of this function is host dependent and
* called by HIF layer.
* @see tpfNmBspIsr
* @return None
*/
void nm_bsp_register_isr(void (*isr_fun)(void));

/*!
* Synchronous enable/disable interrupts function
* @fn void nm_bsp_interrupt_ctrl(uint8);
* @brief Enable/Disable interrupts
* @param [in] u8Enable
* '0' disable interrupts. '1' enable interrupts
* @see tpfNmBspIsr
* @note Implementation of this function is host dependent and
* called by HIF layer.
* @return None
*/
void nm_bsp_interrupt_ctrl(u8_t enable);

#endif /*_NM_BSP_H_*/
Loading