RE: [PATCH 1/1] Production State Awareness support in host side

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ulf,

> -----Original Message-----
> From: Ulf Hansson [mailto:ulf.hansson@xxxxxxxxxx]
> Sent: Monday, November 17, 2014 3:34 PM
> To: Avi Shchislowski
> Cc: linux-mmc; Chris Ball; Alex Lemberg
> Subject: Re: [PATCH 1/1] Production State Awareness support in host side
> 
> On 17 November 2014 13:52, Avi Shchislowski <avi.shchislowski@xxxxxxxxxxx>
> wrote:
> > Adding support for PSA (Production State Awareness) feature for all
> > eMMC devices with revision >=5.0 In this patch the eMMC driver will
> > check if device was completed its Production State mode, and will
> > switch it to Normal (field) mode.
> > Switching to normal mode signal the device to complete its work in
> > production mode and start working in regular performance mode.
> 
> Please add some detail to what this patch does. Additionally why it's needed.

In this patch driver should recognize if eMMC device (Rev >=5.0) was not switched 
to Normal (0x00) PSA mode by storage vendor or Programmer house.
For this, we are checking if device was leaved in PRE_SOLDERING_POST_WRITES (0x02) 
state - represents a state in which the device is in production and the host 
(usually programmer) completed to load the content to the device. 
The host (usually programmer) sets the device to this state after content was loaded 
and just before soldering.
After soldering the device to real host (not programmer), the device should be switched to 
Normal (0x00) mode.
The Normal (0x00) mode of PSA register represents a state in which the device is running 
in the field and uses “regular” operations.
Leaving device in PRE_SOLDERING_POST_WRITES (0x02) might not allow to host write content 
to the device.

More details about PSA feature can be found in eMMC 5.0 spec (Jedec:
 JESD84-B50.pdf)
http://www.jedec.org/standards-documents/technology-focus-areas/flash-memory-ssds-ufs-emmc/e-mmc

Please let us know if more details required.

> 
> Also, make sure to use proper prefix in the commit header.
Sure, we will submit the patch again with correct prefix...

Thanks,
Alex

> 
> >
> > Signed-off-by: Alex Lemberg <alex.lemberg@xxxxxxxxxxx>
> >
> > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index
> > 02ad792..2d59722 100644
> > --- a/drivers/mmc/core/mmc.c
> > +++ b/drivers/mmc/core/mmc.c
> > @@ -605,6 +605,20 @@ static int mmc_read_ext_csd(struct mmc_card
> *card)
> >                                 mmc_hostname(card->host));
> >                         err = 0;
> >                 }
> > +       /* eMMC v5.0 or later */
> > +       if (card->ext_csd.rev > 6) {
> > +               card->ext_csd.psa =
> > +                       ext_csd[EXT_CSD_PSA];
> > +               if (ext_csd[EXT_CSD_PSA_TIMEOUT] > 0) {
> > +                       card->ext_csd.psa_timeout =
> > +                               100 *
> > +                               (1 << ext_csd[EXT_CSD_PSA_TIMEOUT]);
> > +               } else {
> > +                       card->ext_csd.psa_timeout = 0;
> 
> This assignment isn't needed. It's 0 as default.
> 
> > +                       pr_warn("%s: EXT_CSD PSA Timeout is zero\n",
> > +                                       mmc_hostname(card->host));
> 
> Shouldn't we treat this as an error?
> 
> > +               }
> > +       }
> >
> >                 return err;
> >         }
> > @@ -1330,6 +1344,25 @@ static int mmc_init_card(struct mmc_host *host,
> u32 ocr,
> >         if (card->csd.dsr_imp && host->dsr_req)
> >                 mmc_set_dsr(host);
> >
> > +    /*
> > +     * eMMC v5.0 or later
> > +     * and Production State Awareness state is
> EXT_CSD_PSA_POST_SOLDERING_WRITES
> > +     * The host should set the device to NORMAL mode
> > +     */
> > +       if ((card->ext_csd.rev > 6)
> > +               && (card->ext_csd.psa ==
> EXT_CSD_PSA_POST_SOLDERING_WRITES)) {
> > +               unsigned int timeout;
> > +               /*Zero value in PSA Timeout – PSA is not defined*/
> > +               if (card->ext_csd.psa_timeout != 0) {
> > +                       timeout =
> > + DIV_ROUND_UP(card->ext_csd.psa_timeout, 1000);
> 
> Can you give an example of a typical value for the timeout?
> 
> > +                       card->ext_csd.psa = EXT_CSD_PSA_NORMAL;
> > +                       err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> > +                               EXT_CSD_PSA, card->ext_csd.psa, timeout);
> > +                       if (err && err != -EBADMSG)
> > +                               goto free_card;
> > +               }
> 
> So if there is no timeout specified what happens then?
> 
> > +       }
> > +
> >         /*
> >          * Select card, as all following commands rely on that.
> >          */
> > diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index
> > 4d69c00..09ac3b0 100644
> > --- a/include/linux/mmc/card.h
> > +++ b/include/linux/mmc/card.h
> > @@ -60,9 +60,11 @@ struct mmc_ext_csd {
> >         u8                      packed_event_en;
> >         unsigned int            part_time;              /* Units: ms */
> >         unsigned int            sa_timeout;             /* Units: 100ns */
> > +       unsigned int            psa_timeout;            /* Units: 100us */
> >         unsigned int            generic_cmd6_time;      /* Units: 10ms */
> >         unsigned int            power_off_longtime;     /* Units: ms */
> >         u8                      power_off_notification; /* state */
> > +       u8                      psa; /* production state awareness */
> >         unsigned int            hs_max_dtr;
> >         unsigned int            hs200_max_dtr;
> >  #define MMC_HIGH_26_MAX_DTR    26000000
> > diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index
> > 49ad7a9..eb170ff 100644
> > --- a/include/linux/mmc/mmc.h
> > +++ b/include/linux/mmc/mmc.h
> > @@ -285,6 +285,9 @@ struct _mmc_csd {
> >  #define EXT_CSD_EXP_EVENTS_STATUS      54      /* RO, 2 bytes */
> >  #define EXT_CSD_EXP_EVENTS_CTRL                56      /* R/W, 2 bytes */
> >  #define EXT_CSD_DATA_SECTOR_SIZE       61      /* R */
> > +#define EXT_CSD_QRDY_SUPPORT           96      /* RO */
> > +#define EXT_CSD_CMDQ_QRDY_FUNCTION     97      /* R/W */
> 
> What's these?
> 
> > +#define EXT_CSD_PSA                    133     /* R/W/E */
> >  #define EXT_CSD_GP_SIZE_MULT           143     /* R/W */
> >  #define EXT_CSD_PARTITION_SETTING_COMPLETED 155        /* R/W */
> >  #define EXT_CSD_PARTITION_ATTRIBUTE    156     /* R/W */
> > @@ -315,6 +318,7 @@ struct _mmc_csd {
> >  #define EXT_CSD_PWR_CL_26_360          203     /* RO */
> >  #define EXT_CSD_SEC_CNT                        212     /* RO, 4 bytes */
> >  #define EXT_CSD_S_A_TIMEOUT            217     /* RO */
> > +#define EXT_CSD_PSA_TIMEOUT            218     /* RO */
> >  #define EXT_CSD_REL_WR_SEC_C           222     /* RO */
> >  #define EXT_CSD_HC_WP_GRP_SIZE         221     /* RO */
> >  #define EXT_CSD_ERASE_TIMEOUT_MULT     223     /* RO */
> > @@ -433,6 +437,13 @@ struct _mmc_csd {
> >  #define EXT_CSD_BKOPS_LEVEL_2          0x2
> >
> >  /*
> > + * PRODUCTION STATE AWARENESS fields
> > + */
> > +
> > +#define EXT_CSD_PSA_NORMAL                             0x00
> > +#define EXT_CSD_PSA_POST_SOLDERING_WRITES      0x02
> > +
> > +/*
> >   * MMC_SWITCH access modes
> >   */
> >
> > --
> > 1.7.9.5
> >
> 
> Kind regards
> Uffe
��.n��������+%������w��{.n�����{��i��)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux