Skip to contentSkip to conversation

i.mx6 gpio_set_value correct locking

Xenomai Johann Obermayr 2 participants 2 messages Nov 16, 2016 – Nov 18, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

Is it allowed/save to call the function "gpio_set_value" from a primary domain task ?

This is the function called from gpio_set_value.

static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)

{
    struct mxc_gpio_port *port =
        container_of(chip, struct mxc_gpio_port, chip);
    void __iomem *reg = port->base + GPIO_DR;
    u32 l;
    unsigned long flags;

    spin_lock_irqsave(&port->lock, flags);
    l = (__raw_readl(reg) & (~(1 << offset))) | (!!value << offset);
    __raw_writel(l, reg);
    spin_unlock_irqrestore(&port->lock, flags);
}

and port->lock is a ipipe_spinlock_t

Thanks
Regards
Johann Obermayr

#1 lore raw
Quoted 22 lines · Johann Obermayr

Hello,

Is it allowed/save to call the function "gpio_set_value" from a primary domain task ?

This is the function called from gpio_set_value.

static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)

{
    struct mxc_gpio_port *port =
        container_of(chip, struct mxc_gpio_port, chip);
    void __iomem *reg = port->base + GPIO_DR;
    u32 l;
    unsigned long flags;

    spin_lock_irqsave(&port->lock, flags);
    l = (__raw_readl(reg) & (~(1 << offset))) | (!!value << offset);
    __raw_writel(l, reg);
    spin_unlock_irqrestore(&port->lock, flags);
}
Quoted 2 lines

and port->lock is a ipipe_spinlock_t

Looks ok.

Signature · 1 line
Philippe.