Re: [PATCH 2/2] gpio: vg610: Switch to gpio-mmio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 14, 2025 at 12:28 PM Bough Chen <haibo.chen@xxxxxxx> wrote:

> I check the code, seems vf610 has another limitation, refer to the original
> code logic in vf610_gpio_get():
> If the gpio is config as input, need to read GPIO_PDIR to get the input data,
> if gpio is config at output, need to read GPIO_PDOR.
>
> But for bgpio_init, we fix GPIO_PDOR to void __iomem *dat

The logic is that if the line is set as output, we read the output
register instead of the input register to get the value, and that
is fairly standard.

And gpio-mmio is using gbpio_get_set() which looks like
this:

static int bgpio_get_set(struct gpio_chip *gc, unsigned int gpio)
{
    unsigned long pinmask = bgpio_line2mask(gc, gpio);
    bool dir = !!(gc->bgpio_dir & pinmask);

    if (dir)
        return !!(gc->read_reg(gc->reg_set) & pinmask);
    else
        return !!(gc->read_reg(gc->reg_dat) & pinmask);
}

I think my mistake is in that I didn't see the dual
PSOR (set output register) and PCOR (clear
output register) in the driver, as the old one does, I'll
send a new patch.

Yours,
Linus Walleij





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux