Patchwork [U-Boot,12/12,V3] DWMMC: SMDK5420: Disable SMU for eMMC

login
register
mail settings
Submitter Rajeshwari Birje
Date Sept. 11, 2013, 10:01 a.m.
Message ID <1378893684-27733-13-git-send-email-rajeshwari.s@samsung.com>
Download mbox | patch
Permalink /patch/274227/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Rajeshwari Birje - Sept. 11, 2013, 10:01 a.m.
SMDK5420 has a new Security Management Unit added
for dwmmc driver, hence, configuring the control
registers to support booting via eMMC.

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
Changes in V3:
	- New patch.
 drivers/mmc/dw_mmc.c |  7 +++++++
 include/dwmmc.h      | 12 ++++++++++++
 2 files changed, 19 insertions(+)
Simon Glass - Sept. 19, 2013, 6:12 a.m.
Hi Rajeshwari,

On Wed, Sep 11, 2013 at 4:01 AM, Rajeshwari S Shinde <
rajeshwari.s@samsung.com> wrote:

> SMDK5420 has a new Security Management Unit added
> for dwmmc driver, hence, configuring the control
> registers to support booting via eMMC.
>
> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> ---
> Changes in V3:
>         - New patch.
>  drivers/mmc/dw_mmc.c |  7 +++++++
>  include/dwmmc.h      | 12 ++++++++++++
>  2 files changed, 19 insertions(+)
>
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> index a82ee17..d763949 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -300,6 +300,13 @@ static int dwmci_init(struct mmc *mmc)
>         struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
>         u32 fifo_size;
>
> +       dwmci_writel(host, EMMCP_MPSBEGIN0, 0);
> +       dwmci_writel(host, EMMCP_SEND0, 0);
> +       dwmci_writel(host, EMMCP_CTRL0,
> +               MPSCTRL_SECURE_READ_BIT | MPSCTRL_SECURE_WRITE_BIT |
> +               MPSCTRL_NON_SECURE_READ_BIT | MPSCTRL_NON_SECURE_WRITE_BIT
> |
> +               MPSCTRL_VALID);
> +
>

Is this safe for all users of this file (Exynos5250, etc. ?

Regards,
Simon
Pantelis Antoniou - Sept. 19, 2013, 8:38 a.m.
Hi Rajesh, Simon,

On Sep 19, 2013, at 9:12 AM, Simon Glass wrote:

> Hi Rajeshwari,
> 
> On Wed, Sep 11, 2013 at 4:01 AM, Rajeshwari S Shinde <rajeshwari.s@samsung.com> wrote:
> SMDK5420 has a new Security Management Unit added
> for dwmmc driver, hence, configuring the control
> registers to support booting via eMMC.
> 
> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> ---
> Changes in V3:
>         - New patch.
>  drivers/mmc/dw_mmc.c |  7 +++++++
>  include/dwmmc.h      | 12 ++++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> index a82ee17..d763949 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -300,6 +300,13 @@ static int dwmci_init(struct mmc *mmc)
>         struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
>         u32 fifo_size;
> 
> +       dwmci_writel(host, EMMCP_MPSBEGIN0, 0);
> +       dwmci_writel(host, EMMCP_SEND0, 0);
> +       dwmci_writel(host, EMMCP_CTRL0,
> +               MPSCTRL_SECURE_READ_BIT | MPSCTRL_SECURE_WRITE_BIT |
> +               MPSCTRL_NON_SECURE_READ_BIT | MPSCTRL_NON_SECURE_WRITE_BIT |
> +               MPSCTRL_VALID);
> +
> 
> Is this safe for all users of this file (Exynos5250, etc. ?
> 

Same objection here. If it's not safe ifdef CONFIG it.

> Regards,
> Simon
> 

Regards

-- Pantelis
Rajeshwari Birje - Sept. 19, 2013, 3:42 p.m.
Hi Simon,

Thank you for comments.
Will add a check so that it will be executed only for Exynos5420 boards.

Thanks and Regards,
Rajeshwari.


On Thu, Sep 19, 2013 at 11:42 AM, Simon Glass <sjg@chromium.org> wrote:
> Hi Rajeshwari,
>
> On Wed, Sep 11, 2013 at 4:01 AM, Rajeshwari S Shinde <
> rajeshwari.s@samsung.com> wrote:
>
>> SMDK5420 has a new Security Management Unit added
>> for dwmmc driver, hence, configuring the control
>> registers to support booting via eMMC.
>>
>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
>> ---
>> Changes in V3:
>>         - New patch.
>>  drivers/mmc/dw_mmc.c |  7 +++++++
>>  include/dwmmc.h      | 12 ++++++++++++
>>  2 files changed, 19 insertions(+)
>>
>> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
>> index a82ee17..d763949 100644
>> --- a/drivers/mmc/dw_mmc.c
>> +++ b/drivers/mmc/dw_mmc.c
>> @@ -300,6 +300,13 @@ static int dwmci_init(struct mmc *mmc)
>>         struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
>>         u32 fifo_size;
>>
>> +       dwmci_writel(host, EMMCP_MPSBEGIN0, 0);
>> +       dwmci_writel(host, EMMCP_SEND0, 0);
>> +       dwmci_writel(host, EMMCP_CTRL0,
>> +               MPSCTRL_SECURE_READ_BIT | MPSCTRL_SECURE_WRITE_BIT |
>> +               MPSCTRL_NON_SECURE_READ_BIT | MPSCTRL_NON_SECURE_WRITE_BIT
>> |
>> +               MPSCTRL_VALID);
>> +
>>
>
> Is this safe for all users of this file (Exynos5250, etc. ?
>
> Regards,
> Simon
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
Simon Glass - Sept. 19, 2013, 3:53 p.m.
Hi Rajeshwari,

On Thu, Sep 19, 2013 at 9:42 AM, Rajeshwari Birje <
rajeshwari.birje@gmail.com> wrote:

> Hi Simon,
>
> Thank you for comments.
> Will add a check so that it will be executed only for Exynos5420 boards.
>

Also, I don't think an #ifdef for an SOC is permitted in driver code. Are
these registers present in any DWMMC peripheral? I assume that they are a
feature of the peripheral and that Samsung has not hacked the peripheral
for 5420. If so, then I think it should be a flag passed to add_dwmci() to
tell it whether to do this or not.

Regards,
Simon


>
> Thanks and Regards,
> Rajeshwari.
>
>
> On Thu, Sep 19, 2013 at 11:42 AM, Simon Glass <sjg@chromium.org> wrote:
> > Hi Rajeshwari,
> >
> > On Wed, Sep 11, 2013 at 4:01 AM, Rajeshwari S Shinde <
> > rajeshwari.s@samsung.com> wrote:
> >
> >> SMDK5420 has a new Security Management Unit added
> >> for dwmmc driver, hence, configuring the control
> >> registers to support booting via eMMC.
> >>
> >> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
> >> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> >> ---
> >> Changes in V3:
> >>         - New patch.
> >>  drivers/mmc/dw_mmc.c |  7 +++++++
> >>  include/dwmmc.h      | 12 ++++++++++++
> >>  2 files changed, 19 insertions(+)
> >>
> >> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> >> index a82ee17..d763949 100644
> >> --- a/drivers/mmc/dw_mmc.c
> >> +++ b/drivers/mmc/dw_mmc.c
> >> @@ -300,6 +300,13 @@ static int dwmci_init(struct mmc *mmc)
> >>         struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
> >>         u32 fifo_size;
> >>
> >> +       dwmci_writel(host, EMMCP_MPSBEGIN0, 0);
> >> +       dwmci_writel(host, EMMCP_SEND0, 0);
> >> +       dwmci_writel(host, EMMCP_CTRL0,
> >> +               MPSCTRL_SECURE_READ_BIT | MPSCTRL_SECURE_WRITE_BIT |
> >> +               MPSCTRL_NON_SECURE_READ_BIT |
> MPSCTRL_NON_SECURE_WRITE_BIT
> >> |
> >> +               MPSCTRL_VALID);
> >> +
> >>
> >
> > Is this safe for all users of this file (Exynos5250, etc. ?
> >
> > Regards,
> > Simon
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
> >
>
>
>
> --
> Regards,
> Rajeshwari Shinde
>

Patch

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index a82ee17..d763949 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -300,6 +300,13 @@  static int dwmci_init(struct mmc *mmc)
 	struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
 	u32 fifo_size;
 
+	dwmci_writel(host, EMMCP_MPSBEGIN0, 0);
+	dwmci_writel(host, EMMCP_SEND0, 0);
+	dwmci_writel(host, EMMCP_CTRL0,
+		MPSCTRL_SECURE_READ_BIT | MPSCTRL_SECURE_WRITE_BIT |
+		MPSCTRL_NON_SECURE_READ_BIT | MPSCTRL_NON_SECURE_WRITE_BIT |
+		MPSCTRL_VALID);
+
 	dwmci_writel(host, DWMCI_PWREN, 1);
 
 	if (!dwmci_wait_reset(host, DWMCI_RESET_ALL)) {
diff --git a/include/dwmmc.h b/include/dwmmc.h
index 08ced0b..1a67cbf 100644
--- a/include/dwmmc.h
+++ b/include/dwmmc.h
@@ -49,6 +49,9 @@ 
 #define DWMCI_DSCADDR		0x094
 #define DWMCI_BUFADDR		0x098
 #define DWMCI_DATA		0x200
+#define EMMCP_MPSBEGIN0		0x1200
+#define EMMCP_SEND0		0x1204
+#define EMMCP_CTRL0		0x120C
 
 /* Interrupt Mask register */
 #define DWMCI_INTMSK_ALL	0xffffffff
@@ -123,6 +126,15 @@ 
 #define DWMCI_BMOD_IDMAC_FB	(1 << 1)
 #define DWMCI_BMOD_IDMAC_EN	(1 << 7)
 
+#define MPSCTRL_SECURE_READ_BIT		(0x1<<7)
+#define MPSCTRL_SECURE_WRITE_BIT	(0x1<<6)
+#define MPSCTRL_NON_SECURE_READ_BIT	(0x1<<5)
+#define MPSCTRL_NON_SECURE_WRITE_BIT	(0x1<<4)
+#define MPSCTRL_USE_FUSE_KEY		(0x1<<3)
+#define MPSCTRL_ECB_MODE		(0x1<<2)
+#define MPSCTRL_ENCRYPTION		(0x1<<1)
+#define MPSCTRL_VALID			(0x1<<0)
+
 struct dwmci_host {
 	char *name;
 	void *ioaddr;