mfd: twl: Fix for irqdomain/next + SPARSE_IRQ + MMC card detect
Subsystems (6)
cover mfd: twl: Fix for irqdomain/next + SPARSE_IRQ + MMC card detect
Hi Samuel and Tony,
Here is a fix + cleanup + SPARSE_IRQ series for TWL4030 and TWL6030.
The first goal was to fix the current regression due to irqdomain support inside twl-core for OMAP3 + twl4030.
The issue is that there is no quick and dirty fix for that, hence this exhaustive series started by Felipe to add SPARSE_IRQ support for TWL modules.
On top of that a bunch of code cleanup are done, and in order to make the MMC card detect still operational, some fixes are needed in the board file too.
Due to the modification in the SIH setup API, the twl4030-gpio driver has to be updated as well.
It was then trivial to add some basic device tree support for the twl4030-gpio driver.
Please note that this series does depend on the irqdomain/next series from Grant.
These patches will be probably sent in separate pull request. The only strong dependency is with the irqdomain series.
This series is available here for reference:
git://git.kernel.org/pub/scm/linux/kernel/git/bcousson/linux-omap-dt.git for_3.4/twl_irq_gpio_cleanup
This is not for pull-request, becasue it is based on irqdomain + OMAP IRQ DT series + OMAP twl DT series yet to be pushed.
Regards,
Benoit
Benoit Cousson (9):
mfd: twl-core: Remove references already defined in header file
mfd: twl-core: Move IRQ allocation into twl[4030|6030]-irq files
mfd: twl4030-irq: Make SIH SPARSE_IRQ capable
mfd: twl-*: Change from pr_XXX to dev_XXX macros and various cleanups gpio/twl: Allocate irq_desc dynamically for SPARSE_IRQ support gpio/twl: Add DT support to gpio-twl4030 driver
arm/dts: twl4030: Add twl4030-gpio node
mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
ARM: OMAP2+: board-omap4-*: Do not use anymore TWL6030_IRQ_BASE in board files
Felipe Balbi (3):
mfd: twl-core: don't depend on pdata->irq_base/end
mfd: twl-core: remove unneeded header
mfd: twl4030-irq: micro-optimization on IRQ handler
.../devicetree/bindings/gpio/gpio-twl4030.txt | 23 ++++ arch/arm/boot/dts/twl4030.dtsi | 8 ++ arch/arm/mach-omap2/board-4430sdp.c | 13 ++- arch/arm/mach-omap2/board-omap4panda.c | 15 ++-- drivers/gpio/gpio-twl4030.c | 111 ++++++++++++-------- drivers/mfd/twl-core.c | 99 +++++++----------- drivers/mfd/twl-core.h | 4 +- drivers/mfd/twl4030-irq.c | 87 +++++++++------- drivers/mfd/twl6030-irq.c | 71 ++++++++----- include/linux/i2c/twl.h | 2 +- 10 files changed, 247 insertions(+), 186 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-twl4030.txt
PATCH 1/12 mfd: twl-core: don't depend on pdata->irq_base/end
From: Felipe Balbi <[email protected]>
With sparse IRQs the driver shouldn't depend at all on any IRQ values coming from board-file.
Remove every occurences of pdata->irq_base/end.
--- drivers/mfd/twl-core.c | 49 ++++++++++++++++++++++++----------------------- 1 files changed, 25 insertions(+), 24 deletions(-)
drivers/mfd/twl-core.c +25 -24
@@ -648,7 +648,8 @@ add_regulator(int num, struct regulator_init_data *pdata,*/ static int -add_children (struct twl4030_platform_data *pdata,unsigned long features) +add_children (struct twl4030_platform_data *pdata,unsigned irq_base, +unsigned long features) {struct device *child;unsigned sub_chip_id;
@@ -656,7 +657,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)if (twl_has_gpio () && pdata->gpio) { child =add_child (SUB_CHIP_ID1 ,"twl4030_gpio" , pdata->gpio,sizeof (*pdata->gpio), - false, pdata->irq_base +GPIO_INTR_OFFSET ,0 ); + false, irq_base +GPIO_INTR_OFFSET ,0 );if (IS_ERR (child))return PTR_ERR (child); }
@@ -664,7 +665,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)if (twl_has_keypad () && pdata->keypad) { child =add_child (SUB_CHIP_ID2 ,"twl4030_keypad" , pdata->keypad,sizeof (*pdata->keypad), - true, pdata->irq_base +KEYPAD_INTR_OFFSET ,0 ); + true, irq_base +KEYPAD_INTR_OFFSET ,0 );if (IS_ERR (child))return PTR_ERR (child); }
@@ -672,7 +673,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)if (twl_has_madc () && pdata->madc) { child =add_child (2 ,"twl4030_madc" , pdata->madc,sizeof (*pdata->madc), - true, pdata->irq_base +MADC_INTR_OFFSET ,0 ); + true, irq_base +MADC_INTR_OFFSET ,0 );if (IS_ERR (child))return PTR_ERR (child); }
@@ -688,7 +689,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) sub_chip_id = twl_map[TWL_MODULE_RTC ].sid; child =add_child (sub_chip_id,"twl_rtc" ,NULL ,0 , - true, pdata->irq_base +RTC_INTR_OFFSET ,0 ); + true, irq_base +RTC_INTR_OFFSET ,0 );if (IS_ERR (child))return PTR_ERR (child); }
@@ -741,8 +742,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) pdata->usb,sizeof (*pdata->usb), true,/* irq0 = USB_PRES, irq1 = USB */ - pdata->irq_base +USB_PRES_INTR_OFFSET , - pdata->irq_base + USB_INTR_OFFSET); + irq_base +USB_PRES_INTR_OFFSET , + irq_base + USB_INTR_OFFSET);if (IS_ERR (child))return PTR_ERR (child);
@@ -790,8 +791,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) pdata->usb,sizeof (*pdata->usb), true,/* irq1 = VBUS_PRES, irq0 = USB ID */ - pdata->irq_base +USBOTG_INTR_OFFSET , - pdata->irq_base + USB_PRES_INTR_OFFSET); + irq_base +USBOTG_INTR_OFFSET , + irq_base + USB_PRES_INTR_OFFSET);if (IS_ERR (child))return PTR_ERR (child);
@@ -818,7 +819,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)if (twl_has_pwrbutton () &&twl_class_is_4030 ()) { child =add_child (1 ,"twl4030_pwrbutton" , -NULL ,0 , true, pdata->irq_base +8 +0 ,0 ); +NULL ,0 , true, irq_base +8 +0 ,0 );if (IS_ERR (child))return PTR_ERR (child); }
@@ -1052,8 +1053,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) child =add_child (3 ,"twl4030_bci" , pdata->bci,sizeof (*pdata->bci), false,/* irq0 = CHG_PRES, irq1 = BCI */ - pdata->irq_base +BCI_PRES_INTR_OFFSET , - pdata->irq_base +BCI_INTR_OFFSET ); + irq_base +BCI_PRES_INTR_OFFSET , + irq_base +BCI_INTR_OFFSET );if (IS_ERR (child))return PTR_ERR (child); }
@@ -1187,6 +1188,8 @@ static int twl_remove(struct i2c_client *client)static int __devinit twl_probe (struct i2c_client *client,const struct i2c_device_id *id) { +int irq_base; +int irq_end;int status;unsigned i;struct twl4030_platform_data *pdata = client->dev.platform_data;
@@ -1215,15 +1218,15 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)return -EINVAL ; } - status =irq_alloc_descs (-1 , pdata->irq_base, nr_irqs,0 ); + status =irq_alloc_descs (-1 ,0 , nr_irqs,0 );if (IS_ERR_VALUE (status)) {dev_err (&client->dev,"Fail to allocate IRQ descs\n" );return status; } - pdata->irq_base = status; - pdata->irq_end = pdata->irq_base + nr_irqs; -irq_domain_add_legacy (node, nr_irqs, pdata->irq_base,0 , + irq_base = status; + irq_end = irq_base + nr_irqs; +irq_domain_add_legacy (node, nr_irqs, irq_base,0 , &irq_domain_simple_ops,NULL );if (i2c_check_functionality (client->adapter,I2C_FUNC_I2C ) ==0 ) {
@@ -1277,16 +1280,14 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)twl4030_power_init (pdata->power);/* Maybe init the T2 Interrupt subsystem */ -if (client->irq - && pdata->irq_base - && pdata->irq_end > pdata->irq_base) { +if (client->irq) {if (twl_class_is_4030 ()) {twl4030_init_chip_irq (id->name); - status =twl4030_init_irq (client->irq, pdata->irq_base, - pdata->irq_end); + status =twl4030_init_irq (client->irq, irq_base, + irq_end); }else { - status =twl6030_init_irq (client->irq, pdata->irq_base, - pdata->irq_end); + status =twl6030_init_irq (client->irq, irq_base, + irq_end); }if (status <0 )
@@ -1309,7 +1310,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)if (node) status =of_platform_populate (node,NULL ,NULL , &client->dev);if (status) - status =add_children (pdata, id->driver_data); + status =add_children (pdata, irq_base, id->driver_data); fail:if (status <0 )
Signature · 1 line
1.7.0.4
PATCH 1/12 mfd: twl-core: don't depend on pdata->irq_base/end
Quoted 6 lines · Benoit Cousson
From: Felipe Balbi <[email protected]>
With sparse IRQs the driver shouldn't depend at all on any IRQ values coming from board-file.
Remove every occurences of pdata->irq_base/end.
Well, not quite *every*. :)
If the driver isn't going to use those fields anymore, they should also be removed from the pdata struct too[1]. Also, the remaining board/init code that is initializing those fields should be removed as well[2], since it obviously has no effect.
The first patch below should probably be folded into this one, and then the 2nd patch removes all the users.
Kevin
[1]
Quoted 1 line
From
70a1833ca20142ef5b6b96dbc92a63c7f8ef9a04Mon Sep 17 00:00:00 2001
From: Kevin Hilman <[email protected]>
Date: Wed, 14 Mar 2012 13:55:31 -0700
Subject: [PATCH 1/2] mfd: twl-core: remove pdata->irq_base/end
--- include/linux/i2c/twl.h | 1 - 1 file changed, 1 deletion(-)
include/linux/i2c/twl.h +0 -1
@@ -697,7 +697,6 @@ struct twl4030_audio_data { };struct twl4030_platform_data { -unsigned irq_base, irq_end;struct twl4030_clock_init_data *clock;struct twl4030_bci_platform_data *bci;struct twl4030_gpio_platform_data *gpio;
Signature · 4 lines
1.7.9.2 [2]
Quoted 1 line
From
d2b7b518b4c66beb99fccfcb898001c11a2f6dc9Mon Sep 17 00:00:00 2001
From: Kevin Hilman <[email protected]>
Date: Wed, 14 Mar 2012 13:56:01 -0700
Subject: [PATCH 2/2] ARM: OMAP2+: TWL: remove usage of pdata->irq_base/_end
The driver has been converted to use SPARSE_IRQ and no longer needs to be passed IRQ base/end. The driver no longer uses these fields, so remove them from the reamaining users.
--- arch/arm/mach-omap2/board-2430sdp.c | 3 --- arch/arm/mach-omap2/board-omap3logic.c | 3 --- arch/arm/mach-omap2/twl-common.c | 9 --------- 3 files changed, 15 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +0 -3
@@ -218,9 +218,6 @@ static struct twl4030_gpio_platform_data sdp2430_gpio_data = { };static struct twl4030_platform_data sdp2430_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -/* platform_data for children goes here */ .gpio = &sdp2430_gpio_data, .vmmc1 = &sdp2430_vmmc1,
arch/arm/mach-omap2/board-omap3logic.c +0 -3
@@ -85,9 +85,6 @@ static struct twl4030_gpio_platform_data omap3logic_gpio_data = { };static struct twl4030_platform_data omap3logic_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -/* platform_data for children goes here */ .gpio = &omap3logic_gpio_data, .vmmc1 = &omap3logic_vmmc1,
arch/arm/mach-omap2/twl-common.c +0 -9
@@ -184,10 +184,6 @@ static struct twl_regulator_driver_data omap3_vdd2_drvdata = {void __init omap3_pmic_get_config (struct twl4030_platform_data *pmic_data,u32 pdata_flags,u32 regulators_flags) { -if (!pmic_data->irq_base) - pmic_data->irq_base =TWL4030_IRQ_BASE ; -if (!pmic_data->irq_end) - pmic_data->irq_end =TWL4030_IRQ_END ;if (!pmic_data->vdd1) { omap3_vdd1.driver_data = &omap3_vdd1_drvdata; omap3_vdd1_drvdata.data =voltdm_lookup ("mpu_iva" );
@@ -415,11 +411,6 @@ static struct twl_regulator_driver_data omap4_vdd3_drvdata = {void __init omap4_pmic_get_config (struct twl4030_platform_data *pmic_data,u32 pdata_flags,u32 regulators_flags) { -if (!pmic_data->irq_base) - pmic_data->irq_base =TWL6030_IRQ_BASE ; -if (!pmic_data->irq_end) - pmic_data->irq_end =TWL6030_IRQ_END ; -if (!pmic_data->vdd1) { omap4_vdd1.driver_data = &omap4_vdd1_drvdata; omap4_vdd1_drvdata.data =voltdm_lookup ("mpu" );
Signature · 1 line
1.7.9.2
PATCH 1/12 mfd: twl-core: don't depend on pdata->irq_base/end
Quoted 10 lines · Kevin Hilman
Quoted 6 lines · Benoit Cousson
From: Felipe Balbi<[email protected]>
With sparse IRQs the driver shouldn't depend at all on any IRQ values coming from board-file.
Remove every occurences of pdata->irq_base/end.
Well, not quite *every*. :)
Hehe, good catch, thanks.
Quoted 7 lines
If the driver isn't going to use those fields anymore, they should also be removed from the pdata struct too[1]. Also, the remaining board/init code that is initializing those fields should be removed as well[2], since it obviously has no effect.
The first patch below should probably be folded into this one, and then the 2nd patch removes all the users.
We should probably remove all the users before removing the attribute? It looks like your patches are ordered in the opposite way.
I'll add that in the series and repost the pull request.
Regards,
Benoit
Quoted 26 lines
Kevin
[1]
From70a1833ca20142ef5b6b96dbc92a63c7f8ef9a04Mon Sep 17 00:00:00 2001
From: Kevin Hilman<[email protected]>
Date: Wed, 14 Mar 2012 13:55:31 -0700
Subject: [PATCH 1/2] mfd: twl-core: remove pdata->irq_base/endSigned-off-by Kevin Hilman<[email protected]>--- include/linux/i2c/twl.h | 1 - 1 file changed, 1 deletion(-)include/linux/i2c/twl.h +0
-1@@ -697,7 +697,6 @@ struct twl4030_audio_data { };struct twl4030_platform_data { -unsigned irq_base, irq_end;struct twl4030_clock_init_data *clock;struct twl4030_bci_platform_data *bci;struct twl4030_gpio_platform_data *gpio;
PATCH 1/12 mfd: twl-core: don't depend on pdata->irq_base/end
Quoted 19 lines · Benoit
Quoted 10 lines · Kevin Hilman
Quoted 6 lines · Benoit Cousson
From: Felipe Balbi<[email protected]>
With sparse IRQs the driver shouldn't depend at all on any IRQ values coming from board-file.
Remove every occurences of pdata->irq_base/end.
Well, not quite *every*. :)
Hehe, good catch, thanks.
Quoted 5 lines
If the driver isn't going to use those fields anymore, they should also be removed from the pdata struct too[1]. Also, the remaining board/init code that is initializing those fields should be removed as well[2], since it obviously has no effect.
Quoted 5 lines
Quoted 2 lines
The first patch below should probably be folded into this one, and then the 2nd patch removes all the users.
We should probably remove all the users before removing the attribute? It looks like your patches are ordered in the opposite way.
Agreed.
Quoted 1 line
I'll add that in the series and repost the pull request.
Great, thanks.
Kevin
PATCH 1/12 mfd: twl-core: don't depend on pdata->irq_base/end
In reply to Kevin HilmanQuoted 11 lines · Kevin Hilman
Quoted 6 lines · Benoit Cousson
From: Felipe Balbi <[email protected]>
With sparse IRQs the driver shouldn't depend at all on any IRQ values coming from board-file.
Remove every occurences of pdata->irq_base/end.
Well, not quite *every*. :)
Quoted 7 lines
If the driver isn't going to use those fields anymore, they should also be removed from the pdata struct too[1]. Also, the remaining board/init code that is initializing those fields should be removed as well[2], since it obviously has no effect.
The first patch below should probably be folded into this one, and then the 2nd patch removes all the users.
Below is a correct version of the 2nd patch which removes all the users.
The previous version wouldn't apply cleanly because I generated it on top of a local branch that also included some other changes to twl-common.c from the SMPS regulator series (which seems to have missed the window for v3.4.)
This one applies cleanly on your for_3.4/twl_irq_gpio_mmc_fix branch.
Kevin
Quoted 1 line
From
b59a4754fb66f6f729ebbd0563c4cd2bd2cda56eMon Sep 17 00:00:00 2001
From: Kevin Hilman <[email protected]>
Date: Wed, 14 Mar 2012 13:56:01 -0700
Subject: [PATCH] ARM: OMAP2+: TWL: remove usage of pdata->irq_base/_end
The driver has been converted to use SPARSE_IRQ and no longer needs to be passed IRQ base/end. The driver no longer uses these fields, so remove them from the reamaining users.
--- arch/arm/mach-omap2/board-2430sdp.c | 3 --- arch/arm/mach-omap2/board-omap3logic.c | 3 --- arch/arm/mach-omap2/twl-common.c | 10 ---------- 3 files changed, 16 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +0 -3
@@ -218,9 +218,6 @@ static struct twl4030_gpio_platform_data sdp2430_gpio_data = { };static struct twl4030_platform_data sdp2430_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -/* platform_data for children goes here */ .gpio = &sdp2430_gpio_data, .vmmc1 = &sdp2430_vmmc1,
arch/arm/mach-omap2/board-omap3logic.c +0 -3
@@ -85,9 +85,6 @@ static struct twl4030_gpio_platform_data omap3logic_gpio_data = { };static struct twl4030_platform_data omap3logic_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -/* platform_data for children goes here */ .gpio = &omap3logic_gpio_data, .vmmc1 = &omap3logic_vmmc1,
arch/arm/mach-omap2/twl-common.c +0 -10
@@ -129,11 +129,6 @@ static struct regulator_init_data omap3_vpll2_idata = {void __init omap3_pmic_get_config (struct twl4030_platform_data *pmic_data,u32 pdata_flags,u32 regulators_flags) { -if (!pmic_data->irq_base) - pmic_data->irq_base =TWL4030_IRQ_BASE ; -if (!pmic_data->irq_end) - pmic_data->irq_end =TWL4030_IRQ_END ; -/* Common platform data configurations */ if (pdata_flags &TWL_COMMON_PDATA_USB && !pmic_data->usb) pmic_data->usb = &omap3_usb_pdata;
@@ -287,11 +282,6 @@ static struct regulator_init_data omap4_clk32kg_idata = {void __init omap4_pmic_get_config (struct twl4030_platform_data *pmic_data,u32 pdata_flags,u32 regulators_flags) { -if (!pmic_data->irq_base) - pmic_data->irq_base =TWL6030_IRQ_BASE ; -if (!pmic_data->irq_end) - pmic_data->irq_end =TWL6030_IRQ_END ; -/* Common platform data configurations */ if (pdata_flags &TWL_COMMON_PDATA_USB && !pmic_data->usb) pmic_data->usb = &omap4_usb_pdata;
Signature · 1 line
1.7.9.2
PATCH 1/12 mfd: twl-core: don't depend on pdata->irq_base/end
Samuel,
Quoted 21 lines · Kevin Hilman
Quoted 11 lines · Kevin Hilman
Quoted 6 lines · Benoit Cousson
From: Felipe Balbi<[email protected]>
With sparse IRQs the driver shouldn't depend at all on any IRQ values coming from board-file.
Remove every occurences of pdata->irq_base/end.
Well, not quite *every*. :)
Quoted 7 lines
If the driver isn't going to use those fields anymore, they should also be removed from the pdata struct too[1]. Also, the remaining board/init code that is initializing those fields should be removed as well[2], since it obviously has no effect.
The first patch below should probably be folded into this one, and then the 2nd patch removes all the users.
Quoted 8 lines
Below is a correct version of the 2nd patch which removes all the users.
The previous version wouldn't apply cleanly because I generated it on top of a local branch that also included some other changes to
twl-common.cfrom the SMPS regulator series (which seems to have missed the window for v3.4.)This one applies cleanly on your for_3.4/twl_irq_gpio_mmc_fix branch.
After discussing with Kevin, we think it might be better to wait 3.5 for this further cleanup patches.
These patches will need some patches already queued by Tony to avoid breaking OMAP build.
In order to reduce dependency, let's push them for 3.5.
You can the pull the current branch.
Thanks,
Benoit
Quoted 75 lines
Kevin
From
b59a4754fb66f6f729ebbd0563c4cd2bd2cda56eMon Sep 17 00:00:00 2001
From: Kevin Hilman<[email protected]>
Date: Wed, 14 Mar 2012 13:56:01 -0700
Subject: [PATCH] ARM: OMAP2+: TWL: remove usage of pdata->irq_base/_endThe driver has been converted to use
SPARSE_IRQand no longer needs to be passed IRQ base/end. The driver no longer uses these fields, so remove them from the reamaining users.Signed-off-by Kevin Hilman<[email protected]>--- arch/arm/mach-omap2/board-2430sdp.c | 3 --- arch/arm/mach-omap2/board-omap3logic.c | 3 --- arch/arm/mach-omap2/twl-common.c | 10 ---------- 3 files changed, 16 deletions(-)arch/arm/mach-omap2/board-2430sdp.c +0
-3@@ -218,9 +218,6 @@ static struct twl4030_gpio_platform_data sdp2430_gpio_data = { };static struct twl4030_platform_data sdp2430_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -/* platform_data for children goes here */ .gpio =&sdp2430_gpio_data, .vmmc1 =&sdp2430_vmmc1,arch/arm/mach-omap2/board-omap3logic.c +0
-3@@ -85,9 +85,6 @@ static struct twl4030_gpio_platform_data omap3logic_gpio_data = { };static struct twl4030_platform_data omap3logic_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -/* platform_data for children goes here */ .gpio =&omap3logic_gpio_data, .vmmc1 =&omap3logic_vmmc1,arch/arm/mach-omap2/twl-common.c +0
-10@@ -129,11 +129,6 @@ static struct regulator_init_data omap3_vpll2_idata = {void __init omap3_pmic_get_config (struct twl4030_platform_data *pmic_data,u32 pdata_flags,u32 regulators_flags) { -if (!pmic_data->irq_base) - pmic_data->irq_base =TWL4030_IRQ_BASE ; -if (!pmic_data->irq_end) - pmic_data->irq_end =TWL4030_IRQ_END ; -/* Common platform data configurations */ if (pdata_flags&TWL_COMMON_PDATA_USB && !pmic_data->usb) pmic_data->usb =&omap3_usb_pdata;@@ -287,11 +282,6 @@ static struct regulator_init_data omap4_clk32kg_idata = {void __init omap4_pmic_get_config (struct twl4030_platform_data *pmic_data,u32 pdata_flags,u32 regulators_flags) { -if (!pmic_data->irq_base) - pmic_data->irq_base =TWL6030_IRQ_BASE ; -if (!pmic_data->irq_end) - pmic_data->irq_end =TWL6030_IRQ_END ; -/* Common platform data configurations */ if (pdata_flags&TWL_COMMON_PDATA_USB && !pmic_data->usb) pmic_data->usb =&omap4_usb_pdata;
Tony Lindgren
maintainerPATCH 1/12 mfd: twl-core: don't depend on pdata->irq_base/end
In reply to Kevin HilmanQuoted 61 lines · Kevin Hilman
From: Kevin Hilman <[email protected]>
Date: Wed, 14 Mar 2012 13:56:01 -0700
Subject: [PATCH 2/2] ARM: OMAP2+: TWL: remove usage of pdata->irq_base/_endThe driver has been converted to use
SPARSE_IRQand no longer needs to be passed IRQ base/end. The driver no longer uses these fields, so remove them from the reamaining users.Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/board-2430sdp.c | 3 --- arch/arm/mach-omap2/board-omap3logic.c | 3 --- arch/arm/mach-omap2/twl-common.c | 9 --------- 3 files changed, 15 deletions(-)arch/arm/mach-omap2/board-2430sdp.c +0
-3@@ -218,9 +218,6 @@ static struct twl4030_gpio_platform_data sdp2430_gpio_data = { };static struct twl4030_platform_data sdp2430_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -/* platform_data for children goes here */ .gpio = &sdp2430_gpio_data, .vmmc1 = &sdp2430_vmmc1,arch/arm/mach-omap2/board-omap3logic.c +0
-3@@ -85,9 +85,6 @@ static struct twl4030_gpio_platform_data omap3logic_gpio_data = { };static struct twl4030_platform_data omap3logic_twldata = { - .irq_base =TWL4030_IRQ_BASE , - .irq_end =TWL4030_IRQ_END , -/* platform_data for children goes here */ .gpio = &omap3logic_gpio_data, .vmmc1 = &omap3logic_vmmc1,arch/arm/mach-omap2/twl-common.c +0
-4@@ -184,10 +184,6 @@ static struct twl_regulator_driver_data omap3_vdd2_drvdata = {void __init omap3_pmic_get_config (struct twl4030_platform_data *pmic_data,u32 pdata_flags,u32 regulators_flags) { -if (!pmic_data->irq_base) - pmic_data->irq_base =TWL4030_IRQ_BASE ; -if (!pmic_data->irq_end) - pmic_data->irq_end =TWL4030_IRQ_END ;if (!pmic_data->vdd1) { omap3_vdd1.driver_data = &omap3_vdd1_drvdata; omap3_vdd1_drvdata.data =voltdm_lookup ("mpu_iva" );@@ -415,11 +411,6 @@ static struct twl_regulator_driver_data omap4_vdd3_drvdata = { void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
arch/arm/mach-omap2/twl-common.c static struct twl_regulator_driver_data omap4_vdd3_drvdata = { · line 416
Quoted 10 lines
arch/arm/mach-omap2/twl-common.c +0
-5u32 pdata_flags, u32 regulators_flags) { -if (!pmic_data->irq_base) - pmic_data->irq_base =TWL6030_IRQ_BASE ; -if (!pmic_data->irq_end) - pmic_data->irq_end =TWL6030_IRQ_END ; -if (!pmic_data->vdd1) { omap4_vdd1.driver_data = &omap4_vdd1_drvdata; omap4_vdd1_drvdata.data =voltdm_lookup ("mpu" );
Looks right to me:
PATCH 1/12 mfd: twl-core: don't depend on pdata->irq_base/end
In reply to Kevin HilmanHi,
Quoted 7 lines · Kevin Hilman
Quoted 5 lines · Benoit Cousson
From: Felipe Balbi <[email protected]>
With sparse IRQs the driver shouldn't depend at all on any IRQ values coming from board-file.
Quoted 8 lines
Quoted 1 line
Remove every occurences of pdata->irq_base/end.
Well, not quite *every*. :)
If the driver isn't going to use those fields anymore, they should also be removed from the pdata struct too[1]. Also, the remaining board/init code that is initializing those fields should be removed as well[2], since it obviously has no effect.
indeed, but the idea was to decouple driver changes from arch/arm/*omap* changes minimizing the oportunity of conflicts. So, e.g. on v3.4 we change driver and on v3.5 we change board files.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120319/87cc24ee/attachment.sig>
PATCH 2/12 mfd: twl-core: remove unneeded header
In reply to Benoit CoussonFrom: Felipe Balbi <[email protected]>
This driver doesn't really need <plat/cpu.h>, so remove it.
--- drivers/mfd/twl-core.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/mfd/twl-core.c +0 -4
@@ -45,10 +45,6 @@#include <linux/i2c.h> #include <linux/i2c/twl.h> -#if defined(CONFIG_ARCH_OMAP2 ) || defined(CONFIG_ARCH_OMAP3 ) -#include <plat/cpu.h> -#endif -/* * The TWL4030 "Triton 2" is one of a family of a multi-function "Power * Management and System Companion Device" chips originally designed for
Signature · 1 line
1.7.0.4
PATCH 3/12 mfd: twl-core: Remove references already defined in header file
In reply to Benoit CoussonThe twl-core exported functions are already declared in twl-core.h
Include the header file instead or re-declaring the functions.
--- drivers/mfd/twl-core.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
drivers/mfd/twl-core.c +2 -5
@@ -45,6 +45,8 @@#include <linux/i2c.h> #include <linux/i2c/twl.h> +#include "twl-core.h" +/* * The TWL4030 "Triton 2" is one of a family of a multi-function "Power * Management and System Companion Device" chips originally designed for
@@ -1150,11 +1152,6 @@ static void clocks_init(struct device *dev,/*----------------------------------------------------------------------*/ -int twl4030_init_irq (int irq_num,unsigned irq_base,unsigned irq_end); -int twl4030_exit_irq (void ); -int twl4030_init_chip_irq (const char *chip); -int twl6030_init_irq (int irq_num,unsigned irq_base,unsigned irq_end); -int twl6030_exit_irq (void );static int twl_remove (struct i2c_client *client) {
Signature · 1 line
1.7.0.4
PATCH 4/12 mfd: twl-core: Move IRQ allocation into twl[4030|6030]-irq files
In reply to Benoit CoussonDuring DT adaptation, the irq_alloc_desc was added into twl-core, but due to the rather different and weird IRQ management required by the twl4030, it is much better to have a different approach for it.
The issue is that twl4030 uses a two level IRQ mechanism but handles all the PWR interrupts as part of the twl-core interrupt range. It ends up with a range of 16 interrupts total for CORE and PWR.
The other twl4030 functionalities already have a dedicated driver and thus their IRQs and irqdomain can and should be defined localy.
twl6030 is using a single level IRQ controller and thus does not require any trick.
Move the irq_alloc_desc and irq_domain_add_legacy in twl4030-irq and twl6030-irq.
Allocate together CORE and PWR IRQs for twl4030-irq.
--- drivers/mfd/twl-core.c | 29 +++++------------------------ drivers/mfd/twl-core.h | 4 ++-- drivers/mfd/twl4030-irq.c | 29 +++++++++++++++++++++++++++-- drivers/mfd/twl6030-irq.c | 31 ++++++++++++++++++++++--------- 4 files changed, 56 insertions(+), 37 deletions(-)
drivers/mfd/twl-core.c +5 -24
@@ -147,9 +147,6 @@#define TWL_MODULE_LAST TWL4030_MODULE_LAST -#define TWL4030_NR_IRQS 34/* core:8, power:8, gpio: 18 */ -#define TWL6030_NR_IRQS 20 -/* Base Address defns for twl4030_map[] */ /* subchip/slave 0 - USB ID */
@@ -1182,17 +1179,12 @@ static int __devinit twl_probe(struct i2c_client *client, const struct i2c_device_id *id) { int irq_base; -int irq_end;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 ; -int nr_irqs =TWL4030_NR_IRQS ; - -if ((id->driver_data) &TWL6030_CLASS ) - nr_irqs =TWL6030_NR_IRQS ;if (node && !pdata) {/*
@@ -1211,17 +1203,6 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)return -EINVAL ; } - status =irq_alloc_descs (-1 ,0 , nr_irqs,0 ); -if (IS_ERR_VALUE (status)) { -dev_err (&client->dev,"Fail to allocate IRQ descs\n" ); -return status; - } - - irq_base = status; - irq_end = irq_base + nr_irqs; -irq_domain_add_legacy (node, nr_irqs, irq_base,0 , - &irq_domain_simple_ops,NULL ); -if (i2c_check_functionality (client->adapter,I2C_FUNC_I2C ) ==0 ) {dev_dbg (&client->dev,"can't talk I2C?\n" );return -EIO ;
@@ -1276,15 +1257,15 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)if (client->irq) {if (twl_class_is_4030 ()) {twl4030_init_chip_irq (id->name); - status =twl4030_init_irq (client->irq, irq_base, - irq_end); + irq_base =twl4030_init_irq (&client->dev, client->irq); }else { - status =twl6030_init_irq (client->irq, irq_base, - irq_end); + irq_base =twl6030_init_irq (&client->dev, client->irq); } -if (status <0 ) +if (irq_base <0 ) { + status = irq_base; goto fail; + } }/* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface.
drivers/mfd/twl-core.h +2 -2
@@ -1,9 +1,9 @@#ifndef __TWL_CORE_H__#define __TWL_CORE_H__ -extern int twl6030_init_irq (int irq_num,unsigned irq_base,unsigned irq_end); +extern int twl6030_init_irq (struct device *dev,int irq_num);extern int twl6030_exit_irq (void ); -extern int twl4030_init_irq (int irq_num,unsigned irq_base,unsigned irq_end); +extern int twl4030_init_irq (struct device *dev,int irq_num);extern int twl4030_exit_irq (void );extern int twl4030_init_chip_irq (const char *chip);
drivers/mfd/twl4030-irq.c +27 -2
@@ -28,10 +28,13 @@*/ #include <linux/init.h> +#include <linux/export.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/slab.h> +#include <linux/of.h> +#include <linux/irqdomain.h> #include <linux/i2c/twl.h> #include "twl-core.h"
@@ -53,6 +56,8 @@* base + 8 .. base + 15 SIH for PWR_INT * base + 16 .. base + 33 SIH for GPIO */ +#define TWL4030_CORE_NR_IRQS 8 +#define TWL4030_PWR_NR_IRQS 8/* PIH register offsets */ #define REG_PIH_ISR_P1 0x01
@@ -694,14 +699,34 @@ int twl4030_sih_setup(int module)/* FIXME pass in which interrupt line we'll use ... */ #define twl_irq_line 0 -int twl4030_init_irq (int irq_num,unsigned irq_base,unsigned irq_end) +int twl4030_init_irq (struct device *dev,int irq_num) {static struct irq_chip twl4030_irq_chip; +int irq_base, irq_end, nr_irqs; +struct device_node *node = dev->of_node;int status;int i;/* +* TWL core and pwr interrupts must be contiguous because +* the hwirqs numbers are defined contiguously from 1 to 15. +* Create only one domain for both. +*/ + nr_irqs =TWL4030_PWR_NR_IRQS +TWL4030_CORE_NR_IRQS ; + + irq_base =irq_alloc_descs (-1 ,0 , nr_irqs,0 ); +if (IS_ERR_VALUE (irq_base)) { +dev_err (dev,"Fail to allocate IRQ descs\n" ); +return irq_base; + } + +irq_domain_add_legacy (node, nr_irqs, irq_base,0 , + &irq_domain_simple_ops,NULL ); + + irq_end = irq_base +TWL4030_CORE_NR_IRQS ; + +/* * Mask and clear all TWL4030 interrupts since initially we do * not have any TWL4030 module interrupt handlers present */
@@ -745,7 +770,7 @@ int twl4030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end) goto fail_rqirq; } -return status; +return irq_base; fail_rqirq:/* clean up twl4030_sih_setup */ fail:
drivers/mfd/twl6030-irq.c +22 -9
@@ -39,6 +39,8 @@#include <linux/i2c/twl.h> #include <linux/platform_device.h> #include <linux/suspend.h> +#include <linux/of.h> +#include <linux/irqdomain.h> #include "twl-core.h"
@@ -53,6 +55,7 @@* specifies mapping between interrupt number and the associated module. * */ +#define TWL6030_NR_IRQS 20static int twl6030_interrupt_mapping[24 ] = {PWR_INTR_OFFSET ,/* Bit 0 PWRON */
@@ -237,11 +240,6 @@ int twl6030_irq_set_wake(struct irq_data *d, unsigned int on)return 0 ; } -/*----------------------------------------------------------------------*/ - -static unsigned twl6030_irq_next; - -/*----------------------------------------------------------------------*/ int twl6030_interrupt_unmask (u8 bit_mask,u8 offset) {int ret;
@@ -340,8 +338,10 @@ int twl6030_mmc_card_detect(struct device *dev, int slot) }EXPORT_SYMBOL (twl6030_mmc_card_detect); -int twl6030_init_irq (int irq_num,unsigned irq_base,unsigned irq_end) +int twl6030_init_irq (struct device *dev,int irq_num) { +struct device_node *node = dev->of_node; +int nr_irqs, irq_base, irq_end;int status =0 ;int i;
@@ -350,6 +350,20 @@ int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)u8 mask[4 ];static struct irq_chip twl6030_irq_chip; + + nr_irqs =TWL6030_NR_IRQS ; + + irq_base =irq_alloc_descs (-1 ,0 , nr_irqs,0 ); +if (IS_ERR_VALUE (irq_base)) { +dev_err (dev,"Fail to allocate IRQ descs\n" ); +return irq_base; + } + +irq_domain_add_legacy (node, nr_irqs, irq_base,0 , + &irq_domain_simple_ops,NULL ); + + irq_end = irq_base + nr_irqs; + mask[1 ] =0xFF ; mask[2 ] =0xFF ; mask[3 ] =0xFF ;
@@ -377,9 +391,8 @@ int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)activate_irq (i); } - twl6030_irq_next = i;pr_info ("twl6030: %s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , - irq_num, irq_base, twl6030_irq_next -1 ); + irq_num, irq_base, irq_end);/* install an irq handler to demultiplex the TWL6030 interrupt */ init_completion (&irq_event);
@@ -400,7 +413,7 @@ int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end) twl_irq = irq_num;register_pm_notifier (&twl6030_irq_pm_notifier_block); -return status; +return irq_base; fail_kthread:free_irq (irq_num, &irq_event);
Signature · 1 line
1.7.0.4
PATCH 5/12 mfd: twl4030-irq: Make SIH SPARSE_IRQ capable
In reply to Benoit Coussontwl4030 is using a two level irq controllers infrastruture. So far, only the first level was using dynamic irq_desc allocation to be able to have irq_domain support for device tree. There is a need to allocate separate irq_descs for the SIH too to avoid hacking the first level with interrupts from the second level.
Add an irq_base parameter to allow the caller to provide the base from pdata or from dynamic allocation.
Affect TWL4030_NR_IRQS to the twl-core IRQs only.
Moreover that will allow the extraction of the of_node pointer for further Device Tree conversion.
--- drivers/gpio/gpio-twl4030.c | 3 ++- drivers/mfd/twl4030-irq.c | 23 ++++++----------------- include/linux/i2c/twl.h | 2 +- 3 files changed, 9 insertions(+), 19 deletions(-)
drivers/gpio/gpio-twl4030.c +2 -1
@@ -404,7 +404,8 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev) "can't dispatch IRQs from modules\n"); goto no_irqs; } - ret =twl4030_sih_setup (TWL4030_MODULE_GPIO ); + ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , + pdata->irq_base);if (ret <0 )return ret;WARN_ON (ret != pdata->irq_base);
drivers/mfd/twl4030-irq.c +6 -17
@@ -625,30 +625,23 @@ static irqreturn_t handle_twl4030_sih(int irq, void *data)return IRQ_HANDLED ; } -static unsigned twl4030_irq_next; -/* returns the first IRQ used by this SIH bank, * or negative errno */ -int twl4030_sih_setup (int module) +int twl4030_sih_setup (struct device *dev,int module,int irq_base) {int sih_mod;const struct sih *sih =NULL ;struct sih_agent *agent;int i, irq;int status = -EINVAL ; -unsigned irq_base = twl4030_irq_next;/* only support modules with standard clear-on-read for now */ for (sih_mod =0 , sih = sih_modules; sih_mod < nr_sih_modules; sih_mod++, sih++) {if (sih->module == module && sih->set_cor) { -if (!WARN ((irq_base + sih->bits) >NR_IRQS , -"irq %d for %s too big\n" , - irq_base + sih->bits, - sih->name)) - status =0 ; + status =0 ;break ; } }
@@ -659,8 +652,6 @@ int twl4030_sih_setup(int module)if (!agent)return -ENOMEM ; - status =0 ; - agent->irq_base = irq_base; agent->sih = sih; agent->imr = ~0 ;
@@ -676,8 +667,6 @@ int twl4030_sih_setup(int module)activate_irq (irq); } - twl4030_irq_next += i; -/* replace generic PIH handler (handle_simple_irq) */ irq = sih_mod + twl4030_irq_base;irq_set_handler_data (irq, agent);
@@ -686,7 +675,7 @@ int twl4030_sih_setup(int module) agent->irq_name ?: sih->name, NULL);pr_info ("twl4030: %s (irq %d) chaining IRQs %d..%d\n" , sih->name, - irq, irq_base, twl4030_irq_next -1 ); + irq, irq_base, irq_base + i -1 );return status <0 ? status : irq_base; }
@@ -750,12 +739,12 @@ int twl4030_init_irq(struct device *dev, int irq_num)irq_set_nested_thread (i,1 );activate_irq (i); } - twl4030_irq_next = i; +pr_info ("twl4030: %s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , - irq_num, irq_base, twl4030_irq_next -1 ); + irq_num, irq_base, irq_end);/* ... and the PWR_INT module ... */ - status =twl4030_sih_setup (TWL4030_MODULE_INT ); + status =twl4030_sih_setup (dev,TWL4030_MODULE_INT , irq_end);if (status <0 ) {pr_err ("twl4030: sih_setup PWR INT --> %d\n" , status); goto fail;
include/linux/i2c/twl.h +1 -1
@@ -751,7 +751,7 @@ struct twl4030_platform_data {/*----------------------------------------------------------------------*/ -int twl4030_sih_setup (int module); +int twl4030_sih_setup (struct device *dev,int module,int irq_base);/* Offsets to Power Registers */ #define TWL4030_VDAC_DEV_GRP 0x3B
Signature · 1 line
1.7.0.4
PATCH 6/12 mfd: twl4030-irq: micro-optimization on IRQ handler
In reply to Benoit CoussonFrom: Felipe Balbi <[email protected]>
__ffs() will be far faster than the for loop used.
--- drivers/mfd/twl4030-irq.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/mfd/twl4030-irq.c +7 -7
@@ -293,7 +293,6 @@ static unsigned twl4030_irq_base;*/ static irqreturn_t handle_twl4030_pih (int irq,void *devid) { -int module_irq;irqreturn_t ret;u8 pih_isr;
@@ -304,12 +303,13 @@ static irqreturn_t handle_twl4030_pih(int irq, void *devid)return IRQ_NONE ; } -/* these handlers deal with the relevant SIH irq status */ -for (module_irq = twl4030_irq_base; - pih_isr; - pih_isr >>=1 , module_irq++) { -if (pih_isr &0x1 ) -handle_nested_irq (module_irq); +while (pih_isr) { +unsigned long pending =__ffs (pih_isr); +unsigned int irq; + + pih_isr &= ~BIT (pending); + irq = pending + twl4030_irq_base; +handle_nested_irq (irq); }return IRQ_HANDLED ;
Signature · 1 line
1.7.0.4
PATCH 7/12 mfd: twl-*: Change from pr_XXX to dev_XXX macros and various cleanups
In reply to Benoit CoussonSince a structure device is available now, use the dev_ macros instead of the pr_ ones.
Clean some badly formatted comments.
Remove some unused variables.
Move some variable to the place they belong.
Clean some badly wrapped lines.
Align variable definition
Add missing braces in if-then-else block.
Add blank line for better readability.
Move stuff here and there...
--- drivers/mfd/twl-core.c | 32 ++++++++++++++++++-------------- drivers/mfd/twl4030-irq.c | 23 +++++++++++------------ drivers/mfd/twl6030-irq.c | 39 +++++++++++++++++++-------------------- 3 files changed, 48 insertions(+), 46 deletions(-)
drivers/mfd/twl-core.c +18 -14
@@ -1174,17 +1174,15 @@ static int twl_remove(struct i2c_client *client)return 0 ; } -/* NOTE: this driver only handles a single twl4030/tps659x0 chip */ +/* NOTE: This driver only handles a single twl4030/tps659x0 chip */ static int __devinit twl_probe (struct i2c_client *client,const struct i2c_device_id *id) { -int irq_base; -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 ; +int irq_base =0 ; +int status; +unsigned i;if (node && !pdata) {/*
@@ -1214,12 +1212,12 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) }for (i =0 ; i <TWL_NUM_SLAVES ; i++) { -struct twl_client *twl = &twl_modules[i]; +struct twl_client *twl = &twl_modules[i]; twl->address = client->addr + i; -if (i ==0 ) +if (i ==0 ) { twl->client = client; -else { + }else { twl->client =i2c_new_dummy (client->adapter, twl->address);if (!twl->client) {
@@ -1231,7 +1229,9 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) }mutex_init (&twl->xfer_lock); } + inuse = true; +if ((id->driver_data) &TWL6030_CLASS ) { twl_id =TWL6030_CLASS_ID ; twl_map = &twl6030_map[0 ];
@@ -1245,8 +1245,8 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)/* read TWL IDCODE Register */ if (twl_id ==TWL4030_CLASS_ID ) { - ret =twl_read_idcode_register (); -WARN (ret <0 ,"Error: reading twl_idcode register value\n" ); + status =twl_read_idcode_register (); +WARN (status <0 ,"Error: reading twl_idcode register value\n" ); }/* load power event scripts */
@@ -1268,19 +1268,22 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) } } -/* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. +/* +* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. * Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0, * SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0. */ -if (twl_class_is_4030 ()) { +u8 temp; +twl_i2c_read_u8 (TWL4030_MODULE_INTBR , &temp,REG_GPPUPDCTR1 ); temp &= ~(SR_I2C_SDA_CTRL_PU |SR_I2C_SCL_CTRL_PU | \ -I2C_SDA_CTRL_PU |I2C_SCL_CTRL_PU ); +I2C_SDA_CTRL_PU |I2C_SCL_CTRL_PU );twl_i2c_write_u8 (TWL4030_MODULE_INTBR , temp,REG_GPPUPDCTR1 ); } status = -ENODEV ; +if (node) status =of_platform_populate (node,NULL ,NULL , &client->dev);if (status)
@@ -1289,6 +1292,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) fail:if (status <0 )twl_remove (client); +return status; }
drivers/mfd/twl4030-irq.c +11 -12
@@ -32,7 +32,6 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/slab.h> -#include <linux/of.h> #include <linux/irqdomain.h> #include <linux/i2c/twl.h>
@@ -625,7 +624,8 @@ static irqreturn_t handle_twl4030_sih(int irq, void *data)return IRQ_HANDLED ; } -/* returns the first IRQ used by this SIH bank, +/* +* returns the first IRQ used by this SIH bank, * or negative errno */ int twl4030_sih_setup (struct device *dev,int module,int irq_base)
@@ -637,14 +637,14 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)int status = -EINVAL ;/* only support modules with standard clear-on-read for now */ -for (sih_mod =0 , sih = sih_modules; - sih_mod < nr_sih_modules; +for (sih_mod =0 , sih = sih_modules; sih_mod < nr_sih_modules; sih_mod++, sih++) {if (sih->module == module && sih->set_cor) { status =0 ;break ; } } +if (status <0 )return status;
@@ -674,7 +674,7 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base) status =request_threaded_irq (irq,NULL , handle_twl4030_sih,0 , agent->irq_name ?: sih->name,NULL ); -pr_info ("twl4030: %s (irq %d) chaining IRQs %d..%d\n" , sih->name, +dev_info (dev,"%s (irq %d) chaining IRQs %d..%d\n" , sih->name, irq, irq_base, irq_base + i -1 );return status <0 ? status : irq_base;
@@ -691,12 +691,10 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)int twl4030_init_irq (struct device *dev,int irq_num) {static struct irq_chip twl4030_irq_chip; +int status, i;int irq_base, irq_end, nr_irqs;struct device_node *node = dev->of_node; -int status; -int i; -/* * TWL core and pwr interrupts must be contiguous because * the hwirqs numbers are defined contiguously from 1 to 15.
@@ -725,7 +723,8 @@ int twl4030_init_irq(struct device *dev, int irq_num) twl4030_irq_base = irq_base; -/* install an irq handler for each of the SIH modules; +/* +* Install an irq handler for each of the SIH modules; * clone dummy irq_chip since PIH can't *do* anything */ twl4030_irq_chip = dummy_irq_chip;
@@ -740,13 +739,13 @@ int twl4030_init_irq(struct device *dev, int irq_num)activate_irq (i); } -pr_info ("twl4030: %s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , +dev_info (dev,"%s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , irq_num, irq_base, irq_end);/* ... and the PWR_INT module ... */ status =twl4030_sih_setup (dev,TWL4030_MODULE_INT , irq_end);if (status <0 ) { -pr_err ("twl4030: sih_setup PWR INT --> %d\n" , status); +dev_err (dev,"sih_setup PWR INT --> %d\n" , status); goto fail; }
@@ -755,7 +754,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)IRQF_ONESHOT , "TWL4030-PIH", NULL);if (status <0 ) { -pr_err ("twl4030: could not claim irq%d: %d\n" , irq_num, status); +dev_err (dev,"could not claim irq%d: %d\n" , irq_num, status); goto fail_rqirq; }
drivers/mfd/twl6030-irq.c +19 -20
@@ -53,7 +53,6 @@* * We set up IRQs starting@a platform-specified base. An interrupt map table, * specifies mapping between interrupt number and the associated module. -* */ #define TWL6030_NR_IRQS 20
@@ -342,14 +341,11 @@ int twl6030_init_irq(struct device *dev, int irq_num) {struct device_node *node = dev->of_node;int nr_irqs, irq_base, irq_end; - -int status =0 ; -int i;struct task_struct *task; -int ret; -u8 mask[4 ]; - -static struct irq_chip twl6030_irq_chip; +static struct irq_chip twl6030_irq_chip; +int status =0 ; +int i; +u8 mask[4 ]; nr_irqs =TWL6030_NR_IRQS ;
@@ -367,16 +363,18 @@ int twl6030_init_irq(struct device *dev, int irq_num) mask[1 ] =0xFF ; mask[2 ] =0xFF ; mask[3 ] =0xFF ; - ret =twl_i2c_write (TWL_MODULE_PIH , &mask[0 ], -REG_INT_MSK_LINE_A ,3 );/* MASK ALL INT LINES */ - ret =twl_i2c_write (TWL_MODULE_PIH , &mask[0 ], -REG_INT_MSK_STS_A ,3 );/* MASK ALL INT STS */ - ret =twl_i2c_write (TWL_MODULE_PIH , &mask[0 ], -REG_INT_STS_A ,3 );/* clear INT_STS_A,B,C */ + +/* mask all int lines */ +twl_i2c_write (TWL_MODULE_PIH , &mask[0 ],REG_INT_MSK_LINE_A ,3 ); +/* mask all int sts */ +twl_i2c_write (TWL_MODULE_PIH , &mask[0 ],REG_INT_MSK_STS_A ,3 ); +/* clear INT_STS_A,B,C */ +twl_i2c_write (TWL_MODULE_PIH , &mask[0 ],REG_INT_STS_A ,3 ); twl6030_irq_base = irq_base; -/* install an irq handler for each of the modules; +/* +* install an irq handler for each of the modules; * clone dummy irq_chip since PIH can't *do* anything */ twl6030_irq_chip = dummy_irq_chip;
@@ -391,22 +389,22 @@ int twl6030_init_irq(struct device *dev, int irq_num)activate_irq (i); } -pr_info ("twl6030: %s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , +dev_info (dev,"PIH (irq %d) chaining IRQs %d..%d\n" , irq_num, irq_base, irq_end);/* install an irq handler to demultiplex the TWL6030 interrupt */ init_completion (&irq_event); - status =request_irq (irq_num, handle_twl6030_pih,0 , -"TWL6030-PIH" , &irq_event); + status =request_irq (irq_num, handle_twl6030_pih,0 ,"TWL6030-PIH" , + &irq_event);if (status <0 ) { -pr_err ("twl6030: could not claim irq%d: %d\n" , irq_num, status); +dev_err (dev,"could not claim irq %d: %d\n" , irq_num, status); goto fail_irq; } task =kthread_run (twl6030_irq_thread, (void *)irq_num,"twl6030-irq" );if (IS_ERR (task)) { -pr_err ("twl6030: could not create irq %d thread!\n" , irq_num); +dev_err (dev,"could not create irq %d thread!\n" , irq_num); status =PTR_ERR (task); goto fail_kthread; }
@@ -421,6 +419,7 @@ fail_kthread: fail_irq:for (i = irq_base; i < irq_end; i++)irq_set_chip_and_handler (i,NULL ,NULL ); +return status; }
Signature · 1 line
1.7.0.4
PATCH 7/12 mfd: twl-*: Replace pr_ macros by the dev_ equivalent and do various cleanups
In reply to Benoit CoussonSince a structure device is available now, use the dev_ macros instead of the pr_ ones.
Clean some badly formatted comments.
Remove some unused variables.
Move some variable to the place they belong.
Clean some badly wrapped lines.
Align variable definition
Add missing braces in if-then-else block.
Add blank line for better readability.
Move stuff here and there...
--- drivers/mfd/twl-core.c | 32 ++++++++++++++++++-------------- drivers/mfd/twl4030-irq.c | 23 +++++++++++------------ drivers/mfd/twl6030-irq.c | 39 +++++++++++++++++++-------------------- 3 files changed, 48 insertions(+), 46 deletions(-)
drivers/mfd/twl-core.c +18 -14
@@ -1174,17 +1174,15 @@ static int twl_remove(struct i2c_client *client)return 0 ; } -/* NOTE: this driver only handles a single twl4030/tps659x0 chip */ +/* NOTE: This driver only handles a single twl4030/tps659x0 chip */ static int __devinit twl_probe (struct i2c_client *client,const struct i2c_device_id *id) { -int irq_base; -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 ; +int irq_base =0 ; +int status; +unsigned i;if (node && !pdata) {/*
@@ -1214,12 +1212,12 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) }for (i =0 ; i <TWL_NUM_SLAVES ; i++) { -struct twl_client *twl = &twl_modules[i]; +struct twl_client *twl = &twl_modules[i]; twl->address = client->addr + i; -if (i ==0 ) +if (i ==0 ) { twl->client = client; -else { + }else { twl->client =i2c_new_dummy (client->adapter, twl->address);if (!twl->client) {
@@ -1231,7 +1229,9 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) }mutex_init (&twl->xfer_lock); } + inuse = true; +if ((id->driver_data) &TWL6030_CLASS ) { twl_id =TWL6030_CLASS_ID ; twl_map = &twl6030_map[0 ];
@@ -1245,8 +1245,8 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)/* read TWL IDCODE Register */ if (twl_id ==TWL4030_CLASS_ID ) { - ret =twl_read_idcode_register (); -WARN (ret <0 ,"Error: reading twl_idcode register value\n" ); + status =twl_read_idcode_register (); +WARN (status <0 ,"Error: reading twl_idcode register value\n" ); }/* load power event scripts */
@@ -1268,19 +1268,22 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) } } -/* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. +/* +* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. * Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0, * SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0. */ -if (twl_class_is_4030 ()) { +u8 temp; +twl_i2c_read_u8 (TWL4030_MODULE_INTBR , &temp,REG_GPPUPDCTR1 ); temp &= ~(SR_I2C_SDA_CTRL_PU |SR_I2C_SCL_CTRL_PU | \ -I2C_SDA_CTRL_PU |I2C_SCL_CTRL_PU ); +I2C_SDA_CTRL_PU |I2C_SCL_CTRL_PU );twl_i2c_write_u8 (TWL4030_MODULE_INTBR , temp,REG_GPPUPDCTR1 ); } status = -ENODEV ; +if (node) status =of_platform_populate (node,NULL ,NULL , &client->dev);if (status)
@@ -1289,6 +1292,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) fail:if (status <0 )twl_remove (client); +return status; }
drivers/mfd/twl4030-irq.c +11 -12
@@ -32,7 +32,6 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/slab.h> -#include <linux/of.h> #include <linux/irqdomain.h> #include <linux/i2c/twl.h>
@@ -625,7 +624,8 @@ static irqreturn_t handle_twl4030_sih(int irq, void *data)return IRQ_HANDLED ; } -/* returns the first IRQ used by this SIH bank, +/* +* returns the first IRQ used by this SIH bank, * or negative errno */ int twl4030_sih_setup (struct device *dev,int module,int irq_base)
@@ -637,14 +637,14 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)int status = -EINVAL ;/* only support modules with standard clear-on-read for now */ -for (sih_mod =0 , sih = sih_modules; - sih_mod < nr_sih_modules; +for (sih_mod =0 , sih = sih_modules; sih_mod < nr_sih_modules; sih_mod++, sih++) {if (sih->module == module && sih->set_cor) { status =0 ;break ; } } +if (status <0 )return status;
@@ -674,7 +674,7 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base) status =request_threaded_irq (irq,NULL , handle_twl4030_sih,0 , agent->irq_name ?: sih->name,NULL ); -pr_info ("twl4030: %s (irq %d) chaining IRQs %d..%d\n" , sih->name, +dev_info (dev,"%s (irq %d) chaining IRQs %d..%d\n" , sih->name, irq, irq_base, irq_base + i -1 );return status <0 ? status : irq_base;
@@ -691,12 +691,10 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)int twl4030_init_irq (struct device *dev,int irq_num) {static struct irq_chip twl4030_irq_chip; +int status, i;int irq_base, irq_end, nr_irqs;struct device_node *node = dev->of_node; -int status; -int i; -/* * TWL core and pwr interrupts must be contiguous because * the hwirqs numbers are defined contiguously from 1 to 15.
@@ -725,7 +723,8 @@ int twl4030_init_irq(struct device *dev, int irq_num) twl4030_irq_base = irq_base; -/* install an irq handler for each of the SIH modules; +/* +* Install an irq handler for each of the SIH modules; * clone dummy irq_chip since PIH can't *do* anything */ twl4030_irq_chip = dummy_irq_chip;
@@ -740,13 +739,13 @@ int twl4030_init_irq(struct device *dev, int irq_num)activate_irq (i); } -pr_info ("twl4030: %s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , +dev_info (dev,"%s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , irq_num, irq_base, irq_end);/* ... and the PWR_INT module ... */ status =twl4030_sih_setup (dev,TWL4030_MODULE_INT , irq_end);if (status <0 ) { -pr_err ("twl4030: sih_setup PWR INT --> %d\n" , status); +dev_err (dev,"sih_setup PWR INT --> %d\n" , status); goto fail; }
@@ -755,7 +754,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)IRQF_ONESHOT , "TWL4030-PIH", NULL);if (status <0 ) { -pr_err ("twl4030: could not claim irq%d: %d\n" , irq_num, status); +dev_err (dev,"could not claim irq%d: %d\n" , irq_num, status); goto fail_rqirq; }
drivers/mfd/twl6030-irq.c +19 -20
@@ -53,7 +53,6 @@* * We set up IRQs starting@a platform-specified base. An interrupt map table, * specifies mapping between interrupt number and the associated module. -* */ #define TWL6030_NR_IRQS 20
@@ -342,14 +341,11 @@ int twl6030_init_irq(struct device *dev, int irq_num) {struct device_node *node = dev->of_node;int nr_irqs, irq_base, irq_end; - -int status =0 ; -int i;struct task_struct *task; -int ret; -u8 mask[4 ]; - -static struct irq_chip twl6030_irq_chip; +static struct irq_chip twl6030_irq_chip; +int status =0 ; +int i; +u8 mask[4 ]; nr_irqs =TWL6030_NR_IRQS ;
@@ -367,16 +363,18 @@ int twl6030_init_irq(struct device *dev, int irq_num) mask[1 ] =0xFF ; mask[2 ] =0xFF ; mask[3 ] =0xFF ; - ret =twl_i2c_write (TWL_MODULE_PIH , &mask[0 ], -REG_INT_MSK_LINE_A ,3 );/* MASK ALL INT LINES */ - ret =twl_i2c_write (TWL_MODULE_PIH , &mask[0 ], -REG_INT_MSK_STS_A ,3 );/* MASK ALL INT STS */ - ret =twl_i2c_write (TWL_MODULE_PIH , &mask[0 ], -REG_INT_STS_A ,3 );/* clear INT_STS_A,B,C */ + +/* mask all int lines */ +twl_i2c_write (TWL_MODULE_PIH , &mask[0 ],REG_INT_MSK_LINE_A ,3 ); +/* mask all int sts */ +twl_i2c_write (TWL_MODULE_PIH , &mask[0 ],REG_INT_MSK_STS_A ,3 ); +/* clear INT_STS_A,B,C */ +twl_i2c_write (TWL_MODULE_PIH , &mask[0 ],REG_INT_STS_A ,3 ); twl6030_irq_base = irq_base; -/* install an irq handler for each of the modules; +/* +* install an irq handler for each of the modules; * clone dummy irq_chip since PIH can't *do* anything */ twl6030_irq_chip = dummy_irq_chip;
@@ -391,22 +389,22 @@ int twl6030_init_irq(struct device *dev, int irq_num)activate_irq (i); } -pr_info ("twl6030: %s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , +dev_info (dev,"PIH (irq %d) chaining IRQs %d..%d\n" , irq_num, irq_base, irq_end);/* install an irq handler to demultiplex the TWL6030 interrupt */ init_completion (&irq_event); - status =request_irq (irq_num, handle_twl6030_pih,0 , -"TWL6030-PIH" , &irq_event); + status =request_irq (irq_num, handle_twl6030_pih,0 ,"TWL6030-PIH" , + &irq_event);if (status <0 ) { -pr_err ("twl6030: could not claim irq%d: %d\n" , irq_num, status); +dev_err (dev,"could not claim irq %d: %d\n" , irq_num, status); goto fail_irq; } task =kthread_run (twl6030_irq_thread, (void *)irq_num,"twl6030-irq" );if (IS_ERR (task)) { -pr_err ("twl6030: could not create irq %d thread!\n" , irq_num); +dev_err (dev,"could not create irq %d thread!\n" , irq_num); status =PTR_ERR (task); goto fail_kthread; }
@@ -421,6 +419,7 @@ fail_kthread: fail_irq:for (i = irq_base; i < irq_end; i++)irq_set_chip_and_handler (i,NULL ,NULL ); +return status; }
Signature · 1 line
1.7.0.4
PATCH 7/12 mfd: twl-*: Replace pr_ macros by the dev_ equivalent and do various cleanups
For people who were really impatient to get that patch #7, here is the reason it was rejected...
vger.kernel.org #<vger.kernel.org #5.7.1 SMTP; 550 5.7.1 Content-Policy reject msg: The capital Triple-X in subject is way too often associated with junk email, please rephrase. BF:<H 0>; S1758911Ab2CBQvf> #SMTP#
The original subject was indeed using a *double* Triple-X...
mfd: twl-*: Change from pr_XXX to dev_XXX macros and various cleanups
Definitively too nasty for linux-omap mailing list...
I'm really glad vger.kernel.org is taking care of the ethics of the patches :-)
Regards,
Benoit
Quoted 307 lines · Benoit Cousson
Since a structure device is available now, use the
dev_macros instead of thepr_ones.Clean some badly formatted comments.
Remove some unused variables.
Move some variable to the place they belong.
Clean some badly wrapped lines.
Align variable definition
Add missing braces in if-then-else block.
Add blank line for better readability.
Move stuff here and there...Signed-off-by Benoit Cousson<[email protected]>Cc Felipe Balbi<[email protected]>--- drivers/mfd/twl-core.c | 32 ++++++++++++++++++-------------- drivers/mfd/twl4030-irq.c | 23 +++++++++++------------ drivers/mfd/twl6030-irq.c | 39 +++++++++++++++++++-------------------- 3 files changed, 48 insertions(+), 46 deletions(-)drivers/mfd/twl-core.c +18
-14@@ -1174,17 +1174,15 @@ static int twl_remove(struct i2c_client *client)return 0 ; } -/* NOTE: this driver only handles a single twl4030/tps659x0 chip */ +/* NOTE: This driver only handles a single twl4030/tps659x0 chip */ static int __devinit twl_probe (struct i2c_client *client,const struct i2c_device_id *id) { -int irq_base; -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 ; +int irq_base =0 ; +int status; +unsigned i;if (node&& !pdata) {/* @@ -1214,12 +1212,12 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) }for (i =0 ; i<TWL_NUM_SLAVES ; i++) { -struct twl_client *twl =&twl_modules[i]; +struct twl_client *twl =&twl_modules[i]; twl->address = client->addr + i; -if (i ==0 ) +if (i ==0 ) { twl->client = client; -else { + }else { twl->client =i2c_new_dummy (client->adapter, twl->address);if (!twl->client) {@@ -1231,7 +1229,9 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) }mutex_init (&twl->xfer_lock); } + inuse = true; +if ((id->driver_data)&TWL6030_CLASS ) { twl_id =TWL6030_CLASS_ID ; twl_map =&twl6030_map[0 ];@@ -1245,8 +1245,8 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)/* read TWL IDCODE Register */ if (twl_id ==TWL4030_CLASS_ID ) { - ret =twl_read_idcode_register (); -WARN (ret<0 ,"Error: reading twl_idcode register value\n" ); + status =twl_read_idcode_register (); +WARN (status<0 ,"Error: reading twl_idcode register value\n" ); }/* load power event scripts */ @@ -1268,19 +1268,22 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) } } -/* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. +/* +* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. * Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0, * SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0. */ -if (twl_class_is_4030 ()) { +u8 temp; +twl_i2c_read_u8 (TWL4030_MODULE_INTBR ,&temp,REG_GPPUPDCTR1 ); temp&= ~(SR_I2C_SDA_CTRL_PU |SR_I2C_SCL_CTRL_PU | \ -I2C_SDA_CTRL_PU |I2C_SCL_CTRL_PU ); +I2C_SDA_CTRL_PU |I2C_SCL_CTRL_PU );twl_i2c_write_u8 (TWL4030_MODULE_INTBR , temp,REG_GPPUPDCTR1 ); } status = -ENODEV ; +if (node) status =of_platform_populate (node,NULL ,NULL ,&client->dev);if (status)@@ -1289,6 +1292,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) fail:if (status<0 )twl_remove (client); +return status; }drivers/mfd/twl4030-irq.c +11
-12@@ -32,7 +32,6 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/slab.h> -#include <linux/of.h> #include <linux/irqdomain.h> #include <linux/i2c/twl.h> @@ -625,7 +624,8 @@ static irqreturn_t handle_twl4030_sih(int irq, void *data)return IRQ_HANDLED ; } -/* returns the first IRQ used by this SIH bank, +/* +* returns the first IRQ used by this SIH bank, * or negative errno */ int twl4030_sih_setup (struct device *dev,int module,int irq_base)@@ -637,14 +637,14 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)int status = -EINVAL ;/* only support modules with standard clear-on-read for now */ -for (sih_mod =0 , sih = sih_modules; - sih_mod< nr_sih_modules; +for (sih_mod =0 , sih = sih_modules; sih_mod< nr_sih_modules; sih_mod++, sih++) {if (sih->module == module&& sih->set_cor) { status =0 ;break ; } } +if (status<0 )return status;@@ -674,7 +674,7 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base) status =request_threaded_irq (irq,NULL , handle_twl4030_sih,0 , agent->irq_name ?: sih->name,NULL ); -pr_info ("twl4030: %s (irq %d) chaining IRQs %d..%d\n" , sih->name, +dev_info (dev,"%s (irq %d) chaining IRQs %d..%d\n" , sih->name, irq, irq_base, irq_base + i -1 );return status<0 ? status : irq_base;@@ -691,12 +691,10 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)int twl4030_init_irq (struct device *dev,int irq_num) {static struct irq_chip twl4030_irq_chip; +int status, i;int irq_base, irq_end, nr_irqs;struct device_node *node = dev->of_node; -int status; -int i; -/* * TWL core and pwr interrupts must be contiguous because * the hwirqs numbers are defined contiguously from 1 to 15. @@ -725,7 +723,8 @@ int twl4030_init_irq(struct device *dev, int irq_num) twl4030_irq_base = irq_base; -/* install an irq handler for each of the SIH modules; +/* +* Install an irq handler for each of the SIH modules; * clone dummy irq_chip since PIH can't *do* anything */ twl4030_irq_chip = dummy_irq_chip;@@ -740,13 +739,13 @@ int twl4030_init_irq(struct device *dev, int irq_num)activate_irq (i); } -pr_info ("twl4030: %s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , +dev_info (dev,"%s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , irq_num, irq_base, irq_end);/* ... and the PWR_INT module ... */ status =twl4030_sih_setup (dev,TWL4030_MODULE_INT , irq_end);if (status<0 ) { -pr_err ("twl4030: sih_setup PWR INT --> %d\n" , status); +dev_err (dev,"sih_setup PWR INT --> %d\n" , status); goto fail; }@@ -755,7 +754,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)IRQF_ONESHOT , "TWL4030-PIH", NULL);if (status<0 ) { -pr_err ("twl4030: could not claim irq%d: %d\n" , irq_num, status); +dev_err (dev,"could not claim irq%d: %d\n" , irq_num, status); goto fail_rqirq; }drivers/mfd/twl6030-irq.c +19
-20@@ -53,7 +53,6 @@* * We set up IRQs starting at a platform-specified base. An interrupt map table, * specifies mapping between interrupt number and the associated module. -* */ #define TWL6030_NR_IRQS 20@@ -342,14 +341,11 @@ int twl6030_init_irq(struct device *dev, int irq_num) {struct device_node *node = dev->of_node;int nr_irqs, irq_base, irq_end; - -int status =0 ; -int i;struct task_struct *task; -int ret; -u8 mask[4 ]; - -static struct irq_chip twl6030_irq_chip; +static struct irq_chip twl6030_irq_chip; +int status =0 ; +int i; +u8 mask[4 ]; nr_irqs =TWL6030_NR_IRQS ;@@ -367,16 +363,18 @@ int twl6030_init_irq(struct device *dev, int irq_num) mask[1 ] =0xFF ; mask[2 ] =0xFF ; mask[3 ] =0xFF ; - ret =twl_i2c_write (TWL_MODULE_PIH ,&mask[0 ], -REG_INT_MSK_LINE_A ,3 );/* MASK ALL INT LINES */ - ret =twl_i2c_write (TWL_MODULE_PIH ,&mask[0 ], -REG_INT_MSK_STS_A ,3 );/* MASK ALL INT STS */ - ret =twl_i2c_write (TWL_MODULE_PIH ,&mask[0 ], -REG_INT_STS_A ,3 );/* clear INT_STS_A,B,C */ + +/* mask all int lines */ +twl_i2c_write (TWL_MODULE_PIH ,&mask[0 ],REG_INT_MSK_LINE_A ,3 ); +/* mask all int sts */ +twl_i2c_write (TWL_MODULE_PIH ,&mask[0 ],REG_INT_MSK_STS_A ,3 ); +/* clear INT_STS_A,B,C */ +twl_i2c_write (TWL_MODULE_PIH ,&mask[0 ],REG_INT_STS_A ,3 ); twl6030_irq_base = irq_base; -/* install an irq handler for each of the modules; +/* +* install an irq handler for each of the modules; * clone dummy irq_chip since PIH can't *do* anything */ twl6030_irq_chip = dummy_irq_chip;@@ -391,22 +389,22 @@ int twl6030_init_irq(struct device *dev, int irq_num)activate_irq (i); } -pr_info ("twl6030: %s (irq %d) chaining IRQs %d..%d\n" ,"PIH" , +dev_info (dev,"PIH (irq %d) chaining IRQs %d..%d\n" , irq_num, irq_base, irq_end);/* install an irq handler to demultiplex the TWL6030 interrupt */ init_completion (&irq_event); - status =request_irq (irq_num, handle_twl6030_pih,0 , -"TWL6030-PIH" ,&irq_event); + status =request_irq (irq_num, handle_twl6030_pih,0 ,"TWL6030-PIH" , + &irq_event);if (status<0 ) { -pr_err ("twl6030: could not claim irq%d: %d\n" , irq_num, status); +dev_err (dev,"could not claim irq %d: %d\n" , irq_num, status); goto fail_irq; } task =kthread_run (twl6030_irq_thread, (void *)irq_num,"twl6030-irq" );if (IS_ERR (task)) { -pr_err ("twl6030: could not create irq %d thread!\n" , irq_num); +dev_err (dev,"could not create irq %d thread!\n" , irq_num); status =PTR_ERR (task); goto fail_kthread; }@@ -421,6 +419,7 @@ fail_kthread: fail_irq:for (i = irq_base; i< irq_end; i++)irq_set_chip_and_handler (i,NULL ,NULL ); +return status; }
PATCH 8/12 gpio/twl: Allocate irq_desc dynamically for SPARSE_IRQ support
In reply to Benoit CoussonDo not use the board pdata for irq_base, but allocate them dynamically to allow a proper support of SPARSE_IRQ.
Fix an unneeded line wrap.
--- drivers/gpio/gpio-twl4030.c | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-)
drivers/gpio/gpio-twl4030.c +17 -16
@@ -395,23 +395,26 @@ static int gpio_twl4030_remove(struct platform_device *pdev);static int __devinit gpio_twl4030_probe (struct platform_device *pdev) {struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; -int ret; +int ret, irq_base;/* maybe setup IRQs */ -if (pdata->irq_base) { -if (is_module ()) { -dev_err (&pdev->dev, -"can't dispatch IRQs from modules\n" ); - goto no_irqs; - } - ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , - pdata->irq_base); -if (ret <0 ) -return ret; -WARN_ON (ret != pdata->irq_base); - twl4030_gpio_irq_base = ret; +if (is_module ()) { +dev_err (&pdev->dev,"can't dispatch IRQs from modules\n" ); + goto no_irqs; + } + + irq_base =irq_alloc_descs (-1 ,0 ,TWL4030_GPIO_MAX ,0 ); +if (irq_base <0 ) { +dev_err (&pdev->dev,"Failed to alloc irq_descs\n" ); +return irq_base; } + ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , irq_base); +if (ret <0 ) +return ret; + + twl4030_gpio_irq_base = irq_base; + no_irqs:/* * NOTE: boards may waste power if they don't set pullups
@@ -443,9 +446,7 @@ no_irqs: ret =gpiochip_add (&twl_gpiochip);if (ret <0 ) { -dev_err (&pdev->dev, -"could not register gpiochip, %d\n" , - ret); +dev_err (&pdev->dev,"could not register gpiochip, %d\n" , ret); twl_gpiochip.ngpio =0 ;gpio_twl4030_remove (pdev); }else if (pdata->setup) {
Signature · 1 line
1.7.0.4
PATCH 8/12 gpio/twl: Allocate irq_desc dynamically for SPARSE_IRQ support
Hi Grant,
That fix is tightly coupled with the previous twl4030-irq change, so it will be good to pulled it with the twl series through MFD if you are OK with that?
Care to ack this one and the next one?
Thanks,
Benoit
Quoted 66 lines · Benoit Cousson
Do not use the board pdata for
irq_base, but allocate them dynamically to allow a proper support ofSPARSE_IRQ.Fix an unneeded line wrap.
Signed-off-by Benoit Cousson<[email protected]>Acked-by Felipe Balbi<[email protected]>--- drivers/gpio/gpio-twl4030.c | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-)drivers/gpio/gpio-twl4030.c +17
-16@@ -395,23 +395,26 @@ static int gpio_twl4030_remove(struct platform_device *pdev);static int __devinit gpio_twl4030_probe (struct platform_device *pdev) {struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; -int ret; +int ret, irq_base;/* maybe setup IRQs */ -if (pdata->irq_base) { -if (is_module ()) { -dev_err (&pdev->dev, -"can't dispatch IRQs from modules\n" ); - goto no_irqs; - } - ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , - pdata->irq_base); -if (ret<0 ) -return ret; -WARN_ON (ret != pdata->irq_base); - twl4030_gpio_irq_base = ret; +if (is_module ()) { +dev_err (&pdev->dev,"can't dispatch IRQs from modules\n" ); + goto no_irqs; + } + + irq_base =irq_alloc_descs (-1 ,0 ,TWL4030_GPIO_MAX ,0 ); +if (irq_base<0 ) { +dev_err (&pdev->dev,"Failed to alloc irq_descs\n" ); +return irq_base; } + ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , irq_base); +if (ret<0 ) +return ret; + + twl4030_gpio_irq_base = irq_base; + no_irqs:/* * NOTE: boards may waste power if they don't set pullups @@ -443,9 +446,7 @@ no_irqs: ret =gpiochip_add (&twl_gpiochip);if (ret<0 ) { -dev_err (&pdev->dev, -"could not register gpiochip, %d\n" , - ret); +dev_err (&pdev->dev,"could not register gpiochip, %d\n" , ret); twl_gpiochip.ngpio =0 ;gpio_twl4030_remove (pdev); }else if (pdata->setup) {
PATCH 8/12 gpio/twl: Allocate irq_desc dynamically for SPARSE_IRQ support
Hi Grant,
Gentle ping for these patches.
Thanks,
Benoit
Quoted 85 lines · Benoit
Hi Grant,
That fix is tightly coupled with the previous twl4030-irq change, so it will be good to pulled it with the twl series through MFD if you are OK with that?
Care to ack this one and the next one?
Thanks,
BenoitQuoted 57 lines · Benoit Cousson
Do not use the board pdata for
irq_base, but allocate them dynamically to allow a proper support ofSPARSE_IRQ.Fix an unneeded line wrap.
Signed-off-by Benoit Cousson<[email protected]>Acked-by Felipe Balbi<[email protected]>---
drivers/gpio/gpio-twl4030.c| 33 +++++++++++++++++----------------1 files changed, 17 insertions(+), 16 deletions(-)drivers/gpio/gpio-twl4030.c +16
-13@@ -395,23 +395,26 @@ static int gpio_twl4030_remove(struct platform_device *pdev);static int __devinit gpio_twl4030_probe (struct platform_device *pdev) {struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; -int ret; +int ret, irq_base;/* maybe setup IRQs */ -if (pdata->irq_base) { -if (is_module ()) { -dev_err (&pdev->dev, -"can't dispatch IRQs from modules\n" ); - goto no_irqs; - } - ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , - pdata->irq_base); -if (ret<0 ) -return ret; -WARN_ON (ret != pdata->irq_base); - twl4030_gpio_irq_base = ret; +if (is_module ()) { +dev_err (&pdev->dev,"can't dispatch IRQs from modules\n" ); + goto no_irqs; + } + + irq_base =irq_alloc_descs (-1 ,0 ,TWL4030_GPIO_MAX ,0 ); +if (irq_base<0 ) { +dev_err (&pdev->dev,"Failed to alloc irq_descs\n" ); +return irq_base; } + ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , irq_base); +if (ret<0 ) +return ret; + + twl4030_gpio_irq_base = irq_base; +
no_irqs:
/*
* NOTE: boards may waste power if they don't set pullupsdrivers/gpio/gpio-twl4030.c no_irqs: · line 452
Quoted 10 lines
drivers/gpio/gpio-twl4030.c +1
-3@@ -443,9 +446,7 @@ no_irqs: ret =gpiochip_add (&twl_gpiochip);if (ret<0 ) { -dev_err (&pdev->dev, -"could not register gpiochip, %d\n" , - ret); +dev_err (&pdev->dev,"could not register gpiochip, %d\n" , ret); twl_gpiochip.ngpio =0 ;gpio_twl4030_remove (pdev); }else if (pdata->setup) {--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/12 gpio/twl: Allocate irq_desc dynamically for SPARSE_IRQ support
In reply to Cousson, BenoitQuoted 6 lines · Benoit
Hi Grant,
That fix is tightly coupled with the previous twl4030-irq change, so it will be good to pulled it with the twl series through MFD if you are OK with that?
Quoted 14 lines
Care to ack this one and the next one?
Thanks,
BenoitQuoted 7 lines · Benoit Cousson
Do not use the board pdata for
irq_base, but allocate them dynamically to allow a proper support ofSPARSE_IRQ.Fix an unneeded line wrap.
Signed-off-by Benoit Cousson<[email protected]>Acked-by Felipe Balbi<[email protected]>
Quoted 60 lines
Quoted 59 lines
--- drivers/gpio/gpio-twl4030.c | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-)drivers/gpio/gpio-twl4030.c +17
-16@@ -395,23 +395,26 @@ static int gpio_twl4030_remove(struct platform_device *pdev);static int __devinit gpio_twl4030_probe (struct platform_device *pdev) {struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; -int ret; +int ret, irq_base;/* maybe setup IRQs */ -if (pdata->irq_base) { -if (is_module ()) { -dev_err (&pdev->dev, -"can't dispatch IRQs from modules\n" ); - goto no_irqs; - } - ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , - pdata->irq_base); -if (ret<0 ) -return ret; -WARN_ON (ret != pdata->irq_base); - twl4030_gpio_irq_base = ret; +if (is_module ()) { +dev_err (&pdev->dev,"can't dispatch IRQs from modules\n" ); + goto no_irqs; + } + + irq_base =irq_alloc_descs (-1 ,0 ,TWL4030_GPIO_MAX ,0 ); +if (irq_base<0 ) { +dev_err (&pdev->dev,"Failed to alloc irq_descs\n" ); +return irq_base; } + ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , irq_base); +if (ret<0 ) +return ret; + + twl4030_gpio_irq_base = irq_base; + no_irqs:/* * NOTE: boards may waste power if they don't set pullups @@ -443,9 +446,7 @@ no_irqs: ret =gpiochip_add (&twl_gpiochip);if (ret<0 ) { -dev_err (&pdev->dev, -"could not register gpiochip, %d\n" , - ret); +dev_err (&pdev->dev,"could not register gpiochip, %d\n" , ret); twl_gpiochip.ngpio =0 ;gpio_twl4030_remove (pdev); }else if (pdata->setup) {
Signature · 2 lines
Grant Likely, B.Sc, P.Eng. Secret Lab Technologies,Ltd.
PATCH 9/12 gpio/twl: Add DT support to gpio-twl4030 driver
In reply to Benoit CoussonAdd the DT support for the I2C GPIO expander inside the twl4030.
--- .../devicetree/bindings/gpio/gpio-twl4030.txt | 23 ++++++ drivers/gpio/gpio-twl4030.c | 79 ++++++++++++------- 2 files changed, 73 insertions(+), 29 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-twl4030.txt
Documentation/devicetree/bindings/gpio/gpio-twl4030.txt new file +23 -0
@@ -0,0 +1,23 @@ +twl4030 GPIO controller bindings + +Required properties: +- compatible: + - "ti,twl4030-gpio" for twl4030 GPIO controller +- #gpio-cells : Should be two. + - first cell is the pin number + - second cell is used to specify optional parameters (unused) +- gpio-controller : Marks the device node as a GPIO controller. +- #interrupt-cells : Should be 2. +- interrupt-controller: Mark the device node as an interrupt controller + The first cell is the GPIO number. + The second cell is not used. + +Example: + +twl_gpio: gpio { + compatible = "ti,twl4030-gpio"; + #gpio-cells = <2>; + gpio-controller; + #interrupt-cells = <2>; + interrupt-controller; +};
drivers/gpio/gpio-twl4030.c +50 -29
134 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 9/12 gpio/twl: Add DT support to gpio-twl4030 driver
Quoted 4 lines · Benoit Cousson
Add the DT support for the I2C GPIO expander inside the twl4030.
Signed-off-by Benoit Cousson <[email protected]>Acked-by Felipe Balbi <[email protected]>
Quoted 183 lines
--- .../devicetree/bindings/gpio/gpio-twl4030.txt | 23 ++++++ drivers/gpio/gpio-twl4030.c | 79 ++++++++++++------- 2 files changed, 73 insertions(+), 29 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-twl4030.txtDocumentation/devicetree/bindings/gpio/gpio-twl4030.txt new file +23
-0@@ -0,0 +1,23 @@ +twl4030 GPIO controller bindings + +Required properties: +- compatible: + - "ti,twl4030-gpio" for twl4030 GPIO controller +- #gpio-cells : Should be two. + - first cell is the pin number + - second cell is used to specify optional parameters (unused) +- gpio-controller : Marks the device node as a GPIO controller. +- #interrupt-cells : Should be 2. +- interrupt-controller: Mark the device node as an interrupt controller + The first cell is the GPIO number. + The second cell is not used. + +Example: + +twl_gpio: gpio { + compatible = "ti,twl4030-gpio"; + #gpio-cells = <2>; + gpio-controller; + #interrupt-cells = <2>; + interrupt-controller; +};drivers/gpio/gpio-twl4030.c +50
-29@@ -32,6 +32,8 @@#include <linux/irq.h> #include <linux/gpio.h> #include <linux/platform_device.h> +#include <linux/of.h> +#include <linux/irqdomain.h> #include <linux/i2c/twl.h> @@ -256,7 +258,8 @@ static int twl_request(struct gpio_chip *chip, unsigned offset)* and vMMC2 power supplies based on card presence. */ pdata = chip->dev->platform_data; - value |= pdata->mmc_cd &0x03 ; +if (pdata) + value |= pdata->mmc_cd &0x03 ; status =gpio_twl4030_write (REG_GPIO_CTRL , value); }@@ -395,6 +398,7 @@ static int gpio_twl4030_remove(struct platform_device *pdev);static int __devinit gpio_twl4030_probe (struct platform_device *pdev) {struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; +struct device_node *node = pdev->dev.of_node;int ret, irq_base;/* maybe setup IRQs */ @@ -409,6 +413,9 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev)return irq_base; } +irq_domain_add_legacy (node,TWL4030_GPIO_MAX , irq_base,0 , + &irq_domain_simple_ops,NULL ); + ret =twl4030_sih_setup (&pdev->dev,TWL4030_MODULE_GPIO , irq_base);if (ret <0 )return ret;@@ -416,40 +423,45 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev) twl4030_gpio_irq_base = irq_base; no_irqs: -/* -* NOTE: boards may waste power if they don't set pullups -* and pulldowns correctly ... default for non-ULPI pins is -* pulldown, and some other pins may have external pullups -* or pulldowns. Careful! -*/ - ret =gpio_twl4030_pulls (pdata->pullups, pdata->pulldowns); -if (ret) -dev_dbg (&pdev->dev,"pullups %.05x %.05x --> %d\n" , - pdata->pullups, pdata->pulldowns, - ret); - - ret =gpio_twl4030_debounce (pdata->debounce, pdata->mmc_cd); -if (ret) -dev_dbg (&pdev->dev,"debounce %.03x %.01x --> %d\n" , - pdata->debounce, pdata->mmc_cd, - ret); - - twl_gpiochip.base = pdata->gpio_base; + twl_gpiochip.base =-1 ; twl_gpiochip.ngpio =TWL4030_GPIO_MAX ; twl_gpiochip.dev = &pdev->dev; -/* NOTE: we assume VIBRA_CTL.VIBRA_EN, in MODULE_AUDIO_VOICE, -* is (still) clear if use_leds is set. -*/ -if (pdata->use_leds) - twl_gpiochip.ngpio +=2 ; +if (pdata) { + twl_gpiochip.base = pdata->gpio_base; + +/* +* NOTE: boards may waste power if they don't set pullups +* and pulldowns correctly ... default for non-ULPI pins is +* pulldown, and some other pins may have external pullups +* or pulldowns. Careful! +*/ + ret =gpio_twl4030_pulls (pdata->pullups, pdata->pulldowns); +if (ret) +dev_dbg (&pdev->dev,"pullups %.05x %.05x --> %d\n" , + pdata->pullups, pdata->pulldowns, + ret); + + ret =gpio_twl4030_debounce (pdata->debounce, pdata->mmc_cd); +if (ret) +dev_dbg (&pdev->dev,"debounce %.03x %.01x --> %d\n" , + pdata->debounce, pdata->mmc_cd, + ret); + +/* +* NOTE: we assume VIBRA_CTL.VIBRA_EN, in MODULE_AUDIO_VOICE, +* is (still) clear if use_leds is set. +*/ +if (pdata->use_leds) + twl_gpiochip.ngpio +=2 ; + } ret =gpiochip_add (&twl_gpiochip);if (ret <0 ) {dev_err (&pdev->dev,"could not register gpiochip, %d\n" , ret); twl_gpiochip.ngpio =0 ;gpio_twl4030_remove (pdev); - }else if (pdata->setup) { + }else if (pdata && pdata->setup) {int status; status = pdata->setup(&pdev->dev,@@ -467,7 +479,7 @@ static int gpio_twl4030_remove(struct platform_device *pdev)struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data;int status; -if (pdata->teardown) { +if (pdata && pdata->teardown) { status = pdata->teardown (&pdev->dev, pdata->gpio_base,TWL4030_GPIO_MAX );if (status) {@@ -488,12 +500,21 @@ static int gpio_twl4030_remove(struct platform_device *pdev)return -EIO ; } +static const struct of_device_id twl_gpio_match[] = { + { .compatible ="ti,twl4030-gpio" , }, + { }, +}; +MODULE_DEVICE_TABLE (of, twl_gpio_match); +/* Note: this hardware lives inside an I2C-based multi-function device. */ MODULE_ALIAS ("platform:twl4030_gpio" );static struct platform_driver gpio_twl4030_driver = { - .driver.name ="twl4030_gpio" , - .driver.owner =THIS_MODULE , + .driver = { + .name ="twl4030_gpio" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (twl_gpio_match), + }, .probe = gpio_twl4030_probe, .remove = gpio_twl4030_remove, };Signature · 1 line
1.7.0.4
Signature · 2 lines
Grant Likely, B.Sc, P.Eng. Secret Lab Technologies,Ltd.
PATCH 10/12 arm/dts: twl4030: Add twl4030-gpio node
In reply to Benoit CoussonAdd the twl-gpio node inside twl4030 definition.
--- arch/arm/boot/dts/twl4030.dtsi | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/boot/dts/twl4030.dtsi +8 -0
@@ -18,4 +18,12 @@ compatible = "ti,twl4030-rtc"; interrupts = <11>; }; + + twl_gpio: gpio { + compatible = "ti,twl4030-gpio"; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <1>; + }; };
Signature · 1 line
1.7.0.4
PATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
In reply to Benoit CoussonCard detect IRQ from the TWL6030 used to be provided to the MMC controller code using a statically allocated IRQ scheme:
card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET;
This is no longer valid in a SPARSE_IRQ context since there is no more pre-defined TWL6030_IRQ_BASE.
Return the proper card detect IRQ value in the twl6030_mmc_card_detect_config that will be called from the MMC controller.
--- drivers/mfd/twl6030-irq.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/mfd/twl6030-irq.c +2 -1
@@ -308,7 +308,8 @@ int twl6030_mmc_card_detect_config(void) ret);return ret; } -return 0 ; + +return twl6030_irq_base +MMCDETECT_INTR_OFFSET ; }EXPORT_SYMBOL (twl6030_mmc_card_detect_config);
Signature · 1 line
1.7.0.4
PATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
Hi,
Quoted 8 lines · Benoit Cousson
Card detect IRQ from the TWL6030 used to be provided to the MMC controller code using a statically allocated IRQ scheme:
card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET;This is no longer valid in a
SPARSE_IRQcontext since there is no more pre-definedTWL6030_IRQ_BASE.
Quoted 7 lines
Return the proper card detect IRQ value in the
twl6030_mmc_card_detect_configthat will be called from the MMC controller.Signed-off-by Benoit Cousson <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Rajendra Nayak <[email protected]>
Quoted 9 lines
--- drivers/mfd/twl6030-irq.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/mfd/twl6030-irq.c +0
-0
drivers/mfd/twl6030-irq.c int twl6030_mmc_card_detect_config(void) · line 314
Quoted 8 lines
drivers/mfd/twl6030-irq.c +2
-1@@ -308,7 +308,8 @@ int twl6030_mmc_card_detect_config(void) ret);return ret; } -return 0 ; + +return twl6030_irq_base +MMCDETECT_INTR_OFFSET ; }EXPORT_SYMBOL (twl6030_mmc_card_detect_config);
At some point this twl6030_mmc_card_detect_config() needs to vanish in favor of a better mechanism. Maybe passing the GPIO number an requiring the driver to request the GPIO, set its direction and use it as IRQ line.
the only problem would arise if we end up hooking the Card Detect pin to a real IRQ line, but then we can use a flag to differentiate.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120302/6c7941be/attachment.sig>
Tony Lindgren
maintainerPATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
Quoted 44 lines · Felipe Balbi
Hi,
Quoted 8 lines · Benoit Cousson
Card detect IRQ from the TWL6030 used to be provided to the MMC controller code using a statically allocated IRQ scheme:
card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET;This is no longer valid in a
SPARSE_IRQcontext since there is no more pre-definedTWL6030_IRQ_BASE.Quoted 7 lines
Return the proper card detect IRQ value in the
twl6030_mmc_card_detect_configthat will be called from the MMC controller.Signed-off-by Benoit Cousson <[email protected]>Cc Felipe Balbi <[email protected]>Cc Tony Lindgren <[email protected]>Cc Rajendra Nayak <[email protected]>Reviewed-by Felipe Balbi <[email protected]>Quoted 9 lines
--- drivers/mfd/twl6030-irq.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/mfd/twl6030-irq.c +0
-0drivers/mfd/twl6030-irq.c int twl6030_mmc_card_detect_config(void) · line 314
Quoted 8 lines
drivers/mfd/twl6030-irq.c +2
-1@@ -308,7 +308,8 @@ int twl6030_mmc_card_detect_config(void) ret);return ret; } -return 0 ; + +return twl6030_irq_base +MMCDETECT_INTR_OFFSET ; }EXPORT_SYMBOL (twl6030_mmc_card_detect_config);At some point this
twl6030_mmc_card_detect_config()needs to vanish in favor of a better mechanism. Maybe passing the GPIO number an requiring the driver to request the GPIO, set its direction and use it as IRQ line.
Quoted 2 lines
the only problem would arise if we end up hooking the Card Detect pin to a real IRQ line, but then we can use a flag to differentiate.
I'm trying to leave out the need for this callback to pdata.. See mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect that does pretty much the same as Benoit's patch plus removes the need for the callback.
Tony
PATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
Hi Tony,
Quoted 45 lines · Tony Lindgren
Quoted 44 lines · Felipe Balbi
Hi,
Quoted 8 lines · Benoit Cousson
Card detect IRQ from the TWL6030 used to be provided to the MMC controller code using a statically allocated IRQ scheme:
card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET;This is no longer valid in a
SPARSE_IRQcontext since there is no more pre-definedTWL6030_IRQ_BASE.Quoted 7 lines
Return the proper card detect IRQ value in the
twl6030_mmc_card_detect_configthat will be called from the MMC controller.Signed-off-by Benoit Cousson<[email protected]>Cc Felipe Balbi<[email protected]>Cc Tony Lindgren<[email protected]>Cc Rajendra Nayak<[email protected]>Reviewed-by Felipe Balbi<[email protected]>Quoted 9 lines
--- drivers/mfd/twl6030-irq.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/mfd/twl6030-irq.c +0
-0drivers/mfd/twl6030-irq.c int twl6030_mmc_card_detect_config(void) · line 314
Quoted 8 lines
drivers/mfd/twl6030-irq.c +2
-1@@ -308,7 +308,8 @@ int twl6030_mmc_card_detect_config(void) ret);return ret; } -return 0 ; + +return twl6030_irq_base +MMCDETECT_INTR_OFFSET ; }EXPORT_SYMBOL (twl6030_mmc_card_detect_config);At some point this
twl6030_mmc_card_detect_config()needs to vanish in favor of a better mechanism. Maybe passing the GPIO number an requiring the driver to request the GPIO, set its direction and use it as IRQ line.
Quoted 7 lines
Quoted 2 lines
the only problem would arise if we end up hooking the Card Detect pin to a real IRQ line, but then we can use a flag to differentiate.
I'm trying to leave out the need for this callback to pdata.. See mmc:
omap_hsmmc: Simplify init for twl6030 MMC card detect that does pretty much the same as Benoit's patch plus removes the need for the callback.
That's cool. I did that patch to still have a working MMC after my TWL series, and I missed your MMC series.
The patch #4 "mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect" is indeed simplifying a lot that IRQ mess.
I will check with that TWL series, but since you are already using the twl6030_irq_base it should work without any trouble.
Thanks,
Benoit
PATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
Quoted 57 lines · Benoit
Hi Tony,
Quoted 46 lines · Tony Lindgren
Quoted 45 lines · Felipe Balbi
Hi,
Quoted 8 lines · Benoit Cousson
Card detect IRQ from the TWL6030 used to be provided to the MMC controller code using a statically allocated IRQ scheme:
card_detect_irq=TWL6030_IRQ_BASE+MMCDETECT_INTR_OFFSET;This is no longer valid in a
SPARSE_IRQcontext since there is no more pre-definedTWL6030_IRQ_BASE.Quoted 8 lines
Return the proper card detect IRQ value in the
twl6030_mmc_card_detect_config
that will be called from the MMC controller.Signed-off-by Benoit Cousson<[email protected]>Cc Felipe Balbi<[email protected]>Cc Tony Lindgren<[email protected]>Cc Rajendra Nayak<[email protected]>Reviewed-by Felipe Balbi<[email protected]>Quoted 9 lines
---
drivers/mfd/twl6030-irq.c| 3 ++-1 files changed, 2 insertions(+), 1 deletions(-)drivers/mfd/twl6030-irq.c +0
-0drivers/mfd/twl6030-irq.c int twl6030_mmc_card_detect_config(void) · line 314
Quoted 8 lines
drivers/mfd/twl6030-irq.c +2
-1@@ -308,7 +308,8 @@ int twl6030_mmc_card_detect_config(void) ret);return ret; } -return 0 ; + +return twl6030_irq_base +MMCDETECT_INTR_OFFSET ; }EXPORT_SYMBOL (twl6030_mmc_card_detect_config);At some point this
twl6030_mmc_card_detect_config()needs to vanish in favor of a better mechanism. Maybe passing the GPIO number an requiring the driver to request the GPIO, set its direction and use it as IRQ line.Quoted 7 lines
Quoted 2 lines
the only problem would arise if we end up hooking the Card Detect pin to a real IRQ line, but then we can use a flag to differentiate.
I'm trying to leave out the need for this callback to pdata.. See mmc:
omap_hsmmc: Simplify init for twl6030 MMC card detect that does pretty much the same as Benoit's patch plus removes the need for the callback.
Quoted 8 lines
That's cool. I did that patch to still have a working MMC after my TWL series because I missed your MMC series :-(.
The patch #4 "mmc:
omap_hsmmc: Simplify init for twl6030 MMC card detect" is indeed simplifying a lot that IRQ mess.I will check with that TWL series, but since you are already using the
twl6030_irq_baseit should work without any trouble.
I created a for_3.4/twl_irq_gpio_fix branch based on irqdomain/next with all the TWL + GPIO patches except the DTS and without the MMC hacks.
And I merged it into your hsmmc-gpio branch. There is a small conflict in gpio-twl4030 but otherwise it works on the SDP4430.
I cannot test remotely with Panda or Beagle, the animals are already sleeping.
The branch is there if you want to check for OMAP3 as well.git://git.kernel.org/pub/scm/linux/kernel/git/bcousson/linux-omap-dt.git
for_3.4/twl_irq_gpio_fix
Regards,
Benoit
Tony Lindgren
maintainerPATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
Quoted 7 lines · Cousson, Benoit
I created a for_3.4/twl_irq_gpio_fix branch based on irqdomain/next with all the TWL + GPIO patches except the DTS and without the MMC hacks.
And I merged it into your hsmmc-gpio branch. There is a small conflict in gpio-twl4030 but otherwise it works on the SDP4430.
OK cool.
Quoted 6 lines
I cannot test remotely with Panda or Beagle, the animals are already sleeping.
The branch is there if you want to check for OMAP3 as well.
git://git.kernel.org/pub/scm/linux/kernel/git/bcousson/linux-omap-dt.git
for_3.4/twl_irq_gpio_fix
I'll give it a try at some point, looks like there's few more hsmmc fixes needed first..
Tony
PATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
In reply to Felipe BalbiQuoted 44 lines · Felipe Balbi
Hi,
Quoted 8 lines · Benoit Cousson
Card detect IRQ from the TWL6030 used to be provided to the MMC controller code using a statically allocated IRQ scheme:
card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET;This is no longer valid in a
SPARSE_IRQcontext since there is no more pre-definedTWL6030_IRQ_BASE.Quoted 7 lines
Return the proper card detect IRQ value in the
twl6030_mmc_card_detect_configthat will be called from the MMC controller.Signed-off-by Benoit Cousson<[email protected]>Cc Felipe Balbi<[email protected]>Cc Tony Lindgren<[email protected]>Cc Rajendra Nayak<[email protected]>Reviewed-by Felipe Balbi<[email protected]>Quoted 9 lines
--- drivers/mfd/twl6030-irq.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/mfd/twl6030-irq.c +0
-0drivers/mfd/twl6030-irq.c int twl6030_mmc_card_detect_config(void) · line 314
Quoted 8 lines
drivers/mfd/twl6030-irq.c +2
-1@@ -308,7 +308,8 @@ int twl6030_mmc_card_detect_config(void) ret);return ret; } -return 0 ; + +return twl6030_irq_base +MMCDETECT_INTR_OFFSET ; }EXPORT_SYMBOL (twl6030_mmc_card_detect_config);At some point this
twl6030_mmc_card_detect_config()needs to vanish in favor of a better mechanism. Maybe passing the GPIO number an requiring the driver to request the GPIO, set its direction and use it as IRQ line.
Quoted 2 lines
the only problem would arise if we end up hooking the Card Detect pin to a real IRQ line, but then we can use a flag to differentiate.
Shouldn't this be hidden from the driver completely if the card detect pin is a GPIO or connected to a real IRQ line? And the board/DT handle this instead of the driver knowing when to do a gpio_to_irq()? But I see thats not the case with most mmc drivers, not just OMAP, I wonder why.
Quoted 1 line
PATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
Quoted 46 lines · Rajendra Nayak
Quoted 45 lines · Felipe Balbi
Hi,
Quoted 8 lines · Benoit Cousson
Card detect IRQ from the TWL6030 used to be provided to the MMC controller code using a statically allocated IRQ scheme:
card_detect_irq=TWL6030_IRQ_BASE+MMCDETECT_INTR_OFFSET;This is no longer valid in a
SPARSE_IRQcontext since there is no more pre-definedTWL6030_IRQ_BASE.Quoted 8 lines
Return the proper card detect IRQ value in the
twl6030_mmc_card_detect_config
that will be called from the MMC controller.Signed-off-by Benoit Cousson<[email protected]>Cc Felipe Balbi<[email protected]>Cc Tony Lindgren<[email protected]>Cc Rajendra Nayak<[email protected]>Reviewed-by Felipe Balbi<[email protected]>Quoted 9 lines
---
drivers/mfd/twl6030-irq.c| 3 ++-1 files changed, 2 insertions(+), 1 deletions(-)drivers/mfd/twl6030-irq.c +0
-0drivers/mfd/twl6030-irq.c int twl6030_mmc_card_detect_config(void) · line 314
Quoted 8 lines
drivers/mfd/twl6030-irq.c +2
-1@@ -308,7 +308,8 @@ int twl6030_mmc_card_detect_config(void) ret);return ret; } -return 0 ; + +return twl6030_irq_base +MMCDETECT_INTR_OFFSET ; }EXPORT_SYMBOL (twl6030_mmc_card_detect_config);At some point this
twl6030_mmc_card_detect_config()needs to vanish in favor of a better mechanism. Maybe passing the GPIO number an requiring the driver to request the GPIO, set its direction and use it as IRQ line.
Quoted 6 lines
Quoted 2 lines
the only problem would arise if we end up hooking the Card Detect pin to a real IRQ line, but then we can use a flag to differentiate.
Shouldn't this be hidden from the driver completely if the card detect pin is a GPIO or connected to a real IRQ line? And the board/DT handle this instead of the driver knowing when to do a
gpio_to_irq()?
It work fine for a pure GPIO, but in this case, this is an IRQ handled by twl6030. So I'm not sure we have any API for the non-DT case.
DT will clearly help getting rid of such hacks.
Regards,
Benoit
PATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
In reply to Benoit CoussonHello.
Quoted 12 lines · Benoit Cousson
Card detect IRQ from the TWL6030 used to be provided to the MMC
controller code using a statically allocated IRQ scheme:
card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET;This is no longer valid in a
SPARSE_IRQcontext since there is no more pre-definedTWL6030_IRQ_BASE.Return the proper card detect IRQ value in the
twl6030_mmc_card_detect_configthat will be called from the MMC controller.
Quoted 6 lines
Signed-off-by Benoit Cousson<[email protected]>Cc Felipe Balbi<[email protected]>Cc Tony Lindgren<[email protected]>Cc Rajendra Nayak<[email protected]>--- drivers/mfd/twl6030-irq.c | 3 ++-
Subject talks about twl4030-irq.
WBR, Sergei
PATCH 11/12 mfd: twl4030-irq: Return twl6030_mmc_card_detect IRQ for board setup
Hi Sergei,
Quoted 17 lines · Sergei Shtylyov
Hello.
Quoted 13 lines · Benoit Cousson
Card detect IRQ from the TWL6030 used to be provided to the MMC
controller code using a statically allocated IRQ scheme:
card_detect_irq=TWL6030_IRQ_BASE+MMCDETECT_INTR_OFFSET;This is no longer valid in a
SPARSE_IRQcontext since there is no more pre-definedTWL6030_IRQ_BASE.Return the proper card detect IRQ value in the
twl6030_mmc_card_detect_config
that will be called from the MMC controller.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Benoit Cousson<[email protected]>Cc Felipe Balbi<[email protected]>Cc Tony Lindgren<[email protected]>Cc Rajendra Nayak<[email protected]>---
drivers/mfd/twl6030-irq.c| 3 ++-Subject talks about twl4030-irq.
Oops, good catch. thanks.
I guess that Tony's patch (mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect) will supersede that one.
Thanks,
Benoit
PATCH 12/12 ARM: OMAP2+: board-omap4-*: Do not use anymore TWL6030_IRQ_BASE in board files
In reply to Benoit CoussonWith the introduction of dynamically allocated IRQ in the twl6030 driver, the board files can no longer rely of static IRQ defines like before.
Retrieve the value dynamically allocated from the mmc -> twl6030 init callback.
Note: The Panda board does not seems to use the card detect IRQ.
--- arch/arm/mach-omap2/board-4430sdp.c | 13 +++++++------ arch/arm/mach-omap2/board-omap4panda.c | 15 ++++++++------- 2 files changed, 15 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/board-4430sdp.c +7 -6
@@ -457,21 +457,22 @@ static struct platform_device omap_vwlan_device = {static int omap4_twl6030_hsmmc_late_init (struct device *dev) { -int ret =0 ; +int irq =0 ;struct platform_device *pdev =container_of (dev, struct platform_device, dev);struct omap_mmc_platform_data *pdata = dev->platform_data;/* Setting MMC1 Card detect Irq */ if (pdev->id ==0 ) { - ret =twl6030_mmc_card_detect_config (); -if (ret) + irq =twl6030_mmc_card_detect_config (); +if (irq <0 ) {pr_err ("Failed configuring MMC1 card detect\n" ); - pdata->slots[0 ].card_detect_irq =TWL6030_IRQ_BASE + -MMCDETECT_INTR_OFFSET ; +return irq; + } + pdata->slots[0 ].card_detect_irq = irq; pdata->slots[0 ].card_detect = twl6030_mmc_card_detect; } -return ret; +return 0 ; }static __init void omap4_twl6030_hsmmc_set_late_init (struct device *dev)
arch/arm/mach-omap2/board-omap4panda.c +8 -7
@@ -206,7 +206,7 @@ struct wl12xx_platform_data omap_panda_wlan_data __initdata = {static int omap4_twl6030_hsmmc_late_init (struct device *dev) { -int ret =0 ; +int irq =0 ;struct platform_device *pdev =container_of (dev, struct platform_device, dev);struct omap_mmc_platform_data *pdata = dev->platform_data;
@@ -217,14 +217,15 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) }/* Setting MMC1 Card detect Irq */ if (pdev->id ==0 ) { - ret =twl6030_mmc_card_detect_config (); -if (ret) + irq =twl6030_mmc_card_detect_config (); +if (irq <0 ) {dev_err (dev,"%s: Error card detect config(%d)\n" , - __func__, ret); -else - pdata->slots[0 ].card_detect = twl6030_mmc_card_detect; + __func__, irq); +return irq; + } + pdata->slots[0 ].card_detect = twl6030_mmc_card_detect; } -return ret; +return 0 ; }static __init void omap4_twl6030_hsmmc_set_late_init (struct device *dev)
Signature · 1 line
1.7.0.4
Tony Lindgren
maintainerPATCH 12/12 ARM: OMAP2+: board-omap4-*: Do not use anymore TWL6030_IRQ_BASE in board files
Quoted 7 lines · Benoit Cousson
With the introduction of dynamically allocated IRQ in the twl6030 driver, the board files can no longer rely of static IRQ defines like before.
Retrieve the value dynamically allocated from the mmc -> twl6030 init callback.
Note: The Panda board does not seems to use the card detect IRQ.
Looks like this one is safe to merge via MFD and does not seem to cause any merge conflicts.
This one should be folded into patch 08/12 to avoid boot issues for between patches 08 and 12 in this series. Other than that:
PATCH 12/12 ARM: OMAP2+: board-omap4-*: Do not use anymore TWL6030_IRQ_BASE in board files
Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Benoit Cousson
With the introduction of dynamically allocated IRQ in the twl6030 driver, the board files can no longer rely of static IRQ defines like before.
Retrieve the value dynamically allocated from the mmc -> twl6030 init callback.
Quoted 7 lines
Quoted 1 line
Note: The Panda board does not seems to use the card detect IRQ.
Looks like this one is safe to merge via MFD and does not seem to cause any merge conflicts.
This one should be folded into patch 08/12 to avoid boot issues for between patches 08 and 12 in this series. Other than that:
In fact there is no need to merge them. They should just be at the beginning of the series.
The first patch...
mfd: twl6030-irq: Return twl6030_mmc_card_detect IRQ for board setup
- return 0;
+
+ return twl6030_irq_base + MMCDETECT_INTR_OFFSET;
...will just return the proper interrupt number instead of 0, but at that time, the board is still using the static TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET value.
Only the next one...
ARM: OMAP2+: board-omap4-*: Do not use anymore TWL6030_IRQ_BASE in
board files
...will switch from the static to the value returned by twl6030_mmc_card_detect and then it keeps working.
Quoted 1 line
Acked-by Tony Lindgren<[email protected]>
Cool, I'll send the pull request to Samuel ASAP.
Thanks,
Benoit
cover mfd: twl: Fix for irqdomain/next + SPARSE_IRQ + MMC card detect
In reply to Benoit CoussonHi Benoit,
Benoit Cousson <[email protected]> writes:
[...]
Quoted 2 lines
This is not for pull-request, becasue it is based on irqdomain + OMAP IRQ DT series + OMAP twl DT series yet to be pushed.
What's the status of this series?
At least 'gpio/twl: Allocate irq_desc dynamically for SPARSE_IRQ support' is needed in mainline (linux-next) now since without it, non-DT boots will dump a big fat warning trace[2].
Also FYI, I needed the patch below[1] in order to build this series.
Kevin
[1]
arch/arm/mach-omap2/board-generic.c +1 -0
@@ -15,6 +15,7 @@#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>
[2]
[ 0.495117] twl4030: PIH (irq 7) chaining IRQs 368..401 [ 0.501190] twl4030: power (irq 373) chaining IRQs 402..409 [ 0.509429] twl4030: gpio (irq 368) chaining IRQs 410..427 [ 0.515319] ------------[ cut here ]------------ [ 0.520202] WARNING: at /work/kernel/omap/pm/drivers/gpio/gpio-twl4030.c:410 gpio_twl4030_probe+0x44/0x214() [ 0.530395] Modules linked in: [ 0.533691] [<c0014248>] (unwind_backtrace+0x0/0xf0) from [<c0039054>] (warn_slowpath_common+0x4c/0x64) [ 0.543640] [<c0039054>] (warn_slowpath_common+0x4c/0x64) from [<c0039088>] (warn_slowpath_null+0x1c/0x24) [ 0.553680] [<c0039088>] (warn_slowpath_null+0x1c/0x24) from [<c04196f4>] (gpio_twl4030_probe+0x44/0x214) [ 0.563629] [<c04196f4>] (gpio_twl4030_probe+0x44/0x214) from [<c028832c>] (platform_drv_probe+0x18/0x1c) [ 0.573577] [<c028832c>] (platform_drv_probe+0x18/0x1c) from [<c0286fd4>] (really_probe+0x60/0x15c) [ 0.583007] [<c0286fd4>] (really_probe+0x60/0x15c) from [<c0287214>] (driver_probe_device+0x48/0x60) [ 0.592498] [<c0287214>] (driver_probe_device+0x48/0x60) from [<c0285af8>] (bus_for_each_drv+0x5c/0x88) [ 0.602264] [<c0285af8>] (bus_for_each_drv+0x5c/0x88) from [<c028718c>] (device_attach+0x98/0xbc) [ 0.611480] [<c028718c>] (device_attach+0x98/0xbc) from [<c0286844>] (bus_probe_device+0x88/0xac) [ 0.620727] [<c0286844>] (bus_probe_device+0x88/0xac) from [<c0285160>] (device_add+0x278/0x358) [ 0.629882] [<c0285160>] (device_add+0x278/0x358) from [<c02887a8>] (platform_device_add+0xf8/0x1a4) [ 0.639373] [<c02887a8>] (platform_device_add+0xf8/0x1a4) from [<c042e4a0>] (add_numbered_child.constprop.0+0xb8/0xfc) [ 0.650451] [<c042e4a0>] (add_numbered_child.constprop.0+0xb8/0xfc) from [<c042e5a4>] (add_children+0x44/0x6d0) [ 0.660949] [<c042e5a4>] (add_children+0x44/0x6d0) from [<c041a8b8>] (twl_probe+0x354/0x3bc) [ 0.669738] [<c041a8b8>] (twl_probe+0x354/0x3bc) from [<c0326cb0>] (i2c_device_probe+0xc0/0x100) [ 0.678863] [<c0326cb0>] (i2c_device_probe+0xc0/0x100) from [<c0286fd4>] (really_probe+0x60/0x15c) [ 0.688171] [<c0286fd4>] (really_probe+0x60/0x15c) from [<c0287214>] (driver_probe_device+0x48/0x60) [ 0.697692] [<c0287214>] (driver_probe_device+0x48/0x60) from [<c0285af8>] (bus_for_each_drv+0x5c/0x88) [ 0.707458] [<c0285af8>] (bus_for_each_drv+0x5c/0x88) from [<c028718c>] (device_attach+0x98/0xbc) [ 0.716674] [<c028718c>] (device_attach+0x98/0xbc) from [<c0286844>] (bus_probe_device+0x88/0xac) [ 0.725921] [<c0286844>] (bus_probe_device+0x88/0xac) from [<c0285160>] (device_add+0x278/0x358) [ 0.735076] [<c0285160>] (device_add+0x278/0x358) from [<c0327410>] (i2c_new_device+0xec/0x160) [ 0.744354] [<c0327410>] (i2c_new_device+0xec/0x160) from [<c032781c>] (i2c_register_adapter+0x168/0x220) [ 0.754302] [<c032781c>] (i2c_register_adapter+0x168/0x220) from [<c0327a40>] (i2c_add_numbered_adapter+0xd4/0xf0) [ 0.765045] [<c0327a40>] (i2c_add_numbered_adapter+0xd4/0xf0) from [<c041f4c8>] (omap_i2c_probe+0x334/0x424) [ 0.775268] [<c041f4c8>] (omap_i2c_probe+0x334/0x424) from [<c028832c>] (platform_drv_probe+0x18/0x1c) [ 0.784942] [<c028832c>] (platform_drv_probe+0x18/0x1c) from [<c0286fd4>] (really_probe+0x60/0x15c) [ 0.794342] [<c0286fd4>] (really_probe+0x60/0x15c) from [<c0287214>] (driver_probe_device+0x48/0x60) [ 0.803863] [<c0287214>] (driver_probe_device+0x48/0x60) from [<c02872c0>] (__driver_attach+0x94/0x98) [ 0.813537] [<c02872c0>] (__driver_attach+0x94/0x98) from [<c0285b74>] (bus_for_each_dev+0x50/0x7c) [ 0.822937] [<c0285b74>] (bus_for_each_dev+0x50/0x7c) from [<c0286ad4>] (bus_add_driver+0x184/0x248) [ 0.832427] [<c0286ad4>] (bus_add_driver+0x184/0x248) from [<c0287798>] (driver_register+0x78/0x12c) [ 0.841949] [<c0287798>] (driver_register+0x78/0x12c) from [<c0008800>] (do_one_initcall+0x34/0x178) [ 0.851440] [<c0008800>] (do_one_initcall+0x34/0x178) from [<c06068ac>] (kernel_init+0x8c/0x130) [ 0.860565] [<c06068ac>] (kernel_init+0x8c/0x130) from [<c000e850>] (kernel_thread_exit+0x0/0x8) [ 0.870117] ---[ end trace 1b75b31a2719ed1c ]---
cover mfd: twl: Fix for irqdomain/next + SPARSE_IRQ + MMC card detect
Hi Kevin,
Quoted 10 lines · Kevin Hilman
Hi Benoit,
Benoit Cousson<[email protected]> writes:
[...]
Quoted 2 lines
This is not for pull-request, becasue it is based on irqdomain + OMAP IRQ DT series + OMAP twl DT series yet to be pushed.
What's the status of this series?
I sent earlier today the pull request to Samuel.
Here is the branch for information: for_3.4/twl_irq_gpio_mmc_fix
Quoted 3 lines
At least 'gpio/twl: Allocate
irq_descdynamically forSPARSE_IRQsupport' is needed in mainline (linux-next) now since without it, non-DT boots will dump a big fat warning trace[2].
Yeah, I know :-(
Quoted 1 line
Also FYI, I needed the patch below[1] in order to build this series.
That's weird, this include was added by the following commit a7cbb9b15d55dff0488b1a6d93929c2386d8632b at 3.2 time frame.
What branch are you using?
Regards,
Benoit
Quoted 61 lines
Kevin
[1]
arch/arm/mach-omap2/board-generic.c +1
-0@@ -15,6 +15,7 @@#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> [2]
[ 0.495117] twl4030: PIH (irq 7) chaining IRQs 368..401 [ 0.501190] twl4030: power (irq 373) chaining IRQs 402..409 [ 0.509429] twl4030: gpio (irq 368) chaining IRQs 410..427 [ 0.515319] ------------[ cut here ]------------ [ 0.520202] WARNING: at /work/kernel/omap/pm/drivers/gpio/gpio-twl4030.c:410 gpio_twl4030_probe+0x44/0x214() [ 0.530395] Modules linked in: [ 0.533691] [<c0014248>] (unwind_backtrace+0x0/0xf0) from [<c0039054>] (warn_slowpath_common+0x4c/0x64) [ 0.543640] [<c0039054>] (warn_slowpath_common+0x4c/0x64) from [<c0039088>] (warn_slowpath_null+0x1c/0x24) [ 0.553680] [<c0039088>] (warn_slowpath_null+0x1c/0x24) from [<c04196f4>] (gpio_twl4030_probe+0x44/0x214) [ 0.563629] [<c04196f4>] (gpio_twl4030_probe+0x44/0x214) from [<c028832c>] (platform_drv_probe+0x18/0x1c) [ 0.573577] [<c028832c>] (platform_drv_probe+0x18/0x1c) from [<c0286fd4>] (really_probe+0x60/0x15c) [ 0.583007] [<c0286fd4>] (really_probe+0x60/0x15c) from [<c0287214>] (driver_probe_device+0x48/0x60) [ 0.592498] [<c0287214>] (driver_probe_device+0x48/0x60) from [<c0285af8>] (bus_for_each_drv+0x5c/0x88) [ 0.602264] [<c0285af8>] (bus_for_each_drv+0x5c/0x88) from [<c028718c>] (device_attach+0x98/0xbc) [ 0.611480] [<c028718c>] (device_attach+0x98/0xbc) from [<c0286844>] (bus_probe_device+0x88/0xac) [ 0.620727] [<c0286844>] (bus_probe_device+0x88/0xac) from [<c0285160>] (device_add+0x278/0x358) [ 0.629882] [<c0285160>] (device_add+0x278/0x358) from [<c02887a8>] (platform_device_add+0xf8/0x1a4) [ 0.639373] [<c02887a8>] (platform_device_add+0xf8/0x1a4) from [<c042e4a0>] (add_numbered_child.constprop.0+0xb8/0xfc) [ 0.650451] [<c042e4a0>] (add_numbered_child.constprop.0+0xb8/0xfc) from [<c042e5a4>] (add_children+0x44/0x6d0) [ 0.660949] [<c042e5a4>] (add_children+0x44/0x6d0) from [<c041a8b8>] (twl_probe+0x354/0x3bc) [ 0.669738] [<c041a8b8>] (twl_probe+0x354/0x3bc) from [<c0326cb0>] (i2c_device_probe+0xc0/0x100) [ 0.678863] [<c0326cb0>] (i2c_device_probe+0xc0/0x100) from [<c0286fd4>] (really_probe+0x60/0x15c) [ 0.688171] [<c0286fd4>] (really_probe+0x60/0x15c) from [<c0287214>] (driver_probe_device+0x48/0x60) [ 0.697692] [<c0287214>] (driver_probe_device+0x48/0x60) from [<c0285af8>] (bus_for_each_drv+0x5c/0x88) [ 0.707458] [<c0285af8>] (bus_for_each_drv+0x5c/0x88) from [<c028718c>] (device_attach+0x98/0xbc) [ 0.716674] [<c028718c>] (device_attach+0x98/0xbc) from [<c0286844>] (bus_probe_device+0x88/0xac) [ 0.725921] [<c0286844>] (bus_probe_device+0x88/0xac) from [<c0285160>] (device_add+0x278/0x358) [ 0.735076] [<c0285160>] (device_add+0x278/0x358) from [<c0327410>] (i2c_new_device+0xec/0x160) [ 0.744354] [<c0327410>] (i2c_new_device+0xec/0x160) from [<c032781c>] (i2c_register_adapter+0x168/0x220) [ 0.754302] [<c032781c>] (i2c_register_adapter+0x168/0x220) from [<c0327a40>] (i2c_add_numbered_adapter+0xd4/0xf0) [ 0.765045] [<c0327a40>] (i2c_add_numbered_adapter+0xd4/0xf0) from [<c041f4c8>] (omap_i2c_probe+0x334/0x424) [ 0.775268] [<c041f4c8>] (omap_i2c_probe+0x334/0x424) from [<c028832c>] (platform_drv_probe+0x18/0x1c) [ 0.784942] [<c028832c>] (platform_drv_probe+0x18/0x1c) from [<c0286fd4>] (really_probe+0x60/0x15c) [ 0.794342] [<c0286fd4>] (really_probe+0x60/0x15c) from [<c0287214>] (driver_probe_device+0x48/0x60) [ 0.803863] [<c0287214>] (driver_probe_device+0x48/0x60) from [<c02872c0>] (__driver_attach+0x94/0x98) [ 0.813537] [<c02872c0>] (__driver_attach+0x94/0x98) from [<c0285b74>] (bus_for_each_dev+0x50/0x7c) [ 0.822937] [<c0285b74>] (bus_for_each_dev+0x50/0x7c) from [<c0286ad4>] (bus_add_driver+0x184/0x248) [ 0.832427] [<c0286ad4>] (bus_add_driver+0x184/0x248) from [<c0287798>] (driver_register+0x78/0x12c) [ 0.841949] [<c0287798>] (driver_register+0x78/0x12c) from [<c0008800>] (do_one_initcall+0x34/0x178) [ 0.851440] [<c0008800>] (do_one_initcall+0x34/0x178) from [<c06068ac>] (kernel_init+0x8c/0x130) [ 0.860565] [<c06068ac>] (kernel_init+0x8c/0x130) from [<c000e850>] (kernel_thread_exit+0x0/0x8) [ 0.870117] ---[ end trace 1b75b31a2719ed1c ]---
cover mfd: twl: Fix for irqdomain/next + SPARSE_IRQ + MMC card detect
Quoted 22 lines · Benoit
Hi Kevin,
Quoted 10 lines · Kevin Hilman
Hi Benoit,
Benoit Cousson<[email protected]> writes:
[...]
Quoted 2 lines
This is not for pull-request, becasue it is based on irqdomain + OMAP IRQ DT series + OMAP twl DT series yet to be pushed.
What's the status of this series?
I sent earlier today the pull request to Samuel.
Here is the branch for information: for_3.4/twl_irq_gpio_mmc_fix
Quoted 3 lines
At least 'gpio/twl: Allocate
irq_descdynamically forSPARSE_IRQsupport' is needed in mainline (linux-next) now since without it, non-DT boots will dump a big fat warning trace[2].
Quoted 6 lines
Yeah, I know :-(
Quoted 1 line
Also FYI, I needed the patch below[1] in order to build this series.
That's weird, this include was added by the following commit
a7cbb9b15d55dff0488b1a6d93929c2386d8632bat 3.2 time frame.
OK.
Quoted 1 line
What branch are you using?
I was using your for_3.4/twl_irq_gpio_cleanup, but had some merge conflicts. Maybe I mis-merged something and dropped that include.
Kevin