diff options
author | Suman Anna <s-anna@ti.com> | 2014-06-24 20:43:40 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2014-07-29 04:57:25 -0400 |
commit | ef45eae6e9f6af297c0cd0bfb98c85f3f51e96be (patch) | |
tree | 97ece8269b9c2704d8611db57dd696e68e2ddb15 /drivers/mailbox | |
parent | fe714a46a423f1b8802a1700b1b5956184738225 (diff) |
mailbox/omap: simplify the fifo assignment by using macros
The OMAP mailbox IP has two different type of interrupt configuration
registers between OMAP4+ SoCs and OMAP2/3 SoCs. Simplify the current
interrupt configuration by using a single macro that translates the
two variants.
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r-- | drivers/mailbox/mailbox-omap2.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/mailbox/mailbox-omap2.c b/drivers/mailbox/mailbox-omap2.c index b44e3bcff62a..2c463d6c8a8c 100644 --- a/drivers/mailbox/mailbox-omap2.c +++ b/drivers/mailbox/mailbox-omap2.c | |||
@@ -25,13 +25,21 @@ | |||
25 | #define MAILBOX_MESSAGE(m) (0x040 + 4 * (m)) | 25 | #define MAILBOX_MESSAGE(m) (0x040 + 4 * (m)) |
26 | #define MAILBOX_FIFOSTATUS(m) (0x080 + 4 * (m)) | 26 | #define MAILBOX_FIFOSTATUS(m) (0x080 + 4 * (m)) |
27 | #define MAILBOX_MSGSTATUS(m) (0x0c0 + 4 * (m)) | 27 | #define MAILBOX_MSGSTATUS(m) (0x0c0 + 4 * (m)) |
28 | #define MAILBOX_IRQSTATUS(u) (0x100 + 8 * (u)) | 28 | |
29 | #define MAILBOX_IRQENABLE(u) (0x104 + 8 * (u)) | 29 | #define OMAP2_MAILBOX_IRQSTATUS(u) (0x100 + 8 * (u)) |
30 | #define OMAP2_MAILBOX_IRQENABLE(u) (0x104 + 8 * (u)) | ||
30 | 31 | ||
31 | #define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 0x10 * (u)) | 32 | #define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 0x10 * (u)) |
32 | #define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 0x10 * (u)) | 33 | #define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 0x10 * (u)) |
33 | #define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 0x10 * (u)) | 34 | #define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 0x10 * (u)) |
34 | 35 | ||
36 | #define MAILBOX_IRQSTATUS(type, u) (type ? OMAP4_MAILBOX_IRQSTATUS(u) : \ | ||
37 | OMAP2_MAILBOX_IRQSTATUS(u)) | ||
38 | #define MAILBOX_IRQENABLE(type, u) (type ? OMAP4_MAILBOX_IRQENABLE(u) : \ | ||
39 | OMAP2_MAILBOX_IRQENABLE(u)) | ||
40 | #define MAILBOX_IRQDISABLE(type, u) (type ? OMAP4_MAILBOX_IRQENABLE_CLR(u) \ | ||
41 | : OMAP2_MAILBOX_IRQENABLE(u)) | ||
42 | |||
35 | #define MAILBOX_IRQ_NEWMSG(m) (1 << (2 * (m))) | 43 | #define MAILBOX_IRQ_NEWMSG(m) (1 << (2 * (m))) |
36 | #define MAILBOX_IRQ_NOTFULL(m) (1 << (2 * (m) + 1)) | 44 | #define MAILBOX_IRQ_NOTFULL(m) (1 << (2 * (m) + 1)) |
37 | 45 | ||
@@ -227,6 +235,7 @@ static int omap2_mbox_probe(struct platform_device *pdev) | |||
227 | struct omap_mbox2_priv *priv, *privblk; | 235 | struct omap_mbox2_priv *priv, *privblk; |
228 | struct omap_mbox_pdata *pdata = pdev->dev.platform_data; | 236 | struct omap_mbox_pdata *pdata = pdev->dev.platform_data; |
229 | struct omap_mbox_dev_info *info; | 237 | struct omap_mbox_dev_info *info; |
238 | u32 intr_type; | ||
230 | int i; | 239 | int i; |
231 | 240 | ||
232 | if (!pdata || !pdata->info_cnt || !pdata->info) { | 241 | if (!pdata || !pdata->info_cnt || !pdata->info) { |
@@ -251,6 +260,7 @@ static int omap2_mbox_probe(struct platform_device *pdev) | |||
251 | return -ENOMEM; | 260 | return -ENOMEM; |
252 | 261 | ||
253 | info = pdata->info; | 262 | info = pdata->info; |
263 | intr_type = pdata->intr_type; | ||
254 | mbox = mboxblk; | 264 | mbox = mboxblk; |
255 | priv = privblk; | 265 | priv = privblk; |
256 | for (i = 0; i < pdata->info_cnt; i++, info++, priv++) { | 266 | for (i = 0; i < pdata->info_cnt; i++, info++, priv++) { |
@@ -260,17 +270,10 @@ static int omap2_mbox_probe(struct platform_device *pdev) | |||
260 | priv->rx_fifo.msg_stat = MAILBOX_MSGSTATUS(info->rx_id); | 270 | priv->rx_fifo.msg_stat = MAILBOX_MSGSTATUS(info->rx_id); |
261 | priv->notfull_bit = MAILBOX_IRQ_NOTFULL(info->tx_id); | 271 | priv->notfull_bit = MAILBOX_IRQ_NOTFULL(info->tx_id); |
262 | priv->newmsg_bit = MAILBOX_IRQ_NEWMSG(info->rx_id); | 272 | priv->newmsg_bit = MAILBOX_IRQ_NEWMSG(info->rx_id); |
263 | if (pdata->intr_type) { | 273 | priv->irqenable = MAILBOX_IRQENABLE(intr_type, info->usr_id); |
264 | priv->irqenable = OMAP4_MAILBOX_IRQENABLE(info->usr_id); | 274 | priv->irqstatus = MAILBOX_IRQSTATUS(intr_type, info->usr_id); |
265 | priv->irqstatus = OMAP4_MAILBOX_IRQSTATUS(info->usr_id); | 275 | priv->irqdisable = MAILBOX_IRQDISABLE(intr_type, info->usr_id); |
266 | priv->irqdisable = | 276 | priv->intr_type = intr_type; |
267 | OMAP4_MAILBOX_IRQENABLE_CLR(info->usr_id); | ||
268 | } else { | ||
269 | priv->irqenable = MAILBOX_IRQENABLE(info->usr_id); | ||
270 | priv->irqstatus = MAILBOX_IRQSTATUS(info->usr_id); | ||
271 | priv->irqdisable = MAILBOX_IRQENABLE(info->usr_id); | ||
272 | } | ||
273 | priv->intr_type = pdata->intr_type; | ||
274 | 277 | ||
275 | mbox->priv = priv; | 278 | mbox->priv = priv; |
276 | mbox->name = info->name; | 279 | mbox->name = info->name; |