From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 4/6] ARM: i.MX: external NAND boot: remove unnecessary arguments from imx*_nand_load_image
Date: Tue, 18 Feb 2020 16:37:30 +0100 [thread overview]
Message-ID: <20200218153732.14845-5-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20200218153732.14845-1-s.hauer@pengutronix.de>
The imx*_nand_load_image functions all take dest, size, nfc_base and
pagesize_2k arguments. All of these can be guessed inside the functions,
so remove them.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/external-nand-boot.c | 84 ++++++++++++--------------
1 file changed, 39 insertions(+), 45 deletions(-)
diff --git a/arch/arm/mach-imx/external-nand-boot.c b/arch/arm/mach-imx/external-nand-boot.c
index c4d61aa786..de8e0ffe5d 100644
--- a/arch/arm/mach-imx/external-nand-boot.c
+++ b/arch/arm/mach-imx/external-nand-boot.c
@@ -134,12 +134,13 @@ static noinline void __bare_init imx_nandboot_get_page(void *regs, int v1,
imx_nandboot_send_page(regs, v1, NFC_OUTPUT, pagesize_2k);
}
-static void __bare_init imx_nand_load_image(void *dest, int v1, int size,
+static void __bare_init imx_nand_load_image(void *dest, int v1,
void __iomem *base, int pagesize_2k)
{
u32 tmp, page, block, blocksize, pagesize, badblocks;
int bbt = 0;
void *regs, *spare0;
+ int size = *(uint32_t *)(dest + 0x2c);
if (pagesize_2k) {
pagesize = 2048;
@@ -239,60 +240,60 @@ static void __bare_init imx_nand_load_image(void *dest, int v1, int size,
}
}
-static void BARE_INIT_FUNCTION(imx25_nand_load_image)(void *dest, int size,
- void __iomem *base, int pagesize_2k)
+static void BARE_INIT_FUNCTION(imx25_nand_load_image)(void)
{
- imx_nand_load_image(dest, 0, size, base, pagesize_2k);
-}
-
-static void BARE_INIT_FUNCTION(imx27_nand_load_image)(void *dest, int size,
- void __iomem *base, int pagesize_2k)
-{
- imx_nand_load_image(dest, 1, size, base, pagesize_2k);
-}
-
-static void BARE_INIT_FUNCTION(imx31_nand_load_image)(void *dest, int size,
- void __iomem *base, int pagesize_2k)
-{
- imx_nand_load_image(dest, 1, size, base, pagesize_2k);
-}
-
-static void BARE_INIT_FUNCTION(imx35_nand_load_image)(void *dest, int size,
- void __iomem *base, int pagesize_2k)
-{
- imx_nand_load_image(dest, 0, size, base, pagesize_2k);
-}
+ void *sdram = (void *)MX25_CSD0_BASE_ADDR;
+ void __iomem *nfc_base = IOMEM(MX25_NFC_BASE_ADDR);
+ bool pagesize_2k;
-static inline int imx25_pagesize_2k(void)
-{
if (readl(MX25_CCM_BASE_ADDR + MX25_CCM_RCSR) & (1 << 8))
- return 1;
+ pagesize_2k = true;
else
- return 0;
+ pagesize_2k = false;
+
+ imx_nand_load_image(sdram, 0, nfc_base, pagesize_2k);
}
-static inline int imx27_pagesize_2k(void)
+static void BARE_INIT_FUNCTION(imx27_nand_load_image)(void)
{
+ void *sdram = (void *)MX27_CSD0_BASE_ADDR;
+ void __iomem *nfc_base = IOMEM(MX27_NFC_BASE_ADDR);
+ bool pagesize_2k;
+
if (readl(MX27_SYSCTRL_BASE_ADDR + 0x14) & (1 << 5))
- return 1;
+ pagesize_2k = true;
else
- return 0;
+ pagesize_2k = false;
+
+ imx_nand_load_image(sdram, 1, nfc_base, pagesize_2k);
}
-static inline int imx31_pagesize_2k(void)
+static void BARE_INIT_FUNCTION(imx31_nand_load_image)(void)
{
+ void *sdram = (void *)MX31_CSD0_BASE_ADDR;
+ void __iomem *nfc_base = IOMEM(MX31_NFC_BASE_ADDR);
+ bool pagesize_2k;
+
if (readl(MX31_CCM_BASE_ADDR + MX31_CCM_RCSR) & MX31_RCSR_NFMS)
- return 1;
+ pagesize_2k = true;
else
- return 0;
+ pagesize_2k = false;
+
+ imx_nand_load_image(sdram, 1, nfc_base, pagesize_2k);
}
-static inline int imx35_pagesize_2k(void)
+static void BARE_INIT_FUNCTION(imx35_nand_load_image)(void)
{
+ void *sdram = (void *)MX35_CSD0_BASE_ADDR;
+ void __iomem *nfc_base = IOMEM(MX35_NFC_BASE_ADDR);
+ bool pagesize_2k;
+
if (readl(MX35_CCM_BASE_ADDR + MX35_CCM_RCSR) & (1 << 8))
- return 1;
+ pagesize_2k = true;
else
- return 0;
+ pagesize_2k = false;
+
+ imx_nand_load_image(sdram, 0, nfc_base, pagesize_2k);
}
/*
@@ -307,20 +308,13 @@ static inline int imx35_pagesize_2k(void)
static void __noreturn BARE_INIT_FUNCTION(imx##soc##_boot_nand_external_cont) \
(void *boarddata) \
{ \
- unsigned long nfc_base = MX##soc##_NFC_BASE_ADDR; \
- void *sdram = (void *)MX##soc##_CSD0_BASE_ADDR; \
- uint32_t image_size, r; \
- \
- image_size = *(uint32_t *)(sdram + 0x2c); \
+ uint32_t r; \
\
r = get_cr(); \
r |= CR_I; \
set_cr(r); \
\
- imx##soc##_nand_load_image(sdram, \
- image_size, \
- (void *)nfc_base, \
- imx##soc##_pagesize_2k()); \
+ imx##soc##_nand_load_image(); \
\
imx##soc##_barebox_entry(boarddata); \
} \
--
2.25.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-02-18 15:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-18 15:37 [PATCH 0/6] i.MX: Fix external NAND boot Sascha Hauer
2020-02-18 15:37 ` [PATCH 1/6] ARM: i.MX Phytec phycard i.MX27: get fdt in common init function Sascha Hauer
2020-02-18 15:37 ` [PATCH 2/6] ARM: i.MX Phytec phycard i.MX27: replace __naked with noinline Sascha Hauer
2020-02-18 15:37 ` [PATCH 3/6] ARM: i.MX Phytec phycore " Sascha Hauer
2020-02-18 15:37 ` Sascha Hauer [this message]
2020-02-18 15:37 ` [PATCH 5/6] ARM: i.MX: external NAND boot: Leave icache disabled Sascha Hauer
2020-02-19 6:23 ` Oleksij Rempel
2020-02-19 8:27 ` Sascha Hauer
2020-02-19 11:53 ` Lucas Stach
2020-02-18 15:37 ` [PATCH 6/6] ARM: i.MX: external NAND boot: Fix passing boarddata Sascha Hauer
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=20200218153732.14845-5-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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