int num_apbs;
- struct delayed_work delayed_work;
enum svc_wakedetect_state wake_detect_state;
int wake_detect_irq;
spinlock_t lock;
return 0;
}
-/**
- * hub_conf_delayed_work - Configures USB3613 device to HUB mode
- *
- * The idea here is to split the APB coldboot operation with slow HUB configuration,
- * so that driver response to wake/detect event can be met.
- * So expectation is, once code reaches here, means initial unipro linkup
- * between APB<->Switch was successful, so now just take it to AP.
- */
-static void hub_conf_delayed_work(struct work_struct *work)
-{
- struct arche_platform_drvdata *arche_pdata =
- container_of(work, struct arche_platform_drvdata, delayed_work.work);
-
- /* Enable HUB3613 into HUB mode. */
- if (usb3613_hub_mode_ctrl(true))
- dev_warn(arche_pdata->dev, "failed to control hub device\n");
-}
-
static void assert_wakedetect(struct arche_platform_drvdata *arche_pdata)
{
/* Assert wake/detect = Detect event from AP */
/* Bring APB out of reset: cold boot sequence */
device_for_each_child(arche_pdata->dev, NULL, apb_cold_boot);
+ /* Enable HUB3613 into HUB mode. */
+ if (usb3613_hub_mode_ctrl(true))
+ dev_warn(arche_pdata->dev, "failed to control hub device\n");
+
spin_lock_irqsave(&arche_pdata->lock, flags);
- /* USB HUB configuration */
- schedule_delayed_work(&arche_pdata->delayed_work, msecs_to_jiffies(2000));
arche_pdata->wake_detect_state = WD_STATE_IDLE;
spin_unlock_irqrestore(&arche_pdata->lock, flags);
if (time_before(jiffies,
arche_pdata->wake_detect_start +
msecs_to_jiffies(WD_COLDBOOT_PULSE_WIDTH_MS))) {
- /* No harm with cancellation, even if not pending */
- cancel_delayed_work(&arche_pdata->delayed_work);
arche_pdata->wake_detect_state = WD_STATE_IDLE;
} else {
/* Check we are not in middle of irq thread already */
/* wake/detect falling */
if (arche_pdata->wake_detect_state == WD_STATE_IDLE) {
arche_pdata->wake_detect_start = jiffies;
- /* No harm with cancellation even if it is not pending*/
- cancel_delayed_work(&arche_pdata->delayed_work);
/*
* In the begining, when wake/detect goes low (first time), we assume
* it is meant for coldboot and set the flag. If wake/detect line stays low
}
assert_wakedetect(arche_pdata);
- INIT_DELAYED_WORK(&arche_pdata->delayed_work, hub_conf_delayed_work);
dev_info(dev, "Device registered successfully\n");
return 0;
struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
device_remove_file(&pdev->dev, &dev_attr_state);
- cancel_delayed_work_sync(&arche_pdata->delayed_work);
device_for_each_child(&pdev->dev, NULL, arche_remove_child);
arche_platform_poweroff_seq(arche_pdata);
platform_set_drvdata(pdev, NULL);