From patchwork Fri Jun 14 12:25:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Izard X-Patchwork-Id: 2721461 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CA6C09F472 for ; Fri, 14 Jun 2013 12:26:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B21B0201FA for ; Fri, 14 Jun 2013 12:26:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB638201F1 for ; Fri, 14 Jun 2013 12:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752553Ab3FNM0G (ORCPT ); Fri, 14 Jun 2013 08:26:06 -0400 Received: from mail-wg0-f41.google.com ([74.125.82.41]:59902 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752569Ab3FNM0F (ORCPT ); Fri, 14 Jun 2013 08:26:05 -0400 Received: by mail-wg0-f41.google.com with SMTP id y10so1126337wgg.2 for ; Fri, 14 Jun 2013 05:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=q5P1zuIBX7lyf1jX8zffgXtAu3sJUwYZPfUDxpZVVpc=; b=Om5yn+JpU3kvTzQkGuFKqadMqSMJlvJYjKsqaFbFv7cq0NQ9S++AGWew7O0zbi25d4 CQgYJBF7KK/QruV7ZHSulpZzG9WQ4C1MntgZWQXo/R5AYyGK9EONYVuqtywViAXIlsxL MsX5hOLV68qz52saGPGy1x6zE+y+sh5uWznUquh7yplILZ/Q0xp4RqMrxI7aFd4zm57b PKKCFl0a+7aYXDI85DbXNA8v9fCCKhtUDDMUHBXadXnEkRG9dkUrLQ3WnEJt//2XguDa ygf+Uk3CvutXJI5mJsT+rTe65fcpNDaZrWvxPY1K52jLvF+d5Tf3f3ec0F0YpMuWKQm9 UeRg== X-Received: by 10.180.189.136 with SMTP id gi8mr1181744wic.11.1371212763901; Fri, 14 Jun 2013 05:26:03 -0700 (PDT) Received: from localhost.localdomain (ram94-11-88-187-113-157.fbx.proxad.net. [88.187.113.157]) by mx.google.com with ESMTPSA id f8sm2751483wiv.0.2013.06.14.05.26.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Jun 2013 05:26:02 -0700 (PDT) From: Romain Izard To: Chris Ball Cc: linux-mmc@vger.kernel.org, Romain Izard Subject: [PATCH] mmc: core: production year for eMMC 4.41 and later Date: Fri, 14 Jun 2013 14:25:44 +0200 Message-Id: <1371212744-31596-1-git-send-email-romain.izard.pro@gmail.com> X-Mailer: git-send-email 1.8.1.2 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The field containing the production date in the CID register only uses 4 bits to encode the year, starting from 1997 in the original standard. In 2013, the production year field contains 0, and the kernel reports a 1997 production date. The eMMC 4.51 specification adds a new interpretation rule. For all devices implementing the 4.41 specification or later, the production year field will be interpreted as a value between 2010 and 2025, with 0 corresponding to 2013. Signed-off-by: Romain Izard --- drivers/mmc/core/mmc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3a69b94..3914523 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -482,6 +482,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } if (card->ext_csd.rev >= 5) { + /* Adjust production date as per JEDEC JESD84-B451 */ + if (card->cid.year < 2010) + card->cid.year += 16; + /* check whether the eMMC card supports BKOPS */ if (ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1) { card->ext_csd.bkops = 1;