Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2445932yba; Mon, 6 May 2019 06:18:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxq+qOw33v+ks8pfDNnqf0wv6a9f1HFmCEsBSgwJR/Cj01mvIynvuziYNsAL86VuRu9kUf X-Received: by 2002:a17:902:8c8c:: with SMTP id t12mr7345039plo.116.1557148701595; Mon, 06 May 2019 06:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557148701; cv=none; d=google.com; s=arc-20160816; b=nFNYCksAbZFas9PvhY0gtWIj3woF/0vyCbsqmEV5NuCHrtp5ElZU7IsJbudgI9Bedg H7vRnFIYKu83MIsC1+Mr+EXxv+ndNsLEltvYdv8B0R+el3ptS/P+6HY2cbpnmPf1WFjW LDRS1OYy/+oDI6xIKPLNi4Q6JctcicbY8vaD6d+vWQmtuL4qOnGJ+gQhzysq2PtpPbMk rj//BEYJIMSPttW4lTr/xn4Tcr96MwSTnr5U3b1so0EoOOwKpsduc0g1Bhf4t5XeJ3wf QXFiWz11l2jWn0AAaJ4w95p7Rp8LGP8catNPudOeSvIdaBDVjOTRgnP5ir1k8IvgAwp3 4aog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=2C72qdX0BSD+jpcvgd0U2oHWK81EtFzlFyVqJQI/aQc=; b=piuJcO+vOB1QXTd/AF3BBDsIqenmFVkzYZtwX50XKA8N9FPubd6fNIvyHd7WlJdgcc N5gNOOK8BFQi07qQYe4h5ReCj8jEfDgeoFcyX/8vYD8rKfK9Na305lfhHmfDJGEeCjv9 h9mLfp4ONefqbFkVJ/9Z/WCoGagbzXb90tF0rs3u0kU8Fq5IzXQalSydV+E1DJez1uKM 6r+M5v5ufazHU4Jp4gxkia/pCXn2oGTS1C9fERRzS4NoaFciK+Zn3VDxt984HxhWjbIG epjNKifMSrQpp8MCcIHcJpycxF9JGccBd4t9vcxSQjg+Z2JUmu3UBHBV7ccY2DjiyNax gFzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a4si2093827pls.189.2019.05.06.06.18.03; Mon, 06 May 2019 06:18:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726337AbfEFNQ7 (ORCPT + 99 others); Mon, 6 May 2019 09:16:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:56044 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725856AbfEFNQ6 (ORCPT ); Mon, 6 May 2019 09:16:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9C509AC0C; Mon, 6 May 2019 13:16:57 +0000 (UTC) Date: Mon, 6 May 2019 15:16:56 +0200 From: Jean Delvare To: LKML Cc: Linux I2C , Arnd Bergmann , Greg Kroah-Hartman , Jarkko Nikula Subject: [PATCH 2/2] eeprom: ee1004: Deal with nack on page selection Message-ID: <20190506151656.47494e56@endymion> In-Reply-To: <20190506151539.69ee75e8@endymion> References: <20190506151539.69ee75e8@endymion> Organization: SUSE Linux X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some EE1004 implementations will not properly ack page selection commands. They still set the page correctly, so there is no actual error. Deal with this case gracefully by checking the currently selected page after we receive a nack. If the page is set right then we can continue. Signed-off-by: Jean Delvare Tested-by: Jarkko Nikula Cc: Arnd Bergmann Cc: Greg Kroah-Hartman --- drivers/misc/eeprom/ee1004.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- linux-5.0.orig/drivers/misc/eeprom/ee1004.c 2019-05-06 11:57:14.333572368 +0200 +++ linux-5.0/drivers/misc/eeprom/ee1004.c 2019-05-06 15:11:06.009718220 +0200 @@ -1,7 +1,7 @@ /* * ee1004 - driver for DDR4 SPD EEPROMs * - * Copyright (C) 2017 Jean Delvare + * Copyright (C) 2017-2019 Jean Delvare * * Based on the at24 driver: * Copyright (C) 2005-2007 David Brownell @@ -124,6 +124,16 @@ static ssize_t ee1004_read(struct file * /* Data is ignored */ status = i2c_smbus_write_byte(ee1004_set_page[page], 0x00); + if (status == -ENXIO) { + /* + * Don't give up just yet. Some memory + * modules will select the page but not + * ack the command. Check which page is + * selected now. + */ + if (ee1004_get_current_page() == page) + status = 0; + } if (status < 0) { dev_err(dev, "Failed to select page %d (%d)\n", page, status); -- Jean Delvare SUSE L3 Support