diff mbox

[02/12] i2c: si570: merge support for si570 clock generator

Message ID 201401060857.s068v4QU008156@toshiba.co.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Sangorrin Jan. 6, 2014, 8:57 a.m. UTC
On 2014/01/06 17:09, Daniel Sangorrin wrote:
> On 2014/01/06 12:29, Greg KH wrote:
>> On Mon, Jan 06, 2014 at 11:33:00AM +0900, Daniel Sangorrin wrote:
>>>
>>>
>>> On 2014/01/06 7:05, Greg KH wrote:
>>>> On Tue, Dec 24, 2013 at 03:15:01PM +0900, Daniel Sangorrin wrote:
>>>>> From: Rob Armstrong <ra@xilinx.com>
>>>>>
>>>>> This merges support for the si5790 clock generator from the Xilinx
>>>>> repository (commit efc27505715e64526653f35274717c0fc56491e3 from
>>>>> master branch).
>>>>>
>>>>> Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
>>>>> Signed-off-by: Yoshitake Kobayashi <yoshitake.kobayashi@toshiba.co.jp>
>>>>> ---
>>>>>  drivers/misc/Kconfig      |  10 +
>>>>>  drivers/misc/Makefile     |   1 +
>>>>>  drivers/misc/si570.c      | 576 ++++++++++++++++++++++++++++++++++++++++++++++
>>>>>  include/linux/i2c/si570.h |  31 +++
>>>>>  4 files changed, 618 insertions(+)
>>>>>  create mode 100644 drivers/misc/si570.c
>>>>>  create mode 100644 include/linux/i2c/si570.h
>>>>>
>>>>> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
>>>>> index c002d86..1c9fd72 100644
>>>>> --- a/drivers/misc/Kconfig
>>>>> +++ b/drivers/misc/Kconfig
>>>>> @@ -507,6 +507,16 @@ config USB_SWITCH_FSA9480
>>>>>  	  stereo and mono audio, video, microphone and UART data to use
>>>>>  	  a common connector port.
>>>>>  
>>>>> +config SI570
>>>>> +	tristate "Silicon Labs Si570 Clock Generator"
>>>>> +	depends on I2C && SYSFS
>>>>> +	help
>>>>> +	  If you say yes here you get support for the Silicon Labs Si570
>>>>> +	  digital clock generator.
>>>>> +
>>>>> +	  To compile this driver as a module, choose M here: the module
>>>>> +	  will be called si570
>>>>> +
>>>>>  config LATTICE_ECP3_CONFIG
>>>>>  	tristate "Lattice ECP3 FPGA bitstream configuration via SPI"
>>>>>  	depends on SPI && SYSFS
>>>>> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
>>>>> index c235d5b..e84bcaa 100644
>>>>> --- a/drivers/misc/Makefile
>>>>> +++ b/drivers/misc/Makefile
>>>>> @@ -50,6 +50,7 @@ obj-y				+= carma/
>>>>>  obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
>>>>>  obj-$(CONFIG_ALTERA_STAPL)	+=altera-stapl/
>>>>>  obj-$(CONFIG_INTEL_MEI)		+= mei/
>>>>> +obj-$(CONFIG_SI570)		+= si570.o
>>>>>  obj-$(CONFIG_VMWARE_VMCI)	+= vmw_vmci/
>>>>>  obj-$(CONFIG_LATTICE_ECP3_CONFIG)	+= lattice-ecp3-config.o
>>>>>  obj-$(CONFIG_SRAM)		+= sram.o
>>>>> diff --git a/drivers/misc/si570.c b/drivers/misc/si570.c
>>>>> new file mode 100644
>>>>> index 0000000..30d8288
>>>>> --- /dev/null
>>>>> +++ b/drivers/misc/si570.c
>>>>> @@ -0,0 +1,576 @@
>>>>> +/*
>>>>> + * Driver for Silicon Labs Si570/Si571 Programmable XO/VCXO
>>>>> + *
>>>>> + * Copyright (C) 2010, 2011 Ericsson AB.
>>>>> + * Copyright (C) 2011 Guenter Roeck.
>>>>> + *
>>>>> + * Author: Guenter Roeck <guenter.roeck@ericsson.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/module.h>
>>>>> +#include <linux/jiffies.h>
>>>>> +#include <linux/i2c.h>
>>>>> +#include <linux/err.h>
>>>>> +#include <linux/mutex.h>
>>>>> +#include <linux/delay.h>
>>>>> +#include <linux/log2.h>
>>>>> +#include <linux/slab.h>
>>>>> +#include <linux/of_i2c.h>
>>>>
>>>> This line breaks the build on the x86 platform, so I'm going to drop
>>>> this whole patch, sorry.
>>>>
>>>> Please fix it up so that it builds properly and resend.
>>>
>>> Hi Greg,
>>>
>>> I just tested the x86 build with "make allyesconfig" and
>>> "make i386_defconfig" (with SI570 enabled) and both of them
>>> ended without problems on my machine.
>>>
>>> Could it be a collision against patches sent by other people?
>>
>> Ah, yes, it is due to patch 687b81d083c082bc1e853032e3a2a54f8c251d27
>> (from Linus's tree) in the LTSI tree now.  You'll have to handle this
>> when making this code work properly upstream, so might as well make the
>> change now :)
>>
>> thanks,
>>
>> greg k-h
>>
>>
> Hi Greg,
> 
> I applied the LTSI patches on Linux 3.10.25 with quilt.
> 
> Note: I noticed that I had to repeat the commands
> 'quilt push -a -f' and 'quilt refresh' several
> times because quilt was complaining (is that normal?).
> 
> After applying all of the patches, and adding the
> si570 patch as well, I managed to reproduce the problem with
> the x86 build that you mentioned.
> 
> I just had to remove that line (#include <linux/of_i2c.h>)
> to fix the x86 build.
> 
> Unfortunately, I noticed that all ARM builds are in fact
> broken with the current LTSI patches. This is the error message
> that appears when I try to build an ARM kernel:
> 
>   CC      arch/arm/kernel/setup.o
> arch/arm/kernel/setup.c: In function 'customize_machine':
> arch/arm/kernel/setup.c:686: error: implicit declaration of function 'of_platform_populate'
> arch/arm/kernel/setup.c:686: error: 'of_default_bus_match_table' undeclared (first use in this function)
> arch/arm/kernel/setup.c:686: error: (Each undeclared identifier is reported only once
> arch/arm/kernel/setup.c:686: error: for each function it appears in.)
> make[1]: *** [arch/arm/kernel/setup.o] Error 1
> make: *** [arch/arm/kernel] Error 2
> 
> After some research, I managed to track this down to the
> following patch:
> 
> #patches.baytrail/1134-of-remove-CONFIG_OF_DEVICE.patch
> 
> If I ommit that patch, I can build the Zynq kernel (and
> also other ARM board kernels which had the same problem)
> without problems. Unfortunately there are two problems
> with that too:
> 
>   1.- The Zynq kernel mostly works but it seems
>       that I2C devices (eeprom, rtc) are not recognized
>       anymore.
>   2.- 'make allyesconfig' fails again (probably some conflict
>       with other patches)
> 
> Do you have any suggestion of how to fix this?
> 
> Best regards
> Daniel
> 

Greg,

The problem with ARM builds seems to be fixed by
fixing of_platform.h (see patch below. I can prepare
a proper patch tomorrow with cherry-picks from
mainline if you want).

Unfortunately, the problem with the I2C devices is still there.
I will try to fix it tomorrow.
diff mbox

Patch

diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 2a93b64..55f0d80 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -13,8 +13,6 @@ 

 #include <linux/device.h>
 #include <linux/mod_devicetable.h>
-
-#ifdef CONFIG_OF_DEVICE
 #include <linux/pm.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
@@ -82,7 +80,6 @@  extern struct platform_device *of_device_alloc(struct device_node *np,
                                         struct device *parent);
 extern struct platform_device *of_find_device_by_node(struct device_node *np);

-#ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */
 /* Platform devices and busses creation */
 extern struct platform_device *of_platform_device_create(struct device_node *np,
                                                   const char *bus_id,
@@ -91,17 +88,12 @@  extern struct platform_device *of_platform_device_create(struct device_node *
 extern int of_platform_bus_probe(struct device_node *root,
                                 const struct of_device_id *matches,
                                 struct device *parent);
+#ifdef CONFIG_OF_ADDRESS
 extern int of_platform_populate(struct device_node *root,
                                const struct of_device_id *matches,
                                const struct of_dev_auxdata *lookup,
                                struct device *parent);
-#endif /* CONFIG_OF_ADDRESS */
-
-#endif /* CONFIG_OF_DEVICE */
-
-#if !defined(CONFIG_OF_ADDRESS)
-struct of_dev_auxdata;
-struct device_node;
+#else
 static inline int of_platform_populate(struct device_node *root,
                                        const struct of_device_id *matches,
                                        const struct of_dev_auxdata *lookup,