From patchwork Mon May 4 17:36:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Bresticker X-Patchwork-Id: 6329091 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E389CBEEE1 for ; Mon, 4 May 2015 17:47:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04308201BC for ; Mon, 4 May 2015 17:47:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E17D2011E for ; Mon, 4 May 2015 17:47:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YpKPQ-0000IT-6c; Mon, 04 May 2015 17:44:00 +0000 Received: from mail-qc0-f202.google.com ([209.85.216.202]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YpKOl-00084b-Tz for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2015 17:43:21 +0000 Received: by qcrw7 with SMTP id w7so4341115qcr.1 for ; Mon, 04 May 2015 10:42:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e5VY+j/yn54n2D9TQw3ojH+eQXoZt52jA6DzmZqCW3Y=; b=gEEDI+0i7XFHwkEcGGI/Gj3UF5jcZ8VHu7o/92517D2YDT6nY0B7YWv9l69YaAIgJL C5VAys2U7Ft77wbVo5tQ2XzqjUFYGIOwQFt46+pSignj0t4pBChVcm3/noqbhf18Oqyd 6+6B4knZMD3YQ/DY+MTVkpHGRs8lnX9vYsJSDv55PbzSyuEGsb3z+X2xd0pH5nD2InQG 60t4NoXG6U35I1TDSa+zujCPHhUDGoAI0LA/gpdWqqtfo/TdqXYIZoEy+2Oe1ozAHjY9 Pt6MwliF2cM7GM0DUBlZBeUGVDRQrYzQ2rExoUBZ78KU7E5e1mZQN67Ins7iedZoWahI pqMw== X-Gm-Message-State: ALoCoQknhG601F6/pvs9KXDInN2AsUxkhnLMZXvhBjBpMUZy/tpnzOOaGVqMDkp+YZrB0yy9UqvN X-Received: by 10.236.199.72 with SMTP id w48mr32490615yhn.58.1430761011860; Mon, 04 May 2015 10:36:51 -0700 (PDT) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id l36si730540yhb.1.2015.05.04.10.36.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2015 10:36:51 -0700 (PDT) Received: from abrestic.mtv.corp.google.com ([172.22.65.70]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id JmoY0soO.1; Mon, 04 May 2015 10:36:51 -0700 Received: by abrestic.mtv.corp.google.com (Postfix, from userid 137652) id 97271A4919; Mon, 4 May 2015 10:36:50 -0700 (PDT) From: Andrew Bresticker To: Stephen Warren , Thierry Reding , Alexandre Courbot Subject: [PATCH v8 5/9] mfd: Add driver for NVIDIA Tegra XUSB Date: Mon, 4 May 2015 10:36:38 -0700 Message-Id: <1430761002-9327-6-git-send-email-abrestic@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1430761002-9327-1-git-send-email-abrestic@chromium.org> References: <1430761002-9327-1-git-send-email-abrestic@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150504_104320_187255_6699665E X-CRM114-Status: GOOD ( 15.94 ) X-Spam-Score: -0.7 (/) Cc: devicetree@vger.kernel.org, Samuel Ortiz , Andrew Bresticker , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Jon Hunter , linux-tegra@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add an MFD driver for the XUSB host complex found on NVIDIA Tegra124 and later SoCs. Signed-off-by: Andrew Bresticker Cc: Samuel Ortiz Cc: Lee Jones --- 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 +#include +#include +#include +#include +#include +#include +#include +#include + +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 "); +MODULE_LICENSE("GPL v2");