OMAP4: Add DT support for i2c and twl6030
Subsystems (10)
v2 cover OMAP4: Add DT support for i2c and twl6030
Hi Tony and Rob,
Here is the updated version of the i2c + twl DT adaptation.
This update, compared to v1 [1], is mainly due to the merge into 3.2 of Andy's i2c cleanup series that was introducing a lot of pdata accesses at runtime.
The pm.c was updated to prevent the SR / VP initialization in the DT context since none of them is DT aware for the moment.
A couple of basic i2c devices are added for panda, beagle and sdp board.
Patches are based on for_3.3/2_dt_irq, to get the latest GIC binding, and are available here:git://gitorious.org/omap-pm/linux.git for_3.3/3_omap_dt_i2c_twl
Tested on Beagle and sdp4430.
Comments are welcome.
Regards,
Benoit
[1] http://lists.ozlabs.org/pipermail/devicetree-discuss/2011-September/007821.html
Benoit Cousson (10):
ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
i2c: OMAP: Add DT support for i2c controller
mfd: twl-core: Add initial DT support for twl4030/twl6030
rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030 arm/dts: OMAP4: Add i2c controller nodes
arm/dts: OMAP3: Add i2c controller nodes
arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
ARM: OMAP2+: board-generic: Remove i2c static init
Documentation/devicetree/bindings/i2c/omap-i2c.txt | 42 ++++++++ .../devicetree/bindings/mfd/twl-familly.txt | 47 +++++++++ Documentation/devicetree/bindings/rtc/twl-rtc.txt | 12 +++ arch/arm/boot/dts/omap3-beagle.dts | 38 ++++++++ arch/arm/boot/dts/omap3.dtsi | 28 ++++++ arch/arm/boot/dts/omap4-panda.dts | 45 +++++++++ arch/arm/boot/dts/omap4-sdp.dts | 63 ++++++++++++ arch/arm/boot/dts/omap4.dtsi | 28 ++++++ arch/arm/mach-omap2/board-generic.c | 48 +--------- arch/arm/mach-omap2/pm.c | 8 ++ drivers/i2c/busses/i2c-omap.c | 100 +++++++++++++------- drivers/mfd/twl-core.c | 53 ++++++++++- drivers/rtc/rtc-twl.c | 10 ++- 13 files changed, 435 insertions(+), 87 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt create mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txt
PATCH v2 1/10 ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
In the case of DT, the PMIC and SR initialization will be done using a completely different mechanism.
Disable this part if a DT blob is available.
--- arch/arm/mach-omap2/pm.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm.c +8 -0
@@ -227,6 +227,14 @@ postcore_initcall(omap2_common_pm_init);static int __init omap2_common_pm_late_init (void ) { +/* +* In the case of DT, the PMIC and SR initialization will be done using +* a completely different mechanism. +* Disable this part if a DT blob is available. +*/ +if (of_have_populated_dt ()) +return 0 ; +/* Init the voltage layer */ omap_pmic_late_init ();omap_voltage_late_init ();
Signature · 1 line
1.7.0.4
PATCH v2 1/10 ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT
Quoted 6 lines · Benoit Cousson
In the case of DT, the PMIC and SR initialization will be done using a completely different mechanism.
Disable this part if a DT blob is available.
Signed-off-by Benoit Cousson <[email protected]>
Quoted 32 lines
Cc Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/pm.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)arch/arm/mach-omap2/pm.c +8
-0@@ -227,6 +227,14 @@ postcore_initcall(omap2_common_pm_init);static int __init omap2_common_pm_late_init (void ) { +/* +* In the case of DT, the PMIC and SR initialization will be done using +* a completely different mechanism. +* Disable this part if a DT blob is available. +*/ +if (of_have_populated_dt ()) +return 0 ; +/* Init the voltage layer */ omap_pmic_late_init ();omap_voltage_late_init ();Signature · 7 lines
1.7.0.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
In reply to Benoit CoussonAdd initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if of_node exist.
Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
--- Documentation/devicetree/bindings/i2c/omap-i2c.txt | 42 ++++++++ drivers/i2c/busses/i2c-omap.c | 100 +++++++++++++------- 2 files changed, 107 insertions(+), 35 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +42 -0
@@ -0,0 +1,42 @@ +I2C for OMAP platforms + +Required properties : +- compatible : Must be "ti,omap3-i2c" or "ti,omap4-i2c" +- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based) +- #address-cells = <1>; +- #size-cells = <0>; + +Recommended properties : +- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise + the default 100 kHz frequency will be used. + +Optional properties: +- Child nodes conforming to i2c bus binding +- ti,flags : u32: settings or errata relative to the i2c + 0x1: OMAP_I2C_FLAG_NO_FIFO + 0x2: OMAP_I2C_FLAG_SIMPLE_CLOCK + 0x4: OMAP_I2C_FLAG_16BIT_DATA_REG + 0x8: OMAP_I2C_FLAG_RESET_REGS_POSTIDLE + 0x10: OMAP_I2C_FLAG_APPLY_ERRATA_I207 + 0x20: OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK + 0x40: OMAP_I2C_FLAG_FORCE_19200_INT_CLK + Valid for ti,omap3-i2c only: + 0x80: OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers + 0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers + +Note: Current implementation will fetch base address, irq and dma +from omap hwmod data base during device registration. +Future plan is to migrate hwmod data base contents into device tree +blob so that, all the required data will be used from device tree dts +file. + +Examples : + +i2c1: i2c at 0 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c1"; + clock-frequency = <400000>; + ti,flags = <0x118>; +};
drivers/i2c/busses/i2c-omap.c +65 -35
247 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
Quoted 9 lines · Benoit Cousson
Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if
of_nodeexist.Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
Signed-off-by Benoit Cousson <[email protected]>Cc Ben Dooks <[email protected]>
This seems indepenent from the rest of the series, and I can queue up for merge via the I2C tree.
Benoit, please confirm that we shouldn't have any problems if this patch goes independently.
Grant/Rob, with your ack on the bindings, I can queue this up for the I2C maintainers along with some other OMAP I2C changes for v3.3.
Kevin
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
Hi Kevin,
Quoted 12 lines · Kevin Hilman
Quoted 9 lines · Benoit Cousson
Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if
of_nodeexist.Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
Signed-off-by Benoit Cousson<[email protected]>Cc Ben Dooks<[email protected]>
Quoted 8 lines
This seems indepenent from the rest of the series, and I can queue up for merge via the I2C tree.
Benoit, please confirm that we shouldn't have any problems if this patch goes independently.
Grant/Rob, with your ack on the bindings, I can queue this up for the I2C maintainers along with some other OMAP I2C changes for v3.3.
I removed the nasty bindings and got the Reviewed-by: from Rob for the v4 [1].
Could you take it in your branch? I've just tried merging your for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and tested it successfully on OMAP4 DT boot.
Thanks,
Benoit
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
Quoted 24 lines · Benoit
Hi Kevin,
Quoted 12 lines · Kevin Hilman
Quoted 9 lines · Benoit Cousson
Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if
of_nodeexist.Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
Signed-off-by Benoit Cousson<[email protected]>Cc Ben Dooks<[email protected]>Quoted 8 lines
This seems indepenent from the rest of the series, and I can queue up for merge via the I2C tree.
Benoit, please confirm that we shouldn't have any problems if this patch goes independently.
Grant/Rob, with your ack on the bindings, I can queue this up for the I2C maintainers along with some other OMAP I2C changes for v3.3.
Quoted 6 lines
I removed the nasty bindings and got the Reviewed-by: from Rob for the v4 [1].
Could you take it in your branch? I've just tried merging your for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and tested it successfully on OMAP4 DT boot.
Quoted 12 lines
Thanks,
Benoit[1] http://lkml.org/lkml/2011/12/22/176
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
In reply to Cousson, BenoitQuoted 24 lines · Benoit
Hi Kevin,
Quoted 12 lines · Kevin Hilman
Quoted 9 lines · Benoit Cousson
Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if
of_nodeexist.Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
Signed-off-by Benoit Cousson<[email protected]>Cc Ben Dooks<[email protected]>Quoted 8 lines
This seems indepenent from the rest of the series, and I can queue up for merge via the I2C tree.
Benoit, please confirm that we shouldn't have any problems if this patch goes independently.
Grant/Rob, with your ack on the bindings, I can queue this up for the I2C maintainers along with some other OMAP I2C changes for v3.3.
Quoted 6 lines
I removed the nasty bindings and got the Reviewed-by: from Rob for the v4 [1].
Could you take it in your branch? I've just tried merging your for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and tested it successfully on OMAP4 DT boot.
Yes, I'll add v4 to my i2c/misc branch and add Grant's ack and queue.
Note that Ben Dooks has not responded to any of my queries or pull requests, either for v3.2 fixes or for the v3.3 merge window, so unfortunately it doesn't look like this will make it for v3.3 unless Ben starts responding. :(
Kevin
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
Quoted 33 lines · Kevin Hilman
Quoted 24 lines · Benoit
Hi Kevin,
Quoted 12 lines · Kevin Hilman
Quoted 9 lines · Benoit Cousson<[email protected]> ?writes:
Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if
of_nodeexist.Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
Signed-off-by Benoit Cousson<[email protected]>Cc Ben Dooks<[email protected]>Quoted 8 lines
This seems indepenent from the rest of the series, and I can queue up for merge via the I2C tree.
Benoit, please confirm that we shouldn't have any problems if this patch goes independently.
Grant/Rob, with your ack on the bindings, I can queue this up for the I2C maintainers along with some other OMAP I2C changes for v3.3.
Quoted 6 lines
I removed the nasty bindings and got the Reviewed-by: from Rob for the v4 [1].
Could you take it in your branch? I've just tried merging your for_3.3/i2c/misc on top of my for_3.3/3_omap_dt_i2c_twl branch and tested it successfully on OMAP4 DT boot.
Quoted 8 lines
Yes, I'll add v4 to my i2c/misc branch and add Grant's ack and queue.
Note that Ben Dooks has not responded to any of my queries or pull requests, either for v3.2 fixes or for the v3.3 merge window, so unfortunately it doesn't look like this will make it for v3.3 unless Ben starts responding. ?:(
Kevin
Get it into linux-next anyway. If Ben doesn't respond, then you can ask Linus to pull directly near the end of the merge window. I don't see any benefit in making this sit out for another cycle.
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
In reply to Benoit CoussonBenoit,
Quoted 36 lines · Benoit Cousson
Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if
of_nodeexist.Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
Signed-off-by Benoit Cousson <[email protected]>Cc Ben Dooks <[email protected]>--- Documentation/devicetree/bindings/i2c/omap-i2c.txt | 42 ++++++++ drivers/i2c/busses/i2c-omap.c | 100 +++++++++++++------- 2 files changed, 107 insertions(+), 35 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txtDocumentation/devicetree/bindings/i2c/omap-i2c.txt new file +15
-0@@ -0,0 +1,42 @@ +I2C for OMAP platforms + +Required properties : +- compatible : Must be "ti,omap3-i2c" or "ti,omap4-i2c" +- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based) +- #address-cells = <1>; +- #size-cells = <0>; + +Recommended properties : +- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise + the default 100 kHz frequency will be used. + +Optional properties: +- Child nodes conforming to i2c bus binding +- ti,flags : u32: settings or errata relative to the i2c
Documentation/devicetree/bindings/i2c/omap-i2c.txt line 25
Quoted 10 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +10
-0+ 0x1: OMAP_I2C_FLAG_NO_FIFO + 0x2: OMAP_I2C_FLAG_SIMPLE_CLOCK + 0x4: OMAP_I2C_FLAG_16BIT_DATA_REG + 0x8: OMAP_I2C_FLAG_RESET_REGS_POSTIDLE + 0x10: OMAP_I2C_FLAG_APPLY_ERRATA_I207 + 0x20: OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK + 0x40: OMAP_I2C_FLAG_FORCE_19200_INT_CLK + Valid for ti,omap3-i2c only: + 0x80: OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers + 0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
It's generally preferred to split these out to separate properties since there is not yet define capability in dts. Can some of these be removed by having more specific compatible strings? That is the whole point in having compatible strings not be generic. omap4-i2c and omap3-i2c is still kind of generic.
Quoted 153 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +16
-0+Note: Current implementation will fetch base address, irq and dma +from omap hwmod data base during device registration. +Future plan is to migrate hwmod data base contents into device tree +blob so that, all the required data will be used from device tree dts +file. + +Examples : + +i2c1: i2c at 0 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c1"; + clock-frequency = <400000>; + ti,flags = <0x118>; +};drivers/i2c/busses/i2c-omap.c +14
-23@@ -37,6 +37,8 @@#include <linux/platform_device.h> #include <linux/clk.h> #include <linux/io.h> +#include <linux/of_i2c.h> +#include <linux/of_device.h> #include <linux/slab.h> #include <linux/i2c-omap.h> #include <linux/pm_runtime.h> @@ -182,7 +184,9 @@ struct omap_i2c_dev {u32 latency;/* maximum mpu wkup latency */ void (*set_mpu_wkup_lat)(struct device *dev,long latency); -u32 speed;/* Speed of bus in Khz */ +u32 speed;/* Speed of bus in kHz */ +u32 dtrev;/* extra revision from DT */ +u32 flags;u16 cmd_err;u8 *buf;u8 *regs;@@ -266,11 +270,7 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)static void omap_i2c_unidle (struct omap_i2c_dev *dev) { -struct omap_i2c_bus_platform_data *pdata; - - pdata = dev->dev->platform_data; - -if (pdata->flags &OMAP_I2C_FLAG_RESET_REGS_POSTIDLE ) { +if (dev->flags &OMAP_I2C_FLAG_RESET_REGS_POSTIDLE ) {omap_i2c_write_reg (dev,OMAP_I2C_CON_REG ,0 );omap_i2c_write_reg (dev,OMAP_I2C_PSC_REG , dev->pscstate);omap_i2c_write_reg (dev,OMAP_I2C_SCLL_REG , dev->scllstate);@@ -291,13 +291,10 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)static void omap_i2c_idle (struct omap_i2c_dev *dev) { -struct omap_i2c_bus_platform_data *pdata;u16 iv; - pdata = dev->dev->platform_data; - dev->iestate =omap_i2c_read_reg (dev,OMAP_I2C_IE_REG ); -if (pdata->rev ==OMAP_I2C_IP_VERSION_2 ) +if (dev->dtrev ==OMAP_I2C_IP_VERSION_2 )omap_i2c_write_reg (dev,OMAP_I2C_IP_V2_IRQENABLE_CLR ,1 );else omap_i2c_write_reg (dev,OMAP_I2C_IE_REG ,0 );@@ -320,9 +317,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)unsigned long timeout;unsigned long internal_clk =0 ;struct clk *fclk; -struct omap_i2c_bus_platform_data *pdata; - - pdata = dev->dev->platform_data;if (dev->rev >=OMAP_I2C_OMAP1_REV_2 ) {/* Disable I2C controller before soft reset */ @@ -373,7 +367,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) }omap_i2c_write_reg (dev,OMAP_I2C_CON_REG ,0 ); -if (pdata->flags &OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK ) { +if (dev->flags &OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK ) {/* * The I2C functional clock is the armxor_ck, so there's * no need to get "armxor_ck" separately. Now, if OMAP2420 @@ -397,7 +391,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) psc = fclk_rate /12000000 ; } -if (!(pdata->flags &OMAP_I2C_FLAG_SIMPLE_CLOCK )) { +if (!(dev->flags &OMAP_I2C_FLAG_SIMPLE_CLOCK )) {/* * HSI2C controller internal clk rate should be 19.2 Mhz for @@ -406,7 +400,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)* The filter is iclk (fclk for HS) period. */ if (dev->speed >400 || - pdata->flags &OMAP_I2C_FLAG_FORCE_19200_INT_CLK ) + dev->flags &OMAP_I2C_FLAG_FORCE_19200_INT_CLK ) internal_clk =19200 ;else if (dev->speed >100 ) internal_clk =9600 ;@@ -475,7 +469,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) dev->errata =0 ; -if (pdata->flags &OMAP_I2C_FLAG_APPLY_ERRATA_I207 ) +if (dev->flags &OMAP_I2C_FLAG_APPLY_ERRATA_I207 ) dev->errata |=I2C_OMAP_ERRATA_I207 ;/* Enable interrupts */ @@ -484,7 +478,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) OMAP_I2C_IE_AL) | ((dev->fifo_size) ? (OMAP_I2C_IE_RDR |OMAP_I2C_IE_XDR ) :0 );omap_i2c_write_reg (dev,OMAP_I2C_IE_REG , dev->iestate); -if (pdata->flags &OMAP_I2C_FLAG_RESET_REGS_POSTIDLE ) { +if (dev->flags &OMAP_I2C_FLAG_RESET_REGS_POSTIDLE ) { dev->pscstate = psc; dev->scllstate = scll; dev->sclhstate = sclh;@@ -804,9 +798,6 @@ omap_i2c_isr(int this_irq, void *dev_id)u16 bits;u16 stat, w;int err, count =0 ; -struct omap_i2c_bus_platform_data *pdata; - - pdata = dev->dev->platform_data;if (pm_runtime_suspended (dev->dev))return IRQ_NONE ;@@ -875,7 +866,7 @@ complete:* Data reg in 2430, omap3 and * omap4 is 8 bit wide */ -if (pdata->flags & +if (dev->flags &OMAP_I2C_FLAG_16BIT_DATA_REG ) {if (dev->buf_len) { *dev->buf++ = w >>8 ;@@ -918,7 +909,7 @@ complete:* Data reg in 2430, omap3 and * omap4 is 8 bit wide */ -if (pdata->flags & +if (dev->flags &OMAP_I2C_FLAG_16BIT_DATA_REG ) {if (dev->buf_len) { w |= *dev->buf++ <<8 ;@@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = { .functionality = omap_i2c_func,
drivers/i2c/busses/i2c-omap.c static const struct i2c_algorithm omap_i2c_algo = { · line 966
Quoted 10 lines
drivers/i2c/busses/i2c-omap.c +8
-0}; +#ifdef CONFIG_OF +static struct omap_i2c_bus_platform_data omap3_pdata = { + .rev =OMAP_I2C_IP_VERSION_1 , +}; + +static struct omap_i2c_bus_platform_data omap4_pdata = { + .rev =OMAP_I2C_IP_VERSION_2 , +};
This is redundant. The ip version can be determined from the compatible string.
Quoted 5 lines
drivers/i2c/busses/i2c-omap.c +5
-0+ +static const struct of_device_id omap_i2c_of_match[] = { + { + .compatible ="ti,omap4-i2c" , + .data = &omap4_pdata,
drivers/i2c/busses/i2c-omap.c static const struct i2c_algorithm omap_i2c_algo = { · line 981
Quoted 10 lines
drivers/i2c/busses/i2c-omap.c +10
-0+ }, + { + .compatible = "ti,omap3-i2c", + .data = &omap3_pdata, + }, + { }, +}; +MODULE_DEVICE_TABLE (of, omap_i2c_of_match); +#else +#define omap_i2c_of_match NULL
Use of_match_ptr instead of the #else.
Quoted 112 lines
drivers/i2c/busses/i2c-omap.c +28
-12+#endif +static int __devinit omap_i2c_probe (struct platform_device *pdev) {@@ -972,9 +988,10 @@ omap_i2c_probe(struct platform_device *pdev)struct i2c_adapter *adap;struct resource *mem, *irq, *ioarea;struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data; +struct device_node *node = pdev->dev.of_node; +const struct of_device_id *match;irq_handler_t isr;int r; -u32 speed =0 ;/* NOTE: driver uses the static register mapping */ mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 );@@ -1001,15 +1018,24 @@ omap_i2c_probe(struct platform_device *pdev) goto err_release_region; } -if (pdata !=NULL ) { - speed = pdata->clkrate; + match =of_match_device (omap_i2c_of_match, &pdev->dev); +if (match) { +u32 freq =100000 ;/* default to 100000 Hz */ + pdata = match->data; + +of_property_read_u32 (node,"clock-frequency" , &freq); +/* convert DT freq value in Hz into kHz for speed */ + dev->speed = freq /1000 ; +of_property_read_u32 (node,"ti,flags" , &dev->flags); + dev->dtrev = pdata->rev; + + }else if (pdata !=NULL ) { + dev->speed = pdata->clkrate; + dev->flags = pdata->flags; dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat; - }else { - speed =100 ;/* Default speed */ - dev->set_mpu_wkup_lat =NULL ; + dev->dtrev = pdata->rev; } - dev->speed = speed; dev->dev = &pdev->dev; dev->irq = irq->start; dev->base =ioremap (mem->start,resource_size (mem));@@ -1020,9 +1046,9 @@ omap_i2c_probe(struct platform_device *pdev)platform_set_drvdata (pdev, dev); - dev->reg_shift = (pdata->flags >>OMAP_I2C_FLAG_BUS_SHIFT__SHIFT ) &3 ; + dev->reg_shift = (dev->flags >>OMAP_I2C_FLAG_BUS_SHIFT__SHIFT ) &3 ; -if (pdata->rev ==OMAP_I2C_IP_VERSION_2 ) +if (dev->dtrev ==OMAP_I2C_IP_VERSION_2 ) dev->regs = (u8 *)reg_map_ip_v2;else dev->regs = (u8 *)reg_map_ip_v1;@@ -1035,7 +1061,7 @@ omap_i2c_probe(struct platform_device *pdev)if (dev->rev <=OMAP_I2C_REV_ON_3430 ) dev->errata |=I2C_OMAP3_1P153 ; -if (!(pdata->flags &OMAP_I2C_FLAG_NO_FIFO )) { +if (!(dev->flags &OMAP_I2C_FLAG_NO_FIFO )) {u16 s;/* Set up the fifo size - Get total size */ @@ -1057,7 +1083,7 @@ omap_i2c_probe(struct platform_device *pdev)/* calculate wakeup latency constraint for MPU */ if (dev->set_mpu_wkup_lat !=NULL ) dev->latency = (1000000 * dev->fifo_size) / - (1000 * speed /8 ); + (1000 * dev->speed /8 ); }/* reset ASAP, clearing any IRQs */ @@ -1073,7 +1099,7 @@ omap_i2c_probe(struct platform_device *pdev) }dev_info (dev->dev,"bus %d rev%d.%d.%d at %d kHz\n" , pdev->id, - pdata->rev, dev->rev >>4 , dev->rev &0xf , dev->speed); + dev->dtrev, dev->rev >>4 , dev->rev &0xf , dev->speed);pm_runtime_put (dev->dev);@@ -1084,6 +1110,7 @@ omap_i2c_probe(struct platform_device *pdev)strlcpy (adap->name,"OMAP I2C adapter" ,sizeof (adap->name)); adap->algo = &omap_i2c_algo; adap->dev.parent = &pdev->dev; + adap->dev.of_node = pdev->dev.of_node;/* i2c device drivers may be active on return from add_adapter() */ adap->nr = pdev->id;@@ -1093,6 +1120,8 @@ omap_i2c_probe(struct platform_device *pdev) goto err_free_irq; } +of_i2c_register_devices (adap); +return 0 ; err_free_irq:@@ -1165,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = { .name = "omap_i2c", .owner = THIS_MODULE, .pm = OMAP_I2C_PM_OPS, + .of_match_table = omap_i2c_of_match, }, };
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
Hi Rob,
Quoted 44 lines · Rob Herring
Benoit,
Quoted 41 lines · Benoit Cousson
Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if
of_nodeexist.Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
Signed-off-by Benoit Cousson<[email protected]>Cc Ben Dooks<[email protected]>--- Documentation/devicetree/bindings/i2c/omap-i2c.txt | 42 ++++++++ drivers/i2c/busses/i2c-omap.c | 100 +++++++++++++------- 2 files changed, 107 insertions(+), 35 deletions(-)create mode 100644
Documentation/devicetree/bindings/i2c/omap-i2c.txtDocumentation/devicetree/bindings/i2c/omap-i2c.txt new file +20
-0@@ -0,0 +1,42 @@ +I2C for OMAP platforms + +Required properties : +- compatible : Must be "ti,omap3-i2c" or "ti,omap4-i2c" +- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based) +- #address-cells =<1>; +- #size-cells =<0>; + +Recommended properties : +- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise + the default 100 kHz frequency will be used. + +Optional properties: +- Child nodes conforming to i2c bus binding +- ti,flags : u32: settings or errata relative to the i2c + 0x1: OMAP_I2C_FLAG_NO_FIFO + 0x2: OMAP_I2C_FLAG_SIMPLE_CLOCK + 0x4: OMAP_I2C_FLAG_16BIT_DATA_REG + 0x8: OMAP_I2C_FLAG_RESET_REGS_POSTIDLE + 0x10: OMAP_I2C_FLAG_APPLY_ERRATA_I207
Quoted 8 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt line 25
Quoted 5 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +5
-0+ 0x20: OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK + 0x40: OMAP_I2C_FLAG_FORCE_19200_INT_CLK + Valid for ti,omap3-i2c only: + 0x80: OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers + 0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registersIt's generally preferred to split these out to separate properties since there is not yet define capability in dts.
Yeah, I was hoping that Stephen's DTC patches were accepted to avoid that.
Quoted 4 lines
Can some of these be removed
by having more specific compatible strings? That is the whole point in having compatible strings not be generic. omap4-i2c and omap3-i2c is still kind of generic.
Do you mean creating some attributes like that:
+ ti,16bits_shift; + ti,reset_postidle; + ti,errata_i207;
Or using some omap3-i2c or omap4-i2c to determine the proper version and thus populate the right flags during probe.
[...]
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +0
-0@@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = { .functionality = omap_i2c_func, };
Quoted 11 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt static const struct i2c_algorithm omap_i2c_algo = { · line 966
Quoted 8 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +8
-0+#ifdef CONFIG_OF +static struct omap_i2c_bus_platform_data omap3_pdata = { + .rev = OMAP_I2C_IP_VERSION_1, +}; + +static struct omap_i2c_bus_platform_data omap4_pdata = { + .rev = OMAP_I2C_IP_VERSION_2, +};This is redundant. The ip version can be determined from the compatible string.
I'm confused...
I'm using the compatible string below to chose the proper value. This flag is then used later at runtime.
I'm using a pseudo pdata because that driver is still used in old platform that does and will never not have DT support.
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +8
-0+static const struct of_device_id omap_i2c_of_match[] = { + { + .compatible = "ti,omap4-i2c", + .data =&omap4_pdata, + }, + { + .compatible = "ti,omap3-i2c", + .data =&omap3_pdata,
Quoted 8 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt static const struct i2c_algorithm omap_i2c_algo = { · line 980
Quoted 6 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +6
-0+ }, + { }, +}; +MODULE_DEVICE_TABLE(of, omap_i2c_of_match); +#else +#define omap_i2c_of_match NULLUse
of_match_ptrinstead of the #else.
OK, good point.
Thanks,
Benoit
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
Quoted 71 lines · Benoit
Hi Rob,
Quoted 46 lines · Rob Herring
Benoit,
Quoted 43 lines · Benoit Cousson
Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if
of_nodeexist.Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
Signed-off-by Benoit Cousson<[email protected]>Cc Ben Dooks<[email protected]>--- Documentation/devicetree/bindings/i2c/omap-i2c.txt | 42 ++++++++ drivers/i2c/busses/i2c-omap.c | 100 +++++++++++++------- 2 files changed, 107 insertions(+), 35 deletions(-)create mode 100644
Documentation/devicetree/bindings/i2c/omap-i2c.txtDocumentation/devicetree/bindings/i2c/omap-i2c.txt new file +20
-0@@ -0,0 +1,42 @@ +I2C for OMAP platforms + +Required properties : +- compatible : Must be "ti,omap3-i2c" or "ti,omap4-i2c" +- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based) +- #address-cells =<1>; +- #size-cells =<0>; + +Recommended properties : +- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise + the default 100 kHz frequency will be used. + +Optional properties: +- Child nodes conforming to i2c bus binding +- ti,flags : u32: settings or errata relative to the i2c + 0x1: OMAP_I2C_FLAG_NO_FIFO + 0x2: OMAP_I2C_FLAG_SIMPLE_CLOCK + 0x4: OMAP_I2C_FLAG_16BIT_DATA_REG + 0x8: OMAP_I2C_FLAG_RESET_REGS_POSTIDLE + 0x10: OMAP_I2C_FLAG_APPLY_ERRATA_I207Quoted 8 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt line 25
Quoted 5 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +5
-0+ 0x20: OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK + 0x40: OMAP_I2C_FLAG_FORCE_19200_INT_CLK + Valid for ti,omap3-i2c only: + 0x80: OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers + 0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registersIt's generally preferred to split these out to separate properties since there is not yet define capability in dts.
Yeah, I was hoping that Stephen's DTC patches were accepted to avoid that.
Quoted 4 lines
Can some of these be removed
by having more specific compatible strings? That is the whole point in having compatible strings not be generic. omap4-i2c and omap3-i2c is still kind of generic.Do you mean creating some attributes like that:
(quoted diff) +3
-0+ ti,16bits_shift; + ti,reset_postidle; + ti,errata_i207;
Quoted 3 lines
Or using some omap3-i2c or omap4-i2c to determine the proper version and thus populate the right flags during probe.
If that's specific enough, then yes. I meant that if say only the omap3578 (making up numbers here) has errata i207, then define a compatible string "ti,omap3578-i2c" that implies that and possibly other flags.
To put it another way, there are only N valid combinations of flags and N is probably fairly small as long as the flags are dictated by the i2c h/w rev or how it was integrated into a particular SOC. So you should have N compatible strings that reflect those valid combinations. The driver can still use the flags internally.
For any flags that are in fact board level configuration, they should be broken out as individual properties. Most of these sound like they are properties of the h/w and not user configuration of the h/w.
Quoted 18 lines
[...]
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +0
-0@@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = { .functionality = omap_i2c_func, };Quoted 11 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt static const struct i2c_algorithm omap_i2c_algo = { · line 966
Quoted 8 lines
Documentation/devicetree/bindings/i2c/omap-i2c.txt new file +8
-0+#ifdef CONFIG_OF +static struct omap_i2c_bus_platform_data omap3_pdata = { + .rev = OMAP_I2C_IP_VERSION_1, +}; + +static struct omap_i2c_bus_platform_data omap4_pdata = { + .rev = OMAP_I2C_IP_VERSION_2, +};This is redundant. The ip version can be determined from the compatible string.
Quoted 6 lines
I'm confused...
I'm using the compatible string below to chose the proper value. This flag is then used later at runtime.
I'm using a pseudo pdata because that driver is still used in old platform that does and will never not have DT support.
After more thought, never mind. You'll probably need it for handling the flags as I proposed above.
Rob
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
Quoted 1 line · Rob Herring
On 12/15/2011 09:05 AM, Cousson, Benoit wrote:
[...]
Quoted 15 lines
Quoted 3 lines
Or using some omap3-i2c or omap4-i2c to determine the proper version and thus populate the right flags during probe.
If that's specific enough, then yes. I meant that if say only the omap3578 (making up numbers here) has errata i207, then define a compatible string "ti,omap3578-i2c" that implies that and possibly other flags.
To put it another way, there are only N valid combinations of flags and N is probably fairly small as long as the flags are dictated by the i2c h/w rev or how it was integrated into a particular SOC. So you should have N compatible strings that reflect those valid combinations. The driver can still use the flags internally.
Quoted 3 lines
For any flags that are in fact board level configuration, they should be broken out as individual properties. Most of these sound like they are properties of the h/w and not user configuration of the h/w.
Yes, indeed, I got the point. This is even much better for the implementation standpoint. The whole stuff is located inside the driver where it should belong.
Quoted 25 lines
Quoted 18 lines
[...]
Quoted 4 lines
Quoted 4 lines
drivers/i2c/busses/i2c-omap.c +0
-0@@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = { .functionality = omap_i2c_func, };Quoted 11 lines
drivers/i2c/busses/i2c-omap.c static const struct i2c_algorithm omap_i2c_algo = { · line 966
Quoted 8 lines
drivers/i2c/busses/i2c-omap.c +8
-0+#ifdef CONFIG_OF +static struct omap_i2c_bus_platform_data omap3_pdata = { + .rev =OMAP_I2C_IP_VERSION_1 , +}; + +static struct omap_i2c_bus_platform_data omap4_pdata = { + .rev =OMAP_I2C_IP_VERSION_2 , +};This is redundant. The ip version can be determined from the compatible string.
Quoted 6 lines
I'm confused...
I'm using the compatible string below to chose the proper value. This flag is then used later at runtime.
I'm using a pseudo pdata because that driver is still used in old platform that does and will never not have DT support.
Quoted 2 lines
After more thought, never mind. You'll probably need it for handling the flags as I proposed above.
Yes, I'm taking advantage of the existing pdata structure to provide the proper flags.
Thanks for that feedback,
Benoit
PATCH v2 2/10 i2c: OMAP: Add DT support for i2c controller
In reply to Benoit CoussonSince it touches the driver file
+linux-i2c
Quoted 337 lines · Benoit Cousson
Add initial DT support to retrieve the frequency using a DT attribute instead of the pdata pointer if
of_nodeexist.Add documentation for omap i2c controller binding.
Based on original patches from Manju and Grant.
Signed-off-by Benoit Cousson <[email protected]>Cc Ben Dooks <[email protected]>--- Documentation/devicetree/bindings/i2c/omap-i2c.txt | 42 ++++++++ drivers/i2c/busses/i2c-omap.c | 100 +++++++++++++------- 2 files changed, 107 insertions(+), 35 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txtDocumentation/devicetree/bindings/i2c/omap-i2c.txt new file +42
-0@@ -0,0 +1,42 @@ +I2C for OMAP platforms + +Required properties : +- compatible : Must be "ti,omap3-i2c" or "ti,omap4-i2c" +- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based) +- #address-cells = <1>; +- #size-cells = <0>; + +Recommended properties : +- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise + the default 100 kHz frequency will be used. + +Optional properties: +- Child nodes conforming to i2c bus binding +- ti,flags : u32: settings or errata relative to the i2c + 0x1: OMAP_I2C_FLAG_NO_FIFO + 0x2: OMAP_I2C_FLAG_SIMPLE_CLOCK + 0x4: OMAP_I2C_FLAG_16BIT_DATA_REG + 0x8: OMAP_I2C_FLAG_RESET_REGS_POSTIDLE + 0x10: OMAP_I2C_FLAG_APPLY_ERRATA_I207 + 0x20: OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK + 0x40: OMAP_I2C_FLAG_FORCE_19200_INT_CLK + Valid for ti,omap3-i2c only: + 0x80: OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers + 0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers + +Note: Current implementation will fetch base address, irq and dma +from omap hwmod data base during device registration. +Future plan is to migrate hwmod data base contents into device tree +blob so that, all the required data will be used from device tree dts +file. + +Examples : + +i2c1: i2c at 0 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c1"; + clock-frequency = <400000>; + ti,flags = <0x118>; +};drivers/i2c/busses/i2c-omap.c +65
-35@@ -37,6 +37,8 @@#include <linux/platform_device.h> #include <linux/clk.h> #include <linux/io.h> +#include <linux/of_i2c.h> +#include <linux/of_device.h> #include <linux/slab.h> #include <linux/i2c-omap.h> #include <linux/pm_runtime.h> @@ -182,7 +184,9 @@ struct omap_i2c_dev {u32 latency;/* maximum mpu wkup latency */ void (*set_mpu_wkup_lat)(struct device *dev,long latency); -u32 speed;/* Speed of bus in Khz */ +u32 speed;/* Speed of bus in kHz */ +u32 dtrev;/* extra revision from DT */ +u32 flags;u16 cmd_err;u8 *buf;u8 *regs;@@ -266,11 +270,7 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)static void omap_i2c_unidle (struct omap_i2c_dev *dev) { -struct omap_i2c_bus_platform_data *pdata; - - pdata = dev->dev->platform_data; - -if (pdata->flags &OMAP_I2C_FLAG_RESET_REGS_POSTIDLE ) { +if (dev->flags &OMAP_I2C_FLAG_RESET_REGS_POSTIDLE ) {omap_i2c_write_reg (dev,OMAP_I2C_CON_REG ,0 );omap_i2c_write_reg (dev,OMAP_I2C_PSC_REG , dev->pscstate);omap_i2c_write_reg (dev,OMAP_I2C_SCLL_REG , dev->scllstate);@@ -291,13 +291,10 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)static void omap_i2c_idle (struct omap_i2c_dev *dev) { -struct omap_i2c_bus_platform_data *pdata;u16 iv; - pdata = dev->dev->platform_data; - dev->iestate =omap_i2c_read_reg (dev,OMAP_I2C_IE_REG ); -if (pdata->rev ==OMAP_I2C_IP_VERSION_2 ) +if (dev->dtrev ==OMAP_I2C_IP_VERSION_2 )omap_i2c_write_reg (dev,OMAP_I2C_IP_V2_IRQENABLE_CLR ,1 );else omap_i2c_write_reg (dev,OMAP_I2C_IE_REG ,0 );@@ -320,9 +317,6 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)unsigned long timeout;unsigned long internal_clk =0 ;struct clk *fclk; -struct omap_i2c_bus_platform_data *pdata; - - pdata = dev->dev->platform_data;if (dev->rev >=OMAP_I2C_OMAP1_REV_2 ) {/* Disable I2C controller before soft reset */ @@ -373,7 +367,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) }omap_i2c_write_reg (dev,OMAP_I2C_CON_REG ,0 ); -if (pdata->flags &OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK ) { +if (dev->flags &OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK ) {/* * The I2C functional clock is the armxor_ck, so there's * no need to get "armxor_ck" separately. Now, if OMAP2420 @@ -397,7 +391,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) psc = fclk_rate /12000000 ; } -if (!(pdata->flags &OMAP_I2C_FLAG_SIMPLE_CLOCK )) { +if (!(dev->flags &OMAP_I2C_FLAG_SIMPLE_CLOCK )) {/* * HSI2C controller internal clk rate should be 19.2 Mhz for @@ -406,7 +400,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)* The filter is iclk (fclk for HS) period. */ if (dev->speed >400 || - pdata->flags &OMAP_I2C_FLAG_FORCE_19200_INT_CLK ) + dev->flags &OMAP_I2C_FLAG_FORCE_19200_INT_CLK ) internal_clk =19200 ;else if (dev->speed >100 ) internal_clk =9600 ;@@ -475,7 +469,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) dev->errata =0 ; -if (pdata->flags &OMAP_I2C_FLAG_APPLY_ERRATA_I207 ) +if (dev->flags &OMAP_I2C_FLAG_APPLY_ERRATA_I207 ) dev->errata |=I2C_OMAP_ERRATA_I207 ;/* Enable interrupts */ @@ -484,7 +478,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) OMAP_I2C_IE_AL) | ((dev->fifo_size) ? (OMAP_I2C_IE_RDR |OMAP_I2C_IE_XDR ) :0 );omap_i2c_write_reg (dev,OMAP_I2C_IE_REG , dev->iestate); -if (pdata->flags &OMAP_I2C_FLAG_RESET_REGS_POSTIDLE ) { +if (dev->flags &OMAP_I2C_FLAG_RESET_REGS_POSTIDLE ) { dev->pscstate = psc; dev->scllstate = scll; dev->sclhstate = sclh;@@ -804,9 +798,6 @@ omap_i2c_isr(int this_irq, void *dev_id)u16 bits;u16 stat, w;int err, count =0 ; -struct omap_i2c_bus_platform_data *pdata; - - pdata = dev->dev->platform_data;if (pm_runtime_suspended (dev->dev))return IRQ_NONE ;@@ -875,7 +866,7 @@ complete:* Data reg in 2430, omap3 and * omap4 is 8 bit wide */ -if (pdata->flags & +if (dev->flags &OMAP_I2C_FLAG_16BIT_DATA_REG ) {if (dev->buf_len) { *dev->buf++ = w >>8 ;@@ -918,7 +909,7 @@ complete:* Data reg in 2430, omap3 and * omap4 is 8 bit wide */ -if (pdata->flags & +if (dev->flags &OMAP_I2C_FLAG_16BIT_DATA_REG ) {if (dev->buf_len) { w |= *dev->buf++ <<8 ;@@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = { .functionality = omap_i2c_func, }; +#ifdef CONFIG_OF +static struct omap_i2c_bus_platform_data omap3_pdata = { + .rev =OMAP_I2C_IP_VERSION_1 , +}; + +static struct omap_i2c_bus_platform_data omap4_pdata = { + .rev =OMAP_I2C_IP_VERSION_2 , +}; + +static const struct of_device_id omap_i2c_of_match[] = { + { + .compatible ="ti,omap4-i2c" , + .data = &omap4_pdata, + }, + { + .compatible ="ti,omap3-i2c" , + .data = &omap3_pdata, + }, + { }, +}; +MODULE_DEVICE_TABLE (of, omap_i2c_of_match); +#else +#define omap_i2c_of_match NULL +#endif +static int __devinit omap_i2c_probe (struct platform_device *pdev) {@@ -972,9 +988,10 @@ omap_i2c_probe(struct platform_device *pdev)struct i2c_adapter *adap;struct resource *mem, *irq, *ioarea;struct omap_i2c_bus_platform_data *pdata = pdev->dev.platform_data; +struct device_node *node = pdev->dev.of_node; +const struct of_device_id *match;irq_handler_t isr;int r; -u32 speed =0 ;/* NOTE: driver uses the static register mapping */ mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 );@@ -1001,15 +1018,24 @@ omap_i2c_probe(struct platform_device *pdev) goto err_release_region; } -if (pdata !=NULL ) { - speed = pdata->clkrate; + match =of_match_device (omap_i2c_of_match, &pdev->dev); +if (match) { +u32 freq =100000 ;/* default to 100000 Hz */ + pdata = match->data; + +of_property_read_u32 (node,"clock-frequency" , &freq); +/* convert DT freq value in Hz into kHz for speed */ + dev->speed = freq /1000 ; +of_property_read_u32 (node,"ti,flags" , &dev->flags); + dev->dtrev = pdata->rev; + + }else if (pdata !=NULL ) { + dev->speed = pdata->clkrate; + dev->flags = pdata->flags; dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat; - }else { - speed =100 ;/* Default speed */ - dev->set_mpu_wkup_lat =NULL ; + dev->dtrev = pdata->rev; } - dev->speed = speed; dev->dev = &pdev->dev; dev->irq = irq->start; dev->base =ioremap (mem->start,resource_size (mem));@@ -1020,9 +1046,9 @@ omap_i2c_probe(struct platform_device *pdev)platform_set_drvdata (pdev, dev); - dev->reg_shift = (pdata->flags >>OMAP_I2C_FLAG_BUS_SHIFT__SHIFT ) &3 ; + dev->reg_shift = (dev->flags >>OMAP_I2C_FLAG_BUS_SHIFT__SHIFT ) &3 ; -if (pdata->rev ==OMAP_I2C_IP_VERSION_2 ) +if (dev->dtrev ==OMAP_I2C_IP_VERSION_2 ) dev->regs = (u8 *)reg_map_ip_v2;else dev->regs = (u8 *)reg_map_ip_v1;@@ -1035,7 +1061,7 @@ omap_i2c_probe(struct platform_device *pdev)if (dev->rev <=OMAP_I2C_REV_ON_3430 ) dev->errata |=I2C_OMAP3_1P153 ; -if (!(pdata->flags &OMAP_I2C_FLAG_NO_FIFO )) { +if (!(dev->flags &OMAP_I2C_FLAG_NO_FIFO )) {u16 s;/* Set up the fifo size - Get total size */ @@ -1057,7 +1083,7 @@ omap_i2c_probe(struct platform_device *pdev)/* calculate wakeup latency constraint for MPU */ if (dev->set_mpu_wkup_lat !=NULL ) dev->latency = (1000000 * dev->fifo_size) / - (1000 * speed /8 ); + (1000 * dev->speed /8 ); }/* reset ASAP, clearing any IRQs */ @@ -1073,7 +1099,7 @@ omap_i2c_probe(struct platform_device *pdev) }dev_info (dev->dev,"bus %d rev%d.%d.%d at %d kHz\n" , pdev->id, - pdata->rev, dev->rev >>4 , dev->rev &0xf , dev->speed); + dev->dtrev, dev->rev >>4 , dev->rev &0xf , dev->speed);pm_runtime_put (dev->dev);@@ -1084,6 +1110,7 @@ omap_i2c_probe(struct platform_device *pdev)strlcpy (adap->name,"OMAP I2C adapter" ,sizeof (adap->name)); adap->algo = &omap_i2c_algo; adap->dev.parent = &pdev->dev; + adap->dev.of_node = pdev->dev.of_node;/* i2c device drivers may be active on return from add_adapter() */ adap->nr = pdev->id;@@ -1093,6 +1120,8 @@ omap_i2c_probe(struct platform_device *pdev) goto err_free_irq; } +of_i2c_register_devices (adap); +return 0 ; err_free_irq:@@ -1165,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = { .name = "omap_i2c", .owner = THIS_MODULE, .pm = OMAP_I2C_PM_OPS, + .of_match_table = omap_i2c_of_match, }, };
PATCH v2 3/10 mfd: twl-core: Add initial DT support for twl4030/twl6030
In reply to Benoit CoussonAdd initial device-tree support for twl familly chips. The current version is missing the regulator entries due to the lack of DT regulator bindings for the moment. Only the simple sub-modules that do not depend on platform_data information can be initialized properly.
Add documentation for the Texas Instruments TWL Integrated Chip.
--- .../devicetree/bindings/mfd/twl-familly.txt | 47 +++++++++++++++++ drivers/mfd/twl-core.c | 53 ++++++++++++++++++-- 2 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txt
Documentation/devicetree/bindings/mfd/twl-familly.txt new file +47 -0
@@ -0,0 +1,47 @@ +Texas Instruments TWL family + +The TWLs are Integrated Power Management Chips. +Some version might contain much more analog function like +USB transceiver or Audio amplifier. +These chips are connected to an i2c bus. + + +Required properties: +- compatible : Must be "ti,twl4030"; + For Integrated power-management/audio CODEC device used in OMAP3 + based boards +- compatible : Must be "ti,twl6030"; + For Integrated power-management used in OMAP4 based boards +- interrupts : This i2c device has an IRQ line connected to the main SoC +- interrupt-controller : Since the twl support several interrupts internally, + it is considered as an interrupt controller cascaded to the SoC one. +- #interrupt-cells = <1>; +- interrupt-parent : The parent interrupt controller. + +Optional node: +- Child nodes contain in the twl. The twl family is made of severals variants + that support a different number of features. + The children nodes will thus depend of the capabilty of the variant. + + +Example: +/* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/twl6030.pdf + */ +twl at 48 { + compatible = "ti,twl6030"; + reg = <0x48>; + interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */ + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + #address-cells = <1>; + #size-cells = <0>; + + twl_rtc { + compatible = "ti,twl_rtc"; + interrupts = <11>; + reg = <0>; + }; +};
drivers/mfd/twl-core.c +49 -4
87 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 3/10 mfd: twl-core: Add initial DT support for twl4030/twl6030
Hi Benoit,
Quoted 7 lines · Benoit Cousson
Add initial device-tree support for twl familly chips. The current version is missing the regulator entries due to the lack of DT regulator bindings for the moment. Only the simple sub-modules that do not depend on
platform_datainformation can be initialized properly.Add documentation for the Texas Instruments TWL Integrated Chip.
Thanks, patch applied.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
PATCH v2 3/10 mfd: twl-core: Add initial DT support for twl4030/twl6030
Salut Samuel,
Quoted 11 lines · Samuel Ortiz
Hi Benoit,
Quoted 7 lines · Benoit Cousson
Add initial device-tree support for twl familly chips. The current version is missing the regulator entries due to the lack of DT regulator bindings for the moment. Only the simple sub-modules that do not depend on
platform_datainformation can be initialized properly.Add documentation for the Texas Instruments TWL Integrated Chip.
Thanks, patch applied.
Thanks,
Benoit
PATCH v2 3/10 mfd: twl-core: Add initial DT support for twl4030/twl6030
In reply to Benoit CoussonQuoted 91 lines · Benoit Cousson
Add initial device-tree support for twl familly chips. The current version is missing the regulator entries due to the lack of DT regulator bindings for the moment. Only the simple sub-modules that do not depend on
platform_datainformation can be initialized properly.Add documentation for the Texas Instruments TWL Integrated Chip.
Signed-off-by Benoit Cousson <[email protected]>Cc Balaji T K <[email protected]>Cc Graeme Gregory <[email protected]>Cc Samuel Ortiz <[email protected]>--- .../devicetree/bindings/mfd/twl-familly.txt | 47 +++++++++++++++++ drivers/mfd/twl-core.c | 53 ++++++++++++++++++-- 2 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/twl-familly.txtDocumentation/devicetree/bindings/mfd/twl-familly.txt new file +47
-0@@ -0,0 +1,47 @@ +Texas Instruments TWL family + +The TWLs are Integrated Power Management Chips. +Some version might contain much more analog function like +USB transceiver or Audio amplifier. +These chips are connected to an i2c bus. + + +Required properties: +- compatible : Must be "ti,twl4030"; + For Integrated power-management/audio CODEC device used in OMAP3 + based boards +- compatible : Must be "ti,twl6030"; + For Integrated power-management used in OMAP4 based boards +- interrupts : This i2c device has an IRQ line connected to the main SoC +- interrupt-controller : Since the twl support several interrupts internally, + it is considered as an interrupt controller cascaded to the SoC one. +- #interrupt-cells = <1>; +- interrupt-parent : The parent interrupt controller. + +Optional node: +- Child nodes contain in the twl. The twl family is made of severals variants + that support a different number of features. + The children nodes will thus depend of the capabilty of the variant. + + +Example: +/* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/twl6030.pdf + */ +twl at 48 { + compatible = "ti,twl6030"; + reg = <0x48>; + interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */ + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + #address-cells = <1>; + #size-cells = <0>; + + twl_rtc { + compatible = "ti,twl_rtc"; + interrupts = <11>; + reg = <0>; + }; +};drivers/mfd/twl-core.c +5
-0@@ -34,6 +34,10 @@#include <linux/platform_device.h> #include <linux/clk.h> #include <linux/err.h> +#include <linux/slab.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> +#include <linux/irqdomain.h> #include <linux/regulator/machine.h> @@ -1183,22 +1187,53 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)int status;unsigned i;struct twl4030_platform_data *pdata = client->dev.platform_data; +struct device_node *node = client->dev.of_node;
drivers/mfd/twl-core.c twl_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1200
Quoted 10 lines
drivers/mfd/twl-core.c +7
-0u8 temp;int ret =0 ; +if (node && !pdata) { +/* +* XXX: Temporary fake pdata until the information +* is correctly retrieved by every TWL modules from DT. +*/ + pdata =kzalloc (sizeof (struct twl4030_platform_data ), +GFP_KERNEL );
devm_kzalloc() so that it gets cleaned up on remove.
Quoted 8 lines
drivers/mfd/twl-core.c +8
-0+if (!pdata) { + status = -ENOMEM ; + goto exit; + } + +/* +* XXX: For the moment the IRQs for TWL seems to be encoded in +* the global OMAP space. That should be cleaned to allow
drivers/mfd/twl-core.c twl_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1218
Quoted 10 lines
drivers/mfd/twl-core.c +10
-0+* dynamically adding a new IRQ controller. +*/ +if ((id->driver_data) &TWL6030_CLASS ) { + pdata->irq_base =TWL6030_IRQ_BASE ; + pdata->irq_end = pdata->irq_base +TWL6030_BASE_NR_IRQS ; + }else { + pdata->irq_base =TWL4030_IRQ_BASE ; + pdata->irq_end = pdata->irq_base +TWL4030_BASE_NR_IRQS ; + } +irq_domain_add_simple (node, pdata->irq_base);
Yes, you'll want a follow-up patch to convert to dynamically allocated irqs... but I've got to merge the final irq_domain work first. :-)
Quoted 49 lines
drivers/mfd/twl-core.c +19
-4+ } +if (!pdata) {dev_dbg (&client->dev,"no platform data?\n" ); -return -EINVAL ; + status = -EINVAL ; + goto fail_free; }if (i2c_check_functionality (client->adapter,I2C_FUNC_I2C ) ==0 ) {dev_dbg (&client->dev,"can't talk I2C?\n" ); -return -EIO ; + status = -EIO ; + goto fail_free; }if (inuse) {dev_dbg (&client->dev,"driver is already in use\n" ); -return -EBUSY ; + status = -EBUSY ; + goto fail_free; }for (i =0 ; i <TWL_NUM_SLAVES ; i++) {@@ -1270,10 +1305,20 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)twl_i2c_write_u8 (TWL4030_MODULE_INTBR , temp,REG_GPPUPDCTR1 ); } - status =add_children (pdata, id->driver_data); +#ifdef CONFIG_OF_DEVICE +if (node) + status =of_platform_populate (node,NULL ,NULL , &client->dev); + else +#endif + status =add_children (pdata, id->driver_data); + fail:if (status <0 )twl_remove (client); +fail_free: +if (node) +kfree (pdata); +exit:return status; }Signature · 1 line
1.7.0.4
PATCH v2 3/10 mfd: twl-core: Add initial DT support for twl4030/twl6030
Hi Grant,
Quoted 1 line · Grant Likely
On Fri, Dec 09, 2011 at 03:02:34PM +0100, Benoit Cousson wrote:
[...]
Quoted 8 lines
Quoted 8 lines
drivers/mfd/twl-core.c +1
-0@@ -1183,22 +1187,53 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)int status;unsigned i;struct twl4030_platform_data *pdata = client->dev.platform_data; +struct device_node *node = client->dev.of_node;u8 temp;int ret =0 ;
Quoted 9 lines
drivers/mfd/twl-core.c twl_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1200
Quoted 7 lines
drivers/mfd/twl-core.c +7
-0+if (node&& !pdata) { +/* +* XXX: Temporary fake pdata until the information +* is correctly retrieved by every TWL modules from DT. +*/ + pdata =kzalloc (sizeof (struct twl4030_platform_data ), +GFP_KERNEL );
devm_kzalloc()so that it gets cleaned up on remove.
Yep, it was already updated like that in the v4.
Quoted 13 lines
Quoted 13 lines
drivers/mfd/twl-core.c +13
-0+if (!pdata) { + status = -ENOMEM ; + goto exit; + } + +/* +* XXX: For the moment the IRQs for TWL seems to be encoded in +* the global OMAP space. That should be cleaned to allow +* dynamically adding a new IRQ controller. +*/ +if ((id->driver_data)&TWL6030_CLASS ) { + pdata->irq_base =TWL6030_IRQ_BASE ; + pdata->irq_end = pdata->irq_base +TWL6030_BASE_NR_IRQS ;
Quoted 8 lines
drivers/mfd/twl-core.c twl_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1218
Quoted 5 lines
drivers/mfd/twl-core.c +5
-0+ }else { + pdata->irq_base =TWL4030_IRQ_BASE ; + pdata->irq_end = pdata->irq_base +TWL4030_BASE_NR_IRQS ; + } +irq_domain_add_simple (node, pdata->irq_base);Yes, you'll want a follow-up patch to convert to dynamically allocated irqs... but I've got to merge the final
irq_domainwork first. :-)
Yes. I already have a version based on Rob's series, but did not push it since Rob was not confident with the merge of that feature for 3.3.
Quoted 1 line
Acked-by Grant Likely<[email protected]>
Thanks,
Benoit
PATCH v2 4/10 rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
In reply to Benoit CoussonAdd the DT support for the TI rtc-twl present in the twl4030 and twl6030 devices.
--- Documentation/devicetree/bindings/rtc/twl-rtc.txt | 12 ++++++++++++ drivers/rtc/rtc-twl.c | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txt
Documentation/devicetree/bindings/rtc/twl-rtc.txt new file +12 -0
@@ -0,0 +1,12 @@ +* TI twl RTC + +The TWL family (twl4030/6030) contains a RTC. + +Required properties: +- compatible : Should be twl4030-rtc + +Examples: + +rtc at 0 { + compatible = "ti,twl4030-rtc"; +};
drivers/rtc/rtc-twl.c +8 -2
@@ -550,6 +550,11 @@ static int twl_rtc_resume(struct platform_device *pdev)#define twl_rtc_resume NULL#endif +static const struct of_device_id twl_rtc_of_match[] = { + {.compatible ="ti,twl4030-rtc" , }, + { }, +}; +MODULE_DEVICE_TABLE (of, twl_rtc_of_match);MODULE_ALIAS ("platform:twl_rtc" );static struct platform_driver twl4030rtc_driver = {
@@ -559,8 +564,9 @@ static struct platform_driver twl4030rtc_driver = { .suspend = twl_rtc_suspend, .resume = twl_rtc_resume, .driver = { - .owner = THIS_MODULE, - .name = "twl_rtc", + .owner = THIS_MODULE, + .name = "twl_rtc", + .of_match_table = twl_rtc_of_match, }, };
Signature · 1 line
1.7.0.4
PATCH v2 4/10 rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
Hi Alessandro,
Gentle ping on this patch.
Thanks,
Benoit
Quoted 57 lines · Benoit Cousson
Add the DT support for the TI rtc-twl present in the twl4030 and twl6030 devices.
Signed-off-by Benoit Cousson<[email protected]>Cc Alessandro Zummo<[email protected]>--- Documentation/devicetree/bindings/rtc/twl-rtc.txt | 12 ++++++++++++ drivers/rtc/rtc-twl.c | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-)create mode 100644
Documentation/devicetree/bindings/rtc/twl-rtc.txtDocumentation/devicetree/bindings/rtc/twl-rtc.txt new file +12
-0@@ -0,0 +1,12 @@ +* TI twl RTC + +The TWL family (twl4030/6030) contains a RTC. + +Required properties: +- compatible : Should be twl4030-rtc + +Examples: + +rtc at 0 { + compatible = "ti,twl4030-rtc"; +};drivers/rtc/rtc-twl.c +8
-2@@ -550,6 +550,11 @@ static int twl_rtc_resume(struct platform_device *pdev)#define twl_rtc_resume NULL#endif +static const struct of_device_id twl_rtc_of_match[] = { + {.compatible ="ti,twl4030-rtc" , }, + { }, +}; +MODULE_DEVICE_TABLE (of, twl_rtc_of_match);MODULE_ALIAS ("platform:twl_rtc" );static struct platform_driver twl4030rtc_driver = {@@ -559,8 +564,9 @@ static struct platform_driver twl4030rtc_driver = { .suspend = twl_rtc_suspend, .resume = twl_rtc_resume, .driver = { - .owner = THIS_MODULE, - .name = "twl_rtc", + .owner = THIS_MODULE, + .name = "twl_rtc", + .of_match_table = twl_rtc_of_match, }, };
PATCH v2 4/10 rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
Quoted 3 lines · Benoit
Hi Alessandro,
Gentle ping on this patch.
Hi,
Andrew will probably pick it up. ty.
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
PATCH v2 4/10 rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
In reply to Benoit CoussonHi Andrew,
I've never got any feedback on this patch from Alessandro and it seems that you took care of some rtc stuff recently.
Thanks in advance,
Benoit
Quoted 57 lines · Benoit Cousson
Add the DT support for the TI rtc-twl present in the twl4030 and twl6030 devices.
Signed-off-by Benoit Cousson<[email protected]>Cc Alessandro Zummo<[email protected]>--- Documentation/devicetree/bindings/rtc/twl-rtc.txt | 12 ++++++++++++ drivers/rtc/rtc-twl.c | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-)create mode 100644
Documentation/devicetree/bindings/rtc/twl-rtc.txtDocumentation/devicetree/bindings/rtc/twl-rtc.txt new file +12
-0@@ -0,0 +1,12 @@ +* TI twl RTC + +The TWL family (twl4030/6030) contains a RTC. + +Required properties: +- compatible : Should be twl4030-rtc + +Examples: + +rtc at 0 { + compatible = "ti,twl4030-rtc"; +};drivers/rtc/rtc-twl.c +8
-2@@ -550,6 +550,11 @@ static int twl_rtc_resume(struct platform_device *pdev)#define twl_rtc_resume NULL#endif +static const struct of_device_id twl_rtc_of_match[] = { + {.compatible ="ti,twl4030-rtc" , }, + { }, +}; +MODULE_DEVICE_TABLE (of, twl_rtc_of_match);MODULE_ALIAS ("platform:twl_rtc" );static struct platform_driver twl4030rtc_driver = {@@ -559,8 +564,9 @@ static struct platform_driver twl4030rtc_driver = { .suspend = twl_rtc_suspend, .resume = twl_rtc_resume, .driver = { - .owner = THIS_MODULE, - .name = "twl_rtc", + .owner = THIS_MODULE, + .name = "twl_rtc", + .of_match_table = twl_rtc_of_match, }, };
PATCH v2 4/10 rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030
In reply to Benoit CoussonQuoted 5 lines · Benoit Cousson
Add the DT support for the TI rtc-twl present in the twl4030 and twl6030 devices.
Signed-off-by Benoit Cousson <[email protected]>Cc Alessandro Zummo <[email protected]>
Quoted 60 lines
--- Documentation/devicetree/bindings/rtc/twl-rtc.txt | 12 ++++++++++++ drivers/rtc/rtc-twl.c | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/rtc/twl-rtc.txtDocumentation/devicetree/bindings/rtc/twl-rtc.txt new file +12
-0@@ -0,0 +1,12 @@ +* TI twl RTC + +The TWL family (twl4030/6030) contains a RTC. + +Required properties: +- compatible : Should be twl4030-rtc + +Examples: + +rtc at 0 { + compatible = "ti,twl4030-rtc"; +};drivers/rtc/rtc-twl.c +8
-2@@ -550,6 +550,11 @@ static int twl_rtc_resume(struct platform_device *pdev)#define twl_rtc_resume NULL#endif +static const struct of_device_id twl_rtc_of_match[] = { + {.compatible ="ti,twl4030-rtc" , }, + { }, +}; +MODULE_DEVICE_TABLE (of, twl_rtc_of_match);MODULE_ALIAS ("platform:twl_rtc" );static struct platform_driver twl4030rtc_driver = {@@ -559,8 +564,9 @@ static struct platform_driver twl4030rtc_driver = { .suspend = twl_rtc_suspend, .resume = twl_rtc_resume, .driver = { - .owner = THIS_MODULE, - .name = "twl_rtc", + .owner = THIS_MODULE, + .name = "twl_rtc", + .of_match_table = twl_rtc_of_match, }, };Signature · 7 lines
1.7.0.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 5/10 arm/dts: OMAP4: Add i2c controller nodes
In reply to Benoit CoussonAdd i2c controllers nodes into the main ocp bus.
--- arch/arm/boot/dts/omap4.dtsi | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4.dtsi +28 -0
@@ -100,5 +100,33 @@ reg = <0x48241000 0x1000>, <0x48240100 0x0100>; }; + + i2c1: i2c at 1 { + compatible = "ti,omap4-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c1"; + }; + + i2c2: i2c at 2 { + compatible = "ti,omap4-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c2"; + }; + + i2c3: i2c at 3 { + compatible = "ti,omap4-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c3"; + }; + + i2c4: i2c at 4 { + compatible = "ti,omap4-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c4"; + }; }; };
Signature · 1 line
1.7.0.4
PATCH v2 5/10 arm/dts: OMAP4: Add i2c controller nodes
Quoted 5 lines · Benoit Cousson
Add i2c controllers nodes into the main ocp bus.
Signed-off-by Benoit Cousson <[email protected]>Cc Grant Likely <[email protected]>Cc Rob Herring <[email protected]>
Quoted 50 lines
--- arch/arm/boot/dts/omap4.dtsi | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap4.dtsi +28
-0@@ -100,5 +100,33 @@ reg = <0x48241000 0x1000>, <0x48240100 0x0100>; }; + + i2c1: i2c at 1 { + compatible = "ti,omap4-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c1"; + }; + + i2c2: i2c at 2 { + compatible = "ti,omap4-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c2"; + }; + + i2c3: i2c at 3 { + compatible = "ti,omap4-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c3"; + }; + + i2c4: i2c at 4 { + compatible = "ti,omap4-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c4"; + }; }; };Signature · 7 lines
1.7.0.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 6/10 arm/dts: OMAP3: Add i2c controller nodes
In reply to Benoit CoussonAdd i2c controllers nodes into the main ocp bus.
--- arch/arm/boot/dts/omap3.dtsi | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap3.dtsi +28 -0
@@ -61,5 +61,33 @@ ti,intc-size = <96>; reg = <0x48200000 0x1000>; }; + + /* + * Flags for all i2c instances: 0x118 + * APPLY_ERRATA_I207 | RESET_REGS_POSTIDLE | BUS_SHIFT_2 + */ + i2c1: i2c at 1 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c1"; + ti,flags = <0x118>; + }; + + i2c2: i2c at 2 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c2"; + ti,flags = <0x118>; + }; + + i2c3: i2c at 3 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c3"; + ti,flags = <0x118>; + }; }; };
Signature · 1 line
1.7.0.4
PATCH v2 6/10 arm/dts: OMAP3: Add i2c controller nodes
Quoted 5 lines · Benoit Cousson
Add i2c controllers nodes into the main ocp bus.
Signed-off-by Benoit Cousson <[email protected]>Cc Grant Likely <[email protected]>Cc Rob Herring <[email protected]>
Quoted 50 lines
--- arch/arm/boot/dts/omap3.dtsi | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap3.dtsi +28
-0@@ -61,5 +61,33 @@ ti,intc-size = <96>; reg = <0x48200000 0x1000>; }; + + /* + * Flags for all i2c instances: 0x118 + * APPLY_ERRATA_I207 | RESET_REGS_POSTIDLE | BUS_SHIFT_2 + */ + i2c1: i2c at 1 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c1"; + ti,flags = <0x118>; + }; + + i2c2: i2c at 2 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c2"; + ti,flags = <0x118>; + }; + + i2c3: i2c at 3 { + compatible = "ti,omap3-i2c"; + #address-cells = <1>; + #size-cells = <0>; + ti,hwmods = "i2c3"; + ti,flags = <0x118>; + }; }; };Signature · 7 lines
1.7.0.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 7/10 arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
In reply to Benoit CoussonUpdate pandaboard dts file with required clock frequencies for the i2c client devices existing on pandaboard.
Add the twl6030 node in i2c1 controller.
This is the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.
Add a generic i2c EEPROM entry.
--- arch/arm/boot/dts/omap4-panda.dts | 45 +++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda.dts +45 -0
@@ -18,3 +18,48 @@ reg = <0x80000000 0x40000000>; /* 1 GB */ }; }; + +&i2c1 { + clock-frequency = <400000>; + + /* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/twl6030.pdf + */ + twl at 48 { + compatible = "ti,twl6030"; + reg = <0x48>; + /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ + interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + + /* twl is a MFD, so it will contain a bunch of sub-ips */ + rtc { + compatible = "ti,twl4030-rtc"; + interrupts = <11>; + }; + }; +}; + +&i2c2 { + clock-frequency = <400000>; +}; + +&i2c3 { + clock-frequency = <100000>; + + /* + * Display monitor features are burnt in their EEPROM as EDID data. + * The EEPROM is connected as I2C slave device. + */ + eeprom at 50 { + compatible = "ti,eeprom"; + reg = <0x50>; + }; +}; + +&i2c4 { + clock-frequency = <400000>; +};
Signature · 1 line
1.7.0.4
PATCH v2 7/10 arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
Hi Benoit,
Quoted 38 lines · Benoit Cousson
Update pandaboard dts file with required clock frequencies for the i2c client devices existing on pandaboard.
Add the twl6030 node in i2c1 controller.
This is the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.Add a generic i2c EEPROM entry.
Signed-off-by Benoit Cousson <[email protected]>Cc Grant Likely <[email protected]>--- arch/arm/boot/dts/omap4-panda.dts | 45 +++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap4-panda.dts +12
-0@@ -18,3 +18,48 @@ reg = <0x80000000 0x40000000>; /* 1 GB */ }; }; + +&i2c1 { + clock-frequency = <400000>; + + /* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/twl6030.pdf + */ + twl at 48 { + compatible = "ti,twl6030"; + reg = <0x48>; + /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
arch/arm/boot/dts/omap4-panda.dts line 42
Quoted 10 lines
arch/arm/boot/dts/omap4-panda.dts +10
-0+ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + + /* twl is a MFD, so it will contain a bunch of sub-ips */ + rtc { + compatible = "ti,twl4030-rtc"; + interrupts = <11>; + };
After seeing the mostly cut & paste in Rajendra's regulator series, I'm wondering if it wouldn't be better to just have a twl4030.dtsi here which has the RTC and all the regulators with the default voltage ranges from the TWL data sheet.
Not knowing much about how includes work in DT, would it then be possible for board files to override things like default voltage ranges for regulators?
Kevin
PATCH v2 7/10 arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
Hi Kevin,
Quoted 49 lines · Kevin Hilman
Hi Benoit,
Quoted 45 lines · Benoit Cousson
Update pandaboard dts file with required clock frequencies for the i2c client devices existing on pandaboard.
Add the twl6030 node in i2c1 controller.
This is the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.Add a generic i2c EEPROM entry.
Signed-off-by Benoit Cousson<[email protected]>Cc Grant Likely<[email protected]>--- arch/arm/boot/dts/omap4-panda.dts | 45 +++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap4-panda.dts +19
-0@@ -18,3 +18,48 @@ reg =<0x80000000 0x40000000>; /* 1 GB */ }; }; + +&i2c1 { + clock-frequency =<400000>; + + /* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/twl6030.pdf + */ + twl at 48 { + compatible = "ti,twl6030"; + reg =<0x48>; + /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ + interrupts =<0 7 4>; /* IRQ_SYS_1N cascaded to gic */ + interrupt-controller; + #interrupt-cells =<1>; + interrupt-parent =<&gic>; + + /* twl is a MFD, so it will contain a bunch of sub-ips */ + rtc {
Quoted 8 lines
arch/arm/boot/dts/omap4-panda.dts line 42
Quoted 3 lines
arch/arm/boot/dts/omap4-panda.dts +3
-0+ compatible = "ti,twl4030-rtc"; + interrupts =<11>; + };After seeing the mostly cut& paste in Rajendra's regulator series, I'm wondering if it wouldn't be better to just have a
twl4030.dtsihere which has the RTC and all the regulators with the default voltage ranges from the TWL data sheet.
Yes, indeed, it is still small here but will become much bigger with the regulators.
In fact twl6030 is a SoC like OMAP, so all the TWL specific internal details can be located in a single file.
The board will just have to provide the i2c address and the IRQ information.
Quoted 3 lines
Not knowing much about how includes work in DT, would it then be possible for board files to override things like default voltage ranges for regulators?
To be honest, I was wondering as well how to do that with the /include/ functionality :-)
But I've just done a couple of DTC test, and this seems to be pretty straightforward.
The boards will contain that:
&i2c1 {
clock-frequency = <400000>;
twl: twl at 48 {
reg = <0x48>;
/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
interrupt-controller;
interrupt-parent = <&gic>;
};
};/include/ "twl6030.dtsi"
...
And the twl6030.dtsi will contain that for the moment:
/*
* Integrated Power Management Chip
* http://www.ti.com/lit/ds/symlink/twl6030.pdf
*/
&twl {
compatible = "ti,twl6030";
#interrupt-cells = <1>;
/* twl is a MFD, so it will contain a bunch of sub-ips */
rtc {
compatible = "ti,twl4030-rtc";
interrupts = <11>;
};
};And then all the regulators from Rajendra's series will be there as well.
This will avoid the duplication between sdp and panda. Beagle will need a twl4030.dtsi which is different than the twl6030.
I'll update and repost the series soon.
Thanks,
Benoit
PATCH v2 7/10 arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
Quoted 89 lines · Benoit
Hi Kevin,
Quoted 49 lines · Kevin Hilman
Hi Benoit,
Quoted 45 lines · Benoit Cousson
Update pandaboard dts file with required clock frequencies for the i2c client devices existing on pandaboard.
Add the twl6030 node in i2c1 controller.
This is the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.Add a generic i2c EEPROM entry.
Signed-off-by Benoit Cousson<[email protected]>Cc Grant Likely<[email protected]>--- arch/arm/boot/dts/omap4-panda.dts | 45 +++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap4-panda.dts +19
-0@@ -18,3 +18,48 @@ reg =<0x80000000 0x40000000>; /* 1 GB */ }; }; + +&i2c1 { + clock-frequency =<400000>; + + /* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/twl6030.pdf + */ + twl at 48 { + compatible = "ti,twl6030"; + reg =<0x48>; + /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ + interrupts =<0 7 4>; /* IRQ_SYS_1N cascaded to gic */ + interrupt-controller; + #interrupt-cells =<1>; + interrupt-parent =<&gic>; + + /* twl is a MFD, so it will contain a bunch of sub-ips */ + rtc {Quoted 8 lines
arch/arm/boot/dts/omap4-panda.dts line 42
Quoted 3 lines
arch/arm/boot/dts/omap4-panda.dts +3
-0+ compatible = "ti,twl4030-rtc"; + interrupts =<11>; + };After seeing the mostly cut& paste in Rajendra's regulator series, I'm wondering if it wouldn't be better to just have a
twl4030.dtsihere which has the RTC and all the regulators with the default voltage ranges from the TWL data sheet.Yes, indeed, it is still small here but will become much bigger with the regulators.
In fact twl6030 is a SoC like OMAP, so all the TWL specific internal details can be located in a single file.
The board will just have to provide the i2c address and the IRQ information.Quoted 3 lines
Not knowing much about how includes work in DT, would it then be possible for board files to override things like default voltage ranges for regulators?
To be honest, I was wondering as well how to do that with the /include/ functionality :-)
But I've just done a couple of DTC test, and this seems to be pretty straightforward.The boards will contain that:
&i2c1 { clock-frequency = <400000>; twl: twl at 48 { reg = <0x48>; /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ interrupt-controller; interrupt-parent = <&gic>; }; };
Quoted 2 lines
/include/ "
twl6030.dtsi"
Nice.
Quoted 19 lines
...
And the
twl6030.dtsiwill contain that for the moment:/*
* Integrated Power Management Chip
* http://www.ti.com/lit/ds/symlink/twl6030.pdf
*/&twl { compatible = "ti,twl6030"; #interrupt-cells = <1>; /* twl is a MFD, so it will contain a bunch of sub-ips */ rtc { compatible = "ti,twl4030-rtc"; interrupts = <11>; }; };
Quoted 4 lines
And then all the regulators from Rajendra's series will be there as well.
This will avoid the duplication between sdp and panda. Beagle will need a
twl4030.dtsiwhich is different than the twl6030.
Great!
Quoted 1 line
I'll update and repost the series soon.
Thanks,
Kevin
PATCH v2 7/10 arm/dts: omap4-panda: Add twl6030 and i2c EEPROM
In reply to Benoit CoussonQuoted 10 lines · Benoit Cousson
Update pandaboard dts file with required clock frequencies for the i2c client devices existing on pandaboard.
Add the twl6030 node in i2c1 controller.
This is the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.
Quoted 4 lines
Add a generic i2c EEPROM entry.
Signed-off-by Benoit Cousson <[email protected]>Cc Grant Likely <[email protected]>
Quoted 65 lines
--- arch/arm/boot/dts/omap4-panda.dts | 45 +++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap4-panda.dts +45
-0@@ -18,3 +18,48 @@ reg = <0x80000000 0x40000000>; /* 1 GB */ }; }; + +&i2c1 { + clock-frequency = <400000>; + + /* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/twl6030.pdf + */ + twl at 48 { + compatible = "ti,twl6030"; + reg = <0x48>; + /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ + interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + + /* twl is a MFD, so it will contain a bunch of sub-ips */ + rtc { + compatible = "ti,twl4030-rtc"; + interrupts = <11>; + }; + }; +}; + +&i2c2 { + clock-frequency = <400000>; +}; + +&i2c3 { + clock-frequency = <100000>; + + /* + * Display monitor features are burnt in their EEPROM as EDID data. + * The EEPROM is connected as I2C slave device. + */ + eeprom at 50 { + compatible = "ti,eeprom"; + reg = <0x50>; + }; +}; + +&i2c4 { + clock-frequency = <400000>; +};Signature · 7 lines
1.7.0.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 8/10 arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices
In reply to Benoit CoussonUpdate DTS file with required clock frequencies for the i2c client devices existing on sdp4430.
Add the twl6030 node inside the i2c1 controller node. This is the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.
Add the RTC submodule inside the twl node.
Add tmp105 temperature sensor in i2c3
Add bh1780 Ambient Light Sensor in i2c3
Add hmc5843 3-Axis Digital Compass in i2c4
--- arch/arm/boot/dts/omap4-sdp.dts | 63 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-sdp.dts +63 -0
@@ -18,3 +18,66 @@ reg = <0x80000000 0x40000000>; /* 1 GB */ }; }; + +&i2c1 { + clock-frequency = <400000>; + + /* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/twl6030.pdf + */ + twl at 48 { + compatible = "ti,twl6030"; + reg = <0x48>; + /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ + interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + + /* twl is a MFD, so it will contain a bunch of sub-ips */ + rtc { + compatible = "ti,twl4030-rtc"; + interrupts = <11>; + }; + }; +}; + +&i2c2 { + clock-frequency = <400000>; +}; + +&i2c3 { + clock-frequency = <400000>; + + /* + * Temperature Sensor + * http://www.ti.com/lit/ds/symlink/tmp105.pdf + */ + tmp105 at 48 { + compatible = "ti,tmp105"; + reg = <0x48>; + }; + + /* + * Ambient Light Sensor + * http://www.rohm.com/products/databook/sensor/pdf/bh1780gli-e.pdf + */ + bh1780 at 29 { + compatible = "rohm,bh1780"; + reg = <0x29>; + }; +}; + +&i2c4 { + clock-frequency = <400000>; + + /* + * 3-Axis Digital Compass + * http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC5843.pdf + */ + hmc5843 at 1e { + compatible = "honeywell,hmc5843"; + reg = <0x1e>; + }; +};
Signature · 1 line
1.7.0.4
PATCH v2 8/10 arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices
Quoted 9 lines · Benoit Cousson
Update DTS file with required clock frequencies for the i2c client devices existing on sdp4430.
Add the twl6030 node inside the i2c1 controller node. This is the minimal support needed to boot OMAP4 boards without any crash.
The support for all the features included in this MFD will be added later.
Quoted 8 lines
Add the RTC submodule inside the twl node.
Add tmp105 temperature sensor in i2c3
Add bh1780 Ambient Light Sensor in i2c3
Add hmc5843 3-Axis Digital Compass in i2c4Signed-off-by Benoit Cousson <[email protected]>Cc Grant Likely <[email protected]>
Quoted 78 lines
--- arch/arm/boot/dts/omap4-sdp.dts | 63 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap4-sdp.dts +63
-0@@ -18,3 +18,66 @@ reg = <0x80000000 0x40000000>; /* 1 GB */ }; }; + +&i2c1 { + clock-frequency = <400000>; + + /* + * Integrated Power Management Chip + * http://www.ti.com/lit/ds/symlink/twl6030.pdf + */ + twl at 48 { + compatible = "ti,twl6030"; + reg = <0x48>; + /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ + interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&gic>; + + /* twl is a MFD, so it will contain a bunch of sub-ips */ + rtc { + compatible = "ti,twl4030-rtc"; + interrupts = <11>; + }; + }; +}; + +&i2c2 { + clock-frequency = <400000>; +}; + +&i2c3 { + clock-frequency = <400000>; + + /* + * Temperature Sensor + * http://www.ti.com/lit/ds/symlink/tmp105.pdf + */ + tmp105 at 48 { + compatible = "ti,tmp105"; + reg = <0x48>; + }; + + /* + * Ambient Light Sensor + * http://www.rohm.com/products/databook/sensor/pdf/bh1780gli-e.pdf + */ + bh1780 at 29 { + compatible = "rohm,bh1780"; + reg = <0x29>; + }; +}; + +&i2c4 { + clock-frequency = <400000>; + + /* + * 3-Axis Digital Compass + * http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC5843.pdf + */ + hmc5843 at 1e { + compatible = "honeywell,hmc5843"; + reg = <0x1e>; + }; +};Signature · 1 line
1.7.0.4
PATCH v2 9/10 arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
In reply to Benoit CoussonAdd required clock frequencies for the i2c client devices existing on beagle board.
Add the twl4030 basic description with only the twl_rtc module.
Add the EEPROM node.
Based on original patch from Manju:
http://www.spinics.net/lists/linux-omap/msg55831.html
--- arch/arm/boot/dts/omap3-beagle.dts | 38 ++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap3-beagle.dts +38 -0
@@ -18,3 +18,41 @@ reg = <0x80000000 0x20000000>; /* 512 MB */ }; }; + +&i2c1 { + clock-frequency = <2600000>; + + /* + * Integrated Power Management Chip + */ + twl at 48 { + compatible = "ti,twl4030"; + reg = <0x48>; + interrupts = <7>; /* SYS_NIRQ cascaded to intc */ + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&intc>; + + twl_rtc { + compatible = "ti,twl4030-rtc"; + interrupts = <11>; + }; + }; +}; + +&i2c2 { + clock-frequency = <400000>; +}; + +&i2c3 { + clock-frequency = <100000>; + + /* + * Display monitor features are burnt in the EEPROM + * as EDID data. + */ + eeprom at 50 { + compatible = "ti,eeprom"; + reg = <0x50>; + }; +};
Signature · 1 line
1.7.0.4
PATCH v2 9/10 arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
Quoted 5 lines · Benoit Cousson
Add required clock frequencies for the i2c client devices existing on beagle board.
Add the twl4030 basic description with only the
twl_rtcmodule.
Quoted 8 lines
Add the EEPROM node.
Based on original patch from Manju:
http://www.spinics.net/lists/linux-omap/msg55831.htmlSigned-off-by Benoit Cousson <[email protected]>Cc Grant Likely <[email protected]>Cc Rob Herring <[email protected]>
Quoted 53 lines
--- arch/arm/boot/dts/omap3-beagle.dts | 38 ++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)arch/arm/boot/dts/omap3-beagle.dts +38
-0@@ -18,3 +18,41 @@ reg = <0x80000000 0x20000000>; /* 512 MB */ }; }; + +&i2c1 { + clock-frequency = <2600000>; + + /* + * Integrated Power Management Chip + */ + twl at 48 { + compatible = "ti,twl4030"; + reg = <0x48>; + interrupts = <7>; /* SYS_NIRQ cascaded to intc */ + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&intc>; + + twl_rtc { + compatible = "ti,twl4030-rtc"; + interrupts = <11>; + }; + }; +}; + +&i2c2 { + clock-frequency = <400000>; +}; + +&i2c3 { + clock-frequency = <100000>; + + /* + * Display monitor features are burnt in the EEPROM + * as EDID data. + */ + eeprom at 50 { + compatible = "ti,eeprom"; + reg = <0x50>; + }; +};Signature · 1 line
1.7.0.4
PATCH v2 9/10 arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
In reply to Benoit CoussonQuoted 5 lines · Benoit Cousson
+ ? ? ? eeprom at 50 {
+ ? ? ? ? ? ? ? compatible = "ti,eeprom";
+ ? ? ? ? ? ? ? reg = <0x50>;
+ ? ? ? };
Why is this "ti,"? For EDID, isn't the I2C device actually on the monitor itself, and DVI cable just connects to the I2C bus?
The reason I ask is that I'm trying to do the same thing for a PowerPC board. I need to defined an EDID I2C node.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH v2 9/10 arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM
Quoted 9 lines · On 1/10/2012 12:24 AM, Tabi Timur-B04825 wrote:
arch/arm/boot/dts/omap3-beagle.dts line 57
Quoted 5 lines · Benoit Cousson
arch/arm/boot/dts/omap3-beagle.dts +4
-0+ eeprom at 50 { + compatible = "ti,eeprom"; + reg =<0x50>; + };Why is this "ti,"? For EDID, isn't the I2C device actually on the monitor itself, and DVI cable just connects to the I2C bus?
Yes, in fact I didn't know what to put here, since I do not know what kind of eeprom the monitor will use.
And then I realized that the i2c driver is using the compatible name without the prefix, so any prefix can be used there... OK, that's maybe not a very valid reason... but I did not find any better prefix at that time:-)
Quoted 2 lines
The reason I ask is that I'm trying to do the same thing for a PowerPC board. I need to defined an EDID I2C node.
Well, this seems to be generic i2c eeprom, so maybe a "ddc," prefix or "edid," will be a little bit better.
If later, we want to access that node from the display driver, we can just add a phandle to the node's label: "edid-eeprom: eeprom at 50:"
Regards,
Benoit
PATCH v2 10/10 ARM: OMAP2+: board-generic: Remove i2c static init
In reply to Benoit CoussonThis mainly reverts the commit that was adding the i2c static init.
Since the i2c and twl nodes are now present, there is no need for the static initialization anymore.
--- arch/arm/mach-omap2/board-generic.c | 48 +--------------------------------- 1 files changed, 2 insertions(+), 46 deletions(-)
arch/arm/mach-omap2/board-generic.c +2 -46
@@ -15,7 +15,6 @@#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/irqdomain.h> -#include <linux/i2c/twl.h> #include <mach/hardware.h> #include <asm/hardware/gic.h>
@@ -36,34 +35,6 @@ static void __init omap_init_irq(void)of_irq_init (irq_match); } -/* -* XXX: Still needed to boot until the i2c & twl driver is adapted to -* device-tree -*/ -#ifdef CONFIG_ARCH_OMAP4 -static struct twl4030_platform_data sdp4430_twldata = { - .irq_base =TWL6030_IRQ_BASE , - .irq_end =TWL6030_IRQ_END , -}; - -static void __init omap4_i2c_init (void ) -{ -omap4_pmic_init ("twl6030" , &sdp4430_twldata); -} -#endif - -#ifdef CONFIG_ARCH_OMAP3 -static struct twl4030_platform_data beagle_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -}; - -static void __init omap3_i2c_init (void ) -{ -omap3_pmic_init ("twl4030" , &beagle_twldata); -} -#endif -static struct of_device_id omap_dt_match_table[]__initdata = { { .compatible ="simple-bus" , }, { .compatible ="ti,omap-infra" , },
@@ -78,21 +49,6 @@ static void __init omap_generic_init(void)of_platform_populate (NULL , omap_dt_match_table,NULL ,NULL ); } -#ifdef CONFIG_ARCH_OMAP4 -static void __init omap4_init (void ) -{ -omap4_i2c_init (); -omap_generic_init (); -} -#endif - -#ifdef CONFIG_ARCH_OMAP3 -static void __init omap3_init (void ) -{ -omap3_i2c_init (); -omap_generic_init (); -} -#endif #ifdef CONFIG_SOC_OMAP2420 static const char *omap242x_boards_compat[] __initdata = {
@@ -145,7 +101,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)") .init_early = omap3430_init_early, .init_irq = omap_init_irq, .handle_irq = omap3_intc_handle_irq, - .init_machine = omap3_init, + .init_machine = omap_generic_init, .timer = &omap3_timer, .dt_compat = omap3_boards_compat,MACHINE_END
@@ -164,7 +120,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)") .init_early = omap4430_init_early, .init_irq = omap_init_irq, .handle_irq = gic_handle_irq, - .init_machine = omap4_init, + .init_machine = omap_generic_init, .timer = &omap4_timer, .dt_compat = omap4_boards_compat,MACHINE_END
Signature · 1 line
1.7.0.4
PATCH v2 10/10 ARM: OMAP2+: board-generic: Remove i2c static init
Quoted 7 lines · Benoit Cousson
This mainly reverts the commit that was adding the i2c static init.
Since the i2c and twl nodes are now present, there is no need for the static initialization anymore.
Signed-off-by Benoit Cousson <[email protected]>Cc Tony Lindgren <[email protected]>
Quoted 94 lines
--- arch/arm/mach-omap2/board-generic.c | 48 +--------------------------------- 1 files changed, 2 insertions(+), 46 deletions(-)arch/arm/mach-omap2/board-generic.c +2
-46@@ -15,7 +15,6 @@#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/irqdomain.h> -#include <linux/i2c/twl.h> #include <mach/hardware.h> #include <asm/hardware/gic.h> @@ -36,34 +35,6 @@ static void __init omap_init_irq(void)of_irq_init (irq_match); } -/* -* XXX: Still needed to boot until the i2c & twl driver is adapted to -* device-tree -*/ -#ifdef CONFIG_ARCH_OMAP4 -static struct twl4030_platform_data sdp4430_twldata = { - .irq_base =TWL6030_IRQ_BASE , - .irq_end =TWL6030_IRQ_END , -}; - -static void __init omap4_i2c_init (void ) -{ -omap4_pmic_init ("twl6030" , &sdp4430_twldata); -} -#endif - -#ifdef CONFIG_ARCH_OMAP3 -static struct twl4030_platform_data beagle_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -}; - -static void __init omap3_i2c_init (void ) -{ -omap3_pmic_init ("twl4030" , &beagle_twldata); -} -#endif -static struct of_device_id omap_dt_match_table[]__initdata = { { .compatible ="simple-bus" , }, { .compatible ="ti,omap-infra" , },@@ -78,21 +49,6 @@ static void __init omap_generic_init(void)of_platform_populate (NULL , omap_dt_match_table,NULL ,NULL ); } -#ifdef CONFIG_ARCH_OMAP4 -static void __init omap4_init (void ) -{ -omap4_i2c_init (); -omap_generic_init (); -} -#endif - -#ifdef CONFIG_ARCH_OMAP3 -static void __init omap3_init (void ) -{ -omap3_i2c_init (); -omap_generic_init (); -} -#endif #ifdef CONFIG_SOC_OMAP2420 static const char *omap242x_boards_compat[] __initdata = {@@ -145,7 +101,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)") .init_early = omap3430_init_early, .init_irq = omap_init_irq, .handle_irq = omap3_intc_handle_irq, - .init_machine = omap3_init, + .init_machine = omap_generic_init, .timer = &omap3_timer, .dt_compat = omap3_boards_compat,MACHINE_END @@ -164,7 +120,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)") .init_early = omap4430_init_early, .init_irq = omap_init_irq, .handle_irq = gic_handle_irq, - .init_machine = omap4_init, + .init_machine = omap_generic_init, .timer = &omap4_timer, .dt_compat = omap4_boards_compat,MACHINE_END Signature · 1 line
1.7.0.4