diff mbox

[1/1] Production State Awareness support in host side

Message ID 1416228726-8514-1-git-send-email-avi.shchislowski@sandisk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Avi Shchislowski Nov. 17, 2014, 12:52 p.m. UTC
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.

Signed-off-by: Alex Lemberg <alex.lemberg@sandisk.com>

Comments

Ulf Hansson Nov. 17, 2014, 1:33 p.m. UTC | #1
On 17 November 2014 13:52, Avi Shchislowski
<avi.shchislowski@sandisk.com> 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.

Also, make sure to use proper prefix in the commit header.

>
> Signed-off-by: Alex Lemberg <alex.lemberg@sandisk.com>
>
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex Lemberg Nov. 18, 2014, 6:41 p.m. UTC | #2
SGkgVWxmLA0KDQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206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gbW1jX2NhcmQNCj4gKmNhcmQpDQo+ID4gICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICBtbWNfaG9zdG5hbWUoY2FyZC0+aG9zdCkpOw0KPiA+ICAgICAgICAgICAgICAgICAgICAg
ICAgIGVyciA9IDA7DQo+ID4gICAgICAgICAgICAgICAgIH0NCj4gPiArICAgICAgIC8qIGVNTUMg
djUuMCBvciBsYXRlciAqLw0KPiA+ICsgICAgICAgaWYgKGNhcmQtPmV4dF9jc2QucmV2ID4gNikg
ew0KPiA+ICsgICAgICAgICAgICAgICBjYXJkLT5leHRfY3NkLnBzYSA9DQo+ID4gKyAgICAgICAg
ICAgICAgICAgICAgICAgZXh0X2NzZFtFWFRfQ1NEX1BTQV07DQo+ID4gKyAgICAgICAgICAgICAg
IGlmIChleHRfY3NkW0VYVF9DU0RfUFNBX1RJTUVPVVRdID4gMCkgew0KPiA+ICsgICAgICAgICAg
ICAgICAgICAgICAgIGNhcmQtPmV4dF9jc2QucHNhX3RpbWVvdXQgPQ0KPiA+ICsgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgMTAwICoNCj4gPiArICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICgxIDw8IGV4dF9jc2RbRVhUX0NTRF9QU0FfVElNRU9VVF0pOw0KPiA+ICsgICAgICAg
ICAgICAgICB9IGVsc2Ugew0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIGNhcmQtPmV4dF9j
c2QucHNhX3RpbWVvdXQgPSAwOw0KPiANCj4gVGhpcyBhc3NpZ25tZW50IGlzbid0IG5lZWRlZC4g
SXQncyAwIGFzIGRlZmF1bHQuDQo+IA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHByX3dh
cm4oIiVzOiBFWFRfQ1NEIFBTQSBUaW1lb3V0IGlzIHplcm9cbiIsDQo+ID4gKyAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1tY19ob3N0bmFtZShjYXJkLT5ob3N0KS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pbmRleA0KPiA+IDRkNjljMDAuLjA5YWMzYjAgMTAwNjQ0DQo+
ID4gLS0tIGEvaW5jbHVkZS9saW51eC9tbWMvY2FyZC5oDQo+ID4gKysrIGIvaW5jbHVkZS9saW51
eC9tbWMvY2FyZC5oDQo+ID4gQEAgLTYwLDkgKzYwLDExIEBAIHN0cnVjdCBtbWNfZXh0X2NzZCB7
DQo+ID4gICAgICAgICB1OCAgICAgICAgICAgICAgICAgICAgICBwYWNrZWRfZXZlbnRfZW47DQo+
ID4gICAgICAgICB1bnNpZ25lZCBpbnQgICAgICAgICAgICBwYXJ0X3RpbWU7ICAgICAgICAgICAg
ICAvKiBVbml0czogbXMgKi8NCj4gPiAgICAgICAgIHVuc2lnbmVkIGludCAgICAgICAgICAgIHNh
X3RpbWVvdXQ7ICAgICAgICAgICAgIC8qIFVuaXRzOiAxMDBucyAqLw0KPiA+ICsgICAgICAgdW5z
aWduZWQgaW50ICAgICAgICAgICAgcHNhX3RpbWVvdXQ7ICAgICAgICAgICAgLyogVW5pdHM6IDEw
MHVzICovDQo+ID4gICAgICAgICB1bnNpZ25lZCBpbnQgICAgICAgICAgICBnZW5lcmljX2NtZDZf
dGltZTsgICAgICAvKiBVbml0czogMTBtcyAqLw0KPiA+ICAgICAgICAgdW5zaWduZWQgaW50ICAg
ICAgICAgICAgcG93ZXJfb2ZmX2xvbmd0aW1lOyAgICAgLyogVW5pdHM6IG1zICovDQo+ID4gICAg
ICAgICB1OCAgICAgICAgICAgICAgICAgICAgICBwb3dlcl9vZmZfbm90aWZpY2F0aW9uOyAvKiBz
dGF0ZSAqLw0KPiA+ICsgICAgICAgdTggICAgICAgICAgICAgICAgICAgICAgcHNhOyAvKiBwcm9k
dWN0aW9uIHN0YXRlIGF3YXJlbmVzcyAqLw0KPiA+ICAgICAgICAgdW5zaWduZWQgaW50ICAgICAg
ICAgICAgaHNfbWF4X2R0cjsNCj4gPiAgICAgICAgIHVuc2lnbmVkIGludCAgICAgICAgICAgIGhz
MjA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gICAgICAgICAgICAgICAgIDB4MDANCj4gPiArI2RlZmluZSBFWFRfQ1NEX1BTQV9Q
T1NUX1NPTERFUklOR19XUklURVMgICAgICAweDAyDQo+ID4gKw0KPiA+ICsvKg0KPiA+ICAgKiBN
TUNfU1dJVENIIGFjY2VzcyBtb2Rlcw0KPiA+ICAgKi8NCj4gPg0KPiA+IC0tDQo+ID4gMS43Ljku
NQ0KPiA+DQo+IA0KPiBLaW5kIHJlZ2FyZHMNCj4gVWZmZQ0K
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Nov. 19, 2014, 9:58 a.m. UTC | #3
On 18 November 2014 19:41, Alex Lemberg <Alex.Lemberg@sandisk.com> wrote:
> Hi Ulf,
>
>> -----Original Message-----
>> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> 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@sandisk.com>
>> 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.

Okay, that was far better.

I am not so sure we should finalize the production phase while
initializing the eMMC card like this.

Certainly we should check the PSA state, but I think we should return
an error if we think the device hasn’t completed production. It should
be the responsibility for the "programming tools" to finalize the
production, right!?

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex Lemberg Nov. 19, 2014, 10:58 a.m. UTC | #4
> -----Original Message-----

> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]

> Sent: Wednesday, November 19, 2014 11:59 AM

> To: Alex Lemberg

> Cc: linux-mmc; Chris Ball; Avi Shchislowski

> Subject: Re: [PATCH 1/1] Production State Awareness support in host side

> 

> On 18 November 2014 19:41, Alex Lemberg <Alex.Lemberg@sandisk.com>

> wrote:

> > Hi Ulf,

> >

> >> -----Original Message-----

> >> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]

> >> 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@sandisk.com>

> >> 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.

> 

> Okay, that was far better.

> 

> I am not so sure we should finalize the production phase while initializing the

> eMMC card like this.

> 

> Certainly we should check the PSA state, but I think we should return an error if

> we think the device hasn’t completed production. It should be the responsibility

> for the "programming tools" to finalize the production, right!?


According to eMMC spec, the switch to NORMAL should be done after device soldering to final host (not programmer).
Please refer to "Figure 32 — Recommended Soldering procedure" in eMMC5.0 specification document.
Also, since we are dealing with only "field" host here, we are not touching/switching any other modes of PSA, but only Normal (field).
This code should run only once - in the beginning of device life cycle.

Best regards,
Alex

> 

> Kind regards

> Uffe
Ulf Hansson Nov. 21, 2014, 1:16 p.m. UTC | #5
On 19 November 2014 11:58, Alex Lemberg <Alex.Lemberg@sandisk.com> wrote:
>
>
>> -----Original Message-----
>> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> Sent: Wednesday, November 19, 2014 11:59 AM
>> To: Alex Lemberg
>> Cc: linux-mmc; Chris Ball; Avi Shchislowski
>> Subject: Re: [PATCH 1/1] Production State Awareness support in host side
>>
>> On 18 November 2014 19:41, Alex Lemberg <Alex.Lemberg@sandisk.com>
>> wrote:
>> > Hi Ulf,
>> >
>> >> -----Original Message-----
>> >> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> >> 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@sandisk.com>
>> >> 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.
>>
>> Okay, that was far better.
>>
>> I am not so sure we should finalize the production phase while initializing the
>> eMMC card like this.
>>
>> Certainly we should check the PSA state, but I think we should return an error if
>> we think the device hasn’t completed production. It should be the responsibility
>> for the "programming tools" to finalize the production, right!?
>
> According to eMMC spec, the switch to NORMAL should be done after device soldering to final host (not programmer).
> Please refer to "Figure 32 — Recommended Soldering procedure" in eMMC5.0 specification document.
> Also, since we are dealing with only "field" host here, we are not touching/switching any other modes of PSA, but only Normal (field).
> This code should run only once - in the beginning of device life cycle.

I get your point, but I am not so sure.

To me, I wouldn't trust that the platform binaries has been
successfully programmed to the device, unless the programmer tool
takes care of switching the device to "normal".

What does other people think?

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex Lemberg Nov. 23, 2014, 9:01 a.m. UTC | #6
> -----Original Message-----

> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]

> Sent: Friday, November 21, 2014 3:16 PM

> To: Alex Lemberg

> Cc: linux-mmc; Chris Ball; Avi Shchislowski

> Subject: Re: [PATCH 1/1] Production State Awareness support in host side

> 

> On 19 November 2014 11:58, Alex Lemberg <Alex.Lemberg@sandisk.com>

> wrote:

> >

> >

> >> -----Original Message-----

> >> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]

> >> Sent: Wednesday, November 19, 2014 11:59 AM

> >> To: Alex Lemberg

> >> Cc: linux-mmc; Chris Ball; Avi Shchislowski

> >> Subject: Re: [PATCH 1/1] Production State Awareness support in host

> >> side

> >>

> >> On 18 November 2014 19:41, Alex Lemberg <Alex.Lemberg@sandisk.com>

> >> wrote:

> >> > Hi Ulf,

> >> >

> >> >> -----Original Message-----

> >> >> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]

> >> >> 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@sandisk.com>

> >> >> 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/fla

> >> > sh-

> >> > memory-ssds-ufs-emmc/e-mmc

> >> >

> >> > Please let us know if more details required.

> >>

> >> Okay, that was far better.

> >>

> >> I am not so sure we should finalize the production phase while

> >> initializing the eMMC card like this.

> >>

> >> Certainly we should check the PSA state, but I think we should return

> >> an error if we think the device hasn’t completed production. It

> >> should be the responsibility for the "programming tools" to finalize the

> production, right!?

> >

> > According to eMMC spec, the switch to NORMAL should be done after device

> soldering to final host (not programmer).

> > Please refer to "Figure 32 — Recommended Soldering procedure" in

> eMMC5.0 specification document.

> > Also, since we are dealing with only "field" host here, we are not

> touching/switching any other modes of PSA, but only Normal (field).

> > This code should run only once - in the beginning of device life cycle.

> 

> I get your point, but I am not so sure.

> 

> To me, I wouldn't trust that the platform binaries has been successfully

> programmed to the device, unless the programmer tool takes care of switching

> the device to "normal".

> 


Thanks Ulf!
Also, please note - PSA PRE_SOLDERING_POST_WRITES mode intent to save device
pre-loaded content during the soldering process.
Flash data can be corrupted due to soldering procedure high temperature. So switching
to Normal cannot be done by external programmer.
BTW, I have resubmitted the patch again, now with correct subject prefix, and some
additional fixes.

> What does other people think?

> 

> Kind regards

> Uffe
Ulf Hansson Nov. 24, 2014, 12:23 p.m. UTC | #7
[...]

>> >>
>> >> I am not so sure we should finalize the production phase while
>> >> initializing the eMMC card like this.
>> >>
>> >> Certainly we should check the PSA state, but I think we should return
>> >> an error if we think the device hasn’t completed production. It
>> >> should be the responsibility for the "programming tools" to finalize the
>> production, right!?
>> >
>> > According to eMMC spec, the switch to NORMAL should be done after device
>> soldering to final host (not programmer).
>> > Please refer to "Figure 32 — Recommended Soldering procedure" in
>> eMMC5.0 specification document.
>> > Also, since we are dealing with only "field" host here, we are not
>> touching/switching any other modes of PSA, but only Normal (field).
>> > This code should run only once - in the beginning of device life cycle.
>>
>> I get your point, but I am not so sure.
>>
>> To me, I wouldn't trust that the platform binaries has been successfully
>> programmed to the device, unless the programmer tool takes care of switching
>> the device to "normal".
>>
>
> Thanks Ulf!
> Also, please note - PSA PRE_SOLDERING_POST_WRITES mode intent to save device
> pre-loaded content during the soldering process.
> Flash data can be corrupted due to soldering procedure high temperature. So switching
> to Normal cannot be done by external programmer.

So, if flash data will be corrupted due to for example high
temperatures during soldering, how will that be detected when using
the "manual mode"?

If that's the job for the platform software I fail to understand why
the PRE_SOLDERING_POST_WRITES state needs to exists at all!?

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex Lemberg Nov. 25, 2014, 9:17 a.m. UTC | #8
> -----Original Message-----

> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]

> Sent: Monday, November 24, 2014 2:24 PM

> To: Alex Lemberg

> Cc: linux-mmc; Chris Ball; Avi Shchislowski

> Subject: Re: [PATCH 1/1] Production State Awareness support in host side

> 

> [...]

> 

> >> >>

> >> >> I am not so sure we should finalize the production phase while

> >> >> initializing the eMMC card like this.

> >> >>

> >> >> Certainly we should check the PSA state, but I think we should

> >> >> return an error if we think the device hasn’t completed

> >> >> production. It should be the responsibility for the "programming

> >> >> tools" to finalize the

> >> production, right!?

> >> >

> >> > According to eMMC spec, the switch to NORMAL should be done after

> >> > device

> >> soldering to final host (not programmer).

> >> > Please refer to "Figure 32 — Recommended Soldering procedure" in

> >> eMMC5.0 specification document.

> >> > Also, since we are dealing with only "field" host here, we are not

> >> touching/switching any other modes of PSA, but only Normal (field).

> >> > This code should run only once - in the beginning of device life cycle.

> >>

> >> I get your point, but I am not so sure.

> >>

> >> To me, I wouldn't trust that the platform binaries has been

> >> successfully programmed to the device, unless the programmer tool

> >> takes care of switching the device to "normal".

> >>

> >

> > Thanks Ulf!

> > Also, please note - PSA PRE_SOLDERING_POST_WRITES mode intent to save

> > device pre-loaded content during the soldering process.

> > Flash data can be corrupted due to soldering procedure high

> > temperature. So switching to Normal cannot be done by external

> programmer.

> 

> So, if flash data will be corrupted due to for example high temperatures during

> soldering, how will that be detected when using the "manual mode"?

> 

> If that's the job for the platform software I fail to understand why the

> PRE_SOLDERING_POST_WRITES state needs to exists at all!?


The flow of "Manual Mode" is:

[skipping few common steps]
...
Host (Programmer) sets PRODUCTION_STATE_AWARENESS
to 0x1 (PRE_SOLDERING_WRITES)

Host (Programmer) perform pre-soldering data loading
and/or device configuration

Host (Programmer) sets PRODUCTION_STATE_AWARENESS
To 0x2 (PRE_SOLDERING_POST_WRITES).
No writes past this point

Device Soldering

Host (field) sets PRODUCTION_STATE_AWARENESS
to 0x0 (NORMAL)
...

Hope this will answer...

> 

> Kind regards

> Uffe
Ulf Hansson Nov. 25, 2014, 10:57 a.m. UTC | #9
On 25 November 2014 at 10:17, Alex Lemberg <Alex.Lemberg@sandisk.com> wrote:
>
>
>> -----Original Message-----
>> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> Sent: Monday, November 24, 2014 2:24 PM
>> To: Alex Lemberg
>> Cc: linux-mmc; Chris Ball; Avi Shchislowski
>> Subject: Re: [PATCH 1/1] Production State Awareness support in host side
>>
>> [...]
>>
>> >> >>
>> >> >> I am not so sure we should finalize the production phase while
>> >> >> initializing the eMMC card like this.
>> >> >>
>> >> >> Certainly we should check the PSA state, but I think we should
>> >> >> return an error if we think the device hasn’t completed
>> >> >> production. It should be the responsibility for the "programming
>> >> >> tools" to finalize the
>> >> production, right!?
>> >> >
>> >> > According to eMMC spec, the switch to NORMAL should be done after
>> >> > device
>> >> soldering to final host (not programmer).
>> >> > Please refer to "Figure 32 — Recommended Soldering procedure" in
>> >> eMMC5.0 specification document.
>> >> > Also, since we are dealing with only "field" host here, we are not
>> >> touching/switching any other modes of PSA, but only Normal (field).
>> >> > This code should run only once - in the beginning of device life cycle.
>> >>
>> >> I get your point, but I am not so sure.
>> >>
>> >> To me, I wouldn't trust that the platform binaries has been
>> >> successfully programmed to the device, unless the programmer tool
>> >> takes care of switching the device to "normal".
>> >>
>> >
>> > Thanks Ulf!
>> > Also, please note - PSA PRE_SOLDERING_POST_WRITES mode intent to save
>> > device pre-loaded content during the soldering process.
>> > Flash data can be corrupted due to soldering procedure high
>> > temperature. So switching to Normal cannot be done by external
>> programmer.
>>
>> So, if flash data will be corrupted due to for example high temperatures during
>> soldering, how will that be detected when using the "manual mode"?
>>
>> If that's the job for the platform software I fail to understand why the
>> PRE_SOLDERING_POST_WRITES state needs to exists at all!?
>
> The flow of "Manual Mode" is:

Thanks for clarifying.

>
> [skipping few common steps]
> ...
> Host (Programmer) sets PRODUCTION_STATE_AWARENESS
> to 0x1 (PRE_SOLDERING_WRITES)
>
> Host (Programmer) perform pre-soldering data loading
> and/or device configuration
>
> Host (Programmer) sets PRODUCTION_STATE_AWARENESS
> To 0x2 (PRE_SOLDERING_POST_WRITES).
> No writes past this point

To repeat my question:

_Unless_ there are no validation of the device soldering performed by
the "programmer tool" past this point, why couldn't the host set
PRODUCTION_STATE_AWARENESS to 0x0 (NORMAL) at this point instead?

>
> Device Soldering
>
> Host (field) sets PRODUCTION_STATE_AWARENESS
> to 0x0 (NORMAL)
> ...
>
> Hope this will answer...
>

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex Lemberg Nov. 25, 2014, 2:55 p.m. UTC | #10
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogVWxmIEhhbnNzb24gW21h
aWx0bzp1bGYuaGFuc3NvbkBsaW5hcm8ub3JnXQ0KPiBTZW50OiBUdWVzZGF5LCBOb3ZlbWJlciAy
NSwgMjAxNCAxMjo1NyBQTQ0KPiBUbzogQWxleCBMZW1iZXJnDQo+IENjOiBsaW51eC1tbWM7IENo
cmlzIEJhbGw7IEF2aSBTaGNoaXNsb3dza2kNCj4gU3ViamVjdDogUmU6IFtQQVRDSCAxLzFdIFBy
b2R1Y3Rpb24gU3RhdGUgQXdhcmVuZXNzIHN1cHBvcnQgaW4gaG9zdCBzaWRlDQo+IA0KPiBPbiAy
NSBOb3ZlbWJlciAyMDE0IGF0IDEwOjE3LCBBbGV4IExlbWJlcmcgPEFsZXguTGVtYmVyZ0BzYW5k
aXNrLmNvbT4NCj4gd3JvdGU6DQo+ID4NCj4gPg0KPiA+PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2Ut
LS0tLQ0KPiA+PiBGcm9tOiBVbGYgSGFuc3NvbiBbbWFpbHRvOnVsZi5oYW5zc29uQGxpbmFyby5v
cmddDQo+ID4+IFNlbnQ6IE1vbmRheSwgTm92ZW1iZXIgMjQsIDIwMTQgMjoyNCBQTQ0KPiA+PiBU
bzogQWxleCBMZW1iZXJnDQo+ID4+IENjOiBsaW51eC1tbWM7IENocmlzIEJhbGw7IEF2aSBTaGNo
aXNsb3dza2kNCj4gPj4gU3ViamVjdDogUmU6IFtQQVRDSCAxLzFdIFByb2R1Y3Rpb24gU3RhdGUg
QXdhcmVuZXNzIHN1cHBvcnQgaW4gaG9zdA0K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subscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Dec. 2, 2014, 9:31 a.m. UTC | #11
On 25 November 2014 at 15:55, Alex Lemberg <Alex.Lemberg@sandisk.com> wrote:
>
>
>> -----Original Message-----
>> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> Sent: Tuesday, November 25, 2014 12:57 PM
>> To: Alex Lemberg
>> Cc: linux-mmc; Chris Ball; Avi Shchislowski
>> Subject: Re: [PATCH 1/1] Production State Awareness support in host side
>>
>> On 25 November 2014 at 10:17, Alex Lemberg <Alex.Lemberg@sandisk.com>
>> wrote:
>> >
>> >
>> >> -----Original Message-----
>> >> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> >> Sent: Monday, November 24, 2014 2:24 PM
>> >> To: Alex Lemberg
>> >> Cc: linux-mmc; Chris Ball; Avi Shchislowski
>> >> Subject: Re: [PATCH 1/1] Production State Awareness support in host
>> >> side
>> >>
>> >> [...]
>> >>
>> >> >> >>
>> >> >> >> I am not so sure we should finalize the production phase while
>> >> >> >> initializing the eMMC card like this.
>> >> >> >>
>> >> >> >> Certainly we should check the PSA state, but I think we should
>> >> >> >> return an error if we think the device hasn’t completed
>> >> >> >> production. It should be the responsibility for the
>> >> >> >> "programming tools" to finalize the
>> >> >> production, right!?
>> >> >> >
>> >> >> > According to eMMC spec, the switch to NORMAL should be done
>> >> >> > after device
>> >> >> soldering to final host (not programmer).
>> >> >> > Please refer to "Figure 32 — Recommended Soldering procedure" in
>> >> >> eMMC5.0 specification document.
>> >> >> > Also, since we are dealing with only "field" host here, we are
>> >> >> > not
>> >> >> touching/switching any other modes of PSA, but only Normal (field).
>> >> >> > This code should run only once - in the beginning of device life cycle.
>> >> >>
>> >> >> I get your point, but I am not so sure.
>> >> >>
>> >> >> To me, I wouldn't trust that the platform binaries has been
>> >> >> successfully programmed to the device, unless the programmer tool
>> >> >> takes care of switching the device to "normal".
>> >> >>
>> >> >
>> >> > Thanks Ulf!
>> >> > Also, please note - PSA PRE_SOLDERING_POST_WRITES mode intent to
>> >> > save device pre-loaded content during the soldering process.
>> >> > Flash data can be corrupted due to soldering procedure high
>> >> > temperature. So switching to Normal cannot be done by external
>> >> programmer.
>> >>
>> >> So, if flash data will be corrupted due to for example high
>> >> temperatures during soldering, how will that be detected when using the
>> "manual mode"?
>> >>
>> >> If that's the job for the platform software I fail to understand why
>> >> the PRE_SOLDERING_POST_WRITES state needs to exists at all!?
>> >
>> > The flow of "Manual Mode" is:
>>
>> Thanks for clarifying.
>>
>> >
>> > [skipping few common steps]
>> > ...
>> > Host (Programmer) sets PRODUCTION_STATE_AWARENESS to 0x1
>> > (PRE_SOLDERING_WRITES)
>> >
>> > Host (Programmer) perform pre-soldering data loading and/or device
>> > configuration
>> >
>> > Host (Programmer) sets PRODUCTION_STATE_AWARENESS To 0x2
>> > (PRE_SOLDERING_POST_WRITES).
>> > No writes past this point
>>
>> To repeat my question:
>>
>> _Unless_ there are no validation of the device soldering performed by the
>> "programmer tool" past this point, why couldn't the host set
>> PRODUCTION_STATE_AWARENESS to 0x0 (NORMAL) at this point instead?
>>
>
> If programmer set to NORMAL at this point, the programmed data can be
> corrupted during the soldering process.
> eMMC device will protect programmed data during the soldering process in
> PRE_SOLDERING_POST_WRITES (0x2)  mode.

Exactly how will that be done?

During the soldering process the eMMC card isn't powered. So how could
it protect itself better, just because the state is
PRE_SOLDERING_POST_WRITES?

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex Lemberg Dec. 3, 2014, 11:39 a.m. UTC | #12
SGkgVWxmLA0KDQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206IFVsZiBIYW5z
c29uIFttYWlsdG86dWxmLmhhbnNzb25AbGluYXJvLm9yZ10NCj4gU2VudDogVHV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HRoZSBwcm9ncmFtbWVkIGRhdGEgY2FuIGJl
DQo+ID4gY29ycnVwdGVkIGR1cmluZyB0aGUgc29sZGVyaW5nIHByb2Nlc3MuDQo+ID4gZU1NQyBk
ZXZpY2Ugd2lsbCBwcm90ZWN0IHByb2dyYW1tZWQgZGF0YSBkdXJpbmcgdGhlIHNvbGRlcmluZyBw
cm9jZXNzDQo+ID4gaW4gUFJFX1NPTERFUklOR19QT1NUX1dSSVRFUyAoMHgyKSAgbW9kZS4NCj4g
DQo+IEV4YWN0bHkgaG93IHdpbGwgdGhhdCBiZSBkb25lPw0KPiANCj4gRHVyaW5nIHRoZSBzb2xk
ZXJpbmcgcHJvY2VzcyB0aGUgZU1NQyBjYXJkIGlzbid0IHBvd2VyZWQuIFNvIGhvdyBjb3VsZCBp
dA0KPiBwcm90ZWN0IGl0c2VsZiBiZXR0ZXIsIGp1c3QgYmVjYXVzZSB0aGUgc3RhdGUgaXMgUFJF
X1NPTERFUklOR19QT1NUX1dSSVRFUz8NCg0KVGhlIGRldmljZSB3aWxsIHVzZSAic3BlY2lhbCIg
aW50ZXJuYWwgb3BlcmF0aW9ucyBmb3Igc2F2aW5nIGNvbnRlbnQgcHJpb3IgdG8NCmRldmljZSBz
b2xkZXJpbmcsIGFuZCB3aWxsIHN3aXRjaCB0byAicmVndWxhciIgYWZ0ZXIgdGhlIHNvbGRlcmlu
ZyBhbmQgZ2V0dGluZyAiTk9STUFMIiBtb2RlLg0KDQo+IA0KPiBLaW5kIHJlZ2FyZHMNCj4gVWZm
ZQ0K
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Dec. 3, 2014, 12:29 p.m. UTC | #13
On 3 December 2014 at 12:39, Alex Lemberg <Alex.Lemberg@sandisk.com> wrote:
> Hi Ulf,
>
>> -----Original Message-----
>> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> Sent: Tuesday, December 02, 2014 11:31 AM
>> To: Alex Lemberg
>> Cc: linux-mmc; Chris Ball; Avi Shchislowski
>> Subject: Re: [PATCH 1/1] Production State Awareness support in host side
>>
>> On 25 November 2014 at 15:55, Alex Lemberg <Alex.Lemberg@sandisk.com>
>> wrote:
>> >
>> >
>> >> -----Original Message-----
>> >> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> >> Sent: Tuesday, November 25, 2014 12:57 PM
>> >> To: Alex Lemberg
>> >> Cc: linux-mmc; Chris Ball; Avi Shchislowski
>> >> Subject: Re: [PATCH 1/1] Production State Awareness support in host
>> >> side
>> >>
>> >> On 25 November 2014 at 10:17, Alex Lemberg
>> <Alex.Lemberg@sandisk.com>
>> >> wrote:
>> >> >
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> >> >> Sent: Monday, November 24, 2014 2:24 PM
>> >> >> To: Alex Lemberg
>> >> >> Cc: linux-mmc; Chris Ball; Avi Shchislowski
>> >> >> Subject: Re: [PATCH 1/1] Production State Awareness support in
>> >> >> host side
>> >> >>
>> >> >> [...]
>> >> >>
>> >> >> >> >>
>> >> >> >> >> I am not so sure we should finalize the production phase
>> >> >> >> >> while initializing the eMMC card like this.
>> >> >> >> >>
>> >> >> >> >> Certainly we should check the PSA state, but I think we
>> >> >> >> >> should return an error if we think the device hasn’t
>> >> >> >> >> completed production. It should be the responsibility for
>> >> >> >> >> the "programming tools" to finalize the
>> >> >> >> production, right!?
>> >> >> >> >
>> >> >> >> > According to eMMC spec, the switch to NORMAL should be done
>> >> >> >> > after device
>> >> >> >> soldering to final host (not programmer).
>> >> >> >> > Please refer to "Figure 32 — Recommended Soldering procedure"
>> >> >> >> > in
>> >> >> >> eMMC5.0 specification document.
>> >> >> >> > Also, since we are dealing with only "field" host here, we
>> >> >> >> > are not
>> >> >> >> touching/switching any other modes of PSA, but only Normal (field).
>> >> >> >> > This code should run only once - in the beginning of device life cycle.
>> >> >> >>
>> >> >> >> I get your point, but I am not so sure.
>> >> >> >>
>> >> >> >> To me, I wouldn't trust that the platform binaries has been
>> >> >> >> successfully programmed to the device, unless the programmer
>> >> >> >> tool takes care of switching the device to "normal".
>> >> >> >>
>> >> >> >
>> >> >> > Thanks Ulf!
>> >> >> > Also, please note - PSA PRE_SOLDERING_POST_WRITES mode intent to
>> >> >> > save device pre-loaded content during the soldering process.
>> >> >> > Flash data can be corrupted due to soldering procedure high
>> >> >> > temperature. So switching to Normal cannot be done by external
>> >> >> programmer.
>> >> >>
>> >> >> So, if flash data will be corrupted due to for example high
>> >> >> temperatures during soldering, how will that be detected when
>> >> >> using the
>> >> "manual mode"?
>> >> >>
>> >> >> If that's the job for the platform software I fail to understand
>> >> >> why the PRE_SOLDERING_POST_WRITES state needs to exists at all!?
>> >> >
>> >> > The flow of "Manual Mode" is:
>> >>
>> >> Thanks for clarifying.
>> >>
>> >> >
>> >> > [skipping few common steps]
>> >> > ...
>> >> > Host (Programmer) sets PRODUCTION_STATE_AWARENESS to 0x1
>> >> > (PRE_SOLDERING_WRITES)
>> >> >
>> >> > Host (Programmer) perform pre-soldering data loading and/or device
>> >> > configuration
>> >> >
>> >> > Host (Programmer) sets PRODUCTION_STATE_AWARENESS To 0x2
>> >> > (PRE_SOLDERING_POST_WRITES).
>> >> > No writes past this point
>> >>
>> >> To repeat my question:
>> >>
>> >> _Unless_ there are no validation of the device soldering performed by
>> >> the "programmer tool" past this point, why couldn't the host set
>> >> PRODUCTION_STATE_AWARENESS to 0x0 (NORMAL) at this point instead?
>> >>
>> >
>> > If programmer set to NORMAL at this point, the programmed data can be
>> > corrupted during the soldering process.
>> > eMMC device will protect programmed data during the soldering process
>> > in PRE_SOLDERING_POST_WRITES (0x2)  mode.
>>
>> Exactly how will that be done?
>>
>> During the soldering process the eMMC card isn't powered. So how could it
>> protect itself better, just because the state is PRE_SOLDERING_POST_WRITES?
>
> The device will use "special" internal operations for saving content prior to
> device soldering, and will switch to "regular" after the soldering and getting "NORMAL" mode.

Huh, this is a seriously hard question to get some answer to. I still
don't get it.

Are you saying the card are able to protect itself during the
soldering phase? I assume soldiering is done without powering the
card, thus I find it hard to understand that your statement can be
true.

Anyway, to convenience me, you need to give at least one example of
what these protective operations could be during soldering.

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex Lemberg Dec. 3, 2014, 3:49 p.m. UTC | #14
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogbGludXgtbW1jLW93bmVy
QHZnZXIua2VybmVsLm9yZyBbbWFpbHRvOmxpbnV4LW1tYy0NCj4gb3duZXJAdmdlci5rZXJuZWwu
b3JnXSBPbiBCZWhhbGYgT2YgVWxmIEhhbnNzb24NCj4gU2VudDogV2VkbmVzZGF5LCBEZWNlbWJl
ciAwMywgMjAxNCAyOjI5IFBNDQo+IFRvOiBBbGV4IExlbWJlcmcNCj4gQ2M6IGxpbnV4LW1tYzsg
Q2hyaXMgQmFsbDsgQXZpIFNoY2hpc2xvd3NraQ0KPiBTdWJqZWN0OiBSZTogW1BBVENIIDEvMV0g
UHJvZHVjdGlvbiBTdGF0ZSBBd2FyZW5lc3Mgc3VwcG9ydCBpbiBob3N0IHNpZGUNCj4gDQo+IE9u
IDMgRGVjZW1iZXIgMjAxNCBhdCAxMjozOSwgQWxleCBMZW1iZXJnIDxBbGV4LkxlbWJlcmdAc2Fu
ZGlzay5jb20+DQo+IHdyb3RlOg0KPiA+IEhpIFVsZiwNCj4gPg0KPiA+PiAtLS0tLU9yaWdpbmFs
IE1lc3NhZ2UtLS0tLQ0KPiA+PiBGcm9tOiBVbGYgSGFuc3NvbiBbbWFpbHRvOnVsZi5oYW5zc29u
QGxpbmFyby5vcmddDQo+ID4+IFNlbnQ6IFR1ZXNkYXksIERlY2VtYmVyIDAyLCAyMDE0IDExOjMx
IEFNDQo+ID4+IFRv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MgbGlzdDogc2VuZCB0aGUgbGluZSAidW5zdWJzY3JpYmUgbGludXgtbW1jIiBpbiB0
aGUgYm9keQ0KPiBvZiBhIG1lc3NhZ2UgdG8gbWFqb3Jkb21vQHZnZXIua2VybmVsLm9yZyBNb3Jl
IG1ham9yZG9tbyBpbmZvIGF0DQo+IGh0dHA6Ly92Z2VyLmtlcm5lbC5vcmcvbWFqb3Jkb21vLWlu
Zm8uaHRtbA0K
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
+			pr_warn("%s: EXT_CSD PSA Timeout is zero\n",
+					mmc_hostname(card->host));
+		}
+	}
 
 		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);
+			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;
+		}
+	}
+
 	/*
 	 * 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 */
+#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
  */