From mboxrd@z Thu Jan 1 00:00:00 1970 References: <56EBDBCE.3030800@sigmatek.at> <20160318111030.GE6555@hermes.click-hack.org> From: Johann Obermayr Message-ID: <56EBF155.6010006@sigmatek.at> Date: Fri, 18 Mar 2016 13:15:17 +0100 MIME-Version: 1.0 In-Reply-To: <20160318111030.GE6555@hermes.click-hack.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] ipipe bug in gpio/irq for mx6 Reply-To: johann.obermayr@sigmatek.at List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org Am 18.03.2016 um 12:10 schrieb Gilles Chanteperdrix: > On Fri, Mar 18, 2016 at 11:43:26AM +0100, Johann Obermayr wrote: >> Hello, >> >> in the the git branch ipipe-3.0-imx6q > This I-pipe patch is really old now. Any chance to use a current > version of Xenomai? Not now. but we have started to change to 3.10.x with newer xenomai >> in the file arch/arm/plat-mxc/gpio.c >> >> there is follow function. >> >> void __ipipe_mach_enable_irqdesc(struct ipipe_domain *ipd, unsigned irq) >> { >> struct irq_desc *desc = irq_to_desc(irq); >> struct irq_data *idata = irq_desc_get_irq_data(desc); >> struct irq_chip *chip = irq_data_get_irq_chip(idata); >> >> if (chip == &gpio_irq_chip) { >> /* It is a gpio. */ >> u32 gpio = irq_to_gpio(irq); >> struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32]; >> >> if (ipd != &ipipe_root) { >> port->nonroot_gpios |= (1 << (gpio % 32)); >> if (port->nonroot_gpios == (1 << (gpio % 32))) { >> __ipipe_irqbits[(port->irq / 32)] >> &= ~(1 << (port->irq % 32)); >> set_irq_prio(port->irq, 1); >> } >> } >> } else >> set_irq_prio(irq, ipd != &ipipe_root); >> } >> >> But there is missing set_irq_prio for the port->irq_high. >> to add >> if (port->irq_high > 0) >> set_irq_prio(port->irq_high, 1); >> is not my problem. >> >> my problem is, that i don't known if __ipipe_irqbits is handled >> correct. > Well, if you want to set port->irq_high, you have to clear the > corresponding bit in __ipipe_irqbits, as is done for port->irq. > Thank you Gilles. i've also take a part from newer version. void __ipipe_mach_enable_irqdesc(struct ipipe_domain *ipd, unsigned irq) { struct irq_desc *desc = irq_to_desc(irq); struct irq_data *idata = irq_desc_get_irq_data(desc); struct irq_chip *chip = irq_data_get_irq_chip(idata); if (chip == &gpio_irq_chip) { /* It is a gpio. */ u32 gpio = irq_to_gpio(irq); struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32]; if (ipd == &ipipe_root) { port->nonroot_gpios &= ~(1 << (gpio % 32)); if (port->nonroot_gpios == 0) { __ipipe_irqbits[(port->irq / 32)] &= ~(1 << (port->irq % 32)); __ipipe_irqbits[(port->irq_high / 32)] &= ~(1 << (port->irq_high % 32)); set_irq_prio(port->irq, 0); if (port->irq_high > 0) set_irq_prio(port->irq_high, 0); } } else { port->nonroot_gpios |= (1 << (gpio % 32)); if (port->nonroot_gpios == (1 << (gpio % 32))) { __ipipe_irqbits[(port->irq / 32)] &= ~(1 << (port->irq % 32)); __ipipe_irqbits[(port->irq_high / 32)] &= ~(1 << (port->irq_high % 32)); set_irq_prio(port->irq, 1); if (port->irq_high > 0) set_irq_prio(port->irq_high, 1); } } } else set_irq_prio(irq, ipd != &ipipe_root); } is this correct to clear the the bit in __ipipe_irqbits also for ipd == ipipe_root ? Regards Johann