devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Bresticker <abrestic@chromium.org>
To: Stephen Warren <swarren@wwwdotorg.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Alexandre Courbot <gnurou@gmail.com>
Cc: devicetree@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Andrew Bresticker <abrestic@chromium.org>,
	Jon Hunter <jonathanh@nvidia.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>
Subject: [PATCH v8 5/9] mfd: Add driver for NVIDIA Tegra XUSB
Date: Mon,  4 May 2015 10:36:38 -0700	[thread overview]
Message-ID: <1430761002-9327-6-git-send-email-abrestic@chromium.org> (raw)
In-Reply-To: <1430761002-9327-1-git-send-email-abrestic@chromium.org>

Add an MFD driver for the XUSB host complex found on NVIDIA Tegra124
and later SoCs.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
---
Changes from v7:
 - Have child nodes get non-shared memory and interrupts from DT.
 - Use of_platform_populate rather than mfd_add_devices.
 - Get rid of struct tegra_xusb.
New for v7.
---
 drivers/mfd/Kconfig      |  7 +++++
 drivers/mfd/Makefile     |  1 +
 drivers/mfd/tegra-xusb.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 drivers/mfd/tegra-xusb.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index d5ad04d..61872b4 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1430,6 +1430,13 @@ config MFD_STW481X
 	  in various ST Microelectronics and ST-Ericsson embedded
 	  Nomadik series.
 
+config MFD_TEGRA_XUSB
+	tristate "NVIDIA Tegra XUSB"
+	depends on ARCH_TEGRA
+	select MFD_CORE
+	help
+	  Support for the XUSB complex found on NVIDIA Tegra124 and later SoCs.
+
 menu "Multimedia Capabilities Port drivers"
 	depends on ARCH_SA1100
 
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 0e5cfeb..7588caf 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC)	+= hi6421-pmic-core.o
 obj-$(CONFIG_MFD_DLN2)		+= dln2.o
 obj-$(CONFIG_MFD_RT5033)	+= rt5033.o
 obj-$(CONFIG_MFD_SKY81452)	+= sky81452.o
+obj-$(CONFIG_MFD_TEGRA_XUSB)	+= tegra-xusb.o
 
 intel-soc-pmic-objs		:= intel_soc_pmic_core.o intel_soc_pmic_crc.o
 obj-$(CONFIG_INTEL_SOC_PMIC)	+= intel-soc-pmic.o
diff --git a/drivers/mfd/tegra-xusb.c b/drivers/mfd/tegra-xusb.c
new file mode 100644
index 0000000..e11fa23
--- /dev/null
+++ b/drivers/mfd/tegra-xusb.c
@@ -0,0 +1,75 @@
+/*
+ * NVIDIA Tegra XUSB MFD driver
+ *
+ * Copyright (C) 2015 Google, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/mfd/core.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+static const struct of_device_id tegra_xusb_of_match[] = {
+	{ .compatible = "nvidia,tegra124-xusb", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, tegra_xusb_of_match);
+
+static struct regmap_config tegra_fpci_regmap_config = {
+	.reg_bits = 32,
+	.val_bits = 32,
+	.reg_stride = 4,
+};
+
+static int tegra_xusb_probe(struct platform_device *pdev)
+{
+	struct resource *res;
+	struct regmap *fpci_regs;
+	void __iomem *fpci_base;
+	int ret;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	fpci_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(fpci_base))
+		return PTR_ERR(fpci_base);
+
+	tegra_fpci_regmap_config.max_register = res->end - res->start - 3;
+	fpci_regs = devm_regmap_init_mmio(&pdev->dev, fpci_base,
+					  &tegra_fpci_regmap_config);
+	if (IS_ERR(fpci_regs)) {
+		ret = PTR_ERR(fpci_regs);
+		dev_err(&pdev->dev, "Failed to init regmap: %d\n", ret);
+		return ret;
+	}
+	platform_set_drvdata(pdev, fpci_regs);
+
+	ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to add sub-devices: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static struct platform_driver tegra_xusb_driver = {
+	.probe = tegra_xusb_probe,
+	.driver = {
+		.name = "tegra-xusb",
+		.of_match_table = tegra_xusb_of_match,
+	},
+};
+module_platform_driver(tegra_xusb_driver);
+
+MODULE_DESCRIPTION("NVIDIA Tegra XUSB MFD");
+MODULE_AUTHOR("Andrew Bresticker <abrestic@chromium.org>");
+MODULE_LICENSE("GPL v2");
-- 
2.2.0.rc0.207.ga3a616c

  reply	other threads:[~2015-05-04 17:36 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04 17:36 [PATCH v8 0/9] Tegra xHCI support Andrew Bresticker
2015-05-04 17:36 ` Andrew Bresticker [this message]
     [not found]   ` <1430761002-9327-6-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-05-13 14:37     ` [PATCH v8 5/9] mfd: Add driver for NVIDIA Tegra XUSB Lee Jones
2015-05-13 16:31       ` Andrew Bresticker
     [not found] ` <1430761002-9327-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-05-04 17:36   ` [PATCH v8 1/9] xhci: Set shared HCD's hcd_priv in xhci_gen_setup Andrew Bresticker
     [not found]     ` <1430761002-9327-2-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-05-19 18:39       ` Andrew Bresticker
     [not found]         ` <CAL1qeaGo2-T=suBiCTtHmyR1sNeS_ZG-2j2FuuLdGc9vmct2ug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-22 12:19           ` Mathias Nyman
2015-05-04 17:36   ` [PATCH v8 2/9] mailbox: Make mbox_chan_ops const Andrew Bresticker
     [not found]     ` <1430761002-9327-3-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-05-04 19:22       ` Suman Anna
2015-05-04 17:36   ` [PATCH v8 3/9] mailbox: Fix up error handling in mbox_request_channel() Andrew Bresticker
2015-05-04 17:36   ` [PATCH v8 4/9] mfd: Add binding document for NVIDIA Tegra XUSB Andrew Bresticker
     [not found]     ` <1430761002-9327-5-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-05-13 14:39       ` Lee Jones
2015-05-13 16:26         ` Andrew Bresticker
     [not found]           ` <CAL1qeaF-7aAx0gqPe-_D4ZaZET0Kejr801KrbvuQ_2w6c8mcnA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-13 16:50             ` Lee Jones
2015-05-13 17:03               ` Andrew Bresticker
     [not found]                 ` <CAL1qeaE7XHmreQ_b52iop6fOY1osAhjij81c4vVr7_8wO_cYxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-14  7:29                   ` Lee Jones
2015-05-14  7:32                     ` Jon Hunter
     [not found]                       ` <55544F91.4060402-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-05-14  7:45                         ` Lee Jones
2015-05-14  7:20         ` Jon Hunter
     [not found]           ` <55544CC5.9050001-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-05-14  7:40             ` Lee Jones
2015-05-14  9:14               ` Jon Hunter
2015-05-14  9:30                 ` Lee Jones
2015-05-14 10:09                   ` Jon Hunter
     [not found]                     ` <5554746A.4000608-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-05-14 10:23                       ` Lee Jones
2015-05-14 11:21                         ` Jon Hunter
2015-05-14 17:38               ` Andrew Bresticker
     [not found]                 ` <CAL1qeaEqNejuGkN-ke11mtWnaaRo+XieCBkQ6+NQ-Afym6uxVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-19 18:36                   ` Andrew Bresticker
     [not found]                     ` <CAL1qeaHy0h7bXhuLHh4AG2Zfu48JYeawgVo4dp_k4oX8YFw6tA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-20  6:35                       ` Lee Jones
2015-05-20 14:52                         ` Thierry Reding
     [not found]                           ` <20150520145227.GA3787-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-05-21  7:19                             ` Linus Walleij
2015-05-21  8:40                             ` Lee Jones
2015-05-21 10:12                               ` Thierry Reding
     [not found]                                 ` <20150521101247.GA8073-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-05-26 15:18                                   ` Lee Jones
2015-06-30 18:22                                     ` Grant Likely
2015-05-04 17:36   ` [PATCH v8 6/9] mailbox: Add NVIDIA Tegra XUSB mailbox binding Andrew Bresticker
     [not found]     ` <1430761002-9327-7-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-05-08 20:42       ` Benson Leung
     [not found]         ` <CANLzEksWtzSmz=OCuwVdY5RSG6gDrOoMyGsW3i9jMcjD3WtPKQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-08 20:53           ` Andrew Bresticker
2015-05-08 21:03             ` Benson Leung
2015-05-04 17:36   ` [PATCH v8 7/9] mailbox: Add NVIDIA Tegra XUSB mailbox driver Andrew Bresticker
2015-05-04 17:36   ` [PATCH v8 8/9] usb: Add NVIDIA Tegra xHCI controller binding Andrew Bresticker
2015-05-04 17:36   ` [PATCH v8 9/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver Andrew Bresticker
2015-05-12  3:56   ` [PATCH v8 0/9] Tegra xHCI support Jassi Brar
     [not found]     ` <CABb+yY2WhH2gGbCr4n=m9HOa_843MuZDp=QWNDHbtB8AMYYwYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-26 16:27       ` Andrew Bresticker
2015-05-05 14:28 ` Jon Hunter
2015-05-05 14:42   ` Thierry Reding
2015-05-05 14:57     ` Jon Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430761002-9327-6-git-send-email-abrestic@chromium.org \
    --to=abrestic@chromium.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gnurou@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).