From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 01/21] mfd: uniphier: add UniPhier MFD driver
Date: Tue, 10 May 2016 12:26:22 +0100 [thread overview]
Message-ID: <20160510112622.GL19473@dell> (raw)
In-Reply-To: <1462873862-30940-2-git-send-email-yamada.masahiro@socionext.com>
On Tue, 10 May 2016, Masahiro Yamada wrote:
> This MFD driver populates child devices such clock, reset, and other
> system controlling blocks.
>
> On UniPhier SoCs, one system control block contains various registers
> for clock, reset, and others in it. So, it is not reasonable to have
> separate DT nodes for different sub-systems.
>
> This MFD approach modifies Device Tree source just once for adding
> an MFD node.
>
> This series is just for review.
> Please do not apply this patch.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> MAINTAINERS | 1 +
> drivers/mfd/Kconfig | 9 ++
> drivers/mfd/Makefile | 1 +
> drivers/mfd/uniphier-mfd.c | 214 +++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 225 insertions(+)
> create mode 100644 drivers/mfd/uniphier-mfd.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 87b2ddd..8c987ca 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1728,6 +1728,7 @@ F: arch/arm/mm/cache-uniphier.c
> F: arch/arm64/boot/dts/socionext/
> F: drivers/bus/uniphier-system-bus.c
> F: drivers/i2c/busses/i2c-uniphier*
> +F: drivers/mfd/uniphier-mfd.c
> F: drivers/mmc/host/uniphier-sd.c
> F: drivers/pinctrl/uniphier/
> F: drivers/tty/serial/8250/8250_uniphier.c
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index eea61e3..ea85862 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -892,6 +892,15 @@ config MFD_SKY81452
> This driver can also be built as a module. If so, the module
> will be called sky81452.
>
> +config MFD_UNIPHIER
> + tristate "Socionext UniPhier MFD"
> + depends on ARCH_UNIPHIER || COMPILE_TEST
> + default ARCH_UNIPHIER
> + select MFD_CORE
> + help
> + Support for the System Control Block, Media I/O Control Block,
> + Peripheral Control Block available on UniPhier SoCs.
> +
> config MFD_SMSC
> bool "SMSC ECE1099 series chips"
> depends on I2C=y
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 5eaa6465d..5e8c20c 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -198,6 +198,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_UNIPHIER) += uniphier-mfd.o
>
> intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
> intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o
> diff --git a/drivers/mfd/uniphier-mfd.c b/drivers/mfd/uniphier-mfd.c
> new file mode 100644
> index 0000000..7f01d64
> --- /dev/null
> +++ b/drivers/mfd/uniphier-mfd.c
> @@ -0,0 +1,214 @@
> +/*
> + * Copyright (C) 2016 Socionext Inc.
> + * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/mfd/core.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +static const struct mfd_cell uniphier_ld4_sysctrl_cells[] = {
> + { .name = "uniphier-ld4-clk" },
> + { .name = "uniphier-ld4-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_pro4_sysctrl_cells[] = {
> + { .name = "uniphier-pro4-clk" },
> + { .name = "uniphier-pro4-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_sld8_sysctrl_cells[] = {
> + { .name = "uniphier-sld8-clk" },
> + { .name = "uniphier-sld8-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_pro5_sysctrl_cells[] = {
> + { .name = "uniphier-pro5-clk" },
> + { .name = "uniphier-pro5-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_pxs2_sysctrl_cells[] = {
> + { .name = "uniphier-pxs2-clk" },
> + { .name = "uniphier-pxs2-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_ld11_sysctrl_cells[] = {
> + { .name = "uniphier-ld11-clk" },
> + { .name = "uniphier-ld11-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_ld20_sysctrl_cells[] = {
> + { .name = "uniphier-ld20-clk" },
> + { .name = "uniphier-ld20-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_ld4_mioctrl_cells[] = {
> + { .name = "uniphier-ld4-mio-clk" },
> + { .name = "uniphier-ld4-mio-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_pro5_mioctrl_cells[] = {
> + { .name = "uniphier-pro5-mio-clk" },
> + { .name = "uniphier-pro5-mio-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_ld4_perictrl_cells[] = {
> + { .name = "uniphier-ld4-peri-clk" },
> + { .name = "uniphier-ld4-peri-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct mfd_cell uniphier_pro4_perictrl_cells[] = {
> + { .name = "uniphier-pro4-peri-clk" },
> + { .name = "uniphier-pro4-peri-reset" },
> + { /* sentinel */ }
> +};
> +
> +static const struct of_device_id uniphier_mfd_match[] = {
> + /* System Control */
> + {
> + .compatible = "socionext,uniphier-ld4-sysctrl",
> + .data = uniphier_ld4_sysctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-pro4-sysctrl",
> + .data = uniphier_pro4_sysctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-sld8-sysctrl",
> + .data = uniphier_sld8_sysctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-pro5-sysctrl",
> + .data = uniphier_pro5_sysctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-pxs2-sysctrl",
> + .data = uniphier_pxs2_sysctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-ld11-sysctrl",
> + .data = uniphier_ld11_sysctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-ld20-sysctrl",
> + .data = uniphier_ld20_sysctrl_cells,
> + },
> + /* Media I/O */
> + {
> + .compatible = "socionext,uniphier-ld4-mioctrl",
> + .data = uniphier_ld4_mioctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-pro4-mioctrl",
> + .data = uniphier_ld4_mioctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-sld8-mioctrl",
> + .data = uniphier_ld4_mioctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-pro5-mioctrl",
> + .data = uniphier_pro5_mioctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-pxs2-mioctrl",
> + .data = uniphier_pro5_mioctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-ld11-mioctrl",
> + .data = uniphier_ld4_mioctrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-ld20-mioctrl",
> + .data = uniphier_pro5_mioctrl_cells,
> + },
> + /* Peripheral Control */
> + {
> + .compatible = "socionext,uniphier-ld4-perictrl",
> + .data = uniphier_ld4_perictrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-sld8-perictrl",
> + .data = uniphier_ld4_perictrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-pro4-perictrl",
> + .data = uniphier_pro4_perictrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-pro5-perictrl",
> + .data = uniphier_pro4_perictrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-pxs2-perictrl",
> + .data = uniphier_pro4_perictrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-ld11-perictrl",
> + .data = uniphier_pro4_perictrl_cells,
> + },
> + {
> + .compatible = "socionext,uniphier-ld20-perictrl",
> + .data = uniphier_pro4_perictrl_cells,
> + },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, uniphier_mfd_match);
NACK. Please do not mix MFD and DT registration.
> +static int uniphier_mfd_probe(struct platform_device *pdev)
> +{
> + const struct of_device_id *match;
> + const struct mfd_cell *cell;
> + int ret;
> + int n_cells = 0;
> +
> + match = of_match_node(uniphier_mfd_match, pdev->dev.of_node);
> + if (!match)
> + return -ENODEV;
> +
> + cell = match->data;
> +
> + for (; cell->name; cell++)
> + n_cells++;
> +
> + ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, match->data,
> + n_cells, NULL, 0, NULL);
> + if (ret)
> + dev_err(&pdev->dev, "failed to add MFD devices\n");
> +
> + return ret;
> +}
This driver is not required.
I think you just need to use "simple-mfd".
> +static struct platform_driver uniphier_mfd_driver = {
> + .probe = uniphier_mfd_probe,
> + .driver = {
> + .name = "uniphier-mfd",
> + .of_match_table = uniphier_mfd_match,
> + },
> +};
> +module_platform_driver(uniphier_mfd_driver);
> +
> +MODULE_AUTHOR("Masahiro Yamada <yamada.masahiro@socionext.com>");
> +MODULE_DESCRIPTION("UniPhier SoC MFD Driver");
> +MODULE_LICENSE("GPL");
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2016-05-10 11:26 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-10 9:50 [RFC PATCH 00/21] mfd, clock, reset: add UniPhier clock/reset driver support Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 01/21] mfd: uniphier: add UniPhier MFD driver Masahiro Yamada
2016-05-10 11:26 ` Lee Jones [this message]
2016-05-11 1:51 ` Masahiro Yamada
2016-05-11 7:38 ` Lee Jones
2016-05-10 9:50 ` [RFC PATCH 02/21] clk: uniphier: add core support for UniPhier clock driver Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 03/21] clk: uniphier: add clock driver for UniPhier PH1-LD4 SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 04/21] clk: uniphier: add clock driver for UniPhier PH1-Pro4 SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 05/21] clk: uniphier: add clock driver for UniPhier PH1-sLD8 SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 06/21] clk: uniphier: add clock driver for UniPhier PH1-Pro5 SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 07/21] clk: uniphier: add clock driver for UniPhier ProXstream2/PH1-LD6b SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 08/21] clk: uniphier: add clock driver for UniPhier PH1-LD11 SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 09/21] clk: uniphier: add clock driver for UniPhier PH1-LD20 SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 10/21] clk: uniphier: add clock driver for Media I/O block on UniPhier SoCs Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 11/21] clk: uniphier: add clock driver for Peripheral " Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 12/21] reset: uniphier: add core support for UniPhier reset driver Masahiro Yamada
2016-05-10 13:54 ` Philipp Zabel
2016-05-11 2:46 ` Masahiro Yamada
2016-05-11 10:34 ` Philipp Zabel
2016-05-10 9:50 ` [RFC PATCH 13/21] reset: uniphier: add reset driver for UniPhier PH1-LD4 SoC Masahiro Yamada
2016-05-10 12:25 ` Philipp Zabel
2016-05-11 2:52 ` Masahiro Yamada
2016-05-11 10:34 ` Philipp Zabel
2016-05-11 10:37 ` Philipp Zabel
2016-05-10 9:50 ` [RFC PATCH 14/21] reset: uniphier: add reset driver for UniPhier PH1-Pro4 SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 15/21] reset: uniphier: add reset driver for UniPhier PH1-sLD8 SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 16/21] reset: uniphier: add reset driver for UniPhier PH1-Pro5 SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 17/21] reset: uniphier: add reset driver for UniPhier ProXstream2/PH1-LD6b SoC Masahiro Yamada
2016-05-10 9:50 ` [RFC PATCH 18/21] reset: uniphier: add reset driver for UniPhier PH1-LD11 SoC Masahiro Yamada
2016-05-10 9:51 ` [RFC PATCH 19/21] reset: uniphier: add reset driver for UniPhier PH1-LD20 SoC Masahiro Yamada
2016-05-10 9:51 ` [RFC PATCH 20/21] reset: uniphier: add reset driver for Media I/O block on UniPhier SoCs Masahiro Yamada
2016-05-10 9:51 ` [RFC PATCH 21/21] reset: uniphier: add reset driver for Peripheral " Masahiro Yamada
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=20160510112622.GL19473@dell \
--to=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).