From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cQYd8-0002dQ-Vj for barebox@lists.infradead.org; Mon, 09 Jan 2017 12:00:54 +0000 Date: Mon, 9 Jan 2017 13:00:28 +0100 From: Sascha Hauer Message-ID: <20170109120028.rmlau62fksph6aeq@pengutronix.de> References: <1481565788-9115-1-git-send-email-andrew.smirnov@gmail.com> <1481565788-9115-13-git-send-email-andrew.smirnov@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1481565788-9115-13-git-send-email-andrew.smirnov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH v2 12/21] i.MX: iomuxv3: Add helper type to deconstruct iomux_v3_cfg_t values To: Andrey Smirnov Cc: barebox@lists.infradead.org On Mon, Dec 12, 2016 at 10:02:59AM -0800, Andrey Smirnov wrote: > Signed-off-by: Andrey Smirnov > --- > arch/arm/mach-imx/include/mach/iomux-v3.h | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/arch/arm/mach-imx/include/mach/iomux-v3.h b/arch/arm/mach-imx/include/mach/iomux-v3.h > index 3bf457f..470f774 100644 > --- a/arch/arm/mach-imx/include/mach/iomux-v3.h > +++ b/arch/arm/mach-imx/include/mach/iomux-v3.h > @@ -78,6 +78,22 @@ typedef u64 iomux_v3_cfg_t; > ((iomux_v3_cfg_t)(_sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT) | \ > ((iomux_v3_cfg_t)(_sel_input) << MUX_SEL_INPUT_SHIFT)) > > + > +struct iomux_v3_pad_configuration { > + u64 mux_ctrl_ofs : 12; > + u64 pad_ctrl_ofs : 12; > + u64 sel_input_ofs : 12; > + u64 mux_mode : 5; > + u64 pad_ctrl : 18; > + u64 sel_inp : 4; > + u64 reserved : 1; > +} __packed; > + > +union iomux_v3_pad { > + iomux_v3_cfg_t raw; > + struct iomux_v3_pad_configuration cfg; > +}; No, please. The order of bitfields is implementation defined. We shouldn't use this in barebox. Use plain masking/shifting, the defines are almost there. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox