public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: "Tan, Raymond" <raymond.tan@intel.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Chen, Alvin" <alvin.chen@intel.com>,
	"Shevchenko, Andriy" <andriy.shevchenko@intel.com>
Subject: Re: [PATCH v2 1/1] mfd: intel_quark_i2c_gpio: Add Intel Quark X1000 I2C-GPIO MFD Driver
Date: Tue, 25 Nov 2014 16:51:05 +0000	[thread overview]
Message-ID: <20141125165105.GP4241@x1> (raw)
In-Reply-To: <F0CA9E243F4F424B836EAC30E41BF4CF5C7989F2@PGSMSX104.gar.corp.intel.com>

Mike,

Something for you down below.

> > > In Quark X1000, there's a single PCI device that provides both an I2C
> > > controller and a GPIO controller. This MFD driver will split the 2
> > > devices for their respective drivers.
> > >
> > > This patch is based on Josef Ahmad's initial work for Quark enabling.
> > >
> > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Signed-off-by: Weike Chen <alvin.chen@intel.com>
> > > Signed-off-by: Raymond Tan <raymond.tan@intel.com>
> > > ---
> > >  drivers/mfd/Kconfig                |   11 ++
> > >  drivers/mfd/Makefile               |    1 +
> > >  drivers/mfd/intel_quark_i2c_gpio.c |  298
> > > ++++++++++++++++++++++++++++++++++++
> > >  3 files changed, 310 insertions(+)
> > >  create mode 100644 drivers/mfd/intel_quark_i2c_gpio.c

[...]

> > > +	depends on COMMON_CLK
> > 
> > I don't think you should depend on this.  Just use the API and fail if it doesn't
> > find the clock you're after.
> 
> This was added to make sure the clk initialization and other clk related calls will work with the MFD.

[...]

> > > +struct clk *intel_quark_i2c_clk;
> > > +struct clk_lookup *intel_quark_i2c_clk_lookups;
> > 
> > Why do these need to be global?
> 
> I was trying to keep these as runtime allocated variables, and cleaned up with removal of the driver / upon error handling.

They still can be.  But they need to be in a struct somewhere and not
global.

[...]

> > > +static int intel_quark_register_i2c_clk(struct pci_dev *pdev) {
> > > +	intel_quark_i2c_clk_lookups = devm_kcalloc(
> > > +
> > > +		&pdev->dev, INTEL_QUARK_I2C_NCLK,
> > > +		sizeof(*intel_quark_i2c_clk_lookups), GFP_KERNEL);
> > > +
> > > +	if (!intel_quark_i2c_clk_lookups)
> > > +		return -ENOMEM;
> > > +
> > > +	intel_quark_i2c_clk_lookups[0].dev_id =
> > > +INTEL_QUARK_I2C_CONTROLLER_CLK;
> > > +
> > > +	intel_quark_i2c_clk = clk_register_fixed_rate(
> > > +		&pdev->dev, INTEL_QUARK_I2C_CONTROLLER_CLK, NULL,
> > > +		CLK_IS_ROOT, INTEL_QUARK_I2C_CLK_HZ);
> > > +
> > > +	return clk_register_clkdevs(intel_quark_i2c_clk,
> > > +		intel_quark_i2c_clk_lookups, INTEL_QUARK_I2C_NCLK);
> > 
> > We don't normally register clks from MFD.  Normally they are registered in
> > drivers/clk and fetched when a device requires them.
> > Why is this different?
> 
> This is a static clk and on this platform, there's no clk hardware
> to have the clk driver to initialize this and add into the global
> struct for use
> later by i2c controller. The hardware on the platform itself is
> same, and the current driver (i2c_designware_platform) requires the
> clk 
> for its operation. Due to this, I decided to have the clk initialize
> in the MFD before the device being added, which later will trigger
> the probe on the i2c controller driver. 

Mike,

Can I get your input on this please?

[...]

> > > +	pdata = intel_quark_get_i2c_mode(pdev);
> > > +	if (IS_ERR(pdata))
> > > +		return PTR_ERR(pdata);
> > 
> > Bring this functionality into here?
> 
> Were you referring the contents of intel_quark_get_i2c_mode(), and avoid the additional function call instead?

Right.  Please rid intel_quark_get_i2c_mode().

[...]

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2014-11-25 16:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11 13:42 [PATCH v2 0/1] mfd: intel_quark_i2c_gpio: Add Intel Quark X1000 I2C-GPIO MFD Driver Raymond Tan
2014-11-11 13:42 ` [PATCH v2 1/1] " Raymond Tan
2014-11-18 17:21   ` Lee Jones
2014-11-24 13:51     ` Tan, Raymond
2014-11-25 16:51       ` Lee Jones [this message]
2014-11-25 16:52         ` Lee Jones
2014-12-11  9:50           ` Tan, Raymond

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=20141125165105.GP4241@x1 \
    --to=lee.jones@linaro.org \
    --cc=alvin.chen@intel.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raymond.tan@intel.com \
    --cc=sameo@linux.intel.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