static ssize_t hsic_port_enable_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	int retval;
	int org_req;

	if (size > HSIC_ENABLE_SIZE)
		return -EINVAL;

	if (sscanf(buf, "%d", &org_req) != 1) {
		dev_dbg(dev, "Invalid, value\n");
		return -EINVAL;
	}

#if 0
	/* Free the aux irq */
	hsic_aux_irq_free();
	dev_dbg(dev,
		"%s---->AUX IRQ is disabled\n", __func__);
#endif

	if (delayed_work_pending(&hsic.hsic_aux)) {
		dev_dbg(dev,
			"%s---->Wait for delayed work finish\n",
			 __func__);
		retval = wait_event_interruptible(hsic.aux_wq,
						hsic.hsic_aux_finish);
		if (retval < 0)
			return retval;

		if (org_req)
			return size;
	}

	mutex_lock(&hsic.hsic_mutex);
	if (org_req) {
		dev_dbg(dev, "enable hsic\n");

		/* add this due to hcd release
			 doesn't set hcd to NULL */
		if (hsic.hsic_stopped == 0)
			ush_hsic_port_disable(pci_dev);
		usleep_range(5000, 6000);
		ush_hsic_port_enable(pci_dev);
	} else {
		dev_dbg(dev, "disable hsic\n");
		/* add this due to hcd release
			 doesn't set hcd to NULL */
		if (hsic.hsic_stopped == 0)
			ush_hsic_port_disable(pci_dev);

	}
	mutex_unlock(&hsic.hsic_mutex);
	return size;
}
static void hsic_aux_work(struct work_struct *work)
{
	dev_dbg(&pci_dev->dev,
		"%s---->\n", __func__);
	mutex_lock(&hsic.hsic_mutex);
#if 0
	/* Free the aux irq */
	hsic_aux_irq_free();
	msleep(800);
	dev_dbg(&pci_dev->dev,
		"%s---->AUX IRQ is disabled\n", __func__);
#endif

	if (hsic.hsic_stopped == 0)
		ush_hsic_port_disable(pci_dev);

	usleep_range(hsic.reenumeration_delay,
			hsic.reenumeration_delay + 1000);
	ush_hsic_port_enable(pci_dev);
	mutex_unlock(&hsic.hsic_mutex);

	hsic.hsic_aux_finish = 1;
	wake_up(&hsic.aux_wq);
	dev_dbg(&pci_dev->dev,
		"%s<----\n", __func__);
	return;
}
static void hsic_aux_work(struct work_struct *work)
{
	dev_dbg(&pci_dev->dev,
		"%s---->\n", __func__);
	mutex_lock(&hsic.hsic_mutex);
	if ((!hsic.rh_dev) || (hsic_enable == 0)) {
		dev_dbg(&pci_dev->dev,
			"root hub is already removed\n");
		mutex_unlock(&hsic.hsic_mutex);
		return;
	}

	if (hsic.port_disconnect == 0)
		hsic_port_logical_disconnect(hsic.rh_dev,
				HSIC_USH_PORT);
	else
		ush_hsic_port_disable();
	usleep_range(hsic.reenumeration_delay,
			hsic.reenumeration_delay + 1000);
	ush_hsic_port_enable();
	mutex_unlock(&hsic.hsic_mutex);

	hsic.hsic_aux_finish = 1;
	wake_up(&hsic.aux_wq);
	dev_dbg(&pci_dev->dev,
		"%s<----\n", __func__);
	return;
}
static void hsic_port_logical_disconnect(struct usb_device *hdev,
		unsigned int port)
{
	dev_dbg(&pci_dev->dev, "logical disconnect on root hub\n");
	hsic.port_disconnect = 1;
	ush_hsic_port_disable();

	usb_set_change_bits(hdev, port);
	usb_kick_khubd(hdev);
}
static ssize_t hsic_port_enable_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	int retval;
	int org_req;

	if (size > HSIC_ENABLE_SIZE)
		return -EINVAL;

	if (sscanf(buf, "%d", &org_req) != 1) {
		dev_dbg(dev, "Invalid, value\n");
		return -EINVAL;
	}

	if (delayed_work_pending(&hsic.hsic_aux)) {
		dev_dbg(dev,
			"%s---->Wait for delayed work finish\n",
			 __func__);
		retval = wait_event_interruptible(hsic.aux_wq,
						hsic.hsic_aux_finish);
		if (retval < 0)
			return retval;

		if (org_req)
			return size;
	}

	mutex_lock(&hsic.hsic_mutex);
	if (!hsic.rh_dev) {
		dev_dbg(&pci_dev->dev,
			"root hub is already removed\n");
		mutex_unlock(&hsic.hsic_mutex);
		return -ENODEV;
	}
	if (hsic.modem_dev) {
		pm_runtime_get_sync(&hsic.modem_dev->dev);
		pm_runtime_put(&hsic.modem_dev->dev);
	}
	if (hsic.rh_dev) {
		pm_runtime_get_sync(&hsic.rh_dev->dev);
		pm_runtime_put(&hsic.rh_dev->dev);
	}

	if (hsic.port_disconnect == 0)
		hsic_port_logical_disconnect(hsic.rh_dev,
				HSIC_USH_PORT);
	else
		ush_hsic_port_disable();

	if (org_req) {
		dev_dbg(dev, "enable hsic\n");
		msleep(20);
		ush_hsic_port_enable();
	} else {
		dev_dbg(dev, "disable hsic\n");
		if ((hsic.rh_dev) && (hsic.autosuspend_enable == 0)) {
			hsic.autosuspend_enable = 1;
			usb_enable_autosuspend(hsic.rh_dev);
		}
	}
	mutex_unlock(&hsic.hsic_mutex);
	return size;
}