[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdZFi34nChnMEo6yik67zk9owZLk-6zcdP7mmOXyLz8uqQ@mail.gmail.com>
Date: Thu, 14 Jun 2012 19:12:14 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Lee Jones <lee.jones@...aro.org>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linus.walleij@...ricsson.com, arnd@...db.de,
grant.likely@...retlab.ca, linux-i2c@...r.kernel.org
Subject: Re: [PATCH 1/3] i2c: Add Device Tree support to the Nomadik I2C driver
On Wed, Jun 13, 2012 at 6:07 PM, Lee Jones <lee.jones@...aro.org> wrote:
> Here we apply the bindings required for successful Device Tree
> probing of the i2c-nomadik driver. We also apply a fall-back
> configuration in case either one is not provided, or a required
> element is missing from the one supplied.
>
> Cc: linux-i2c@...r.kernel.org
> Signed-off-by: Lee Jones <lee.jones@...aro.org>
This looks more like I'd expect it, good job! :-D
> +static int __devinit
> +nmk_i2c_of_probe(struct device_node *np, struct nmk_i2c_controller *pdata)
> +{
> + of_property_read_u32(np, "clock-frequency", (u32*)&pdata->clk_freq);
> + if (!pdata->clk_freq) {
> + pr_warn("%s: Clock frequency not found\n", np->full_name);
> + return -EINVAL;
> + }
> +
> + of_property_read_u32(np, "stericsson,slsu", (u32*)&pdata->slsu);
> + if (!pdata->slsu) {
> + pr_warn("%s: Data line delay not found\n", np->full_name);
> + return -EINVAL;
> + }
> +
> + of_property_read_u32(np, "stericsson,tft", (u32*)&pdata->tft);
> + if (!pdata->tft) {
> + pr_warn("%s: Tx FIFO threshold not found\n", np->full_name);
> + return -EINVAL;
> + }
> +
> + of_property_read_u32(np, "stericsson,rft", (u32*)&pdata->rft);
> + if (!pdata->rft) {
> + pr_warn("%s: Rx FIFO threshold not found\n", np->full_name);
> + return -EINVAL;
> + }
> +
> + of_property_read_u32(np, "stericsson,timeout", (u32*)&pdata->timeout);
> + if (!pdata->timeout) {
> + pr_warn("%s: Timeout not found\n", np->full_name);
> + return -EINVAL;
> + }
> +
> + if (of_get_property(np, "stericsson,i2c_freq_mode_fast", NULL))
> + pdata->sm = I2C_FREQ_MODE_FAST;
> + else
> + pdata->sm = I2C_FREQ_MODE_STANDARD;
> +
> + return 0;
> +}
Will this compile fine if CONFIG_OF is not selected?
> /* fetch the controller configuration from machine */
> dev->cfg.clk_freq = pdata->clk_freq;
> - dev->cfg.slsu = pdata->slsu;
> - dev->cfg.tft = pdata->tft;
> - dev->cfg.rft = pdata->rft;
> - dev->cfg.sm = pdata->sm;
> -
> - i2c_set_adapdata(adap, dev);
> + dev->cfg.slsu = pdata->slsu;
> + dev->cfg.tft = pdata->tft;
> + dev->cfg.rft = pdata->rft;
> + dev->cfg.sm = pdata->sm; i2c_set_adapdata(adap, dev);
This looks like an unrelated whitespace fix, but OK...
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists