buf_handle->free_buf_handle(buf_handle->priv_buffer_handle);
buf_handle->priv_buffer_handle = NULL;
}
- ESP_LOGD(TAG, "Data path stopped");
usleep(100*1000);
return;
}
#if defined(CONFIG_IDF_TARGET_ESP32)||defined(CONFIG_IDF_TARGET_ESP32C6)
#include "driver/sdio_slave.h"
#else
- #error "SDIO is not supported ESP32S2"
+ #error "SDIO is not supported"
#endif
#endif
ESP_SLAVE := ""
# Toolchain Path
-CROSS_COMPILE := /usr/bin/arm-linux-gnueabihf-
+CROSS_COMPILE :=
# Linux Kernel header
KERNEL := /lib/modules/$(shell uname -r)/build
# Architecture
-ARCH := arm
+ARCH := arm64
#Default interface is sdio
MODULE_NAME=esp32_sdio
hdev->dev_type = HCI_PRIMARY;
+ if (adapter->if_type == ESP_IF_TYPE_SDIO)
+ SET_HCIDEV_DEV(hdev, adapter->dev);
+
ret = hci_register_dev(hdev);
if (ret < 0) {
BT_ERR("Can not register HCI device");
return;
}
+ if (!test_bit(ESP_INIT_DONE, &adapter->state_flags)) {
+ esp_info("Driver init is ongoing\n");
+ return;
+ }
+ if (test_bit(ESP_CLEANUP_IN_PROGRESS, &adapter->state_flags)) {
+ esp_info("Driver cleanup is ongoing\n");
+ return;
+ }
+
esp_dev = wiphy_priv(wiphy);
if (!esp_dev || !esp_dev->adapter) {
esp_info("%u esp_dev not initialized yet \n", __LINE__);
return;
}
- if (test_bit(ESP_CLEANUP_IN_PROGRESS, &adapter->state_flags)) {
- return;
- }
priv = esp_dev->adapter->priv[0];
ESP_CLEANUP_IN_PROGRESS, /* Driver unloading or ESP reseted */
ESP_CMD_INIT_DONE, /* Cmd component is initialized with esp_commands_setup() */
ESP_DRIVER_ACTIVE, /* kernel module __exit is not yet invoked */
+ ESP_INIT_DONE, /* Driver init done */
};
enum priv_flags_e {
VAL_CONFIG_TEST_RAW_TP=y
fi
+ if [ "$ESP_SLAVE" != "" ] ; then
+ CUSTOM_OPTS=${CUSTOM_OPTS}" ESP_SLAVE=\"$ESP_SLAVE"\"
+ fi
+ if [ "$CUSTOM_OPTS" != "" ] ; then
+ echo "Adding $CUSTOM_OPTS"
+ fi
+
# For Linux other than Raspberry Pi, Please point
# CROSS_COMPILE -> <Toolchain-Path>/bin/arm-linux-gnueabihf-
# KERNEL -> Place where kernel is checked out and built
# ARCH -> Architecture
- make -j8 target=$IF_TYPE CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- KERNEL="/lib/modules/$(uname -r)/build" \
- CONFIG_TEST_RAW_TP="$VAL_CONFIG_TEST_RAW_TP" ARCH=arm
+ # make -j8 target=$IF_TYPE CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- KERNEL="/lib/modules/$(uname -r)/build" \
+ # CONFIG_TEST_RAW_TP="$VAL_CONFIG_TEST_RAW_TP" ARCH=arm64
+
+ # Populate your arch if not populated correctly.
+ arch_num_bits=$(getconf LONG_BIT)
+ if [ "$arch_num_bits" = "32" ] ; then arch_found="arm"; else arch_found="arm64"; fi
+
+ make -j8 target=$IF_TYPE KERNEL="/lib/modules/$(uname -r)/build" CONFIG_TEST_RAW_TP="$VAL_CONFIG_TEST_RAW_TP" ARCH=$arch_found $CUSTOM_OPTS
if [ "$RESETPIN" = "" ] ; then
#By Default, BCM6 is GPIO on host. use resetpin=6
echo "Building for esp32"
ESP_SLAVE='CONFIG_TARGET_ESP32=y'
;;
+ [Ee][Ss][Pp]32[Cc]6)
+ echo "Building for esp32c6"
+ ESP_SLAVE='CONFIG_TARGET_ESP32C6=y'
+ ;;
[Ee][Ss][Pp]32-[Cc]6)
echo "Building for esp32c6"
ESP_SLAVE='CONFIG_TARGET_ESP32C6=y'
usage
exit 1
else
- if [ "$IF_TYPE" = "sdio" ] ; then
- # SDIO Kernel driver registration varies for ESP32 and ESP32-C6 slave chipsets
- select_esp_slave
- fi
+if [ "$IF_TYPE" = "sdio" ] ; then
+ # SDIO Kernel driver registration varies for ESP32 and ESP32-C6 slave chipsets
+ select_esp_slave
+fi
echo "Building for $IF_TYPE protocol"
MODULE_NAME=esp32_${IF_TYPE}.ko
fi
return 0;
}
-static struct esp_sdio_context *init_sdio_func(struct sdio_func *func)
+static struct esp_sdio_context *init_sdio_func(struct sdio_func *func, int *sdio_ret)
{
struct esp_sdio_context *context = NULL;
int ret = 0;
/* Enable Function */
ret = sdio_enable_func(func);
if (ret) {
+ esp_err("sdio_enable_func ret: %d\n", ret);
+ if (sdio_ret)
+ *sdio_ret = ret;
+ sdio_release_host(func);
+
return NULL;
}
/* Register IRQ */
ret = sdio_claim_irq(func, esp_handle_isr);
if (ret) {
+ esp_err("sdio_claim_irq ret: %d\n", ret);
sdio_disable_func(func);
+
+ if (sdio_ret)
+ *sdio_ret = ret;
+ sdio_release_host(func);
+
return NULL;
}
esp_info("ESP network device detected\n");
- context = init_sdio_func(func);
+ context = init_sdio_func(func, &ret);;
if (!context) {
- return -EINVAL;
+ if (ret)
+ return ret;
+ else
+ return -EINVAL;
}
if (sdio_context.sdio_clk_mhz) {
/* SDIO driver structure to be registered with kernel */
static struct sdio_driver esp_sdio_driver = {
- .name = "esp_sdio",
+ .name = KBUILD_MODNAME,
.id_table = esp_devices,
.probe = esp_probe,
.remove = esp_remove,
.drv = {
- .name = "esp_sdio",
+ .name = KBUILD_MODNAME,
.owner = THIS_MODULE,
.pm = &esp_pm_ops,
.of_match_table = esp_sdio_of_match,
if (!evt_buf)
return;
+ if (len_left >= 64) {
+ esp_info("ESP init event len looks unexpected: %u (>=64)\n", len_left);
+ esp_info("You probably facing timing mismatch at transport layer\n");
+ }
+
pos = evt_buf;
+ clear_bit(ESP_INIT_DONE, &adapter->state_flags);
while (len_left) {
tag_len = *(pos + 1);
if (*pos == ESP_BOOTUP_CAPABILITY) {
adapter->capabilities = *(pos + 2);
- process_capabilities(adapter);
- print_capabilities(*(pos + 2));
} else if (*pos == ESP_BOOTUP_FIRMWARE_CHIP_ID) {
if (tag_len != sizeof(struct fw_data))
esp_info("Length not matching to firmware data size\n");
else
- if (process_fw_data((struct fw_data *)(pos + 2)))
+ if (process_fw_data((struct fw_data *)(pos + 2))) {
if (context->func) {
generate_slave_intr(context, BIT(ESP_CLOSE_DATA_PATH));
return;
}
+ }
} else {
esp_warn("Unsupported tag in event");
if (esp_add_card(adapter)) {
esp_err("network iterface init failed\n");
generate_slave_intr(context, BIT(ESP_CLOSE_DATA_PATH));
+ } else {
+ set_bit(ESP_INIT_DONE, &adapter->state_flags);
+ process_capabilities(adapter);
+ print_capabilities(adapter->capabilities);
}
}
if (esp_add_card(adapter)) {
esp_err("network iterface init failed\n");
+ } else {
+ set_bit(ESP_INIT_DONE, &adapter->state_flags);
}
process_capabilities(adapter);