* [PATCH 1/2] ARM: i.MX: boot: Make use of FIELD_GET() in imx51_get_boot_source()
@ 2018-09-19 15:48 Andrey Smirnov
2018-09-19 15:48 ` [PATCH 2/2] ARM: i.MX: boot: Detect boot instance on i.MX51 Andrey Smirnov
2018-09-24 6:54 ` [PATCH 1/2] ARM: i.MX: boot: Make use of FIELD_GET() in imx51_get_boot_source() Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Andrey Smirnov @ 2018-09-19 15:48 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/boot.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index f1fc40479..830ea08f3 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -167,10 +167,10 @@ void imx27_boot_save_loc(void)
imx_boot_save_loc(imx27_get_boot_source);
}
-#define IMX51_SRC_SBMR 0x4
-#define IMX51_SBMR_BT_MEM_TYPE_SHIFT 7
-#define IMX51_SBMR_BT_MEM_CTL_SHIFT 0
-#define IMX51_SBMR_BMOD_SHIFT 14
+#define IMX51_SRC_SBMR 0x4
+#define IMX51_SBMR_BT_MEM_TYPE GENMASK(8, 7)
+#define IMX51_SBMR_BT_MEM_CTL GENMASK(1, 0)
+#define IMX51_SBMR_BMOD GENMASK(15, 14)
void imx51_get_boot_source(enum bootsource *src, int *instance)
{
@@ -180,12 +180,12 @@ void imx51_get_boot_source(enum bootsource *src, int *instance)
reg = readl(src_base + IMX51_SRC_SBMR);
- switch ((reg >> IMX51_SBMR_BMOD_SHIFT) & 0x3) {
+ switch (FIELD_GET(IMX51_SBMR_BMOD, reg)) {
case 0:
case 2:
/* internal boot */
- ctrl = (reg >> IMX51_SBMR_BT_MEM_CTL_SHIFT) & 0x3;
- type = (reg >> IMX51_SBMR_BT_MEM_TYPE_SHIFT) & 0x3;
+ ctrl = FIELD_GET(IMX51_SBMR_BT_MEM_CTL, reg);
+ type = FIELD_GET(IMX51_SBMR_BT_MEM_TYPE, reg);
*src = locations[ctrl][type];
break;
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] ARM: i.MX: boot: Detect boot instance on i.MX51
2018-09-19 15:48 [PATCH 1/2] ARM: i.MX: boot: Make use of FIELD_GET() in imx51_get_boot_source() Andrey Smirnov
@ 2018-09-19 15:48 ` Andrey Smirnov
2018-09-24 6:54 ` [PATCH 1/2] ARM: i.MX: boot: Make use of FIELD_GET() in imx51_get_boot_source() Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Andrey Smirnov @ 2018-09-19 15:48 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/boot.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 830ea08f3..0c51767c4 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -170,6 +170,7 @@ void imx27_boot_save_loc(void)
#define IMX51_SRC_SBMR 0x4
#define IMX51_SBMR_BT_MEM_TYPE GENMASK(8, 7)
#define IMX51_SBMR_BT_MEM_CTL GENMASK(1, 0)
+#define IMX51_SBMR_BT_SRC GENMASK(20, 19)
#define IMX51_SBMR_BMOD GENMASK(15, 14)
void imx51_get_boot_source(enum bootsource *src, int *instance)
@@ -188,6 +189,7 @@ void imx51_get_boot_source(enum bootsource *src, int *instance)
type = FIELD_GET(IMX51_SBMR_BT_MEM_TYPE, reg);
*src = locations[ctrl][type];
+ *instance = FIELD_GET(IMX51_SBMR_BT_SRC, reg);
break;
case 1:
/* reserved */
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ARM: i.MX: boot: Make use of FIELD_GET() in imx51_get_boot_source()
2018-09-19 15:48 [PATCH 1/2] ARM: i.MX: boot: Make use of FIELD_GET() in imx51_get_boot_source() Andrey Smirnov
2018-09-19 15:48 ` [PATCH 2/2] ARM: i.MX: boot: Detect boot instance on i.MX51 Andrey Smirnov
@ 2018-09-24 6:54 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2018-09-24 6:54 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Wed, Sep 19, 2018 at 08:48:46AM -0700, Andrey Smirnov wrote:
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> arch/arm/mach-imx/boot.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
> index f1fc40479..830ea08f3 100644
> --- a/arch/arm/mach-imx/boot.c
> +++ b/arch/arm/mach-imx/boot.c
> @@ -167,10 +167,10 @@ void imx27_boot_save_loc(void)
> imx_boot_save_loc(imx27_get_boot_source);
> }
>
> -#define IMX51_SRC_SBMR 0x4
> -#define IMX51_SBMR_BT_MEM_TYPE_SHIFT 7
> -#define IMX51_SBMR_BT_MEM_CTL_SHIFT 0
> -#define IMX51_SBMR_BMOD_SHIFT 14
> +#define IMX51_SRC_SBMR 0x4
> +#define IMX51_SBMR_BT_MEM_TYPE GENMASK(8, 7)
> +#define IMX51_SBMR_BT_MEM_CTL GENMASK(1, 0)
> +#define IMX51_SBMR_BMOD GENMASK(15, 14)
>
> void imx51_get_boot_source(enum bootsource *src, int *instance)
> {
> @@ -180,12 +180,12 @@ void imx51_get_boot_source(enum bootsource *src, int *instance)
>
> reg = readl(src_base + IMX51_SRC_SBMR);
>
> - switch ((reg >> IMX51_SBMR_BMOD_SHIFT) & 0x3) {
> + switch (FIELD_GET(IMX51_SBMR_BMOD, reg)) {
> case 0:
> case 2:
> /* internal boot */
> - ctrl = (reg >> IMX51_SBMR_BT_MEM_CTL_SHIFT) & 0x3;
> - type = (reg >> IMX51_SBMR_BT_MEM_TYPE_SHIFT) & 0x3;
> + ctrl = FIELD_GET(IMX51_SBMR_BT_MEM_CTL, reg);
> + type = FIELD_GET(IMX51_SBMR_BT_MEM_TYPE, reg);
>
> *src = locations[ctrl][type];
> break;
> --
> 2.17.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-24 6:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 15:48 [PATCH 1/2] ARM: i.MX: boot: Make use of FIELD_GET() in imx51_get_boot_source() Andrey Smirnov
2018-09-19 15:48 ` [PATCH 2/2] ARM: i.MX: boot: Detect boot instance on i.MX51 Andrey Smirnov
2018-09-24 6:54 ` [PATCH 1/2] ARM: i.MX: boot: Make use of FIELD_GET() in imx51_get_boot_source() Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox