提交 e3a98ac4 编写于 作者: L Linus Torvalds

Merge branch 'mailbox-for-next' of git://git.linaro.org/landing-teams/working/fujitsu/integration

Pull mailbox updates from Jassi Brar:
 "Mainly we move from jiffy based timer to HRTIMER for finer control
  over polling.  Then a controller reduces its polling period from 10 to
  1ms"

* 'mailbox-for-next' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
  mailbox: arm_mhu: reduce txpoll_period from 10ms to 1 ms
  mailbox: switch to hrtimer for tx_complete polling
  mailbox: Drop owner assignment from platform_driver
...@@ -148,7 +148,7 @@ static int mhu_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -148,7 +148,7 @@ static int mhu_probe(struct amba_device *adev, const struct amba_id *id)
mhu->mbox.ops = &mhu_ops; mhu->mbox.ops = &mhu_ops;
mhu->mbox.txdone_irq = false; mhu->mbox.txdone_irq = false;
mhu->mbox.txdone_poll = true; mhu->mbox.txdone_poll = true;
mhu->mbox.txpoll_period = 10; mhu->mbox.txpoll_period = 1;
amba_set_drvdata(adev, mhu); amba_set_drvdata(adev, mhu);
......
...@@ -204,7 +204,6 @@ MODULE_DEVICE_TABLE(of, bcm2835_mbox_of_match); ...@@ -204,7 +204,6 @@ MODULE_DEVICE_TABLE(of, bcm2835_mbox_of_match);
static struct platform_driver bcm2835_mbox_driver = { static struct platform_driver bcm2835_mbox_driver = {
.driver = { .driver = {
.name = "bcm2835-mbox", .name = "bcm2835-mbox",
.owner = THIS_MODULE,
.of_match_table = bcm2835_mbox_of_match, .of_match_table = bcm2835_mbox_of_match,
}, },
.probe = bcm2835_mbox_probe, .probe = bcm2835_mbox_probe,
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
static LIST_HEAD(mbox_cons); static LIST_HEAD(mbox_cons);
static DEFINE_MUTEX(con_mutex); static DEFINE_MUTEX(con_mutex);
static void poll_txdone(unsigned long data);
static int add_to_rbuf(struct mbox_chan *chan, void *mssg) static int add_to_rbuf(struct mbox_chan *chan, void *mssg)
{ {
int idx; int idx;
...@@ -88,7 +86,9 @@ static void msg_submit(struct mbox_chan *chan) ...@@ -88,7 +86,9 @@ static void msg_submit(struct mbox_chan *chan)
spin_unlock_irqrestore(&chan->lock, flags); spin_unlock_irqrestore(&chan->lock, flags);
if (!err && (chan->txdone_method & TXDONE_BY_POLL)) if (!err && (chan->txdone_method & TXDONE_BY_POLL))
poll_txdone((unsigned long)chan->mbox); /* kick start the timer immediately to avoid delays */
hrtimer_start(&chan->mbox->poll_hrt, ktime_set(0, 0),
HRTIMER_MODE_REL);
} }
static void tx_tick(struct mbox_chan *chan, int r) static void tx_tick(struct mbox_chan *chan, int r)
...@@ -112,9 +112,10 @@ static void tx_tick(struct mbox_chan *chan, int r) ...@@ -112,9 +112,10 @@ static void tx_tick(struct mbox_chan *chan, int r)
complete(&chan->tx_complete); complete(&chan->tx_complete);
} }
static void poll_txdone(unsigned long data) static enum hrtimer_restart txdone_hrtimer(struct hrtimer *hrtimer)
{ {
struct mbox_controller *mbox = (struct mbox_controller *)data; struct mbox_controller *mbox =
container_of(hrtimer, struct mbox_controller, poll_hrt);
bool txdone, resched = false; bool txdone, resched = false;
int i; int i;
...@@ -130,9 +131,11 @@ static void poll_txdone(unsigned long data) ...@@ -130,9 +131,11 @@ static void poll_txdone(unsigned long data)
} }
} }
if (resched) if (resched) {
mod_timer(&mbox->poll, jiffies + hrtimer_forward_now(hrtimer, ms_to_ktime(mbox->txpoll_period));
msecs_to_jiffies(mbox->txpoll_period)); return HRTIMER_RESTART;
}
return HRTIMER_NORESTART;
} }
/** /**
...@@ -451,9 +454,9 @@ int mbox_controller_register(struct mbox_controller *mbox) ...@@ -451,9 +454,9 @@ int mbox_controller_register(struct mbox_controller *mbox)
txdone = TXDONE_BY_ACK; txdone = TXDONE_BY_ACK;
if (txdone == TXDONE_BY_POLL) { if (txdone == TXDONE_BY_POLL) {
mbox->poll.function = &poll_txdone; hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
mbox->poll.data = (unsigned long)mbox; HRTIMER_MODE_REL);
init_timer(&mbox->poll); mbox->poll_hrt.function = txdone_hrtimer;
} }
for (i = 0; i < mbox->num_chans; i++) { for (i = 0; i < mbox->num_chans; i++) {
...@@ -495,7 +498,7 @@ void mbox_controller_unregister(struct mbox_controller *mbox) ...@@ -495,7 +498,7 @@ void mbox_controller_unregister(struct mbox_controller *mbox)
mbox_free_channel(&mbox->chans[i]); mbox_free_channel(&mbox->chans[i]);
if (mbox->txdone_poll) if (mbox->txdone_poll)
del_timer_sync(&mbox->poll); hrtimer_cancel(&mbox->poll_hrt);
mutex_unlock(&con_mutex); mutex_unlock(&con_mutex);
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/timer.h> #include <linux/hrtimer.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/completion.h> #include <linux/completion.h>
...@@ -67,7 +67,8 @@ struct mbox_chan_ops { ...@@ -67,7 +67,8 @@ struct mbox_chan_ops {
* @txpoll_period: If 'txdone_poll' is in effect, the API polls for * @txpoll_period: If 'txdone_poll' is in effect, the API polls for
* last TX's status after these many millisecs * last TX's status after these many millisecs
* @of_xlate: Controller driver specific mapping of channel via DT * @of_xlate: Controller driver specific mapping of channel via DT
* @poll: API private. Used to poll for TXDONE on all channels. * @poll_hrt: API private. hrtimer used to poll for TXDONE on all
* channels.
* @node: API private. To hook into list of controllers. * @node: API private. To hook into list of controllers.
*/ */
struct mbox_controller { struct mbox_controller {
...@@ -81,7 +82,7 @@ struct mbox_controller { ...@@ -81,7 +82,7 @@ struct mbox_controller {
struct mbox_chan *(*of_xlate)(struct mbox_controller *mbox, struct mbox_chan *(*of_xlate)(struct mbox_controller *mbox,
const struct of_phandle_args *sp); const struct of_phandle_args *sp);
/* Internal to API */ /* Internal to API */
struct timer_list poll; struct hrtimer poll_hrt;
struct list_head node; struct list_head node;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册