Add device tree support of i2c Atmel driver
Subsystems (4)
v2 cover Add device tree support of i2c Atmel driver
Change since v1:
* Squash the commit [1] which adds the sam9x5 config.
This patcheset adds the device tree support for i2c Atmel driver and the corresping clocks for the at91sam9g45 device.
Raphaël Poggi (2) :
(1) i2c: at91: add support of device tree
(2) at91sam9g45: clock: add i2c clocks
arch/arm/mach-at91/at91sam9g45.c | 4 +++drivers/i2c/busses/i2c-at91.c | 66 +++++++++++++++++++++++++++++++++-----
2 files changed, 62 insertions(+), 8 deletions(-)
[1]: http://lists.infradead.org/pipermail/barebox/2014-August/020493.html
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 1/2 i2c: at91: add support of device tree
--- drivers/i2c/busses/i2c-at91.c | 66 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 8 deletions(-)
drivers/i2c/busses/i2c-at91.c +58 -8
@@ -346,6 +346,12 @@ static struct at91_twi_pdata at91sam9g10_config = { .has_unre_flag = false, }; +static struct at91_twi_pdata at91sam9x5_config = { + .clk_max_div =7 , + .clk_offset =4 , + .has_unre_flag = false, +}; +static struct platform_device_id at91_twi_devtypes[] = { { .name ="i2c-at91rm9200" ,
@@ -367,20 +373,63 @@ static struct platform_device_id at91_twi_devtypes[] = { } }; +static struct of_device_id at91_twi_dt_ids[] = { + { + .compatible ="atmel,at91rm9200-i2c" , + .data = (unsigned long ) &at91rm9200_config, + } , { + .compatible ="atmel,at91sam9260-i2c" , + .data = (unsigned long ) &at91sam9260_config, + } , { + .compatible ="atmel,at91sam9261-i2c" , + .data = (unsigned long ) &at91sam9261_config, + } , { + .compatible ="atmel,at91sam9g20-i2c" , + .data = (unsigned long ) &at91sam9g20_config, + } , { + .compatible ="atmel,at91sam9g10-i2c" , + .data = (unsigned long ) &at91sam9g10_config, + }, { + .compatible ="atmel,at91sam9x5-i2c" , + .data = (unsigned long ) &at91sam9x5_config, + }, { +/* sentinel */ + } +}; + +static struct at91_twi_pdata *at91_twi_get_driver_data (struct device_d *dev) +{ +struct at91_twi_pdata *i2c_data =NULL ; +int rc; + +if (dev->device_node) { +const struct of_device_id *match; + match =of_match_node (at91_twi_dt_ids, dev->device_node); +if (!match) + i2c_data =NULL ; +else + i2c_data = (struct at91_twi_pdata *)match->data; + } +else { + rc =dev_get_drvdata (dev, (unsigned long *)&i2c_data); +if (rc) + i2c_data =NULL ; + } + +return i2c_data; +} +static int at91_twi_probe (struct device_d *dev) {struct at91_twi_dev *i2c_at91; -struct at91_twi_pdata *i2c_data; -int rc; +int rc =0 ;u32 bus_clk_rate; i2c_at91 =xzalloc (sizeof (struct at91_twi_dev )); - rc =dev_get_drvdata (dev, (unsigned long *)&i2c_data); -if (rc) - goto out_free; - - i2c_at91->pdata = i2c_data; + i2c_at91->pdata =at91_twi_get_driver_data (dev); +if (!i2c_at91->pdata) + goto out_free; i2c_at91->base =dev_request_mem_region (dev,0 );if (!i2c_at91->base) {
@@ -389,7 +438,7 @@ static int at91_twi_probe(struct device_d *dev) goto out_free; } - i2c_at91->clk =clk_get (dev,"twi_clk" ); + i2c_at91->clk =clk_get (dev,NULL );if (IS_ERR (i2c_at91->clk)) {dev_err (dev,"no clock defined\n" ); rc = -ENODEV ;
@@ -429,6 +478,7 @@ static struct driver_d at91_twi_driver = { .name = "at91-twi", .probe = at91_twi_probe, .id_table = at91_twi_devtypes, + .of_compatible = DRV_OF_COMPAT(at91_twi_dt_ids), };device_platform_driver (at91_twi_driver);
Signature · 7 lines
1.7.9.5 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH V2 1/2] i2c: at91: add support of device tree
Hi Raphaël Poggi,
Quoted 10 lines · Raphaël Poggi
Signed-off-by Raphaël Poggi <[email protected]>--- drivers/i2c/busses/i2c-at91.c | 66 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 8 deletions(-)drivers/i2c/busses/i2c-at91.c +0
-0
drivers/i2c/busses/i2c-at91.c static struct at91_twi_pdata at91sam9g10_config = { · line 354
Quoted 9 lines
drivers/i2c/busses/i2c-at91.c +6
-0@@ -346,6 +346,12 @@ static struct at91_twi_pdata at91sam9g10_config = { .has_unre_flag = false, }; +static struct at91_twi_pdata at91sam9x5_config = { + .clk_max_div =7 , + .clk_offset =4 , + .has_unre_flag = false, +}; +
Can you add this also for non device tree?
Quoted 35 lines
drivers/i2c/busses/i2c-at91.c +28
-0static struct platform_device_id at91_twi_devtypes[] = { { .name ="i2c-at91rm9200" ,@@ -367,20 +373,63 @@ static struct platform_device_id at91_twi_devtypes[] = { } }; +static struct of_device_id at91_twi_dt_ids[] = { + { + .compatible ="atmel,at91rm9200-i2c" , + .data = (unsigned long ) &at91rm9200_config, + } , { + .compatible ="atmel,at91sam9260-i2c" , + .data = (unsigned long ) &at91sam9260_config, + } , { + .compatible ="atmel,at91sam9261-i2c" , + .data = (unsigned long ) &at91sam9261_config, + } , { + .compatible ="atmel,at91sam9g20-i2c" , + .data = (unsigned long ) &at91sam9g20_config, + } , { + .compatible ="atmel,at91sam9g10-i2c" , + .data = (unsigned long ) &at91sam9g10_config, + }, { + .compatible ="atmel,at91sam9x5-i2c" , + .data = (unsigned long ) &at91sam9x5_config, + }, { +/* sentinel */ + } +}; + +static struct at91_twi_pdata *at91_twi_get_driver_data (struct device_d *dev) +{ +struct at91_twi_pdata *i2c_data =NULL ; +int rc;
drivers/i2c/busses/i2c-at91.c static struct platform_device_id at91_twi_devtypes[] = { · line 413
Quoted 10 lines
drivers/i2c/busses/i2c-at91.c +10
-0+ +if (dev->device_node) { +const struct of_device_id *match; + match =of_match_node (at91_twi_dt_ids, dev->device_node); +if (!match) + i2c_data =NULL ; +else + i2c_data = (struct at91_twi_pdata *)match->data; + } +else {
Maybe better if: } else {
Quoted 16 lines
drivers/i2c/busses/i2c-at91.c +9
-2+ rc =dev_get_drvdata (dev, (unsigned long *)&i2c_data); +if (rc) + i2c_data =NULL ; + } + +return i2c_data; +} +static int at91_twi_probe (struct device_d *dev) {struct at91_twi_dev *i2c_at91; -struct at91_twi_pdata *i2c_data; -int rc; +int rc =0 ;u32 bus_clk_rate;
drivers/i2c/busses/i2c-at91.c static struct platform_device_id at91_twi_devtypes[] = { · line 432
Quoted 10 lines
drivers/i2c/busses/i2c-at91.c +3
-5i2c_at91 =xzalloc (sizeof (struct at91_twi_dev )); - rc =dev_get_drvdata (dev, (unsigned long *)&i2c_data); -if (rc) - goto out_free; - - i2c_at91->pdata = i2c_data; + i2c_at91->pdata =at91_twi_get_driver_data (dev); +if (!i2c_at91->pdata) + goto out_free;
Maybe add error information will be better.
Btw, do you use "tab" for alignment?
Quoted 13 lines
drivers/i2c/busses/i2c-at91.c +1
-1i2c_at91->base =dev_request_mem_region (dev,0 );if (!i2c_at91->base) {@@ -389,7 +438,7 @@ static int at91_twi_probe(struct device_d *dev) goto out_free; } - i2c_at91->clk =clk_get (dev,"twi_clk" ); + i2c_at91->clk =clk_get (dev,NULL );if (IS_ERR (i2c_at91->clk)) {dev_err (dev,"no clock defined\n" ); rc = -ENODEV ;
drivers/i2c/busses/i2c-at91.c static struct driver_d at91_twi_driver = { · line 484
Quoted 7 lines
drivers/i2c/busses/i2c-at91.c +1
-0@@ -429,6 +478,7 @@ static struct driver_d at91_twi_driver = { .name = "at91-twi", .probe = at91_twi_probe, .id_table = at91_twi_devtypes, + .of_compatible = DRV_OF_COMPAT(at91_twi_dt_ids), };device_platform_driver (at91_twi_driver);
Best Regards,
Bo Shen
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH V2 1/2] i2c: at91: add support of device tree
Quoted 16 lines
Hi Raphaël Poggi,
Quoted 13 lines · Raphaël Poggi
Signed-off-by Raphaël Poggi <[email protected]>--- drivers/i2c/busses/i2c-at91.c | 66 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 8 deletions(-)drivers/i2c/busses/i2c-at91.c +0
-0@@ -346,6 +346,12 @@ static struct at91_twi_pdata at91sam9g10_config = { .has_unre_flag = false, };
Quoted 8 lines
drivers/i2c/busses/i2c-at91.c static struct at91_twi_pdata at91sam9g10_config = { · line 354
Quoted 6 lines
drivers/i2c/busses/i2c-at91.c +6
-0+static struct at91_twi_pdata at91sam9x5_config = { + .clk_max_div =7 , + .clk_offset =4 , + .has_unre_flag = false, +}; +Can you add this also for non device tree?
Ok no problem.
Quoted 40 lines
Quoted 40 lines
drivers/i2c/busses/i2c-at91.c +32
-0static struct platform_device_id at91_twi_devtypes[] = { { .name ="i2c-at91rm9200" ,@@ -367,20 +373,63 @@ static struct platform_device_id at91_twi_devtypes[] = { } }; +static struct of_device_id at91_twi_dt_ids[] = { + { + .compatible ="atmel,at91rm9200-i2c" , + .data = (unsigned long ) &at91rm9200_config, + } , { + .compatible ="atmel,at91sam9260-i2c" , + .data = (unsigned long ) &at91sam9260_config, + } , { + .compatible ="atmel,at91sam9261-i2c" , + .data = (unsigned long ) &at91sam9261_config, + } , { + .compatible ="atmel,at91sam9g20-i2c" , + .data = (unsigned long ) &at91sam9g20_config, + } , { + .compatible ="atmel,at91sam9g10-i2c" , + .data = (unsigned long ) &at91sam9g10_config, + }, { + .compatible ="atmel,at91sam9x5-i2c" , + .data = (unsigned long ) &at91sam9x5_config, + }, { +/* sentinel */ + } +}; + +static struct at91_twi_pdata *at91_twi_get_driver_data (struct device_d *dev) +{ +struct at91_twi_pdata *i2c_data =NULL ; +int rc; + +if (dev->device_node) { +const struct of_device_id *match; + match =of_match_node (at91_twi_dt_ids, dev->device_node);
Quoted 8 lines
drivers/i2c/busses/i2c-at91.c static struct platform_device_id at91_twi_devtypes[] = { · line 413
Quoted 6 lines
drivers/i2c/busses/i2c-at91.c +6
-0+if (!match) + i2c_data =NULL ; +else + i2c_data = (struct at91_twi_pdata *)match->data; + } +else {Maybe better if: } else {
Ok
Quoted 19 lines
Quoted 19 lines
drivers/i2c/busses/i2c-at91.c +9
-2+ rc =dev_get_drvdata (dev, (unsigned long *)&i2c_data); +if (rc) + i2c_data =NULL ; + } + +return i2c_data; +} +static int at91_twi_probe (struct device_d *dev) {struct at91_twi_dev *i2c_at91; -struct at91_twi_pdata *i2c_data; -int rc; +int rc =0 ;u32 bus_clk_rate; i2c_at91 =xzalloc (sizeof (struct at91_twi_dev ));
Quoted 10 lines
drivers/i2c/busses/i2c-at91.c static struct platform_device_id at91_twi_devtypes[] = { · line 432
Quoted 8 lines
drivers/i2c/busses/i2c-at91.c +3
-5- rc =dev_get_drvdata (dev, (unsigned long *)&i2c_data); -if (rc) - goto out_free; - - i2c_at91->pdata = i2c_data; + i2c_at91->pdata =at91_twi_get_driver_data (dev); +if (!i2c_at91->pdata) + goto out_free;Maybe add error information will be better.
Yes, you're right.
Quoted 2 lines
Btw, do you use "tab" for alignment?
Yes, but maybe my vim config is wrong ? (set tabstop=4, set shiftwidth=4, set softtabstop=4)
Quoted 16 lines
Quoted 16 lines
drivers/i2c/busses/i2c-at91.c +1
-1i2c_at91->base =dev_request_mem_region (dev,0 );if (!i2c_at91->base) {@@ -389,7 +438,7 @@ static int at91_twi_probe(struct device_d *dev) goto out_free; } - i2c_at91->clk =clk_get (dev,"twi_clk" ); + i2c_at91->clk =clk_get (dev,NULL );if (IS_ERR (i2c_at91->clk)) {dev_err (dev,"no clock defined\n" ); rc = -ENODEV ;@@ -429,6 +478,7 @@ static struct driver_d at91_twi_driver = { .name = "at91-twi", .probe = at91_twi_probe, .id_table = at91_twi_devtypes,
Quoted 9 lines
drivers/i2c/busses/i2c-at91.c static struct driver_d at91_twi_driver = { · line 484
Quoted 5 lines
drivers/i2c/busses/i2c-at91.c +1
-0+ .of_compatible = DRV_OF_COMPAT(at91_twi_dt_ids), };device_platform_driver (at91_twi_driver);Best Regards,
Bo Shen
Thanks for you review,
Raphaël Poggi
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH V2 1/2] i2c: at91: add support of device tree
Hi Raphaël Poggi,
Quoted 3 lines · Raphaël Poggi
Quoted 2 lines
Quoted 2 lines
Btw, do you use "tab" for alignment?
Yes, but maybe my vim config is wrong ? (set tabstop=4, set shiftwidth=4, set softtabstop=4)
In general, the tabstop = 8.
Best Regards,
Bo Shen
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 2/2 at91sam9g45: clock: add i2c clocks
In reply to Raphaël PoggiAdd the device tree and non device tree at91 i2c clocks.
--- arch/arm/mach-at91/at91sam9g45.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mach-at91/at91sam9g45.c +4 -0
@@ -192,6 +192,10 @@ static struct clk_lookup periph_clocks_lookups[] = {CLKDEV_CON_DEV_ID ("mci_clk" ,"atmel_mci1" , &mmc1_clk),CLKDEV_CON_DEV_ID ("spi_clk" ,"atmel_spi0" , &spi0_clk),CLKDEV_CON_DEV_ID ("spi_clk" ,"atmel_spi1" , &spi1_clk), +CLKDEV_CON_DEV_ID (NULL ,"at91-twi0" , &twi0_clk), +CLKDEV_CON_DEV_ID (NULL ,"at91-twi1" , &twi1_clk), +CLKDEV_CON_DEV_ID (NULL ,"fff84000.i2c" , &twi0_clk), +CLKDEV_CON_DEV_ID (NULL ,"fff88000.i2c" , &twi1_clk),CLKDEV_DEV_ID ("at91rm9200-gpio0" , &pioA_clk),CLKDEV_DEV_ID ("at91rm9200-gpio1" , &pioB_clk), CLKDEV_DEV_ID("at91rm9200-gpio2", &pioC_clk),
Signature · 7 lines
1.7.9.5 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH V2 2/2] at91sam9g45: clock: add i2c clocks
Hi Raphaël Poggi,
Quoted 12 lines · Raphaël Poggi
Add the device tree and non device tree at91 i2c clocks.
Signed-off-by Raphaël Poggi <[email protected]>--- arch/arm/mach-at91/at91sam9g45.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/mach-at91/at91sam9g45.c +0
-0
arch/arm/mach-at91/at91sam9g45.c static struct clk_lookup periph_clocks_lookups[] = { · line 195
Quoted 4 lines
arch/arm/mach-at91/at91sam9g45.c +1
-0@@ -192,6 +192,10 @@ static struct clk_lookup periph_clocks_lookups[] = {CLKDEV_CON_DEV_ID ("mci_clk" ,"atmel_mci1" , &mmc1_clk),CLKDEV_CON_DEV_ID ("spi_clk" ,"atmel_spi0" , &spi0_clk),CLKDEV_CON_DEV_ID ("spi_clk" ,"atmel_spi1" , &spi1_clk), + CLKDEV_CON_DEV_ID(NULL, "at91-twi0", &twi0_clk),
s/CLKDEV_CON_DEV_ID/CLKDEV_DEV_ID (also for the following).
the DEV_ID should be presented in the id_table in the driver.
arch/arm/mach-at91/at91sam9g45.c static struct clk_lookup periph_clocks_lookups[] = { · line 201
Quoted 7 lines
arch/arm/mach-at91/at91sam9g45.c +3
-0+CLKDEV_CON_DEV_ID (NULL ,"at91-twi1" , &twi1_clk), +CLKDEV_CON_DEV_ID (NULL ,"fff84000.i2c" , &twi0_clk), +CLKDEV_CON_DEV_ID (NULL ,"fff88000.i2c" , &twi1_clk),CLKDEV_DEV_ID ("at91rm9200-gpio0" , &pioA_clk),CLKDEV_DEV_ID ("at91rm9200-gpio1" , &pioB_clk), CLKDEV_DEV_ID("at91rm9200-gpio2", &pioC_clk),
Best Regards,
Bo Shen
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH V2 2/2] at91sam9g45: clock: add i2c clocks
Hi,
I have used CLKDEV_CON_DEV_ID because it is like that in Linux, but ok I will replace it by CLKDEV_DEV_ID.
Btw, can you explain me why in Linux it's CLKDEV_CON_DEV_ID ? (just by curiosity)
Thanks,
Raphaël Poggi
2014-08-04 11:17 GMT+02:00 Bo Shen <[email protected]>:
Quoted 37 lines
Hi Raphaël Poggi,
Quoted 14 lines · Raphaël Poggi
Add the device tree and non device tree at91 i2c clocks.
Signed-off-by Raphaël Poggi <[email protected]>--- arch/arm/mach-at91/at91sam9g45.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/mach-at91/at91sam9g45.c +0
-0arch/arm/mach-at91/at91sam9g45.c static struct clk_lookup periph_clocks_lookups[] = { · line 195
Quoted 4 lines
arch/arm/mach-at91/at91sam9g45.c +1
-0@@ -192,6 +192,10 @@ static struct clk_lookup periph_clocks_lookups[] = {CLKDEV_CON_DEV_ID ("mci_clk" ,"atmel_mci1" , &mmc1_clk),CLKDEV_CON_DEV_ID ("spi_clk" ,"atmel_spi0" , &spi0_clk),CLKDEV_CON_DEV_ID ("spi_clk" ,"atmel_spi1" , &spi1_clk), + CLKDEV_CON_DEV_ID(NULL, "at91-twi0", &twi0_clk),s/CLKDEV_CON_DEV_ID/CLKDEV_DEV_ID (also for the following).
the
DEV_IDshould be presented in theid_tablein the driver.arch/arm/mach-at91/at91sam9g45.c static struct clk_lookup periph_clocks_lookups[] = { · line 201
Quoted 7 lines
arch/arm/mach-at91/at91sam9g45.c +3
-0+CLKDEV_CON_DEV_ID (NULL ,"at91-twi1" , &twi1_clk), +CLKDEV_CON_DEV_ID (NULL ,"fff84000.i2c" , &twi0_clk), +CLKDEV_CON_DEV_ID (NULL ,"fff88000.i2c" , &twi1_clk),CLKDEV_DEV_ID ("at91rm9200-gpio0" , &pioA_clk),CLKDEV_DEV_ID ("at91rm9200-gpio1" , &pioB_clk), CLKDEV_DEV_ID("at91rm9200-gpio2", &pioC_clk),
Quoted 7 lines
Best Regards,
Bo Shen_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Raphaël Poggi,
I try to manage to make the i2c driver work, however, failed for non
device tree.
I am still checking it. However, some comments for the patches.
Best Regards,
Bo Shen
Quoted 10 lines · Raphaël Poggi
Change since v1:
* Squash the commit [1] which adds the sam9x5 config.This patcheset adds the device tree support for i2c Atmel driver and the corresping clocks for the at91sam9g45 device.
Raphaël Poggi (2) :
(1) i2c: at91: add support of device tree
(2) at91sam9g45: clock: add i2c clocks
Quoted 5 lines
arch/arm/mach-at91/at91sam9g45.c| 4 +++drivers/i2c/busses/i2c-at91.c| 66 +++++++++++++++++++++++++++++++++-----2 files changed, 62 insertions(+), 8 deletions(-)[1]: http://lists.infradead.org/pipermail/barebox/2014-August/020493.html
Best Regards,
Bo Shen
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi,
I have tested it on a custom board which use a sam9m10 and it worked... Tell me more when we have found something suspicious.
Thanks for your test.
Raphaël Poggi
2014-08-04 11:11 GMT+02:00 Bo Shen <[email protected]>:
Quoted 35 lines
Hi Raphaël Poggi,
I try to manage to make the i2c driver work, however, failed for non
device tree.
I am still checking it. However, some comments for the patches.Best Regards,
Bo ShenQuoted 12 lines · Raphaël Poggi
Change since v1:
* Squash the commit [1] which adds the sam9x5 config.This patcheset adds the device tree support for i2c Atmel driver and the corresping clocks
for the at91sam9g45 device.Raphaël Poggi (2) :
(1) i2c: at91: add support of device tree
(2) at91sam9g45: clock: add i2c clocksQuoted 6 lines
arch/arm/mach-at91/at91sam9g45.c| 4 +++drivers/i2c/busses/i2c-at91.c| 66
+++++++++++++++++++++++++++++++++-----2 files changed, 62 insertions(+), 8 deletions(-)[1]: http://lists.infradead.org/pipermail/barebox/2014-August/020493.html
Best Regards,
Bo Shen
Quoted 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Raphaël Poggi,
Quoted 4 lines · Raphaël Poggi
Hi,
I have tested it on a custom board which use a sam9m10 and it worked... Tell me more when we have found something suspicious.
I tested on sama5d3xek with qt1070 connect to i2c, and the i2c host register successfully, however can not access qt1070, if I use i2c-gpio driver, it works well.
I am still working on it, if any news, I will let you know.
Best Regards,
Bo Shen
Quoted 45 lines
Thanks for your test.
Raphaël Poggi
2014-08-04 11:11 GMT+02:00 Bo Shen <[email protected]>:
Quoted 35 lines
Hi Raphaël Poggi,
I try to manage to make the i2c driver work, however, failed for non
device tree.
I am still checking it. However, some comments for the patches.Best Regards,
Bo ShenQuoted 12 lines · Raphaël Poggi
Change since v1:
* Squash the commit [1] which adds the sam9x5 config.This patcheset adds the device tree support for i2c Atmel driver and the corresping clocks
for the at91sam9g45 device.Raphaël Poggi (2) :
(1) i2c: at91: add support of device tree
(2) at91sam9g45: clock: add i2c clocksQuoted 6 lines
arch/arm/mach-at91/at91sam9g45.c| 4 +++drivers/i2c/busses/i2c-at91.c| 66
+++++++++++++++++++++++++++++++++-----2 files changed, 62 insertions(+), 8 deletions(-)[1]: http://lists.infradead.org/pipermail/barebox/2014-August/020493.html
Best Regards,
Bo ShenQuoted 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 5 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Raphaël Poggi,
Quoted 5 lines · Bo Shen
Hi Raphaël Poggi,
Quoted 2 lines · Raphaël Poggi
Hi,
Quoted 8 lines
Quoted 2 lines
I have tested it on a custom board which use a sam9m10 and it worked... Tell me more when we have found something suspicious.
I tested on sama5d3xek with qt1070 connect to i2c, and the i2c host register successfully, however can not access qt1070, if I use i2c-gpio driver, it works well.
I am still working on it, if any news, I will let you know.
I have re-write the interrupt function as the enclosed patch. Then, the i2c host driver works properly.
Can you help test it also on your board?
Thanks.
Quoted 7 lines
Best Regards,
Bo ShenQuoted 4 lines
Thanks for your test.
Raphaël Poggi
Best Regards,
Bo Shen
From 1dd3da701f15d360b5432c9d2eb6e5ca1e5368ad Mon Sep 17 00:00:00 2001
From: Bo Shen <[email protected]>
Date: Tue, 5 Aug 2014 14:41:31 +0800
Subject: [PATCH] I2C: at91: fix the method for interrupt
As the i2c-at91 driver won't work in the interrupt mode, so need to poll the interrupts.
--- drivers/i2c/busses/i2c-at91.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-)
drivers/i2c/busses/i2c-at91.c +23 -15
@@ -174,24 +174,32 @@ static void at91_twi_read_next_byte(struct at91_twi_dev *dev)static int at91_twi_wait_completion (struct at91_twi_dev *dev) {uint64_t start =get_time_ns (); -unsigned int status =at91_twi_read (dev,AT91_TWI_SR ); -unsigned int irqstatus =at91_twi_read (dev,AT91_TWI_IMR ); +unsigned int status; +unsigned int irqstatus; + +do { + status =at91_twi_read (dev,AT91_TWI_SR ); + irqstatus =at91_twi_read (dev,AT91_TWI_IMR ); + +if (!(status & irqstatus)) { +if (is_timeout (start,AT91_I2C_TIMEOUT )) { +dev_warn (&dev->adapter.dev,"timeout waiting for bus ready\n" ); +return -ETIMEDOUT ; + }else { +continue ; + } + } -if (irqstatus &AT91_TWI_RXRDY ) -at91_twi_read_next_byte (dev); -else if (irqstatus &AT91_TWI_TXRDY ) -at91_twi_write_next_byte (dev); -else -dev_warn (&dev->adapter.dev,"neither rx and tx are ready\n" ); +if (irqstatus &AT91_TWI_RXRDY ) +at91_twi_read_next_byte (dev); +else if (irqstatus &AT91_TWI_TXRDY ) +at91_twi_write_next_byte (dev); +else +dev_warn (&dev->adapter.dev,"neither rx and tx are ready\n" ); - dev->transfer_status |= status; + dev->transfer_status |= status; -while (!(at91_twi_read (dev,AT91_TWI_SR ) &AT91_TWI_TXCOMP )) { -if (is_timeout (start,AT91_I2C_TIMEOUT )) { -dev_warn (&dev->adapter.dev,"timeout waiting for bus ready\n" ); -return -ETIMEDOUT ; - } - } + }while (!(at91_twi_read (dev,AT91_TWI_SR ) &AT91_TWI_TXCOMP ));at91_disable_twi_interrupts (dev);
Signature · 1 line
1.8.5.2
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hello,
The patch works fine for me. Thanks for your review/help.
Best Regards,
Raphaël Poggi
2014-08-05 8:55 GMT+02:00 Bo Shen <[email protected]>:
Quoted 33 lines
Hi Raphaël Poggi,
Quoted 11 lines · Bo Shen
Hi Raphaël Poggi,
Quoted 5 lines · Raphaël Poggi
Hi,
I have tested it on a custom board which use a sam9m10 and it worked... Tell me more when we have found something suspicious.
Quoted 5 lines
I tested on sama5d3xek with qt1070 connect to i2c, and the i2c host register successfully, however can not access qt1070, if I use i2c-gpio driver, it works well.
I am still working on it, if any news, I will let you know.
I have re-write the interrupt function as the enclosed patch. Then, the i2c host driver works properly.
Can you help test it also on your board?
Thanks.
Quoted 3 lines
Best Regards,
Bo Shen
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Thanks for your test.
Raphaël Poggi
Best Regards,
Bo Shen
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
I am ready to send a v3. Are you going to send your fix or you want me to squash it in v3 ?
Best Regards,
Raphaël Poggi
2014-08-05 10:32 GMT+02:00 Raphaël Poggi <[email protected]>:
Quoted 48 lines
Hello,
The patch works fine for me. Thanks for your review/help.
Best Regards,
Raphaël Poggi2014-08-05 8:55 GMT+02:00 Bo Shen <[email protected]>:
Quoted 40 lines
Hi Raphaël Poggi,
Quoted 11 lines · Bo Shen
Hi Raphaël Poggi,
Quoted 5 lines · Raphaël Poggi
Hi,
I have tested it on a custom board which use a sam9m10 and it worked... Tell me more when we have found something suspicious.
Quoted 5 lines
I tested on sama5d3xek with qt1070 connect to i2c, and the i2c host register successfully, however can not access qt1070, if I use i2c-gpio driver, it works well.
I am still working on it, if any news, I will let you know.
I have re-write the interrupt function as the enclosed patch. Then, the i2c host driver works properly.
Can you help test it also on your board?
Thanks.
Quoted 7 lines
Best Regards,
Bo ShenQuoted 4 lines
Thanks for your test.
Raphaël Poggi
Best Regards,
Bo Shen
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Raphaël Poggi,
Quoted 2 lines · Raphaël Poggi
I am ready to send a v3. Are you going to send your fix or you want me to squash it in v3 ?
Please send it together with your patch.
Thanks.
Quoted 2 lines
Best Regards,
Raphaël Poggi
Best Regards,
Bo Shen
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Ok, about the "signed-off", do I have to let your name ? or my name + your name ? Sorry if my question seems stupid, but i'm new to open source development.
2014-08-06 3:06 GMT+02:00 Bo Shen <[email protected]>:
Quoted 16 lines
Hi Raphaël Poggi,
Quoted 3 lines · Raphaël Poggi
I am ready to send a v3. Are you going to send your fix or you want me to squash it in v3 ?
Please send it together with your patch.
Thanks.Quoted 2 lines
Best Regards,
Raphaël Poggi
Quoted 7 lines
Best Regards,
Bo Shen_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Raphaël Poggi,
Quoted 3 lines · Raphaël Poggi
Ok, about the "signed-off", do I have to let your name ? or my name + your name ? Sorry if my question seems stupid, but i'm new to open source development.
I think, you can first "git am" my patch, and then apply your patch and generate the series and send it, then there won't have "signed-off" issue. (In general, keep my "signed-off" and add your "signed-off" if you prefer).
Best Regards,
Bo Shen
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
All right, thanks.
Raphaël Poggi
2014-08-06 9:33 GMT+02:00 Bo Shen <[email protected]>:
Quoted 20 lines
Hi Raphaël Poggi,
Quoted 4 lines · Raphaël Poggi
Ok, about the "signed-off", do I have to let your name ? or my name + your name ? Sorry if my question seems stupid, but i'm new to open source development.
I think, you can first "git am" my patch, and then apply your patch and generate the series and send it, then there won't have "signed-off" issue. (In general, keep my "signed-off" and add your "signed-off" if you prefer).
Best Regards,
Bo Shen
Quoted 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox