#define HOST_GPIO_PIN_INVALID -1
#define CONFIG_ALLOW_MULTICAST_WAKEUP 1
static int resetpin = HOST_GPIO_PIN_INVALID;
+static int readypin = HOST_GPIO_PIN_INVALID;
+static int handshakepin = HOST_GPIO_PIN_INVALID;
static u32 clockspeed = 0;
extern u8 ap_bssid[MAC_ADDR_LEN];
extern volatile u8 host_sleep;
module_param(raw_tp_mode, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(raw_tp_mode, "Mode choosed to test raw throughput");
+module_param(readypin, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+MODULE_PARM_DESC(readypin, "Data ready pin default is pin 13, gpio27");
+
+module_param(handshakepin, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+MODULE_PARM_DESC(handshakepin, "Handshake pin default is pin 15, gpio22");
+
static void deinit_adapter(void);
clear_bit(ESP_INIT_DONE, &adapter->state_flags);
/* Deinit module if already initialized */
+ test_raw_tp_cleanup();
esp_deinit_module(adapter);
pos = evt_buf;
}
rtnl_lock();
- wdev = esp_cfg80211_add_iface(adapter->wiphy, "espsta%d", 1, NL80211_IFTYPE_STATION, NULL);
+ wdev = esp_cfg80211_add_iface(adapter->wiphy, "wlan%d", 1, NL80211_IFTYPE_STATION, NULL);
rtnl_unlock();
/* Return success if network added successfully */
RET_ON_FAIL(esp_commands_setup(adapter));
RET_ON_FAIL(esp_add_wiphy(adapter));
RET_ON_FAIL(esp_add_network_ifaces(adapter));
+ clear_bit(ESP_CLEANUP_IN_PROGRESS, &adapter->state_flags);
return 0;
}
}
esp_stop_network_ifaces(adapter);
+ esp_cfg_cleanup(adapter);
/* BT may have been initialized after fw bootup event, deinit it */
esp_deinit_bt(adapter);
esp_commands_teardown(adapter);
u16 rx_checksum = 0, checksum = 0;
struct hci_dev *hdev = adapter->hcidev;
u8 *type = NULL;
- struct sk_buff *eap_skb = NULL;
- struct ethhdr *eth = NULL;
if (!skb)
return;
}
if (payload_header->packet_type == PACKET_TYPE_EAPOL) {
- esp_info("Rx PACKET_TYPE_EAPOL!!!!\n");
+ esp_dbg("Rx PACKET_TYPE_EAPOL!!!!\n");
esp_port_open(priv);
-
- eap_skb = alloc_skb(skb->len + ETH_HLEN, GFP_KERNEL);
- if (!eap_skb) {
- esp_info("%u memory alloc failed\n", __LINE__);
- dev_kfree_skb_any(skb);
- return;
- }
- eap_skb->dev = priv->ndev;
-
- if (!IS_ALIGNED((unsigned long) eap_skb->data, SKB_DATA_ADDR_ALIGNMENT)) {
- esp_info("%u eap skb unaligned\n", __LINE__);
- }
-
- eth = (struct ethhdr *) skb_put(eap_skb, ETH_HLEN);
- ether_addr_copy(eth->h_dest, /*skb->data*/priv->ndev->dev_addr);
- ether_addr_copy(eth->h_source, /*skb->data+6*/ ap_bssid);
- eth->h_proto = cpu_to_be16(ETH_P_PAE);
-
- skb_put_data(eap_skb, skb->data, skb->len);
- eap_skb->protocol = eth_type_trans(eap_skb, eap_skb->dev);
- dev_kfree_skb_any(skb);
-
- netif_rx(eap_skb);
+ skb->dev = priv->ndev;
+ skb->protocol = eth_type_trans(skb, priv->ndev);
+ netif_rx(skb);
} else if (payload_header->packet_type == PACKET_TYPE_DATA) {
}
}
+char *esp_get_hardware_name(int hardware_id)
+{
+ if(hardware_id == ESP_FIRMWARE_CHIP_ESP32)
+ return "ESP32";
+ else if(hardware_id == ESP_FIRMWARE_CHIP_ESP32S2)
+ return "ESP32S2";
+ else if(hardware_id == ESP_FIRMWARE_CHIP_ESP32C3)
+ return "ESP32C3";
+ else if(hardware_id == ESP_FIRMWARE_CHIP_ESP32S3)
+ return "ESP32S3";
+ else if(hardware_id == ESP_FIRMWARE_CHIP_ESP32C2)
+ return "ESP32C2";
+ else if(hardware_id == ESP_FIRMWARE_CHIP_ESP32C6)
+ return "ESP32C6";
+ else
+ return "N/A";
+}
+
+bool esp_is_valid_hardware_id(int hardware_id)
+{
+ switch(hardware_id) {
+ case ESP_FIRMWARE_CHIP_ESP32:
+ case ESP_FIRMWARE_CHIP_ESP32S2:
+ case ESP_FIRMWARE_CHIP_ESP32C3:
+ case ESP_FIRMWARE_CHIP_ESP32S3:
+ case ESP_FIRMWARE_CHIP_ESP32C2:
+ case ESP_FIRMWARE_CHIP_ESP32C6:
+ return true;
+ default:
+ return false;
+ }
+}
+
int esp_is_tx_queue_paused(struct esp_wifi_device *priv)
{
if (!priv || !priv->ndev)
}
}
+void dt_get_reset_pin(void)
+{
+ struct device_node *resetpin_node = NULL;
+ int temp_resetpin = HOST_GPIO_PIN_INVALID;
+
+
+ resetpin_node = of_find_compatible_node(NULL, NULL, "espressif,esp_sdio");
+ if (!resetpin_node)
+ resetpin_node = of_find_compatible_node(NULL, NULL, "espressif,esp_spi");
+ if (resetpin_node){
+ of_property_read_u32(resetpin_node, "resetpin", &temp_resetpin);
+ if (temp_resetpin == HOST_GPIO_PIN_INVALID)
+ esp_warn("Unable to find resetpin in device tree.\n");
+ else
+ resetpin = temp_resetpin;
+ }
+}
+
static int __init esp_init(void)
{
int ret = 0;
struct esp_adapter *adapter = NULL;
+ struct esp_if_params if_params;
+
+ dt_get_reset_pin();
/* Reset ESP, Clean start ESP */
esp_reset();
if (!adapter)
return -EFAULT;
+ if_params.speed = clockspeed;
+ if_params.handshake_pin = handshakepin;
+ if_params.data_ready_pin = readypin;
/* Init transport layer */
- ret = esp_init_interface_layer(adapter, clockspeed);
+ ret = esp_init_interface_layer(adapter, &if_params);
if (ret != 0) {
deinit_adapter();