Hi Masahiro,

Can you please try with this below change and let me know if it works. 
In our case, we don’t want to read tuning pattern, instead it waits for 
TUNED_CLK bit to be set in host ctrl2 register. But, in your case, you want to 
read back the pattern data and compare it.


--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -161,8 +161,8 @@ static int sdhci_send_command(struct mmc *mmc, struct 
mmc_cmd *cmd,
        /* We shouldn't wait for data inihibit for stop commands, even
           though they might use busy signaling */
        if (cmd->cmdidx == MMC_CMD_STOP_TRANSMISSION ||
-           cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
-           cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200)
+           ((cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
+             cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200) && !data))
                mask &= ~SDHCI_DATA_INHIBIT;
 
        while (sdhci_readl(host, SDHCI_PRESENT_STATE) & mask) {
@@ -184,8 +184,8 @@ static int sdhci_send_command(struct mmc *mmc, struct 
mmc_cmd *cmd,
        sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_STATUS);
 
        mask = SDHCI_INT_RESPONSE;
-       if (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
-           cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200)
+       if ((cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
+            cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200) && !data)
                mask = SDHCI_INT_DATA_AVAIL;
 
        if (!(cmd->resp_type & MMC_RSP_PRESENT))



Thanks,
Siva

> -----Original Message-----
> From: Michal Simek [mailto:michal.si...@xilinx.com]
> Sent: Tuesday, June 12, 2018 2:34 PM
> To: Masahiro Yamada <yamada.masah...@socionext.com>; Siva Durga
> Prasad Paladugu <siva...@xilinx.com>; Michal Simek
> <michal.si...@xilinx.com>; U-Boot Mailing List <u-boot@lists.denx.de>
> Cc: Jaehoon Chung <jh80.ch...@samsung.com>; Tom Rini
> <tr...@konsulko.com>
> Subject: Re: HS200 for SDHCI is broken
> 
> On 12.6.2018 07:31, Masahiro Yamada wrote:
> > 2018-06-12 14:26 GMT+09:00 Masahiro Yamada
> <yamada.masah...@socionext.com>:
> >> Hi Siva, Michal.
> >>
> >>
> >> I noticed drivers/mmc/sdhci-cadence.c not working for my boards.
> >>
> >>
> >> git-bisect points the following commit:
> >>
> >>
> >>
> >> commit 434f9d454eb1a17bb7f5cdb21167ccbe7e41da39
> >> Author: Siva Durga Prasad Paladugu <siva.durga.palad...@xilinx.com>
> >> Date:   Tue May 29 20:03:10 2018 +0530
> >>
> >>     mmc: sdhci: Update sdhci_send_command() to handle HS200
> >>
> >>     This patch updates sdhci_send_command() to handle MMC
> >>     HS200 tuning command.
> >>
> >>     Signed-off-by: Siva Durga Prasad Paladugu
> <siva.durga.palad...@xilinx.com>
> >>     Signed-off-by: Michal Simek <michal.si...@xilinx.com>
> >>
> >>
> >>
> >>
> >>
> >> By reverting it, I can get the MMC on my boards working again.
> >>
> >> Any idea to fix it?
> >
> >
> >
> > BTW, 'mmc info' looks like follows on the bad commit:
> >
> >
> >
> >
> > U-Boot 2018.05-00471-g434f9d4 (Jun 12 2018 - 14:08:39 +0900)
> >
> > SoC:   LD20 (model 1, revision 1)
> > Model: UniPhier LD20 Reference Board
> > DRAM:  3 GiB
> > SC:    Micro Support Card (CPLD version 3.6)
> > NAND:  0 MiB
> > MMC:   sdhc@5a000000: 0
> > In:    serial@54006800
> > Out:   serial@54006800
> > Err:   serial@54006800
> > MODE:  NOR Boot (STM: OFF)
> > Net:   smc911x-0
> > Warning: smc911x-0 (eth0) using random MAC address -
> fe:7e:f8:eb:45:1d
> >
> > Hit any key to stop autoboot:  0
> > => mmc info
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > no tuning point found
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > sdhci_send_command: Timeout for status update!
> > no tuning point found
> > Device: sdhc@5a000000
> > Manufacturer ID: 11
> > OEM: 100
> > Name: 004G6
> > Bus Speed: 52000000
> > Mode : MMC DDR52 (52MHz)
> > Rd Block Len: 512
> > MMC version 5.0
> > High Capacity: Yes
> > Capacity: 3.7 GiB
> > Bus Width: 8-bit DDR
> > Erase Group Size: 512 KiB
> > HC WP Group Size: 4 MiB
> > User Capacity: 3.7 GiB WRREL
> > Boot Capacity: 2 MiB ENH
> > RPMB Capacity: 512 KiB ENH
> >
> 
> DP: Please look at it ASAP.
> 
> Thanks,
> Michal
> 

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to