On 7/14/2012 9:45 AM, Heiko Schocher wrote: > Hello Sekhar, > > On 13.07.2012 15:57, Sekhar Nori wrote: >> Hi Heiko, >> >> On 5/30/2012 3:49 PM, Heiko Schocher wrote: >>> add of support for the davinci i2c driver. >>> >>> Signed-off-by: Heiko Schocher<hs@xxxxxxx> >>> Cc: davinci-linux-open-source@xxxxxxxxxxxxxxxxxxxx >>> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx >>> Cc: devicetree-discuss@xxxxxxxxxxxxxxxx >>> Cc: linux-i2c@xxxxxxxxxxxxxxx >>> Cc: Ben Dooks<ben-linux@xxxxxxxxx> >>> Cc: Wolfram Sang<w.sang@xxxxxxxxxxxxxx> >>> Cc: Grant Likely<grant.likely@xxxxxxxxxxxx> >>> Cc: Sekhar Nori<nsekhar@xxxxxx> >>> Cc: Wolfgang Denk<wd@xxxxxxx> >>> Cc: Sylwester Nawrocki<s.nawrocki@xxxxxxxxxxx> > [...] [...] >>> diff --git a/drivers/i2c/busses/i2c-davinci.c >>> b/drivers/i2c/busses/i2c-davinci.c >>> index a76d85f..4e7a966 100644 >>> --- a/drivers/i2c/busses/i2c-davinci.c >>> +++ b/drivers/i2c/busses/i2c-davinci.c [...] >>> static int davinci_i2c_probe(struct platform_device *pdev) >>> { >>> struct davinci_i2c_dev *dev; >>> @@ -676,6 +695,25 @@ static int davinci_i2c_probe(struct >>> platform_device *pdev) >>> dev->irq = irq->start; >>> platform_set_drvdata(pdev, dev); >>> >>> + if ((dev->dev->platform_data == NULL)&& >>> + (pdev->dev.of_node)) { >>> + u32 prop; >>> + >>> + dev->pdata = devm_kzalloc(&pdev->dev, >>> + sizeof(struct davinci_i2c_platform_data), GFP_KERNEL); >>> + if (!dev->pdata) { >>> + r = -ENOMEM; >>> + goto err_free_mem; >>> + } >>> + memcpy(dev->pdata,&davinci_i2c_platform_data_default, >>> + sizeof(struct davinci_i2c_platform_data)); >>> + if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency", >>> + &prop)) >>> + dev->pdata->bus_freq = prop / 1000; >>> + if (!of_property_read_u32(pdev->dev.of_node, "bus-delay", >>> + &prop)) >>> + dev->pdata->bus_delay = prop; >> >> You are leaving out two other platform data members (the gpio pins >> corresponding to data and clock) from DT data. We should be able to >> get that information from DT too, right? > > Yes, but I had not ported the GPIO driver to OF ... Okay. Understood. They can added once GPIO has been ported too and this part is tested. > >> So, I took this patch and tried to see if pdata maintenance can be >> simplified and came with the diff below. Can you have a look and see >> if this makes sense? I tested this using i2cdetect both with and >> without DT. > > Tested your patch on the enbw_cmc board with a LM75 on the enbw_cmc > board, works fine. Can I post a "v6" of my patch, merged with your > patch below and your Signed-off? Yes, please do. You can post it as in independent patch (not as part of a series) since the patch does not have any dependencies. Thanks, Sekhar -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html