From patchwork Wed Mar 9 16:51:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raffaele Recalcati X-Patchwork-Id: 86131 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3488EB6F78 for ; Thu, 10 Mar 2011 03:52:10 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 352AA280C8; Wed, 9 Mar 2011 17:51:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SLe7wsWncPjY; Wed, 9 Mar 2011 17:51:47 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 98D12280B6; Wed, 9 Mar 2011 17:51:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C724D28093 for ; Wed, 9 Mar 2011 17:51:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lusMHpIICRR9 for ; Wed, 9 Mar 2011 17:51:35 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ey0-f172.google.com (mail-ey0-f172.google.com [209.85.215.172]) by theia.denx.de (Postfix) with ESMTPS id C08082808B for ; Wed, 9 Mar 2011 17:51:29 +0100 (CET) Received: by mail-ey0-f172.google.com with SMTP id 13so210403eye.3 for ; Wed, 09 Mar 2011 08:51:29 -0800 (PST) Received: by 10.213.103.7 with SMTP id i7mr3944265ebo.88.1299689489421; Wed, 09 Mar 2011 08:51:29 -0800 (PST) Received: from localhost.localdomain (host41-16-static.112-2-b.business.telecomitalia.it [2.112.16.41]) by mx.google.com with ESMTPS id b52sm1702392eei.7.2011.03.09.08.51.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Mar 2011 08:51:28 -0800 (PST) From: Raffaele Recalcati To: u-boot list Date: Wed, 9 Mar 2011 17:51:18 +0100 Message-Id: <1299689478-22747-4-git-send-email-lamiaposta71@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1299689478-22747-1-git-send-email-lamiaposta71@gmail.com> References: <1299689478-22747-1-git-send-email-lamiaposta71@gmail.com> Cc: Raffaele Recalcati Subject: [U-Boot] [RFC 3/3] mmc: trace added X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Raffaele Recalcati Defining CONFIG_MMC_TRACE in the include board file it is possible to activate a tracing support. This code helps in case of eMMC hw failure or to investigate possible eMMC initialization issues. Signed-off-by: Raffaele Recalcati --- drivers/mmc/mmc.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index acd7479..0dfc83a 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -45,7 +45,60 @@ int board_mmc_getcd(u8 *cd, struct mmc *mmc)__attribute__((weak, int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) { +#ifdef CONFIG_MMC_TRACE + int ret; + int i; + u8 *ptr; + + printf("CMD_SEND:%d\n", cmd->cmdidx); + printf("\t\tARG\t\t\t 0x%08X\n", cmd->cmdarg); + printf("\t\tFLAG\t\t\t %d\n", cmd->flags); + ret = mmc->send_cmd(mmc, cmd, data); + switch (cmd->resp_type) { + case MMC_RSP_NONE: + printf("\t\tMMC_RSP_NONE\n"); + break; + case MMC_RSP_R1: + printf("\t\tMMC_RSP_R1,5,6,7 \t 0x%08X \n", + cmd->response[0]); + break; + case MMC_RSP_R1b: + printf("\t\tMMC_RSP_R1b\t\t 0x%08X \n", + cmd->response[0]); + break; + case MMC_RSP_R2: + printf("\t\tMMC_RSP_R2\t\t 0x%08X \n", + cmd->response[0]); + printf("\t\t \t\t 0x%08X \n", + cmd->response[1]); + printf("\t\t \t\t 0x%08X \n", + cmd->response[2]); + printf("\t\t \t\t 0x%08X \n", + cmd->response[3]); + printf("\n"); + printf("\t\t\t\t\tDUMPING DATA\n"); + for (i = 0; i < 4; i++) { + int j; + printf("\t\t\t\t\t%03d - ", i*4); + ptr = &cmd->response[i]; + ptr += 3; + for (j = 0; j < 4; j++) + printf("%02X ", *ptr--); + printf("\n"); + } + break; + case MMC_RSP_R3: + printf("\t\tMMC_RSP_R3,4\t\t 0x%08X \n", + cmd->response[0]); + break; + default: + printf("\t\tERROR MMC rsp not supported\n"); + break; + } + return ret; +#else return mmc->send_cmd(mmc, cmd, data); +#endif } int mmc_send_status(struct mmc *mmc) @@ -71,6 +124,10 @@ int mmc_send_status(struct mmc *mmc) } } while (!(cmd.response[0] & MMC_STATUS_RDY_FOR_DATA) && timeout--); +#ifdef CONFIG_MMC_TRACE + status = (cmd.response[0] & MMC_STATUS_CURR_STATE) >> 9; + printf("CURR STATE:%d\n", status); +#endif return 0; } @@ -418,6 +475,20 @@ int mmc_send_ext_csd(struct mmc *mmc, char *ext_csd) err = mmc_send_cmd(mmc, &cmd, &data); +#ifdef CONFIG_MMC_TRACE + { + int i; + printf("\n"); + printf("MMC_SEND_EXT_CSD: DUMPING DATA\n"); + for (i = 0; i < 32; i++) { + int j; + printf("%03d - ", i*16); + for (j = 0; j < 16; j++) + printf("%02X ", data.dest[j+i*16]); + printf("\n"); + } + } +#endif return err; }