From: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Thierry Reding
<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Alexandre Courbot
<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Andrew Bresticker
<abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: [PATCH V7 5/9] mfd: Add driver for NVIDIA Tegra XUSB
Date: Mon, 27 Apr 2015 15:37:18 -0700 [thread overview]
Message-ID: <1430174242-29465-6-git-send-email-abrestic@chromium.org> (raw)
In-Reply-To: <1430174242-29465-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Add an MFD driver for the XUSB host complex found on NVIDIA Tegra124
and later SoCs.
Signed-off-by: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
New for v7.
---
drivers/mfd/Kconfig | 7 ++
drivers/mfd/Makefile | 1 +
drivers/mfd/tegra-xusb.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++
include/soc/tegra/xusb.h | 19 ++++++
4 files changed, 194 insertions(+)
create mode 100644 drivers/mfd/tegra-xusb.c
create mode 100644 include/soc/tegra/xusb.h
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..d30d259
--- /dev/null
+++ b/drivers/mfd/tegra-xusb.c
@@ -0,0 +1,167 @@
+/*
+ * 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/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#include <soc/tegra/xusb.h>
+
+struct tegra_xusb_soc_data {
+ struct mfd_cell *devs;
+ unsigned int num_devs;
+};
+
+static struct resource tegra_xhci_resources[] = {
+ {
+ .name = "host",
+ .flags = IORESOURCE_IRQ,
+ },
+ {
+ .name = "xhci",
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "ipfs",
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct resource tegra_xusb_mbox_resources[] = {
+ {
+ .name = "smi",
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct mfd_cell tegra124_xusb_devs[] = {
+ {
+ .name = "tegra-xhci",
+ .of_compatible = "nvidia,tegra124-xhci",
+ },
+ {
+ .name = "tegra-xusb-mbox",
+ .of_compatible = "nvidia,tegra124-xusb-mbox",
+ },
+};
+
+static const struct tegra_xusb_soc_data tegra124_xusb_data = {
+ .devs = tegra124_xusb_devs,
+ .num_devs = ARRAY_SIZE(tegra124_xusb_devs),
+};
+
+static const struct of_device_id tegra_xusb_of_match[] = {
+ { .compatible = "nvidia,tegra124-xusb", .data = &tegra124_xusb_data },
+ {},
+};
+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)
+{
+ const struct tegra_xusb_soc_data *soc;
+ const struct of_device_id *match;
+ struct tegra_xusb *xusb;
+ struct resource *res;
+ void __iomem *fpci_base;
+ int irq, ret;
+
+ xusb = devm_kzalloc(&pdev->dev, sizeof(*xusb), GFP_KERNEL);
+ if (!xusb)
+ return -ENOMEM;
+ platform_set_drvdata(pdev, xusb);
+
+ match = of_match_node(tegra_xusb_of_match, pdev->dev.of_node);
+ soc = match->data;
+
+ irq = platform_get_irq_byname(pdev, "host");
+ if (irq < 0)
+ return irq;
+ tegra_xhci_resources[0].start = irq;
+ tegra_xhci_resources[0].end = irq;
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "xhci");
+ if (!res)
+ return -ENODEV;
+ tegra_xhci_resources[1].start = res->start;
+ tegra_xhci_resources[1].end = res->end;
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ipfs");
+ if (!res)
+ return -ENODEV;
+ tegra_xhci_resources[2].start = res->start;
+ tegra_xhci_resources[2].end = res->end;
+
+ soc->devs[0].resources = tegra_xhci_resources;
+ soc->devs[0].num_resources = ARRAY_SIZE(tegra_xhci_resources);
+
+ irq = platform_get_irq_byname(pdev, "smi");
+ if (irq < 0)
+ return irq;
+ tegra_xusb_mbox_resources[0].start = irq;
+ tegra_xusb_mbox_resources[0].end = irq;
+
+ soc->devs[1].resources = tegra_xusb_mbox_resources;
+ soc->devs[1].num_resources = ARRAY_SIZE(tegra_xusb_mbox_resources);
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fpci");
+ 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;
+ xusb->fpci_regs = devm_regmap_init_mmio(&pdev->dev, fpci_base,
+ &tegra_fpci_regmap_config);
+ if (IS_ERR(xusb->fpci_regs)) {
+ ret = PTR_ERR(xusb->fpci_regs);
+ dev_err(&pdev->dev, "Failed to init regmap: %d\n", ret);
+ return ret;
+ }
+
+ ret = mfd_add_devices(&pdev->dev, -1, soc->devs, soc->num_devs,
+ NULL, 0, NULL);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to add MFD devices: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int tegra_xusb_remove(struct platform_device *pdev)
+{
+ mfd_remove_devices(&pdev->dev);
+
+ return 0;
+}
+
+static struct platform_driver tegra_xusb_driver = {
+ .probe = tegra_xusb_probe,
+ .remove = tegra_xusb_remove,
+ .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-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>");
+MODULE_LICENSE("GPL v2");
diff --git a/include/soc/tegra/xusb.h b/include/soc/tegra/xusb.h
new file mode 100644
index 0000000..9d28d90
--- /dev/null
+++ b/include/soc/tegra/xusb.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2014 NVIDIA Corporation
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef __SOC_TEGRA_XUSB_H__
+#define __SOC_TEGRA_XUSB_H__
+
+struct regmap;
+
+struct tegra_xusb {
+ struct regmap *fpci_regs;
+};
+
+#endif /* __SOC_TEGRA_XUSB_H__ */
--
2.2.0.rc0.207.ga3a616c
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-04-27 22:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-27 22:37 [PATCH V7 0/9] Tegra xHCI support Andrew Bresticker
2015-04-27 22:37 ` [PATCH V7 1/9] xhci: Set shared HCD's hcd_priv in xhci_gen_setup Andrew Bresticker
[not found] ` <1430174242-29465-1-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-04-27 22:37 ` [PATCH V7 2/9] mailbox: Make struct mbox_controller's ops field const Andrew Bresticker
[not found] ` <1430174242-29465-3-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-04-28 16:49 ` Suman Anna
2015-04-27 22:37 ` [PATCH V7 3/9] mailbox: Fix up error handling in mbox_request_channel() Andrew Bresticker
2015-04-28 16:42 ` Suman Anna
2015-04-27 22:37 ` [PATCH V7 4/9] mfd: Add binding document for NVIDIA Tegra XUSB Andrew Bresticker
[not found] ` <1430174242-29465-5-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2015-04-29 9:25 ` Lee Jones
2015-04-29 17:02 ` Andrew Bresticker
[not found] ` <CAL1qeaFh5go_K0GnGXxU7KqjcgCm2kpUL5mVgGSYosPoXAXgpw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-29 18:34 ` Lee Jones
2015-04-29 19:46 ` Andrew Bresticker
[not found] ` <CAL1qeaEt9kGbcCfwqhVzwJxx9DvgOnjfU6C8MCH6t0vqwJK0WA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-30 10:06 ` Lee Jones
2015-04-30 16:28 ` Andrew Bresticker
2015-04-27 22:37 ` Andrew Bresticker [this message]
2015-04-29 9:23 ` [PATCH V7 5/9] mfd: Add driver " Lee Jones
2015-04-29 17:59 ` Andrew Bresticker
2015-04-29 18:30 ` Lee Jones
2015-04-27 22:37 ` [PATCH V7 6/9] mailbox: Add NVIDIA Tegra XUSB mailbox binding Andrew Bresticker
2015-04-27 22:37 ` [PATCH V7 7/9] mailbox: Add NVIDIA Tegra XUSB mailbox driver Andrew Bresticker
2015-04-27 22:37 ` [PATCH V7 8/9] usb: Add NVIDIA Tegra xHCI controller binding Andrew Bresticker
2015-04-27 22:37 ` [PATCH V7 9/9] usb: xhci: Add NVIDIA Tegra xHCI host-controller driver Andrew Bresticker
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=1430174242-29465-6-git-send-email-abrestic@chromium.org \
--to=abrestic-f7+t8e8rja9g9huczpvpmw@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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).