From: christopher tyerman <linuxkernel@fbautosys.co.uk>
To: linux-spi@vger.kernel.org
Subject: Remap, SPI and parity bit
Date: Sun, 14 Nov 2021 18:41:00 +0000 [thread overview]
Message-ID: <d9ef0f42-4ebe-b7db-f18f-8652dcf38ca0@fbautosys.co.uk> (raw)
hello
I'm not sure if this is the correct place to be asking this, if there is
a better place please redirect me.
I'm currently working on a kernel driver for the Texas Instruments
tps92518-Q1 and tps92518HV-Q1.
This device uses 16-bit SPI Frames (7-bit control, 9-bit data).
is "Command Frame"
|1-bit command bit 5-bit Address 1-bit parity 9-bit data|
requires a parity bit
|PARITY = XNOR(CMD, A4..A0, D8..D0)|
I'm trying to use regmaps where possible and I can define a regmap, e.g.
|static struct regmap_config tps92518_regmap_config = { .reg_bits = 6,
.pad_bits = 1, // parity bit .val_bits = 9, .max_register =
tps92518_RESET, }; |
however so far i cannot currently see how to automatically calculate it
without replacing large chunks of code
e.g replacing chunks of /drivers/base/regmap/regmap-spi.c with a new
regmap_bus
some where i need to be able to calculate and insert a parity bit
is there anywhere i can setup a callback that preprocesses the spi
frames before sending?
I'm working up the chain an i can see a potential patch to regmaps that
would fix this if nothing better already exists
with regmap_config exists /@read_flag_mask/ and /@write_flag_mask/,
along the same line there could be added a "@read_parity_mask" and
"@write_parity_mask"
and an optional "@reg_parity" callback that calculates the parity
from/reg/ and /val/ similar/@reg_read/ and /@reg_write/ but without
replacing the entire read/write operations
I may even be able to write this but that is outside the spi-subsystem,
and i'm currently not sure what list regmaps fall under
i apologise if this is the wrong list and, thankyou for any responses
kind regards
christopher tyerman
next reply other threads:[~2021-11-14 18:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-14 18:41 christopher tyerman [this message]
2021-11-15 15:14 ` Remap, SPI and parity bit Andy Shevchenko
2021-11-15 18:36 ` Mark Brown
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=d9ef0f42-4ebe-b7db-f18f-8652dcf38ca0@fbautosys.co.uk \
--to=linuxkernel@fbautosys.co.uk \
--cc=linux-spi@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).