1 // SPDX-License-Identifier: GPL-2.0
3 * Wireless Host Controller (WHC) interrupt handling.
5 * Copyright (C) 2007 Cambridge Silicon Radio Ltd.
7 #include <linux/kernel.h>
8 #include <linux/uwb/umc.h>
10 #include "../../wusbcore/wusbhc.h"
14 static void transfer_done(struct whc
*whc
)
16 queue_work(whc
->workqueue
, &whc
->async_work
);
17 queue_work(whc
->workqueue
, &whc
->periodic_work
);
20 irqreturn_t
whc_int_handler(struct usb_hcd
*hcd
)
22 struct wusbhc
*wusbhc
= usb_hcd_to_wusbhc(hcd
);
23 struct whc
*whc
= wusbhc_to_whc(wusbhc
);
26 sts
= le_readl(whc
->base
+ WUSBSTS
);
27 if (!(sts
& WUSBSTS_INT_MASK
))
29 le_writel(sts
& WUSBSTS_INT_MASK
, whc
->base
+ WUSBSTS
);
31 if (sts
& WUSBSTS_GEN_CMD_DONE
)
32 wake_up(&whc
->cmd_wq
);
34 if (sts
& WUSBSTS_HOST_ERR
)
35 dev_err(&whc
->umc
->dev
, "FIXME: host system error\n");
37 if (sts
& WUSBSTS_ASYNC_SCHED_SYNCED
)
38 wake_up(&whc
->async_list_wq
);
40 if (sts
& WUSBSTS_PERIODIC_SCHED_SYNCED
)
41 wake_up(&whc
->periodic_list_wq
);
43 if (sts
& WUSBSTS_DNTS_INT
)
44 queue_work(whc
->workqueue
, &whc
->dn_work
);
47 * A transfer completed (see [WHCI] section 4.7.1.2 for when
50 if (sts
& (WUSBSTS_INT
| WUSBSTS_ERR_INT
))
56 static int process_dn_buf(struct whc
*whc
)
58 struct wusbhc
*wusbhc
= &whc
->wusbhc
;
59 struct dn_buf_entry
*dn
;
62 for (dn
= whc
->dn_buf
; dn
< whc
->dn_buf
+ WHC_N_DN_ENTRIES
; dn
++) {
63 if (dn
->status
& WHC_DN_STATUS_VALID
) {
64 wusbhc_handle_dn(wusbhc
, dn
->src_addr
,
65 (struct wusb_dn_hdr
*)dn
->dn_data
,
67 dn
->status
&= ~WHC_DN_STATUS_VALID
;
74 void whc_dn_work(struct work_struct
*work
)
76 struct whc
*whc
= container_of(work
, struct whc
, dn_work
);
80 processed
= process_dn_buf(whc
);