[U-Boot] [PATCH 1/2] dm: gpio: mxc: fix mxc_gpio_bank_get_value
Peng Fan
van.freenix at gmail.com
Thu Mar 17 02:44:33 CET 2016
On Wed, Mar 16, 2016 at 09:48:24AM -0300, Fabio Estevam wrote:
>Hi Peng,
>
>On Tue, Mar 15, 2016 at 10:27 PM, Peng Fan <van.freenix at gmail.com> wrote:
>
>> If set the SION bit, we need to change the pinmux settings in device tree,
>> however device tree are introduced from linux kernel. I would not like
>> to change the pinmux setting value.
>>
>> So I choose to use data register but not PSR register.
>
>Haven't checked the kernel driver, but just curious: how does the
>kernel handle this?
bgc->gc.get = bgpio_get;
The get method:
* @get: returns value for signal "offset"; for output signals this
* returns either the value actually sensed, or zero
138 static int bgpio_get(struct gpio_chip *gc, unsigned int gpio)
139 {
140 struct bgpio_chip *bgc = to_bgpio_chip(gc);
141
142 return !!(bgc->read_reg(bgc->reg_dat) & bgc->pin2mask(bgc, gpio));
143 }
The gpio subsystem use reg_data. The reg_data is GPIO_PSR for gpio-mxc.c:
450 err = bgpio_init(&port->bgc, &pdev->dev, 4,
451 port->base + GPIO_PSR,
452 port->base + GPIO_DR, NULL,
453 port->base + GPIO_GDIR, NULL, 0);
So we know that kernel gpio-mxc use GPIO_PSR for reading data, but
as the comments for get method "for output signals this returns
either the value actually sensed, or zero", if no SION bit set, reading
PSR will return 0 with direction output.
But in U-Boot, the regulator driver needs to get the value when direction is
configured as output, we can use data register here or configure SION in pinmux.
But I prefer using data register here.
Thanks,
Peng.
More information about the U-Boot
mailing list