From: Cory Tusar <cory.tusar@pid1solutions.com>
To: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
gregkh@linuxfoundation.org
Cc: jic23@kernel.org, vz@mleia.com, broonie@kernel.org, afd@ti.com,
andrew@lunn.ch, Chris.Healy@zii.aero, Keith.Vennel@zii.aero,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Cory Tusar <cory.tusar@pid1solutions.com>
Subject: [PATCH v4 1/5] misc: eeprom_93xx46: Fix 16-bit read and write accesses.
Date: Wed, 9 Dec 2015 23:00:51 -0500 [thread overview]
Message-ID: <1449720055-25965-2-git-send-email-cory.tusar@pid1solutions.com> (raw)
In-Reply-To: <1449720055-25965-1-git-send-email-cory.tusar@pid1solutions.com>
Compatible at93xx46 devices from both Microchip and Atmel expect a
word-based address, regardless of whether the device is strapped for 8-
or 16-bit operation. However, the offset parameter passed in when
reading or writing at a specific location is always specified in terms
of bytes.
This commit fixes 16-bit read and write accesses by shifting the offset
parameter to account for this difference between a byte offset and a
word-based address.
Signed-off-by: Cory Tusar <cory.tusar@pid1solutions.com>
Tested-by: Chris Healy <chris.healy@zii.aero>
---
drivers/misc/eeprom/eeprom_93xx46.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
index ff63f05..e1bf0a5 100644
--- a/drivers/misc/eeprom/eeprom_93xx46.c
+++ b/drivers/misc/eeprom/eeprom_93xx46.c
@@ -54,7 +54,7 @@ eeprom_93xx46_bin_read(struct file *filp, struct kobject *kobj,
cmd_addr |= off & 0x7f;
bits = 10;
} else {
- cmd_addr |= off & 0x3f;
+ cmd_addr |= (off >> 1) & 0x3f;
bits = 9;
}
@@ -155,7 +155,7 @@ eeprom_93xx46_write_word(struct eeprom_93xx46_dev *edev,
bits = 10;
data_len = 1;
} else {
- cmd_addr |= off & 0x3f;
+ cmd_addr |= (off >> 1) & 0x3f;
bits = 9;
data_len = 2;
}
--
2.4.10
next prev parent reply other threads:[~2015-12-10 4:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-10 4:00 [PATCH v4 0/5] Devicetree support for misc/eeprom/eeprom_93xx46 Cory Tusar
2015-12-10 4:00 ` Cory Tusar [this message]
2015-12-10 4:00 ` [PATCH v4 2/5] Documentation: devicetree: Add DT bindings to eeprom_93xx46 driver Cory Tusar
2015-12-22 0:01 ` Vladimir Zapolskiy
2016-01-06 2:38 ` Cory Tusar
2015-12-10 4:00 ` [PATCH v4 3/5] misc: eeprom_93xx46: Implement eeprom_93xx46 DT bindings Cory Tusar
2015-12-22 0:12 ` Vladimir Zapolskiy
2016-01-06 3:18 ` Cory Tusar
2015-12-10 4:00 ` [PATCH v4 4/5] misc: eeprom_93xx46: Add quirks to support Atmel AT93C46D device Cory Tusar
2015-12-22 0:19 ` Vladimir Zapolskiy
2016-01-06 3:20 ` Cory Tusar
2015-12-10 4:00 ` [PATCH v4 5/5] misc: eeprom_93xx46: Add support for a GPIO 'select' line Cory Tusar
2015-12-22 0:30 ` Vladimir Zapolskiy
2016-01-06 3:21 ` Cory Tusar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449720055-25965-2-git-send-email-cory.tusar@pid1solutions.com \
--to=cory.tusar@pid1solutions.com \
--cc=Chris.Healy@zii.aero \
--cc=Keith.Vennel@zii.aero \
--cc=afd@ti.com \
--cc=andrew@lunn.ch \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jic23@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=vz@mleia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®