From: Patrice CHOTARD <patrice.chotard@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 7/9] pinctrl: stm32: Add get_pin_muxing() ops
Date: Tue, 23 Oct 2018 06:41:31 +0000 [thread overview]
Message-ID: <74c131fe-0448-8784-9c2c-3ab27e6b4f58@st.com> (raw)
In-Reply-To: <CAPnjgZ0qkLUBk0a3StpcyndrjGG8AC1tHx6h7F2x8_dWf2ae6A@mail.gmail.com>
Hi Simon
On 10/19/18 5:25 AM, Simon Glass wrote:
> Hi Patrice,
>
> On 9 October 2018 at 07:31, Patrice Chotard <patrice.chotard@st.com> wrote:
>> Add get_pin_muxing() ops to obtain the pin muxing description
>> a given pin index.
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
>> ---
>>
>> Changes in v3: None
>> Changes in v2: None
>>
>> drivers/pinctrl/pinctrl_stm32.c | 77 +++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 77 insertions(+)
>>
>> diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
>> index e0bee4b97bd5..588efda8df4b 100644
>> --- a/drivers/pinctrl/pinctrl_stm32.c
>> +++ b/drivers/pinctrl/pinctrl_stm32.c
>> @@ -27,8 +27,34 @@ struct stm32_gpio_bank {
>>
>> #define MAX_PIN_PER_BANK 16
>>
>> +#define MAX_PIN_MUX_LEN 40
>> +static char pin_mux[MAX_PIN_MUX_LEN];
>> +
>> #define MAX_PIN_NAME_LEN 12
>> static char pin_name[MAX_PIN_NAME_LEN];
>> +#define PINMUX_MODE_COUNT 5
>> +static const char * const pinmux_mode[PINMUX_MODE_COUNT] = {
>> + "gpio input",
>> + "gpio output",
>> + "analog",
>> + "unknown",
>> + "alt function",
>> +};
>> +
>> +static int stm32_pinctrl_get_af(struct udevice *dev, unsigned int offset)
>> +{
>> + struct stm32_gpio_priv *priv = dev_get_priv(dev);
>> + struct stm32_gpio_regs *regs = priv->regs;
>> + u32 af;
>> + u32 alt_shift = (offset % 8) * 4;
>> + u32 alt_index = offset / 8;
>> +
>> + af = (readl(®s->afr[alt_index]) &
>> + GENMASK(alt_shift + 3, alt_shift)) >> alt_shift;
>> +
>> + return af;
>> +}
>> +
>> static int stm32_pinctrl_get_pins_count(struct udevice *dev)
>> {
>> struct stm32_pinctrl_priv *priv = dev_get_priv(dev);
>> @@ -97,6 +123,56 @@ static const char *stm32_pinctrl_get_pin_name(struct udevice *dev,
>>
>> return pin_name;
>> }
>> +
>> +static const char *stm32_pinctrl_get_pin_muxing(struct udevice *dev,
>> + unsigned int selector)
>
> Again I think this should be passed a buffer to write into.
Ok
Thanks
Patrice
>
> Regards,
> Simon
>
next prev parent reply other threads:[~2018-10-23 6:41 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 13:31 [U-Boot] [PATCH v3 0/9] Add pinmux command Patrice Chotard
2018-10-09 13:31 ` [U-Boot] [PATCH v3 1/9] dm: pinctrl: Add get_pin_muxing() ops Patrice Chotard
2018-10-19 3:28 ` Simon Glass
2018-10-23 6:41 ` Patrice CHOTARD
2018-10-24 14:14 ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 2/9] dm: pinctrl: Add pinctrl_get_pin_name and pinctrl_get_pins_count Patrice Chotard
2018-10-19 3:28 ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 3/9] dm: uclass: Add uclass_foreach_dev_probe Patrice Chotard
2018-10-11 9:06 ` Bin Meng
2018-10-12 7:51 ` Patrice CHOTARD
2018-10-12 10:13 ` Bin Meng
2018-10-15 9:01 ` Patrice CHOTARD
2018-10-19 3:27 ` Simon Glass
2018-10-23 7:16 ` Patrice CHOTARD
2018-10-09 13:31 ` [U-Boot] [PATCH v3 4/9] cmd: pinmux: Add pinmux command Patrice Chotard
2018-10-19 3:28 ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 5/9] pinctrl: stm32: Add get_pins_count() ops Patrice Chotard
2018-10-19 3:25 ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 6/9] pinctrl: stm32: Add get_pin_name() ops Patrice Chotard
2018-10-19 3:25 ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 7/9] pinctrl: stm32: Add get_pin_muxing() ops Patrice Chotard
2018-10-19 3:25 ` Simon Glass
2018-10-23 6:41 ` Patrice CHOTARD [this message]
2018-10-09 13:31 ` [U-Boot] [PATCH v3 8/9] gpio: stm32f7: Add ops get_function Patrice Chotard
2018-10-09 13:31 ` [U-Boot] [PATCH v3 9/9] pinctrl: sandbox: Add get_pin_muxing ops support Patrice Chotard
2018-10-19 3:25 ` Simon Glass
2018-10-23 6:40 ` Patrice CHOTARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=74c131fe-0448-8784-9c2c-3ab27e6b4f58@st.com \
--to=patrice.chotard@st.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.