From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA583C433EF for ; Thu, 17 Feb 2022 14:16:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7065683BA7; Thu, 17 Feb 2022 15:16:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=permerror header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="U32LXtR5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E2EF083595; Thu, 17 Feb 2022 15:16:37 +0100 (CET) Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1966D83BC1 for ; Thu, 17 Feb 2022 15:16:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=permerror header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.behun@nic.cz Received: from dellmb (unknown [IPv6:2001:1488:fffe:6:8747:7254:5571:3010]) by mail.nic.cz (Postfix) with ESMTPSA id ADD75146383; Thu, 17 Feb 2022 15:16:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1645107393; bh=idbDwMjdzhdcCox878mZeO2WXgoabYO83WoESZcHwWc=; h=Date:From:To; b=U32LXtR5mFcyojnhnHLCcP2zmM/RW+Yk7cYY0Qm1GKgfwtkTKthz2KHRUDFuUjKj/ Lj01sDXIvB17E6Ve34+VYPsowwn7Jququ3P2Bg+BjWsXN2r3mU0TeZN5x9cYBvcktX 3nx1JtfMAO/dwz8I+6kFz7UgqK8p6MOlco1qOLM4= Date: Thu, 17 Feb 2022 15:16:33 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Pali =?UTF-8?B?Um9ow6Fy?= Cc: Stefan Roese , Konstantin Porotchkin , Vladimir Vid , u-boot@lists.denx.de Subject: Re: [PATCH u-boot-mvebu 4/5] arm: mvebu: a37xx: Extend mbox_do_cmd() code Message-ID: <20220217151633.242aa231@dellmb> In-Reply-To: <20220217092619.1445-5-pali@kernel.org> References: <20220217092619.1445-1-pali@kernel.org> <20220217092619.1445-5-pali@kernel.org> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Thu, 17 Feb 2022 10:26:18 +0100 Pali Roh=C3=A1r wrote: > Allow to specify input parameters, define all available mbox commands > supported by CZ.NIC secure firmware + Marvell fuse.bin firmware and fix CZ.NIC's and also Marvell's > parsing response from Marvell OTP commands. >=20 > Signed-off-by: Pali Roh=C3=A1r ... > #define MBOX_STS_ERROR(s) ((s) & (3 << 30)) > #define MBOX_STS_VALUE(s) (((s) >> 10) & 0xfffff) > #define MBOX_STS_CMD(s) ((s) & 0x3ff) > +#define MBOX_STS_MARVELL_ERROR(s) ((s) =3D=3D 0 ? 0 : (s) =3D=3D 2 ? ETI= MEDOUT : (s) =3D=3D 3 ? EINVAL : (s) =3D=3D 4 ? ENOSYS : EIO) This is starting to become too complicated for a macro :-( What do you think about converting all these to a static function? Something like static int mbox_parse_status(u32 status, u16 *cmd, u32 *value, bool marvell) { ... } > =20 > #ifndef _MVEBU_MBOX_H > @@ -16,8 +17,24 @@ enum mbox_cmd { > =20 > MBOX_CMD_OTP_READ, > MBOX_CMD_OTP_WRITE, > + > + MBOX_CMD_REBOOT, > + > + /* OTP read commands supported by Marvell fuse.bin firmware */ Marvell's > + MBOX_CMD_OTP_READ_1B =3D 257, > + MBOX_CMD_OTP_READ_8B, > + MBOX_CMD_OTP_READ_32B, > + MBOX_CMD_OTP_READ_64B, > + MBOX_CMD_OTP_READ_256B, > + > + /* OTP write commands supported by Marvell fuse.bin firmware */ Marvell's