From: Pratyush Yadav <p.yadav@ti.com>
To: Vaishnav Achath <vaishnav.a@ti.com>
Cc: <hs@denx.de>, <u-boot@lists.denx.de>, <sjg@chromium.org>,
<mr.nuke.me@gmail.com>, <jh80.chung@samsung.com>,
<michal.simek@amd.com>, <marek.behun@nic.cz>, <pali@kernel.org>,
<sr@denx.de>, <marex@denx.de>, <ricardo@foundries.io>,
<vigneshr@ti.com>, <s-anna@ti.com>, <kishon@ti.com>,
<j-keerthy@ti.com>
Subject: Re: [PATCH v2 2/2] arm: k3: j721e: add dynamic sf bus override support for j721e
Date: Tue, 31 May 2022 16:29:08 +0530 [thread overview]
Message-ID: <20220531105908.x3ltmcb6ipcppwhq@ti.com> (raw)
In-Reply-To: <20220511060352.28140-3-vaishnav.a@ti.com>
Hi Vaishnav,
On 11/05/22 11:33AM, Vaishnav Achath wrote:
> implement overrides for spl_spi_boot_bus() and spl_spi_boot_cs()
> lookup functions according to bootmode selection, so as to support
> both QSPI and OSPI boot using the same build.
>
> Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
> ---
> arch/arm/mach-k3/j721e_init.c | 17 +++++++++++++++++
> arch/arm/mach-k3/sysfw-loader.c | 4 ++--
> 2 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
> index f503f15f19..82391b5cf8 100644
> --- a/arch/arm/mach-k3/j721e_init.c
> +++ b/arch/arm/mach-k3/j721e_init.c
> @@ -355,6 +355,23 @@ static u32 __get_primary_bootmedia(u32 main_devstat, u32 wkup_devstat)
> return bootmode;
> }
>
> +u32 spl_spi_boot_bus(void)
> +{
> + u32 wkup_devstat = readl(CTRLMMR_WKUP_DEVSTAT);
> + u32 main_devstat = readl(CTRLMMR_MAIN_DEVSTAT);
> + u32 bootmode = ((wkup_devstat & WKUP_DEVSTAT_PRIMARY_BOOTMODE_MASK) >>
> + WKUP_DEVSTAT_PRIMARY_BOOTMODE_SHIFT) |
> + ((main_devstat & MAIN_DEVSTAT_BOOT_MODE_B_MASK) << BOOT_MODE_B_SHIFT);
> +
> + return (bootmode == BOOT_DEVICE_QSPI) ? 1 : 0;
> +}
> +
> +/* both OSPI and QSPI flash are in CS0 */
> +u32 spl_spi_boot_cs(void)
> +{
> + return 0;
> +}
> +
I don't think we need to hard-code the chip select here. Let that come
from the config. Other than this,
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
> u32 spl_boot_device(void)
> {
> u32 wkup_devstat = readl(CTRLMMR_WKUP_DEVSTAT);
> diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
> index 5e48c36ccd..8ff36759c1 100644
> --- a/arch/arm/mach-k3/sysfw-loader.c
> +++ b/arch/arm/mach-k3/sysfw-loader.c
> @@ -324,9 +324,9 @@ static void *k3_sysfw_get_spi_addr(void)
> struct udevice *dev;
> fdt_addr_t addr;
> int ret;
> + unsigned int sf_bus = spl_spi_boot_bus();
>
> - ret = uclass_find_device_by_seq(UCLASS_SPI, CONFIG_SF_DEFAULT_BUS,
> - &dev);
> + ret = uclass_find_device_by_seq(UCLASS_SPI, sf_bus, &dev);
> if (ret)
> return NULL;
>
> --
> 2.17.1
>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
prev parent reply other threads:[~2022-05-31 10:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 6:03 [PATCH v2 0/2] Add support for dynamic overriding of default SF bus Vaishnav Achath
2022-05-11 6:03 ` [PATCH v2 1/2] common: spl: spl_spi: add support for dynamic override of sf bus Vaishnav Achath
2022-05-11 8:24 ` Heiko Schocher
2022-05-12 6:28 ` Vaishnav Achath
2022-05-31 8:59 ` Pratyush Yadav
2022-05-11 6:03 ` [PATCH v2 2/2] arm: k3: j721e: add dynamic sf bus override support for j721e Vaishnav Achath
2022-05-31 10:59 ` Pratyush Yadav [this message]
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=20220531105908.x3ltmcb6ipcppwhq@ti.com \
--to=p.yadav@ti.com \
--cc=hs@denx.de \
--cc=j-keerthy@ti.com \
--cc=jh80.chung@samsung.com \
--cc=kishon@ti.com \
--cc=marek.behun@nic.cz \
--cc=marex@denx.de \
--cc=michal.simek@amd.com \
--cc=mr.nuke.me@gmail.com \
--cc=pali@kernel.org \
--cc=ricardo@foundries.io \
--cc=s-anna@ti.com \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
--cc=vaishnav.a@ti.com \
--cc=vigneshr@ti.com \
/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