summaryrefslogtreecommitdiffstats
path: root/drivers/mailbox
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2016-04-06 13:37:37 -0400
committerJassi Brar <jaswinder.singh@linaro.org>2016-04-26 00:49:37 -0400
commit4899f78a3dccda41ffdaa1a2cbf78209753e0f70 (patch)
treea90cedd796aabac6de65c270ff4bd5ec78f6b28a /drivers/mailbox
parentc3b46c73264b03000d1e18b22f5caf63332547c9 (diff)
mailbox/omap: drop legacy platform device support
OMAP mailbox devices can no longer be created in legacy non-DT mode, all the relevant code has been cleaned up. The OMAP mailbox driver will only support devices created from DT going forward, so drop the legacy platform device support from the driver. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r--drivers/mailbox/omap-mailbox.c101
1 files changed, 41 insertions, 60 deletions
diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c
index b7f636f15cac..8754d810ef05 100644
--- a/drivers/mailbox/omap-mailbox.c
+++ b/drivers/mailbox/omap-mailbox.c
@@ -2,7 +2,7 @@
2 * OMAP mailbox driver 2 * OMAP mailbox driver
3 * 3 *
4 * Copyright (C) 2006-2009 Nokia Corporation. All rights reserved. 4 * Copyright (C) 2006-2009 Nokia Corporation. All rights reserved.
5 * Copyright (C) 2013-2014 Texas Instruments Inc. 5 * Copyright (C) 2013-2016 Texas Instruments Incorporated - http://www.ti.com
6 * 6 *
7 * Contact: Hiroshi DOYU <Hiroshi.DOYU@nokia.com> 7 * Contact: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
8 * Suman Anna <s-anna@ti.com> 8 * Suman Anna <s-anna@ti.com>
@@ -33,7 +33,6 @@
33#include <linux/of_device.h> 33#include <linux/of_device.h>
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/pm_runtime.h> 35#include <linux/pm_runtime.h>
36#include <linux/platform_data/mailbox-omap.h>
37#include <linux/omap-mailbox.h> 36#include <linux/omap-mailbox.h>
38#include <linux/mailbox_controller.h> 37#include <linux/mailbox_controller.h>
39#include <linux/mailbox_client.h> 38#include <linux/mailbox_client.h>
@@ -69,6 +68,10 @@
69#define MBOX_NR_REGS (MBOX_REG_SIZE / sizeof(u32)) 68#define MBOX_NR_REGS (MBOX_REG_SIZE / sizeof(u32))
70#define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / sizeof(u32)) 69#define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / sizeof(u32))
71 70
71/* Interrupt register configuration types */
72#define MBOX_INTR_CFG_TYPE1 0
73#define MBOX_INTR_CFG_TYPE2 1
74
72struct omap_mbox_fifo { 75struct omap_mbox_fifo {
73 unsigned long msg; 76 unsigned long msg;
74 unsigned long fifo_stat; 77 unsigned long fifo_stat;
@@ -696,8 +699,6 @@ static int omap_mbox_probe(struct platform_device *pdev)
696 int ret; 699 int ret;
697 struct mbox_chan *chnls; 700 struct mbox_chan *chnls;
698 struct omap_mbox **list, *mbox, *mboxblk; 701 struct omap_mbox **list, *mbox, *mboxblk;
699 struct omap_mbox_pdata *pdata = pdev->dev.platform_data;
700 struct omap_mbox_dev_info *info = NULL;
701 struct omap_mbox_fifo_info *finfo, *finfoblk; 702 struct omap_mbox_fifo_info *finfo, *finfoblk;
702 struct omap_mbox_device *mdev; 703 struct omap_mbox_device *mdev;
703 struct omap_mbox_fifo *fifo; 704 struct omap_mbox_fifo *fifo;
@@ -710,36 +711,26 @@ static int omap_mbox_probe(struct platform_device *pdev)
710 u32 l; 711 u32 l;
711 int i; 712 int i;
712 713
713 if (!node && (!pdata || !pdata->info_cnt || !pdata->info)) { 714 if (!node) {
714 pr_err("%s: platform not supported\n", __func__); 715 pr_err("%s: only DT-based devices are supported\n", __func__);
715 return -ENODEV; 716 return -ENODEV;
716 } 717 }
717 718
718 if (node) { 719 match = of_match_device(omap_mailbox_of_match, &pdev->dev);
719 match = of_match_device(omap_mailbox_of_match, &pdev->dev); 720 if (!match)
720 if (!match) 721 return -ENODEV;
721 return -ENODEV; 722 intr_type = (u32)match->data;
722 intr_type = (u32)match->data;
723 723
724 if (of_property_read_u32(node, "ti,mbox-num-users", 724 if (of_property_read_u32(node, "ti,mbox-num-users", &num_users))
725 &num_users)) 725 return -ENODEV;
726 return -ENODEV;
727 726
728 if (of_property_read_u32(node, "ti,mbox-num-fifos", 727 if (of_property_read_u32(node, "ti,mbox-num-fifos", &num_fifos))
729 &num_fifos)) 728 return -ENODEV;
730 return -ENODEV;
731 729
732 info_count = of_get_available_child_count(node); 730 info_count = of_get_available_child_count(node);
733 if (!info_count) { 731 if (!info_count) {
734 dev_err(&pdev->dev, "no available mbox devices found\n"); 732 dev_err(&pdev->dev, "no available mbox devices found\n");
735 return -ENODEV; 733 return -ENODEV;
736 }
737 } else { /* non-DT device creation */
738 info_count = pdata->info_cnt;
739 info = pdata->info;
740 intr_type = pdata->intr_type;
741 num_users = pdata->num_users;
742 num_fifos = pdata->num_fifos;
743 } 734 }
744 735
745 finfoblk = devm_kzalloc(&pdev->dev, info_count * sizeof(*finfoblk), 736 finfoblk = devm_kzalloc(&pdev->dev, info_count * sizeof(*finfoblk),
@@ -750,38 +741,28 @@ static int omap_mbox_probe(struct platform_device *pdev)
750 finfo = finfoblk; 741 finfo = finfoblk;
751 child = NULL; 742 child = NULL;
752 for (i = 0; i < info_count; i++, finfo++) { 743 for (i = 0; i < info_count; i++, finfo++) {
753 if (node) { 744 child = of_get_next_available_child(node, child);
754 child = of_get_next_available_child(node, child); 745 ret = of_property_read_u32_array(child, "ti,mbox-tx", tmp,
755 ret = of_property_read_u32_array(child, "ti,mbox-tx", 746 ARRAY_SIZE(tmp));
756 tmp, ARRAY_SIZE(tmp)); 747 if (ret)
757 if (ret) 748 return ret;
758 return ret; 749 finfo->tx_id = tmp[0];
759 finfo->tx_id = tmp[0]; 750 finfo->tx_irq = tmp[1];
760 finfo->tx_irq = tmp[1]; 751 finfo->tx_usr = tmp[2];
761 finfo->tx_usr = tmp[2]; 752
762 753 ret = of_property_read_u32_array(child, "ti,mbox-rx", tmp,
763 ret = of_property_read_u32_array(child, "ti,mbox-rx", 754 ARRAY_SIZE(tmp));
764 tmp, ARRAY_SIZE(tmp)); 755 if (ret)
765 if (ret) 756 return ret;
766 return ret; 757 finfo->rx_id = tmp[0];
767 finfo->rx_id = tmp[0]; 758 finfo->rx_irq = tmp[1];
768 finfo->rx_irq = tmp[1]; 759 finfo->rx_usr = tmp[2];
769 finfo->rx_usr = tmp[2]; 760
770 761 finfo->name = child->name;
771 finfo->name = child->name; 762
772 763 if (of_find_property(child, "ti,mbox-send-noirq", NULL))
773 if (of_find_property(child, "ti,mbox-send-noirq", NULL)) 764 finfo->send_no_irq = true;
774 finfo->send_no_irq = true; 765
775 } else {
776 finfo->tx_id = info->tx_id;
777 finfo->rx_id = info->rx_id;
778 finfo->tx_usr = info->usr_id;
779 finfo->tx_irq = info->irq_id;
780 finfo->rx_usr = info->usr_id;
781 finfo->rx_irq = info->irq_id;
782 finfo->name = info->name;
783 info++;
784 }
785 if (finfo->tx_id >= num_fifos || finfo->rx_id >= num_fifos || 766 if (finfo->tx_id >= num_fifos || finfo->rx_id >= num_fifos ||
786 finfo->tx_usr >= num_users || finfo->rx_usr >= num_users) 767 finfo->tx_usr >= num_users || finfo->rx_usr >= num_users)
787 return -EINVAL; 768 return -EINVAL;