U-boot Archive mirror
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: Dragan Simic <dsimic@manjaro.org>
Cc: Marek Vasut <marex@denx.de>, Ulf Hansson <ulf.hansson@linaro.org>,
	 Avri Altman <avri.altman@wdc.com>, Tom Rini <trini@konsulko.com>,
	Simon Glass <sjg@chromium.org>,
	 Fabio Estevam <festevam@gmail.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	u-boot@lists.denx.de
Subject: Re: [PATCH v3] mmc: allow use of hardware partition names for mmc partconf
Date: Tue, 14 May 2024 09:31:29 -0700	[thread overview]
Message-ID: <CAJ+vNU2dy9Z6hFjbU_RLv+N9gUOasp-XxUQYKuWM971f0aAsxQ@mail.gmail.com> (raw)
In-Reply-To: <3a1a4406d54e6cdc09f03e88f265e555@manjaro.org>

On Tue, May 14, 2024 at 5:05 AM Dragan Simic <dsimic@manjaro.org> wrote:
>
> Hello all,
>
> On 2024-05-14 01:02, Marek Vasut wrote:
> > On 5/13/24 10:52 PM, Tim Harvey wrote:
> >> On Mon, Apr 29, 2024 at 1:51 PM Marek Vasut <marex@denx.de> wrote:
> >>>
> >>> On 4/29/24 6:48 PM, Tim Harvey wrote:
> >>>> On Sat, Apr 27, 2024 at 4:20 PM Marek Vasut <marex@denx.de> wrote:
> >>>>>
> >>>>> On 4/27/24 2:11 AM, Tim Harvey wrote:
> >>>>>
> >>>>> [...]
> >>>>>
> >>>>>> diff --git a/include/mmc.h b/include/mmc.h
> >>>>>> index 4b8327f1f93b..7243bd761202 100644
> >>>>>> --- a/include/mmc.h
> >>>>>> +++ b/include/mmc.h
> >>>>>> @@ -381,6 +381,21 @@ enum mmc_voltage {
> >>>>>>     #define MMC_TIMING_MMC_HS200        9
> >>>>>>     #define MMC_TIMING_MMC_HS400        10
> >>>>>>
> >>>>>> +/* emmc hardware partition values */
> >>>>>> +enum emmc_hwpart {
> >>>>>> +     EMMC_HWPART_DEFAULT = 0,
> >>>>>
> >>>>> One more thing ... eMMC hardware partition 0 and 7 are both
> >>>>> referring to
> >>>>> USER HW partition. Have a look at the git log, there have been
> >>>>> patches
> >>>>> which handled this case in the MMC subsystem from about a year ago.
> >>>>
> >>>> I can't find what you are referring to. I assume you are talking
> >>>> about
> >>>> calling the first name something other than 'user' as technically
> >>>> it's
> >>>> not (but it gets treated as user).
> >>>>
> >>>> Can you find the commit or discussion you are thinking about?
> >>>
> >>> It seems this whole thing is much older:
> >>>
> >>> 7dbe63bc950b ("SPL: Add CONFIG_SUPPORT_EMMC_BOOT support to
> >>> CONFIG_SPL_FRAMEWORK")
> >>>
> >>> +                * We need to check what the partition is configured
> >>> to.
> >>> +                * 1 and 2 match up to boot0 / boot1 and 7 is user
> >>> data
> >>> +                * which is the first physical partition (0).
> >>> +                */
> >>> +               int part = (mmc->part_config >> 3) &
> >>> PART_ACCESS_MASK;
> >>> +
> >>> +               if (part == 7)
> >>> +                       part = 0;
> >> Sorry, I haven't been able to work on U-Boot for the past week or so
> >> and am just getting back to this.
> >
> > No worries.
> >
> >> I'm glad you pointed this out as it made me aware that there is a bit
> >> of a mixing of eMMC PARTITION_CONFIG (Ext CSD 179) fields
> >> BOOT_PARTITION_ENABLE and PARTITION_ACCESS in U-Boot currently.
> >>
> >> I'm going to add an enumerated type for each and update the various
> >> places where a 'conversion' as above is done but I'm still a bit torn
> >> on naming conventions.
> >>
> >> Consider the following:
> >> - the eMMC spec refers to boot partitions and gp partitions as 1 based
> >> - the Linux kernel device names for these are 0 based
> >> - U-Boot does not currently refer to the boot devices by names but
> >> does currently refer to the gp's by names using 1-based names (the
> >> 'mmc hwpartition' command)
> >>
> >> Personally I would like to name the boot partitions 'boot0' and
> >> 'boot1' to match Linux but I think I should name the gp's
> >> 'gp1'...'gp4' to be backward compatible with the 'mmc hwpartition'
> >> command.
> >>
> >> What do you think?
> >
> > I agree.
> >
> > Maybe you could also check this with Ulf (Linux MMC maintainer) and
> > Avri (mmc-utils), both on To:, so we would be consistent and in sync ?
>
> As I promised earlier, I went through a few JEDEC standards and some
> publicly available JEDEC documents and presentations, and my conclusion
> is that no official numbering scheme for the partitions seems to be
> defined there.
>
> However, I'd propose that we keep "boot0" and "boot1", because that's
> pretty much become a de facto standard, and also switch to using "gp0"
> through "gp3" for the general-purpose partitions.  That switch might
> be some kind of a backward-incompatible change, but it would follow
> the names of the corresponding GP_SIZE_MULT_GP0 ... GP_SIZE_MULT_GP3
> fields in the EXT_CSD register, as defined by JEDEC, and it would also
> be more consistent with the numbering of the boot partitions.
>
> Though, general-purpose partitions are mentioned as GPP1 ... GPP4 in
> one place in the JEDEC standard, which just confirms that no official
> numbering scheme seems to be defined.  Moreover, the boot partitions
> are more than once referred to as "boot partition 1" and "boot partition
> 2" in the JEDEC standard, which means we're already not following the
> standard with "boot0" and "boot1".
>
> Frankly, it's all a bit contradictory and confusing, but I think that
> the increased consistency would outweigh the backward-incompatible
> downside of the switch to "gp0" through "gp3".

Dragan,

Thanks for your freedback and sorry for the late reply.

I also went over the spec and found that they used 1 based naming in
their referencing of the partitions but noticed that Linux uses 0
based naming for both boot partitions as well as gp's when creating
devs. Seeing as both Linux and U-Boot tend to use 0 based naming I
wanted to go that route but then I noticed the 'mmc hwpartition'
command (enabled via MMC_HW_PARTITIONING) which is used to create gp's
uses 1-based gp names in its parameter list and that 'mmc info' will
display the gp's, if configured, as 1 based as well.

I submitted yesterday a new v3 series where I use boot0, boot1 for
boot partitions but gp1, gp2, gp3, gp4 for gp names just to stick with
the current usage of 'gp' in U-Boot (although the array of names isn't
used currently in the 'mmc hwpartition' or 'mmc info' commands.

I'm open to further discussion on the matter. I hate to make things
non-standard just to be backward compatible but I have no idea who is
using the 'mmc hwpartition' or output of 'mmc info' currently with
regards to gp's.

Best Regards,

Tim

      reply	other threads:[~2024-05-14 16:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-27  0:11 [PATCH v3] mmc: allow use of hardware partition names for mmc partconf Tim Harvey
2024-04-27  0:48 ` Marek Vasut
2024-04-27  1:29   ` E Shattow
2024-04-27 10:22     ` Marek Vasut
2024-04-27 12:06       ` E Shattow
2024-04-27 23:19         ` Marek Vasut
2024-04-27 23:20 ` Marek Vasut
2024-04-29 16:48   ` Tim Harvey
2024-04-29 20:15     ` Marek Vasut
2024-05-13 20:52       ` Tim Harvey
2024-05-13 23:02         ` Marek Vasut
2024-05-14 12:05           ` Dragan Simic
2024-05-14 16:31             ` Tim Harvey [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=CAJ+vNU2dy9Z6hFjbU_RLv+N9gUOasp-XxUQYKuWM971f0aAsxQ@mail.gmail.com \
    --to=tharvey@gateworks.com \
    --cc=avri.altman@wdc.com \
    --cc=dsimic@manjaro.org \
    --cc=festevam@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=marex@denx.de \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=ulf.hansson@linaro.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).