From: Stefan Roese <sr@denx.de>
To: "Marek Behún" <kabel@kernel.org>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH u-boot-mvebu v3 13/18] gpio: turris_omnia_mcu: Update firmware features reading
Date: Thu, 28 Mar 2024 11:15:09 +0100 [thread overview]
Message-ID: <ab15fe52-c157-4875-b8a4-affe7935d23f@denx.de> (raw)
In-Reply-To: <20240327162355.24584-14-kabel@kernel.org>
On 3/27/24 17:23, Marek Behún wrote:
> Update firmware features reading to try reading 32 bits of features and
> fallback to reading 16 bits.
>
> Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Thanks,
Stefan
> ---
> drivers/gpio/turris_omnia_mcu.c | 32 ++++++++++++++++++++++----------
> 1 file changed, 22 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpio/turris_omnia_mcu.c b/drivers/gpio/turris_omnia_mcu.c
> index c441d07d69..40ced261e3 100644
> --- a/drivers/gpio/turris_omnia_mcu.c
> +++ b/drivers/gpio/turris_omnia_mcu.c
> @@ -10,7 +10,7 @@
> #include <linux/log2.h>
>
> struct turris_omnia_mcu_info {
> - u16 features;
> + u32 features;
> };
>
> static int turris_omnia_mcu_get_function(struct udevice *dev, uint offset)
> @@ -228,25 +228,37 @@ static int turris_omnia_mcu_probe(struct udevice *dev)
> {
> struct turris_omnia_mcu_info *info = dev_get_plat(dev);
> struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
> - u16 val;
> + u32 dword;
> + u16 word;
> int ret;
>
> - ret = dm_i2c_read(dev, CMD_GET_STATUS_WORD, (void *)&val, sizeof(val));
> + ret = dm_i2c_read(dev, CMD_GET_STATUS_WORD, (void *)&word, sizeof(word));
> if (ret < 0) {
> printf("Error: turris_omnia_mcu CMD_GET_STATUS_WORD failed: %d\n",
> ret);
> return ret;
> }
>
> - if (le16_to_cpu(val) & STS_FEATURES_SUPPORTED) {
> - ret = dm_i2c_read(dev, CMD_GET_FEATURES, (void *)&val,
> - sizeof(val));
> + if (le16_to_cpu(word) & STS_FEATURES_SUPPORTED) {
> + /* try read 32-bit features */
> + ret = dm_i2c_read(dev, CMD_GET_FEATURES, (void *)&dword,
> + sizeof(dword));
> if (ret < 0) {
> - printf("Error: turris_omnia_mcu CMD_GET_FEATURES failed: %d\n",
> - ret);
> - return ret;
> + /* try read 16-bit features */
> + ret = dm_i2c_read(dev, CMD_GET_FEATURES, (void *)&word,
> + sizeof(word));
> + if (ret < 0) {
> + printf("Error: turris_omnia_mcu CMD_GET_FEATURES failed: %d\n",
> + ret);
> + return ret;
> + }
> +
> + info->features = le16_to_cpu(word);
> + } else {
> + info->features = le32_to_cpu(dword);
> + if (info->features & FEAT_FROM_BIT_16_INVALID)
> + info->features &= GENMASK(15, 0);
> }
> - info->features = le16_to_cpu(val);
> }
>
> uc_priv->bank_name = "mcu_";
Viele Grüße,
Stefan Roese
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de
next prev parent reply other threads:[~2024-03-28 10:15 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 16:23 [PATCH u-boot-mvebu v3 00/18] Turris Omnia - New board revision support Marek Behún
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 01/18] arm: mvebu: turris_omnia: Enable LTO by default on Turris Omnia Marek Behún
2024-03-28 9:53 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 02/18] arm: mvebu: turris_omnia: Add header containing MCU command interface and use it Marek Behún
2024-03-28 9:53 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 03/18] arm: mvebu: turris_{omnia, mox}: Don't print model two times Marek Behún
2024-03-28 9:53 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 04/18] arm: mvebu: turris_omnia: Update MCU status and features reading Marek Behún
2024-03-28 9:54 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 05/18] arm: mvebu: turris_omnia: Implement getting board information from MCU Marek Behún
2024-03-28 9:56 ` Stefan Roese
2024-03-28 11:17 ` Marek Behún
2024-03-28 12:53 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 06/18] arm: mvebu: turris_omnia: Print board ECDSA public key if available Marek Behún
2024-03-28 9:56 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 07/18] arm: mvebu: turris_omnia: Disable Atmel SHA node if not present Marek Behún
2024-03-28 9:56 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 08/18] arm: mvebu: spl: Do not build mvebu-reset in SPL Marek Behún
2024-03-28 9:58 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 09/18] arm: mvebu: system-controller: Rework to use UCLASS_SYSCON Marek Behún
2024-03-28 9:59 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 10/18] arm: mvebu: system-controller: Select mvebu-reset if DM_RESET && PCI_MVEBU Marek Behún
2024-03-28 10:00 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 11/18] arm: mvebu: system-controller: Add support for SYSRESET Marek Behún
2024-03-28 10:04 ` Stefan Roese
2024-03-28 11:21 ` Marek Behún
2024-03-28 13:01 ` Stefan Roese
2024-03-28 14:18 ` Marek Behún
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 12/18] gpio: turris_omnia_mcu: Use byteorder conversion functions Marek Behún
2024-03-28 10:12 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 13/18] gpio: turris_omnia_mcu: Update firmware features reading Marek Behún
2024-03-28 10:15 ` Stefan Roese [this message]
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 14/18] gpio: turris_omnia_mcu: Add support for system power off via sysreset Marek Behún
2024-03-28 10:18 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 15/18] arm: mvebu: turris_omnia: Enable poweroff command via sysreset in defconfig Marek Behún
2024-03-28 10:18 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 16/18] cmd: rng: Print "Abort" on -EINTR Marek Behún
2024-03-28 10:22 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 17/18] misc: turris_omnia_mcu: Add support for rng provided by MCU Marek Behún
2024-03-28 10:25 ` Stefan Roese
2024-03-27 16:23 ` [PATCH u-boot-mvebu v3 18/18] arm: mvebu: turris_omnia: Enable rng command in defconfig Marek Behún
2024-03-28 10:25 ` Stefan Roese
2024-04-04 6:38 ` [PATCH u-boot-mvebu v3 00/18] Turris Omnia - New board revision support Stefan Roese
2024-04-04 7:38 ` Marek Behún
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=ab15fe52-c157-4875-b8a4-affe7935d23f@denx.de \
--to=sr@denx.de \
--cc=kabel@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox