Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756380AbbBQJU3 (ORCPT ); Tue, 17 Feb 2015 04:20:29 -0500 Received: from down.free-electrons.com ([37.187.137.238]:33033 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752086AbbBQJUX (ORCPT ); Tue, 17 Feb 2015 04:20:23 -0500 Date: Tue, 17 Feb 2015 10:20:20 +0100 From: Antoine Tenart To: Lee Jones Cc: Antoine Tenart , sebastian.hesselbarth@gmail.com, sameo@linux.intel.com, jszhang@marvell.com, zmxu@marvell.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/11] mfd: add the Berlin controller driver Message-ID: <20150217092020.GC4507@kwain> References: <1423671332-24580-1-git-send-email-antoine.tenart@free-electrons.com> <1423671332-24580-2-git-send-email-antoine.tenart@free-electrons.com> <20150216124808.GC14545@x1> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150216124808.GC14545@x1> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4404 Lines: 161 Lee, On Mon, Feb 16, 2015 at 12:48:08PM +0000, Lee Jones wrote: > On Wed, 11 Feb 2015, Antoine Tenart wrote: > > > --- a/drivers/mfd/Kconfig > > +++ b/drivers/mfd/Kconfig > > @@ -840,6 +840,11 @@ config STMPE_SPI > > This is used to enable SPI interface of STMPE > > endmenu > > > > +config MFD_BERLIN_CTRL > > + bool > > Missing description. > Why can't this driver be built as a module? Well, this mfd driver registers various devices as the pinctrl and the reset driver. I think we want the pinctrl driver to always be registered. IMHO we want this driver to always be selected when using a Berlin SoC. > > > + select MFD_CORE > > + select MFD_SYSCON > > Missing help. > > > config MFD_STA2X11 > > bool "STMicroelectronics STA2X11" > > depends on STA2X11 > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > > index 53467e211381..adf60e85df20 100644 > > --- a/drivers/mfd/Makefile > > +++ b/drivers/mfd/Makefile > > @@ -179,3 +179,5 @@ obj-$(CONFIG_MFD_DLN2) += dln2.o > > > > intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o > > obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o > > + > > +obj-$(CONFIG_MFD_BERLIN_CTRL) += berlin-ctrl.o > > diff --git a/drivers/mfd/berlin-ctrl.c b/drivers/mfd/berlin-ctrl.c > > new file mode 100644 > > index 000000000000..e3ce6f069f16 > > --- /dev/null > > +++ b/drivers/mfd/berlin-ctrl.c > > @@ -0,0 +1,180 @@ > > +/* > > + * Copyright (C) 2015 Marvell Technology Group Ltd. > > + * > > + * Antoine Tenart > > Author: Antoine Tenart Hmmm, okay. > > > + > > +#include > > +#include > > +#include > > kernel.h? Is there a reason to add this header here? > > +/* > > + * BG2 devices > > + */ > > +static const struct mfd_cell berlin2_ctrl_chip_ctrl_subdevs[] = { > > + { > > + .name = "berlin2-soc-pinctrl", > > + .of_compatible = "marvell,berlin2-soc-pinctrl", > > + }, > > + { > > + .name = "berlin2-reset", > > + .of_compatible = "marvell,berlin2-reset", > > + }, > > +}; > > + > > +static const struct mfd_cell berlin2_ctrl_system_ctrl_subdevs[] = { > > + { > > + .name = "berlin2-system-pinctrl", > > + .of_compatible = "marvell,berlin2-system-pinctrl", > > + }, > > +}; > > + > > +static const struct berlin_ctrl_priv berlin2_ctrl_chip_ctrl_data = { > > + .devs = berlin2_ctrl_chip_ctrl_subdevs, > > + .ndevs = ARRAY_SIZE(berlin2_ctrl_chip_ctrl_subdevs), > > +}; > > + > > +static const struct berlin_ctrl_priv berlin2_ctrl_system_data = { > > + .devs = berlin2_ctrl_system_ctrl_subdevs, > > + .ndevs = ARRAY_SIZE(berlin2_ctrl_system_ctrl_subdevs), > > +}; > > + > > + > > Superfluous '\n' Sure. > > > + > > +static int berlin_ctrl_probe(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + const struct of_device_id *match; > > + const struct berlin_ctrl_priv *priv; > > + int ret; > > + > > + match = of_match_node(berlin_ctrl_of_match, dev->of_node); > > + if (!match) > > + return -EINVAL; > > + > > + priv = match->data; > > + > > + ret = mfd_add_devices(dev, 0, priv->devs, priv->ndevs, NULL, -1, NULL); > > + if (ret) { > > + dev_err(dev, "Failed to add devices: %d\n", ret); > > + return ret; > > + } > > + > > + return 0; > > +} > > I'm not sure I see the point in this driver. Why can't you just > register these devices directly from DT? All these devices share the same bank of registers and we previously used a single node. But with many devices sharing a single node, this is problematic to register all the devices from DT. Using this MFD driver to do it is a proper solution in this case. To provide a regmap to the devices' drivers we also use syscon on the chip/system controller nodes. > > +MODULE_LICENSE("GPL"); > > v2 "GPL" is a valid choice, quoting include/linux.module.h: "GPL" [GNU Public License v2 or later] "GPL v2" [GNU Public License v2] Is there a reason you explicitly want to use GPLv2, and only GPLv2? Antoine -- Antoine T?nart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/