From patchwork Fri Sep 13 14:55:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 828937 Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FA992576F; Fri, 13 Sep 2024 14:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239414; cv=none; b=AGC5cY2qsYjg6k0C6G/Q7wW5VjcRYXjeN8JBE7pI/MQ9P5ClT71mndisVad0wno06EJ4/jYLvwyp+Ai2DgMpqKUf8PkUFc8i3LIT1UBVcEc70Bst0sUOgDx3yaIQi4Yztso6dV1i5wktvEOFmjgxPT2W2gvI8r6wPJ9lvMYvOSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239414; c=relaxed/simple; bh=9VUjDB38D5gusKXh3tcO7Xgzucfd20lyIcwP8BR9ZnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lvw1rEQ+GXd3vqeisvxiTpyPUrTdkeSVxDW+YiBHixd4LEKFGT+zXaMPrhhU+BItmhMOepJSI5aY221O1uAKzDho0bP16Hd1h3XptZFxRPsOIr32fnuhkj1SaFxv0o5seCy7P4CawSgKI5LXq6n14OHL8HSERUFbiETK8677xC4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=fD5X7pf7; arc=none smtp.client-ip=74.208.4.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="fD5X7pf7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1726239389; x=1726844189; i=parker@finest.io; bh=LYDFlSewnM1hZa6TohQSG+KKeWsX59McBuPFtyid5I0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=fD5X7pf7gxdiPyUc2hMdUSX+UkoqXsV2OEA5u+Y21nEaP5mOEHiQos8weQx44wWW j54Kq+xtVoeJvzporTiMnBatUASNbQTgcfLVofbgm5oJjELyLW3/K8U21+V4Rt1Kb SErKF/NOiXUxqSFFSfGcZyuyEgtwJJqFJ7eNbLWQ6FqMV6M7EJr4Lh6T1croHdqa7 w9Er2NXIsx2R9B0bSh+2LHGt0TYzvM+3sxUPlK/EJwacxwGaJHlQsOBc4iZohdU1m U626XuAR0kj2vlLRt1KW9pisEXK3gCMV7KU8laIVXyVGch91pAkNfjhvsvel6DaMh zBTLWn1LnlTbq4ZOqQ== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus004 [74.208.5.2]) with ESMTPSA (Nemesis) id 1MuUKU-1rywXe3W9i-00vOMq; Fri, 13 Sep 2024 16:56:28 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v1 1/6] misc: eeprom: eeprom_93cx6: Add quirk for extra read clock cycle Date: Fri, 13 Sep 2024 10:55:38 -0400 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:xoC21p7aRxHGxyZmTc45jiVrbvLLDI0okdT6q2ule3p0kB2AzP5 G/6i+nDujSRi4K2tWXhPr6axTPdHdzcHCEZZFtmHRT/yDwnZlJXx+ybPaGa7Emdp2xsLXnH 6sSpDSNiExEas7VAvMIFhiuIELkAvYXOGDEwkmVMQ5pSd18dkGfZo58IYJN6E5Jr0RoVYvR BLtxTY64HlH8gRheQzPLw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:WcYYKb1YQ9c=;vSEqNbY1/6hB7BLz3KZk3axaVyy Ks47fDX6XAvr6rIId0w7uev6QoXyki3n3E8ticEQxtpT9VL1IDv8vrSBYd6fLCrtqvRBNE96a 1X7QhWvu0KLpBCdltCt/ZVHJtqgTunR9qYfi0xeeWCqYWB30BnueIRxQC3yLi1Kvj29W6jrt9 9QgpdkUddVX9SjrZcFVa78FHybKpo4mo40SnxoeThjoocOFKnnmZH9XUxW+EvIoGQzQO6iUU7 98pW5WAb07u/vzEWW5CIiq3F9tKa6TWWBvFKETlHsepvbKkLT1eMuUGFn0nAJ9YqhnmZ4Xhw+ ygelwCtVrqd6+i2EMHxX5rLuFfRXRLICrH0UeInBSlg4lQBrfhLuUehadKFDP3QiqlUUaoywy b1XLphULJSkub8F4XtxaY1dSOUam0qPRDKN0kRlumVFc300b5zIAIrAlgkR9sqi01fpd3qNR2 JnVL70S5lQ5Lj0EVvtrQvYeFIAUx2zDOheVlVXFGe7A6s44eUN1WEOTIl5fIyR8ax0iE+iEgG FeZu4+H5r6Mkutl25qjznvxvbWBXGK7GUqeIpvWCThMAYd9IRg4pjOFxSEPDZ5BJPc9/qEdF2 ptN9OFHXgRwSkbBPMq18HSxAG0tVXGqoDZxkIz4CwiJijFtrEKYF5BAfwJRiuJa7lEIH8NXkZ ulzPdbdfewNvqpSwAmm7F6LFqvEJyh+Cn1PoMA4oZT2joRppiVeZagS4aA3/i1hlDCD3QpuOT 2KesyO0ZSKhlNqU/d54ISfPa1IuuDWiNg== From: Parker Newman This patch adds a quirk similar to eeprom_93xx46 to add an extra clock cycle before reading data from the EEPROM. The 93Cx6 family of EEPROMs output a "dummy 0 bit" between the writing of the op-code/address from the host to the EEPROM and the reading of the actual data from the EEPROM. More info can be found on page 6 of the AT93C46 datasheet. Similar notes are found in other 93xx6 datasheets. Link: https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-5193-SEEPROM-AT93C46D-Datasheet.pdf In summary the read operation for a 93Cx6 EEPROM is: Write to EEPROM : 110[A5-A0] (9 bits) Read from EEPROM: 0[D15-D0] (17 bits) Where: 110 is the start bit and READ OpCode [A5-A0] is the address to read from 0 is a "dummy bit" preceding the actual data [D15-D0] is the actual data. Looking at the READ timing diagrams in the 93Cx6 datasheets the dummy bit should be clocked out on the last address bit clock cycle meaning it should be discarded naturally. However, depending on the hardware configuration sometimes this dummy bit is not discarded. This is the case with Exar PCI UARTs which require an extra clock cycle between sending the address and reading the data. Signed-off-by: Parker Newman --- drivers/misc/eeprom/eeprom_93cx6.c | 15 +++++++++++++++ include/linux/eeprom_93cx6.h | 7 +++++++ 2 files changed, 22 insertions(+) -- 2.46.0 diff --git a/drivers/misc/eeprom/eeprom_93cx6.c b/drivers/misc/eeprom/eeprom_93cx6.c index 9627294fe3e9..0f52d3c4bc1d 100644 --- a/drivers/misc/eeprom/eeprom_93cx6.c +++ b/drivers/misc/eeprom/eeprom_93cx6.c @@ -18,6 +18,11 @@ MODULE_VERSION("1.0"); MODULE_DESCRIPTION("EEPROM 93cx6 chip driver"); MODULE_LICENSE("GPL"); +static inline bool has_quirk_extra_read_cycle(struct eeprom_93cx6 *eeprom) +{ + return eeprom->quirks & PCI_EEPROM_QUIRK_EXTRA_READ_CYCLE; +} + static inline void eeprom_93cx6_pulse_high(struct eeprom_93cx6 *eeprom) { eeprom->reg_data_clock = 1; @@ -186,6 +191,11 @@ void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, const u8 word, eeprom_93cx6_write_bits(eeprom, command, PCI_EEPROM_WIDTH_OPCODE + eeprom->width); + if (has_quirk_extra_read_cycle(eeprom)) { + eeprom_93cx6_pulse_high(eeprom); + eeprom_93cx6_pulse_low(eeprom); + } + /* * Read the requested 16 bits. */ @@ -252,6 +262,11 @@ void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom, const u8 byte, eeprom_93cx6_write_bits(eeprom, command, PCI_EEPROM_WIDTH_OPCODE + eeprom->width + 1); + if (has_quirk_extra_read_cycle(eeprom)) { + eeprom_93cx6_pulse_high(eeprom); + eeprom_93cx6_pulse_low(eeprom); + } + /* * Read the requested 8 bits. */ diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h index c860c72a921d..5274bcc7ca39 100644 --- a/include/linux/eeprom_93cx6.h +++ b/include/linux/eeprom_93cx6.h @@ -11,6 +11,8 @@ Supported chipsets: 93c46, 93c56 and 93c66. */ +#include + /* * EEPROM operation defines. */ @@ -25,6 +27,9 @@ #define PCI_EEPROM_EWDS_OPCODE 0x10 #define PCI_EEPROM_EWEN_OPCODE 0x13 +/* Some EEPROMs require an extra clock cycle before reading */ +#define PCI_EEPROM_QUIRK_EXTRA_READ_CYCLE BIT(0) + /** * struct eeprom_93cx6 - control structure for setting the commands * for reading the eeprom data. @@ -34,6 +39,7 @@ * @register_write(struct eeprom_93cx6 *eeprom): handler to * write to the eeprom register by using all reg_* fields. * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines + * @quirks: eeprom or controller quirk bitfield * @drive_data: Set if we're driving the data line. * @reg_data_in: register field to indicate data input * @reg_data_out: register field to indicate data output @@ -50,6 +56,7 @@ struct eeprom_93cx6 { void (*register_write)(struct eeprom_93cx6 *eeprom); int width; + unsigned int quirks; char drive_data; char reg_data_in; From patchwork Fri Sep 13 14:55:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 828593 Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9BD7EED6; Fri, 13 Sep 2024 14:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239410; cv=none; b=I80pkynWsocCl7VM8tjrttFcuDUNtQZXocHR2BqfYC0y6A1Qjzo+wrA4iye1mKVfNP8Pf7xKLBtIPfymZbm2gvFP8ZhVqtVpodWccd/AfUBDh2tZiiC4fWmM84vBMhB4JzHx59UEbGJRb7QT5TrnfhkOJqugXaBf8DVGZ0aJKvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239410; c=relaxed/simple; bh=2S5EjdohUtafJVN0LclLZOeaa5BwcEKgqmTqIaUCLXc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z5x2LBWVweBSCI/l8nDmoxJ0+O6/QWgrFpVNa+VGNAxWpxMgBSUd43erDOrxsLJC0eaFcxdFLfzQ/vAIZEsqNFA+N/a36QoBJOF8S9iIsOqmuma8el3PBCQKWufankoIygYewRL67sF5e6gQB5hyqDCZy0segHRUMvZlGGcnyhM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=S6+8schn; arc=none smtp.client-ip=74.208.4.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="S6+8schn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1726239389; x=1726844189; i=parker@finest.io; bh=u5dwxRXFP0sPzsc3PAhsuP1tz7y0KsCKMmM5JoZ61c0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=S6+8schnQyYE9E1UzQ0d2WibxsyuUHFfaNNaEaAqYNZlcDegNsMd6p3fck+ZUCR+ jTiaL1yFJG/UJKZEmik7MGGr3EyzFe+JskAEtzzou8mPD4vu0JpQmTOWv+EE7zh2x irbGXdw/7CgEq0jejOm8iwYWFGPGNGcJJUDDjPTYog7+m3VO3DktFk1IcPSfVZIcM MGTjL7JnsozcQq2xrCg0aXzq1KMMxtczYWnUDJqy68ktcNx/Qs7QrxfqB7jnRAvpF /jXrCJpOiNv7TgiTpkmr9GWQ/h4vqqpG7w0no+a+JI+2u/r5sdJBLpGjj49rCq+1H bozUG8kq1Y60jrnUXQ== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus004 [74.208.5.2]) with ESMTPSA (Nemesis) id 1MS4SF-1sRivG1Kbj-00XIwz; Fri, 13 Sep 2024 16:56:29 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v1 2/6] misc: eeprom: eeprom_93cx6: Switch to BIT() macro Date: Fri, 13 Sep 2024 10:55:39 -0400 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:7Ukjgtuaq5ajxqwDz4KN63U3de7irQDKJlYjSATh7lgk4iC8Nk5 gV+YfHiij48dGxQzvmy1BiSEjRJjR4T29agpIp8ZFm8dJe7prEeh3mpyz6oRLA6cz6tKonj hVhkeeu7NJlTCbIcpjgdVjEQONU2fDnVDEllzINn+tqsb1wZ5q+9IYC5xuFhtcTWBCiz7va fVB152x/pwjb29yHZehxQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:AmqoMiT8DMo=;2rLNuGc/xbAutWzEOqKdaNbc/+K 7wi1nJjKW4JAVN4gcZdiJEUVD9fv7qQ68gFbGfiFs0XtbVWI7VcZ0y3Km1ouvCkHxTLo2SJ7g 2h+E96oedng6jGdzA5az7jGdINjLQON0U9U3mMbzApNxkCLwceoMG6a119qD0PMe0q9n15WPR jG7qkgzS+QGpP1qNyhn97BzZFjY841AuuRw+es+YVLK/GP6yEZuh1vu3iWEYuQOa+MMRmC0fb JeYscpUmM2X9JsYzj1ah/DqXKnRR3PhDwucM0yM++COuK1TzmlQKvA26QGVyVMjosbgsgvtvU UqSBPaRamXaiTs7DvqVFgZXmakTHFGAFC7/yJdXPs387QZ5EwBW9BofugegHYgO+Tvq3HXPuJ PWwDYvtkW/a1w9/3MWmY7X3kT8QAVCHSGUhCXcra2o9512I+VZpbDjKbZXECiHM+fPOm+Xfue yu1HaqR3kC/QMZjnKXaEzAi7yIo52VIYTb6jpsC+4/c5u+bcEctbCPTV1MU8npLp0MupL+Tld KmbspvORxmLwauvKYF3PDGRzEhGl5d5A9XiYn+0GavzheIz1tRoVlowfon2ntpf3Z2CGibT75 mMAK2dvKQxBkJOX7jJ6ISdFdVeFWPOERSPv7EQuM9rR+Efk1PVrX/UM6HJB9EP5yT+A9sGx5R NiD7/Vzto0Imeolew0UIXujXfQBvq1JZhceU5T4mXKdPJVzXumqdrMZMclLWmwMQcO3PjTMEU x/08Jwuy1rK8aD/rQsGVtKI8Ugi0UYj2w== From: Parker Newman Use the BIT() macro rather than (1 << (i - 1)) Signed-off-by: Parker Newman --- drivers/misc/eeprom/eeprom_93cx6.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.46.0 diff --git a/drivers/misc/eeprom/eeprom_93cx6.c b/drivers/misc/eeprom/eeprom_93cx6.c index 0f52d3c4bc1d..64da22edefa4 100644 --- a/drivers/misc/eeprom/eeprom_93cx6.c +++ b/drivers/misc/eeprom/eeprom_93cx6.c @@ -8,6 +8,7 @@ * Supported chipsets: 93c46 & 93c66. */ +#include #include #include #include @@ -107,7 +108,7 @@ static void eeprom_93cx6_write_bits(struct eeprom_93cx6 *eeprom, /* * Check if this bit needs to be set. */ - eeprom->reg_data_in = !!(data & (1 << (i - 1))); + eeprom->reg_data_in = !!(data & BIT(i - 1)); /* * Write the bit to the eeprom register. @@ -157,7 +158,7 @@ static void eeprom_93cx6_read_bits(struct eeprom_93cx6 *eeprom, * Read if the bit has been set. */ if (eeprom->reg_data_out) - buf |= (1 << (i - 1)); + buf |= BIT(i - 1); eeprom_93cx6_pulse_low(eeprom); } From patchwork Fri Sep 13 14:55:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 828591 Received: from mout.perfora.net (mout.perfora.net [74.208.4.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0A7C18054; Fri, 13 Sep 2024 15:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239720; cv=none; b=ezRlJ+EkNCMc7CukEbASRoBSozUgna5XxPn7xfwWEGEPasuO9fUfMyGe29VGiNClES4Z/zyj6+eLqMCLSN9chaz8vSdbnP76qRad88Engj2K4HRw7u31p/hffX0SG40NOi8RzCldNoziQYDioE+vpqDA1YhIneMagIOeOzpzx4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239720; c=relaxed/simple; bh=Prop8X1u5n9vXxzf5jOSP/AMviBnOLDj1YxG3MfeTSU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EjlZqMR8JXPJ2XPfat4Ssi65S0Qk6RH0ZW1Qe+fh6KwYYlZGebzb8xiQs79EH56wooS9Xlu2dCGUZE2kxed4iOyHAR3OXIr3I2jY75eAJ52xNZ8qHVxBJN2+RUe8s0G8kVFObgcR/Uk0Uwnflbn94Xb0Byhl8jYkhhqHnlfDPbQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=Zzx54NxF; arc=none smtp.client-ip=74.208.4.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="Zzx54NxF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1726239715; x=1726844515; i=parker@finest.io; bh=XcKN6q0TBp89e0wB0f+FMk1TLd9btuVWG0QWEJAGodg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Zzx54NxFb57Q7WyGm26DIn5KWtSXiVALR08QXN6C7IIz45yqCRd4dCnj1rj8ijYS nSjCn0ub1ORyC9iwjY1bnsEEkPePy6I1lnDYDCKhLnOHvBJ1v3PCpY60taovBU7po j5CdI14nSLRHfR2B7GuOa9umAtd/CMVJh2PWSHQ1BSFrak+yQg3gYlN0xK1Spt8fH LVrLPQX6/SZ0qbeQoeKEtYobIj7ZfuelWAuciVWPWVyMc1SoG7VX8/1axIlVKM7Ik sCQOMjx29qaMYut/F4TnZ926Gdwbvj8IHpRu9DzeFPACNFWZkIfIf4t4WFOkBxOI7 6Kk+rO7Ezs/5Ko3fVw== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus004 [74.208.5.2]) with ESMTPSA (Nemesis) id 1MsIT8-1s19Sp3HEw-00xbIG; Fri, 13 Sep 2024 16:56:29 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v1 3/6] misc: eeprom: eeprom_93cx6: Replace printk(KERN_ERR ...) with pr_err() Date: Fri, 13 Sep 2024 10:55:40 -0400 Message-ID: <127dcc7f60d15a1cc9007c9e5b06a1aa2b170e19.1726237379.git.pnewman@connecttech.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:mPfsegP9z14MiUC6IhNn4jM/ANnsdT/sOovmOq6y+rpXz6nvaf/ 9qskY9F0kghKN5DS9mtdl17qS43tf1AmB8Pz3ew2mOXJ8HLs8KfvwVhZICsJ25wFafgrs52 p26+nHka0/fnZU9d4G8Ukxz25vs6dcJKme2jtXDW1a4KpuYYA+ywQEpqdGl5ZVGPBHERXXs DGLU84D7meXUutgfa/U2A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:J23xp/a1mPk=;fdT3TA1eWzuORCpVRS//uRqJz+G 2+5B7bKjm+cXMVQXHFr+9+4f0vwjx0pQyF2gFWnT3JMVyu5CzbLw9WUWY46WPa0/j+K4FqGMt X5LXzEBt4A99g8i7L0MjjT2932q5ZSChJCgA3MBCr7ts7XAs0xE7liADPg19hpNIRLG5Tcb0G Q9fjMRiqxcwpnMbtVTU0V4FrdCHTM+i1mxvfOnojozSQR+4b/cz+9Aw6gOcAEmjX3AjE1j1pU 5uGJW+y1KQAoLA2aEKePGWQ/IZWBtXkfi0IIrZ3M7pGzCSql5ACKBe1QCQ8dVC7hW+oX0hLjl oJxzyzWYfMz5U8K22Q1khS4k+Mr/6NH+3CoCqzBHCn3RNxo/zwP/hZJFfhg4eMpLkVxWrIIhS tZun6O7qboHJcX6IoRb5I4HE15MVLqVmxae1ssXyXfnKV0UMWqNBYDiUj8CCHqMVUFGuYIJ0/ IDCv9U+JGV3DqL6N3UlFc7Or7qaLpi4mola55N9bW41L2rST7wOgmx+tNRlSl9tsIQ72vIC+l dASqouuJxHzfPSWLotPPwFLDsp4GZD8xOckgLHZArBy77tifPJl8j357qFo5lVzuP0CqC9Utl Gxt+pBJ7vSKiydme7D3lUVyAv2YoFa8CkbpPhPAe25OWKt2zry8x/wT4eWaPqyxeC+RnhTZoC jreC7xvYd6zsEYA7CMsPTfUtU3SnFo8G4/neE9ZihrtlQ5khIqEGnETxZgmqWVSHCh8ZJf4yy L1lwODX8i4C/SgOoBBP+MuuKBc7iyqHrQ== From: Parker Newman Replace printk(KERN_ERR ...) with pr_err() to improve readability. Fixes checkpatch warning: WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ... + printk(KERN_ERR "%s: timeout\n", __func__); Signed-off-by: Parker Newman --- drivers/misc/eeprom/eeprom_93cx6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.46.0 diff --git a/drivers/misc/eeprom/eeprom_93cx6.c b/drivers/misc/eeprom/eeprom_93cx6.c index 64da22edefa4..755be9a4ffd4 100644 --- a/drivers/misc/eeprom/eeprom_93cx6.c +++ b/drivers/misc/eeprom/eeprom_93cx6.c @@ -378,7 +378,7 @@ void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom, u8 addr, u16 data) usleep_range(1000, 2000); if (--timeout <= 0) { - printk(KERN_ERR "%s: timeout\n", __func__); + pr_err("%s: timeout\n", __func__); break; } } From patchwork Fri Sep 13 14:55:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 828592 Received: from mout.perfora.net (mout.perfora.net [74.208.4.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBCF629CE7; Fri, 13 Sep 2024 14:56:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239413; cv=none; b=YTg5eSxvF3M7hZksrnfywoKcsz0/JxMQ5sorOesQ9jvlllTLxGsDVhHWY3/K6s+/aYnjFluHaZKj4teRZHLUWwLL5kxzaEeq9bO5/iyLCewzjCkQ6mcqT6rTr5CtZ7186NbbxXLJJ41Wm2MJc2CYVlQO0/IZ3duTR7Gu5Y12zF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239413; c=relaxed/simple; bh=3WCsga3GqIwYhBmstLx/z0AhqxN2IfYpeKnamXXGdzc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FIJwh9koFn9D9wkMBmKseWvgCC8f4Fsz1dVhMUJqFUCE84ddawlusfE8W1IxKQuAtE2rNSwmgNK/BSf9lq1pUEb5dEP1kmkViQ+SwSRRJP7hKFq/r4aD+iwku5a7Gs1/AKOUwKYVwrVsn8U3DF2/L7nM0CFHj15L3dE7/Zv/+F8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=mXexuzNS; arc=none smtp.client-ip=74.208.4.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="mXexuzNS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1726239390; x=1726844190; i=parker@finest.io; bh=b4O9e5pH2C9mry5jrjkn2GHODSWJkyFz+pjodKXA+xA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=mXexuzNSPzyaYwC1W/mFBzPal99tjPZ2A5u56BVsPEGbkcrhusrmM0TN+qCmyAQP mcO3tiYBj/y6TMIxCmtdLBrgxDljw2BUD7j5vOOR0rmGDlzBBgwizat/Y1L+gdPQ+ BqZgVndn7h5CEvW2nDpIL1ziAxjJrfN7mc54oM/ZgfIPow5uOW9duCwRqOtL/2Qc7 6mrzQvGeeX0aCFaNvenFu8ZULCsjg8V/Kk4N0ta2+72CZK80gkalwsnzpdgtIqTpL cXKIXrh0A6jz2Q2F9LRIid1Ae5w5IrxNI+vrYWMJH4GIrfqRSAbBei1qw8K0mhHe8 4uZ7bIiqyqq7kw391Q== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus004 [74.208.5.2]) with ESMTPSA (Nemesis) id 1Mad3m-1sIoq416d8-00g4RU; Fri, 13 Sep 2024 16:56:30 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v1 4/6] serial: 8250_exar: Replace custom EEPROM read with eeprom_93cx6 Date: Fri, 13 Sep 2024 10:55:41 -0400 Message-ID: <78dead78311ea619e0be99cc32ee0df1610a480d.1726237379.git.pnewman@connecttech.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:BQbriEhczTMvDyonXQ0dqYK7p6lCYymmcHtH1Fm/YlxLyNmjLOj ybBgu3uyOLqxpqYMHY3ZaNYZYKm6l5nLJr1crSoy5xkVsjFj+67Ii1h59d955/CwbGj1WJ0 uINVYCSNM1FtfRvYj4dFqpFwOOBV99z3UeXT0tGT4tHNNdAxJIJdPFX4X9/ZOaYlkkJNE9a 8vMpd+IeIY7ZbJO0li9Ww== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:9rsu8cD/61M=;Rfb+0YV+CyFLtFK67TtW7j0j3m1 uI7UrW++m3EkrifFh3slJWgDjrEMghiRbeSwBoNYQ/dUSL1X+ZIBfslkdlad+L0PyldgvygHf 1sEM2v0wRZQcK9/amdGfc2mIOvAN7K0IAbU3V4VFyLL5NBUJxqfJLqy99XE9O1l0jTAckedOs 6Wu+GELprg0KpsJz14SnFmcBaFTt31YXOIkVsWCuaMT27Jb9O+lEPISIOk2u+/ZdDAjbHF4PD jEnHiy3mnXKLzCH7EmElFkck8q/YY2akkmnMKFHAsrFh6xNbxKsQrk+mzKQQV+PkoTweEzetX JizkrTTCnF5EtmoPjdUoevQ+TcquQjfnGpGfAPWu1SbIEcPRTcOa9erboFCCEsFfMJ3fYUTpm wsADqAC1BRb/xoMdOkzfrdWKQZPdTbhUi1+f12RoMyEMOtUXtll+xS+Qn25Ory/VFeSx2ess6 Zr9TSuMFSDl3NfcG/IW8i3O4tiNHAjqVe8xsEV6Ens97YbZvnNA1Z3rDDB+iCFRjFbafx1dg0 TzD0sBIn+ZAl/1v4K6Y7TXotTF5bTE5rrHj721uJ7AsrQ0yw6hBVtFrbXslPg16UqokMKEqql quDAzgnNtxOT2oLB+0MXhw90ru4FklotC7/pqT0IHRR4XUmNarbHICUBEG5eUHVuBlGdr6Zmn b74dFjaSPuPcL+Xiu45gipupfOZ/SGm7SgfJWwhReruuBVDkJ773Xln7czZFXmXJlmf2E/Q4k PXVbHYGvvL97zxP3LUXJTZDwBz833dbPg== From: Parker Newman Replace the custom 93cx6 EEPROM read functions with the eeprom_93cx6 driver. This removes duplicate code and improves code readability. exar_ee_read() calls are replaced with eeprom_93cx6_read() or eeprom_93cx6_multiread(). Link to discussion with Andy Shevchenko: Link: https://lore.kernel.org/linux-serial/Ztr5u2wEt8VF1IdI@black.fi.intel.com/ Note: Old exar_ee_read() and associated functions are removed in next patch in this series. Signed-off-by: Parker Newman --- drivers/tty/serial/8250/8250_exar.c | 54 +++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 11 deletions(-) -- 2.46.0 diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c index b7a75db15249..0edb5aeba199 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -252,6 +253,7 @@ struct exar8250 { unsigned int nr; unsigned int osc_freq; struct exar8250_board *board; + struct eeprom_93cx6 eeprom; void __iomem *virt; int line[]; }; @@ -355,6 +357,39 @@ static u16 exar_ee_read(struct exar8250 *priv, u8 ee_addr) return data; } +static void exar_eeprom_93cx6_reg_read(struct eeprom_93cx6 *eeprom) +{ + struct exar8250 *priv = (struct exar8250 *)eeprom->data; + u8 regb = exar_read_reg(priv, UART_EXAR_REGB); + + // EECK and EECS always read 0 from REGB so only set EEDO + eeprom->reg_data_out = regb & UART_EXAR_REGB_EEDO; +} + +static void exar_eeprom_93cx6_reg_write(struct eeprom_93cx6 *eeprom) +{ + struct exar8250 *priv = (struct exar8250 *)eeprom->data; + u8 regb = 0; + + if (eeprom->reg_data_in) + regb |= UART_EXAR_REGB_EEDI; + if (eeprom->reg_data_clock) + regb |= UART_EXAR_REGB_EECK; + if (eeprom->reg_chip_select) + regb |= UART_EXAR_REGB_EECS; + + exar_write_reg(priv, UART_EXAR_REGB, regb); +} + +static void exar_eeprom_init(struct exar8250 *priv) +{ + priv->eeprom.data = (void *)priv; + priv->eeprom.register_read = exar_eeprom_93cx6_reg_read; + priv->eeprom.register_write = exar_eeprom_93cx6_reg_write; + priv->eeprom.width = PCI_EEPROM_WIDTH_93C46; + priv->eeprom.quirks |= PCI_EEPROM_QUIRK_EXTRA_READ_CYCLE; +} + /** * exar_mpio_config_output() - Configure an Exar MPIO as an output * @priv: Device's private structure @@ -696,20 +731,15 @@ static int cti_plx_int_enable(struct exar8250 *priv) */ static int cti_read_osc_freq(struct exar8250 *priv, u8 eeprom_offset) { - u16 lower_word; - u16 upper_word; + __le32 osc_freq_le; - lower_word = exar_ee_read(priv, eeprom_offset); - // Check if EEPROM word was blank - if (lower_word == 0xFFFF) - return -EIO; + eeprom_93cx6_multiread(&priv->eeprom, eeprom_offset, + (__le16 *)&osc_freq_le, 2); - upper_word = exar_ee_read(priv, (eeprom_offset + 1)); - if (upper_word == 0xFFFF) + if (osc_freq_le == 0xFFFFFFFF) return -EIO; - return FIELD_PREP(CTI_EE_MASK_OSC_FREQ_LOWER, lower_word) | - FIELD_PREP(CTI_EE_MASK_OSC_FREQ_UPPER, upper_word); + return le32_to_cpu(osc_freq_le); } /** @@ -833,7 +863,7 @@ static enum cti_port_type cti_get_port_type_xr17v35x(struct exar8250 *priv, u8 offset; offset = CTI_EE_OFF_XR17V35X_PORT_FLAGS + port_num; - port_flags = exar_ee_read(priv, offset); + eeprom_93cx6_read(&priv->eeprom, offset, &port_flags); port_type = FIELD_GET(CTI_EE_MASK_PORT_FLAGS_TYPE, port_flags); if (CTI_PORT_TYPE_VALID(port_type)) @@ -1551,6 +1581,8 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) if (rc) return rc; + exar_eeprom_init(priv); + for (i = 0; i < nr_ports && i < maxnr; i++) { rc = board->setup(priv, pcidev, &uart, i); if (rc) { From patchwork Fri Sep 13 14:55:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 828938 Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FAD32629F; Fri, 13 Sep 2024 14:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239412; cv=none; b=n+8ce4U0u3uLCpujOXZ84jKt7d/AImDg52x5Q2PKLHFdu4lnsctYN+GHBMYYCikxxMYkH+edQQh7TPcIIkI/+XOudn92oQNE0ierhus6LYPm7Xon9U0DrAr7B8+Hx8DSMsX6HPfmtUlwVy2xt4XKdUefAjoLqIA83hT68fJD0Vg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239412; c=relaxed/simple; bh=6HGa3xH4q/wVIDbcp21UHl2EmGSf3xbW64DuCdXyolc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oGHkEfU01nRrSb4MHW5x6/idec4Frfs2Vy6spfWk5WaOQ2OIfwXPjisxayq67GW2EUgMWA61PGsnpszvc2daAGeQrxQN5niVw+h5nM8AIkAMlqOf+V6ZrDupvgWHA1FQt9sv6Hpppcpud3xuE89jLTYdfrTxMrIHAQWK6WGSnuA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=g7jUPpoU; arc=none smtp.client-ip=74.208.4.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="g7jUPpoU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1726239390; x=1726844190; i=parker@finest.io; bh=XwoyajezAxnq4yQoPqaucc/mmTrf6GLB40+rbTgUjoU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=g7jUPpoUyzfdcVEYnf19SOKXmwk9J7z/f0ayL6veGP/3m/cr+x6seWDqu0plPw0V AenIhRW5v2l8hWydcvprg2j4rApoWl/skDeCSbLH9SzyhzI2vfa0oxk0s30chIXeL /DsRIjKuayfoWT/beUMC2TRvwqYD5LRxZABYdPsYpK3P+GLSW9xnDbFeW+lw92UMZ Ttv2f2+jyHmNXp1vQaBGyb8Op4518Qz2nssOyZ9KyFQrhBbSFBBqcJTX1QCiD3xuZ XapduiHvvb+pyOhtYboc0HsU1zE31p4czvQE9Bha1M0Id66B/T5IMrcz+mT8vOyaL aFGgDTPznowPVTs+yA== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus004 [74.208.5.2]) with ESMTPSA (Nemesis) id 1MKtBx-1sYqSB34cX-00QBQ7; Fri, 13 Sep 2024 16:56:30 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v1 5/6] serial: 8250_exar: Remove old exar_ee_read() and other unneeded code Date: Fri, 13 Sep 2024 10:55:42 -0400 Message-ID: <3d7342999229210b18d1e163362999cac78a52d6.1726237379.git.pnewman@connecttech.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:PiWaDdgHCq6lF/1o+DvXnHdtCsbtl67UQZZbI/RYrhJYKdJ43V2 784SedABsWcUXJQSleEbl5aQ5N04VUeGe3RnUV29GS0Rdbvf+z1/vjcpBhW3omWZ6FudoDl X97x3EmGk2qqWHIzj10cZKIV/UKg0JIcERt4rN+7ltHXiHtIZBxEMgEBQ6n4yWLuKgrKbzY PMpUwlQnBX4uPev+AHVWw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:bFYaTlExvS4=;Yy/Bb8iWmB21KDO5uNEI9QwRnKl E5DfwtRn5vIJ0w8FrkD3n5KqREBeyOEKL1UWyH0ShkCiortq6e91v4N+8sIAOzw0XoicQncYp VxCu2G+iJOUCQ4oQs7OYGQirkb8pu1Jy1+FIiDoM5lg0ynTVBvCesIgrfKIyKqM6jpOkFyqnJ s0wnxspO5/jNJ/rN7ZyDpJ3ENDYlQLD3Bq0lN9sFYdIG4jgKItkpv56TknwT2QSNUqKA1lmZP A9q+gPAD0ZJXX4PoAXm/kpM235qzhLnxz4DpxPvULFyLPfVutzPgs6eA6HshhAcJHHWdccqdI pK/jkl1Lr4/riRPI45uMKy+i6Bljug/8okIiJSO8ETvUuYDKD3thmMEYP7uZCqDVC1BynUL2r qvr9h3DpFAhzvAnJqD3TrY8PTSFUc9dv7Eq1vIVdPcYvndLBhe9jrRzXBSSPRziEYkgaSqCIZ 0Gud/MSpSCk58eDsqZiDILjCyY7J/INdQY7LU6PywpusCH51UKKhSF5wTZXRZfFtiTBd3yxkM 3ou8HWOiDEiuyCOjof+/lOSBkWQ+5nPWK9uw3JgFPoR4uTRtx7aEPtlHTUhuLYi/CASch6jZw /7Xa5sU5O+gPzfFxuwyiRKSdnu0/y/m2yOi1kL2rr97LUbU+Vo0OuScsEsr+P5BOGygUqeA4K J4hfwBQIOSfaLI8GfyH5Y7+BRAzFNg2JtdoR4Rr4RXg5C/cCspM1yNFe4omOVcqy0pjcWqsLT U5cFtgoC4V70yCyta5B52pREEOUx73GYQ== From: Parker Newman Remove the old exar_ee_read() and associated helper functions as well as some defines that are no longer needed after the switch to using the eeprom_93cx6 driver. Signed-off-by: Parker Newman --- drivers/tty/serial/8250/8250_exar.c | 92 ----------------------------- 1 file changed, 92 deletions(-) -- 2.46.0 diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c index 0edb5aeba199..3ef28429f1d1 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -136,8 +136,6 @@ #define UART_EXAR_REGB_EECS BIT(5) #define UART_EXAR_REGB_EEDI BIT(6) #define UART_EXAR_REGB_EEDO BIT(7) -#define UART_EXAR_REGB_EE_ADDR_SIZE 6 -#define UART_EXAR_REGB_EE_DATA_SIZE 16 #define UART_EXAR_XR17C15X_PORT_OFFSET 0x200 #define UART_EXAR_XR17V25X_PORT_OFFSET 0x200 @@ -190,8 +188,6 @@ #define CTI_EE_OFF_XR17V35X_PORT_FLAGS 0x14 /* 1 word */ #define CTI_EE_MASK_PORT_FLAGS_TYPE GENMASK(7, 0) -#define CTI_EE_MASK_OSC_FREQ_LOWER GENMASK(15, 0) -#define CTI_EE_MASK_OSC_FREQ_UPPER GENMASK(31, 16) #define CTI_FPGA_RS485_IO_REG 0x2008 #define CTI_FPGA_CFG_INT_EN_REG 0x48 @@ -269,94 +265,6 @@ static inline u8 exar_read_reg(struct exar8250 *priv, unsigned int reg) return readb(priv->virt + reg); } -static inline void exar_ee_select(struct exar8250 *priv) -{ - // Set chip select pin high to enable EEPROM reads/writes - exar_write_reg(priv, UART_EXAR_REGB, UART_EXAR_REGB_EECS); - // Min ~500ns delay needed between CS assert and EEPROM access - udelay(1); -} - -static inline void exar_ee_deselect(struct exar8250 *priv) -{ - exar_write_reg(priv, UART_EXAR_REGB, 0x00); -} - -static inline void exar_ee_write_bit(struct exar8250 *priv, u8 bit) -{ - u8 value = UART_EXAR_REGB_EECS; - - if (bit) - value |= UART_EXAR_REGB_EEDI; - - // Clock out the bit on the EEPROM interface - exar_write_reg(priv, UART_EXAR_REGB, value); - // 2us delay = ~500khz clock speed - udelay(2); - - value |= UART_EXAR_REGB_EECK; - - exar_write_reg(priv, UART_EXAR_REGB, value); - udelay(2); -} - -static inline u8 exar_ee_read_bit(struct exar8250 *priv) -{ - u8 regb; - u8 value = UART_EXAR_REGB_EECS; - - // Clock in the bit on the EEPROM interface - exar_write_reg(priv, UART_EXAR_REGB, value); - // 2us delay = ~500khz clock speed - udelay(2); - - value |= UART_EXAR_REGB_EECK; - - exar_write_reg(priv, UART_EXAR_REGB, value); - udelay(2); - - regb = exar_read_reg(priv, UART_EXAR_REGB); - - return (regb & UART_EXAR_REGB_EEDO ? 1 : 0); -} - -/** - * exar_ee_read() - Read a word from the EEPROM - * @priv: Device's private structure - * @ee_addr: Offset of EEPROM to read word from - * - * Read a single 16bit word from an Exar UART's EEPROM. - * The type of the EEPROM is AT93C46D. - * - * Return: EEPROM word - */ -static u16 exar_ee_read(struct exar8250 *priv, u8 ee_addr) -{ - int i; - u16 data = 0; - - exar_ee_select(priv); - - // Send read command (opcode 110) - exar_ee_write_bit(priv, 1); - exar_ee_write_bit(priv, 1); - exar_ee_write_bit(priv, 0); - - // Send address to read from - for (i = UART_EXAR_REGB_EE_ADDR_SIZE - 1; i >= 0; i--) - exar_ee_write_bit(priv, ee_addr & BIT(i)); - - // Read data 1 bit at a time starting with a dummy bit - for (i = UART_EXAR_REGB_EE_DATA_SIZE; i >= 0; i--) { - if (exar_ee_read_bit(priv)) - data |= BIT(i); - } - - exar_ee_deselect(priv); - - return data; -} - static void exar_eeprom_93cx6_reg_read(struct eeprom_93cx6 *eeprom) { struct exar8250 *priv = (struct exar8250 *)eeprom->data; From patchwork Fri Sep 13 14:55:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 828590 Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C57C4AEE5; Fri, 13 Sep 2024 15:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239725; cv=none; b=FzvA8ijwVSepuw0G2id4O8TgbHl1DELzTFnF++qq37LhKyIpz+9h5q8G404zPs4KcCrU8p/8mYEfNEjsaWoO9r6VsthnPgL3o0ol7XU7R+oT9//Eq6r5H96MGwjFcg2VA9x0DrRbA9nH/QzlXjA3EJH5Syrp+5DpbBZWAvU1W84= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726239725; c=relaxed/simple; bh=ESKLF8yFEtUQytc0bKQ3oBD2aW2a9E9kSXQeLosTxeE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pE8mqwowBxuJRezJ+A/LEFt2K5P2wemlXh7OEwnUQKzZ1tutSRGrD1oKMDDCUP+vRsF7DIePqbRXIOoOcCkxedR7Q1+6cbgyJFJfZbwnnstIb6P3qeWifJhq9S3e/PQrGMHTiUhF1bBbAJkFyChzXvNSPXUqEVmJpAEU0nJMBw4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=vt/aSyrG; arc=none smtp.client-ip=74.208.4.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="vt/aSyrG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1726239721; x=1726844521; i=parker@finest.io; bh=2o7ADJUQgRYhhYBqQX29IqghXTlpdQRGn0FGNbn1NUI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=vt/aSyrGR0pI0utiyKc+KclswpULP4ACa8uNh00+H6SEfQC52JMi74QE2A+SUf/L PX5/lk3vlwenK4FLgl2z1aBNII96vhLhpQseB8P4GhJuNefpgmfc7le72a97IF9Fd n0Vu7N3PTKRQAOvlmotvJvhA2v3tD4oeHs/sw27rg9FWVMsJOfJUzWIIh2efFKz0p fPs874M6J6j1QfNl5S/U850+Qpx7VvmDVLbbvXq5WWtynegFUYC9IxBVp9gjP0Hxu TA0DIBqK05mLDwQabSXck+Ullrj8Zz2O8tPGq/pGAwBEwPkbTNDI3a1KR/4Hzoz6h Dxya9IPaMrGSW67XiQ== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus004 [74.208.5.2]) with ESMTPSA (Nemesis) id 1MQdh4-1sbI5p0r26-00Ijhc; Fri, 13 Sep 2024 16:56:31 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v1 6/6] serial: 8250_exar: Add select EEPROM_93CX6 in Kconfig Date: Fri, 13 Sep 2024 10:55:43 -0400 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:ajSEOcGFWwOl3ZVKbnLk5A4JCktIcIR++kmKHBG9KY4PhRwnsKq gFQWdnF4kErSeMUGkRa8Tit2TjYHtLJpmxCmi9zfc4ndO1RM20ITIiceoZo9ODltrLhlCwa mjDx76qXS252rPgX40mY7MBkCkz387RJEUcBpq13g7Ci0yGUmldKgDagyKIQAgoZjmOzG8X ctfGuLLPyOjjqJDDhN1Hg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:K8dNiyVWNQI=;0F0kA9AYH9Cy3j0YwgV/acixk0h 5YGkt5o3KYsm4hAYt0+TYpzonADsI75g6kF1NH2vpKO+ZKLRjmRnBiF6gq3LRlt0GI9iI5dVK BJ06aFpXEWE0Pmrpult0dibntcMT3Xm8eF0CZ8UhDoXSn8AxTtEfS6GMv7qOovlg1HDqK7a7a +8+fdlwplcgw0yMOwit6Osr76ToDjAtb53q7P9gmb7+ZP5kxuxydB6g1E42vcuBcjXPsBaqOA XvhwNDEF2oYykanIRAcmAPo2ZktPtiHsIHPX0BEgoVnls+MS/DAVzIciWMvxyEkhJQt6N1WnZ 8Qa7DWsYe5ROZJaYtg+dRSrjjBnaHd4pbRjPhWtSS6MhVR9ddjRuQDT8SfM/vodkvjhZZoip4 aTs/49AJ6SovsXZimJ71mo98y4ouzNaRCa5hkLq3DyGewno9eIa0bS08M/vC8+Qv1DBmFfBu7 w3mZg627RHe/D4Qpwrdx503PCPWq9TveBaVMuTxGbBJ1/qLldcAbrmwGvV8/ujBHxGLOud3L4 NPO71TX7j4C987umx/s9j2KWFML9SrhN7F6W7WTwcwx8z5KlqBfHXcKUQd9+2Ed/Mlndiy+kN YedLTRGGCGYkNDKOJea5+UIFng8T5EoCJg3Rzw2PFfJBwFEywvY/K6oc/6jNrdGo932WXEcas ZCGrO62S+40EQMATsvc3NRh4gqw3EwK09JLceYBc+TRnlB0ye9ORdLaYzYmkwGaafGfz2g0ni c0chnqXagLl4Alyv8ImDw9pYLYJjOvIbw== From: Parker Newman Add "select EEPROM_93CX6" to config SERIAL_8250_EXAR to ensure eeprom_93cx6 driver is also compiled when 8250_exar driver is selected. Signed-off-by: Parker Newman --- drivers/tty/serial/8250/Kconfig | 1 + 1 file changed, 1 insertion(+) -- 2.46.0 diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig index 47ff50763c04..94910ced8238 100644 --- a/drivers/tty/serial/8250/Kconfig +++ b/drivers/tty/serial/8250/Kconfig @@ -150,6 +150,7 @@ config SERIAL_8250_EXAR tristate "8250/16550 Exar/Commtech PCI/PCIe device support" depends on SERIAL_8250 && PCI select SERIAL_8250_PCILIB + select EEPROM_93CX6 default SERIAL_8250 help This builds support for XR17C1xx, XR17V3xx and some Commtech