public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Eric Nelson <eric.nelson@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] mx6: add function to determine boot device
Date: Fri, 08 Nov 2013 16:09:07 -0700	[thread overview]
Message-ID: <527D6F13.4060208@boundarydevices.com> (raw)
In-Reply-To: <1383903253.3157.492.camel@edward-x220-laptop>

Hi Edward,

On 11/08/2013 02:34 AM, Edward Lin wrote:
> During boot the boot pin configuration is copied to the SBMR registers.
> This patch adds a function to read the boot device from SBMR.
>
> Signed-off-by: Edward Lin <edward.lin@technexion.com>
> Signed-off-by: Richard Hu <richard.hu@technexion.com>
>
> ---
>   arch/arm/cpu/armv7/mx6/soc.c              | 43
> +++++++++++++++++++++++++++++++
>   arch/arm/include/asm/arch-mx6/sys_proto.h | 17 ++++++++++++
>   2 files changed, 60 insertions(+)
>
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index a390296..6bacdab 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
> @@ -243,6 +243,49 @@ void s_init(void)
>          writel(mask528, &anatop->pfd_528_clr);
>   }
>
> +enum mx6_boot_device imx_get_boot_device(void)
> +{
> +       uint soc_sbmr = readl(SRC_BASE_ADDR + 0x4);

(struct src)->sbmr1? (from imx-regs.h)

> +       uint bt_mem_ctl = (soc_sbmr & 0x000000FF) >> 4 ;

You may want a macro here, but certainly don't need the
low four bits set.

> +       uint bt_mem_type = (soc_sbmr & 0x00000008) >> 3;
> +       uint bt_mem_mmc = (soc_sbmr & 0x00001000) >> 12;
> +
> +       switch (bt_mem_ctl) {
> +       case 0x0:
> +               if (bt_mem_type)
> +                       return MX6_ONE_NAND_BOOT;
> +               else
> +                       return MX6_WEIM_NOR_BOOT;
> +               break;
> +       case 0x2:
> +                       return MX6_SATA_BOOT;
> +               break;
> +       case 0x3:
> +               if (bt_mem_type)
> +                       return MX6_I2C_BOOT;
> +               else
> +                       return MX6_SPI_NOR_BOOT;
> +               break;
> +       case 0x4:
> +       case 0x5:
> +               if (bt_mem_mmc)
> +                       return MX6_SD0_BOOT;
> +               else
> +                       return MX6_SD1_BOOT;
> +               break;
> +       case 0x6:
> +       case 0x7:
> +               return MX6_MMC_BOOT;
> +               break;
> +       case 0x8 ... 0xf:
> +               return MX6_NAND_BOOT;
> +               break;
> +       default:
> +               return MX6_UNKNOWN_BOOT;
> +               break;
> +       }
> +}
> +

These magic values are the same as those used in
arch/arm/cpu/armv7/mx6/soc.c for the "bmode" command,
so I'd personally like to see some constants...

I'd also like to know where the definitive reference
for these is. I have a spreadsheet of dubious ancestry,
and the current RM has the very helpful comment
"Refer to the fusemap", and the fuse map is similarly
opaque.

Troy? Anyone?

>   #ifdef CONFIG_IMX_HDMI
>   void imx_enable_hdmi_phy(void)
>   {
> diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h
> b/arch/arm/include/asm/arch-mx6/sys_proto.h
> index 8c21364..b26955e 100644
> --- a/arch/arm/include/asm/arch-mx6/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
> @@ -17,6 +17,21 @@
>   #define MXC_CPU_MX6SOLO                0x62
>   #define MXC_CPU_MX6Q           0x63
>
> +enum mx6_boot_device {
> +        MX6_SD0_BOOT,
> +        MX6_SD1_BOOT,
> +        MX6_MMC_BOOT,
> +        MX6_NAND_BOOT,
> +        MX6_SATA_BOOT,
> +        MX6_WEIM_NOR_BOOT,
> +        MX6_ONE_NAND_BOOT,
> +        MX6_PATA_BOOT,
> +        MX6_I2C_BOOT,
> +        MX6_SPI_NOR_BOOT,
> +        MX6_UNKNOWN_BOOT,
> +        MX6_BOOT_DEV_NUM = MX6_UNKNOWN_BOOT,
> +};
> +

It might make sense to just place these into the
soc_boot_modes table, gain "bmode" support for all
of them, and have imx_get_boot_device() walk the
table.

At the moment, it appears that only USB, SATA,
SPI-NOR, and SD card are supported by "bmode".

Regards,


Eric

      reply	other threads:[~2013-11-08 23:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1383902813.3157.481.camel@edward-x220-laptop>
2013-11-08  9:34 ` [U-Boot] [PATCH 1/4] mx6: add function to determine boot device Edward Lin
2013-11-08 23:09   ` Eric Nelson [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=527D6F13.4060208@boundarydevices.com \
    --to=eric.nelson@boundarydevices.com \
    --cc=u-boot@lists.denx.de \
    /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