Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c949509 authored by Azhar Shaikh's avatar Azhar Shaikh
Browse files

net: usbnet: Perform IPA initialization after IPA is ready



IPA driver finishes its initialization only after the IPA FW is
loaded. Upon function bind config if IPA driver is not ready defer
IPA related initializations. This is done by registering a call
back with IPA and wait for IPA ready call back to unblock the
function bind config.

Change-Id: If3f18ff2611194560c2addf82c1d2a67cb6b34e7
Signed-off-by: default avatarAzhar Shaikh <azhars@codeaurora.org>
parent a4fd93ee
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@
#include <linux/pm_runtime.h>
#include <linux/debugfs.h>
#include <linux/types.h>
#include <linux/ipa.h>
#define DRIVER_VERSION		"22-Aug-2005"


@@ -1997,6 +1998,16 @@ static void usbnet_ipa_send_routine(struct work_struct *work)
	spin_unlock(&dev->ipa_pendq.lock);
}

static void usbnet_ipa_ready_callback(void *user_data)
{
	struct usbnet *dev = user_data;

	pr_info("%s: ipa is ready\n", __func__);
	dev->ipa_ready = true;

	wake_up_interruptible(&dev->wait_for_ipa_ready);
}

int
usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
{
@@ -2049,6 +2060,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
	dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV
				| NETIF_MSG_PROBE | NETIF_MSG_LINK);
	init_waitqueue_head(&dev->wait);
	init_waitqueue_head(&dev->wait_for_ipa_ready);
	skb_queue_head_init (&dev->rxq);
	skb_queue_head_init (&dev->txq);
	skb_queue_head_init (&dev->done);
@@ -2204,6 +2216,20 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
			pr_err("Couldnt initialize ODU_Bridge Driver\n");
			goto out4;
		}

		status = ipa_register_ipa_ready_cb(usbnet_ipa_ready_callback,
						   dev);
		if (!status) {
			pr_info("%s: ipa is not ready\n", __func__);
			status = wait_event_interruptible_timeout(
					dev->wait_for_ipa_ready, dev->ipa_ready,
					msecs_to_jiffies
						(USBNET_IPA_READY_TIMEOUT));
			if (!status) {
				pr_err("%s: ipa ready timeout\n", __func__);
				return -ETIMEDOUT;
			}
		}
	}

	// ok, it's ready to go.
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#define USBNET_IPA_SYS_PIPE_MAX_PKTS_DESC 200
#define USBNET_IPA_SYS_PIPE_MIN_PKTS_DESC 5
#define USBNET_IPA_SYS_PIPE_DNE_PKTS (USBNET_IPA_SYS_PIPE_MAX_PKTS_DESC*2)
#define USBNET_IPA_READY_TIMEOUT 5000

struct usbnet_ipa_stats {
	/* RX Side */
@@ -118,6 +119,8 @@ struct usbnet {
	struct sk_buff_head	ipa_pendq;
	/* work to send pending packets to ipa */
	struct work_struct ipa_send_task;
	bool	ipa_ready;
	wait_queue_head_t wait_for_ipa_ready;
};

static inline struct usb_driver *driver_of(struct usb_interface *intf)