Message ID | 801va635f7.fsf@merkur.tec.linutronix.de |
---|---|
State | New, archived |
Headers | show |
On Tue, Aug 10, 2010 at 04:31:40PM +0200, John Ogness wrote: > On 2010-08-10, Sascha Hauer <s.hauer@pengutronix.de> wrote: > > Sorry, last time I sent only up to 09/12, so the patches I explicitely > > mentioned to solve the things from your previous series were missing. > > I just sent them. My versions of the patches differ slightly. > > Your version allows a small window between request_irq() and > irq_control() where on the i.MX21 there is a possibility of the > interrupts being disabled twice. Namely, if an interrupt occurs before > irq_control() has had a chance to disable it. IMHO it would be better to > call: > > set_irq_flags(host->irq, IRQF_VALID | IRQF_NOAUTOEN); > > for the i.MX21 before requesting the irq. This closes the window. IIRC it is not allowed to call set_irq_flags before request_irq. We are changing a resource we do not own yet. I think the worst thing that could happen without this change is that we get an interrupt after request_irq. Alternatively we could set the interrupt mask bit before requesting the irq. Sascha
On 2010-08-11, Sascha Hauer <s.hauer@pengutronix.de> wrote: >> Your version allows a small window between request_irq() and >> irq_control() where on the i.MX21 there is a possibility of the >> interrupts being disabled twice. Namely, if an interrupt occurs >> before irq_control() has had a chance to disable it. IMHO it would be >> better to call: >> >> set_irq_flags(host->irq, IRQF_VALID | IRQF_NOAUTOEN); >> >> for the i.MX21 before requesting the irq. This closes the window. > > IIRC it is not allowed to call set_irq_flags before request_irq. We > are changing a resource we do not own yet. Normally, yes. But the only way the IRQF_NOAUTOEN flag can ever be useful is if set_irq_flags() is called before request_irq(). > I think the worst thing that could happen without this change is that > we get an interrupt after request_irq. Yes. And this causes a problem on the i.MX21 because the interrupt handler will disable the interrupts. The irq_control() after request_irq() will _also_ disable the interrupts. This means the interrupts are disabled twice, which causes some issues on an RT kernel. > Alternatively we could set the interrupt mask bit before requesting > the irq. Yes. This would be best. But for the i.MX21 it is important that the interrupts are unmasked after irq_control() has disabled the interrupts. John Ogness
On Wed, Aug 11, 2010 at 03:16:34PM +0200, John Ogness wrote: > On 2010-08-11, Sascha Hauer <s.hauer@pengutronix.de> wrote: > >> Your version allows a small window between request_irq() and > >> irq_control() where on the i.MX21 there is a possibility of the > >> interrupts being disabled twice. Namely, if an interrupt occurs > >> before irq_control() has had a chance to disable it. IMHO it would be > >> better to call: > >> > >> set_irq_flags(host->irq, IRQF_VALID | IRQF_NOAUTOEN); > >> > >> for the i.MX21 before requesting the irq. This closes the window. > > > > IIRC it is not allowed to call set_irq_flags before request_irq. We > > are changing a resource we do not own yet. > > Normally, yes. But the only way the IRQF_NOAUTOEN flag can ever be > useful is if set_irq_flags() is called before request_irq(). > > > I think the worst thing that could happen without this change is that > > we get an interrupt after request_irq. > > Yes. And this causes a problem on the i.MX21 because the interrupt > handler will disable the interrupts. The irq_control() after > request_irq() will _also_ disable the interrupts. This means the > interrupts are disabled twice, which causes some issues on an RT kernel. > > > Alternatively we could set the interrupt mask bit before requesting > > the irq. > > Yes. This would be best. But for the i.MX21 it is important that the > interrupts are unmasked after irq_control() has disabled the interrupts. Ok, I'll update the patches to use this approach. Sascha
Index: linux-2.6-454a740/drivers/mtd/nand/mxc_nand.c =================================================================== --- linux-2.6-454a740.orig/drivers/mtd/nand/mxc_nand.c +++ linux-2.6-454a740/drivers/mtd/nand/mxc_nand.c @@ -788,6 +788,8 @@ static void preset_v1_v2(struct mtd_info if (nfc_is_v21()) config1 |= NFC_V2_CONFIG1_FP_INT; + else + config1 |= NFC_V1_V2_CONFIG1_INT_MSK; if (nfc_is_v21() && mtd->writesize) { uint16_t pages_per_block = mtd->erasesize / mtd->writesize; @@ -846,6 +848,7 @@ static void preset_v3(struct mtd_info *m NFC_V3_CONFIG2_2CMD_PHASES | NFC_V3_CONFIG2_SPAS(mtd->oobsize >> 1) | NFC_V3_CONFIG2_ST_CMD(0x70) | + NFC_V3_CONFIG2_INT_MSK | NFC_V3_CONFIG2_NUM_ADDR_PHASE0; if (chip->ecc.mode == NAND_ECC_HW)