diff options
author | Benoit Cousson <b-cousson@ti.com> | 2012-02-29 13:40:31 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-03-22 08:04:33 -0400 |
commit | 78518ffa08fceee42d61359303c58bdd0a82033f (patch) | |
tree | 3db4458970c145e8b82fa8a31536c700a4479aee /drivers/mfd/twl-core.c | |
parent | 1b8f333ff49f778a1215f65754c31c02408d1d08 (diff) |
mfd: Move twl-core IRQ allocation into twl[4030|6030]-irq files
During 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.
Conflicts:
drivers/mfd/twl-core.c
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/twl-core.c')
-rw-r--r-- | drivers/mfd/twl-core.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 712e262ba99..764c5b5d914 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
@@ -147,9 +147,6 @@ | |||
147 | 147 | ||
148 | #define TWL_MODULE_LAST TWL4030_MODULE_LAST | 148 | #define TWL_MODULE_LAST TWL4030_MODULE_LAST |
149 | 149 | ||
150 | #define TWL4030_NR_IRQS 8 | ||
151 | #define TWL6030_NR_IRQS 20 | ||
152 | |||
153 | /* Base Address defns for twl4030_map[] */ | 150 | /* Base Address defns for twl4030_map[] */ |
154 | 151 | ||
155 | /* subchip/slave 0 - USB ID */ | 152 | /* subchip/slave 0 - USB ID */ |
@@ -1186,17 +1183,12 @@ static int __devinit | |||
1186 | twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | 1183 | twl_probe(struct i2c_client *client, const struct i2c_device_id *id) |
1187 | { | 1184 | { |
1188 | int irq_base; | 1185 | int irq_base; |
1189 | int irq_end; | ||
1190 | int status; | 1186 | int status; |
1191 | unsigned i; | 1187 | unsigned i; |
1192 | struct twl4030_platform_data *pdata = client->dev.platform_data; | 1188 | struct twl4030_platform_data *pdata = client->dev.platform_data; |
1193 | struct device_node *node = client->dev.of_node; | 1189 | struct device_node *node = client->dev.of_node; |
1194 | u8 temp; | 1190 | u8 temp; |
1195 | int ret = 0; | 1191 | int ret = 0; |
1196 | int nr_irqs = TWL4030_NR_IRQS; | ||
1197 | |||
1198 | if ((id->driver_data) & TWL6030_CLASS) | ||
1199 | nr_irqs = TWL6030_NR_IRQS; | ||
1200 | 1192 | ||
1201 | if (node && !pdata) { | 1193 | if (node && !pdata) { |
1202 | /* | 1194 | /* |
@@ -1215,17 +1207,6 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1215 | return -EINVAL; | 1207 | return -EINVAL; |
1216 | } | 1208 | } |
1217 | 1209 | ||
1218 | status = irq_alloc_descs(-1, 0, nr_irqs, 0); | ||
1219 | if (IS_ERR_VALUE(status)) { | ||
1220 | dev_err(&client->dev, "Fail to allocate IRQ descs\n"); | ||
1221 | return status; | ||
1222 | } | ||
1223 | |||
1224 | irq_base = status; | ||
1225 | irq_end = irq_base + nr_irqs; | ||
1226 | irq_domain_add_legacy(node, nr_irqs, irq_base, 0, | ||
1227 | &irq_domain_simple_ops, NULL); | ||
1228 | |||
1229 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) { | 1210 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) { |
1230 | dev_dbg(&client->dev, "can't talk I2C?\n"); | 1211 | dev_dbg(&client->dev, "can't talk I2C?\n"); |
1231 | return -EIO; | 1212 | return -EIO; |
@@ -1280,15 +1261,15 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1280 | if (client->irq) { | 1261 | if (client->irq) { |
1281 | if (twl_class_is_4030()) { | 1262 | if (twl_class_is_4030()) { |
1282 | twl4030_init_chip_irq(id->name); | 1263 | twl4030_init_chip_irq(id->name); |
1283 | status = twl4030_init_irq(client->irq, irq_base, | 1264 | irq_base = twl4030_init_irq(&client->dev, client->irq); |
1284 | irq_end); | ||
1285 | } else { | 1265 | } else { |
1286 | status = twl6030_init_irq(client->irq, irq_base, | 1266 | irq_base = twl6030_init_irq(&client->dev, client->irq); |
1287 | irq_end); | ||
1288 | } | 1267 | } |
1289 | 1268 | ||
1290 | if (status < 0) | 1269 | if (irq_base < 0) { |
1270 | status = irq_base; | ||
1291 | goto fail; | 1271 | goto fail; |
1272 | } | ||
1292 | } | 1273 | } |
1293 | 1274 | ||
1294 | /* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. | 1275 | /* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. |