From: Stefan Berger <stefanb@linux.ibm.com>
To: Chalapathi V <chalapathi.v@linux.ibm.com>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, fbarrat@linux.ibm.com, npiggin@gmail.com,
clg@kaod.org, calebs@us.ibm.com, chalapathi.v@ibm.com,
saif.abrar@linux.vnet.ibm.com
Subject: Re: [PATCH v1 2/5] hw/ppc: SPI controller model - registers implementation
Date: Fri, 8 Mar 2024 10:17:07 -0500 [thread overview]
Message-ID: <4b73cdf8-ce5c-424b-b81d-73c1fd72a385@linux.ibm.com> (raw)
In-Reply-To: <6ab8bb8e-5126-4322-bb91-6709e46c444a@linux.ibm.com>
On 3/7/24 13:54, Stefan Berger wrote:
>
>
> On 2/7/24 11:08, Chalapathi V wrote:
>> SPI controller device model supports a connection to a single SPI
>> responder.
>> This provide access to SPI seeproms, TPM, flash device and an ADC
>> controller.
>>
>> All SPI function control is mapped into the SPI register space to
>> enable full
>> control by firmware. In this commit SPI configuration component is
>> modelled
>> which contains all SPI configuration and status registers as well as
>> the hold
>> registers for data to be sent or having been received.
>>
>> Signed-off-by: Chalapathi V <chalapathi.v@linux.ibm.com>
>
>> + case SEQUENCER_OPERATION_REG:
>> + for (int i = 0; i < SPI_CONTROLLER_REG_SIZE; i++) {
>> + sc->sequencer_operation_reg[i] =
>> + (val & PPC_BITMASK(i * 8 , i * 8 + 7)) >> (63 - (i *
>> 8 + 7));
>
> To me it would be more obvious if you used a mask here like this:
>
> mask = PPC_BIT_MASK(0, 7);
> mask = (0xff << 56);
>
> for (...) {
> sc->sequencer_operation_reg[i] = (val & mask) >> (56 - i * 8);
> mask >>= 8;
> }
>
Actually simpler and even this masking is not necessary:
for (...) {
sc->sequencer_operation_reg[i] = (val >> (56 - i * 8)) & 0xff;
}
next prev parent reply other threads:[~2024-03-08 15:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 16:08 [PATCH v1 0/5] hw/ppc: SPI model Chalapathi V
2024-02-07 16:08 ` [PATCH v1 1/5] hw/ppc: SPI responder model Chalapathi V
2024-03-08 16:00 ` Stefan Berger
2024-02-07 16:08 ` [PATCH v1 2/5] hw/ppc: SPI controller model - registers implementation Chalapathi V
2024-03-07 18:54 ` Stefan Berger
2024-03-07 19:11 ` Stefan Berger
2024-03-08 15:17 ` Stefan Berger [this message]
2024-02-07 16:08 ` [PATCH v1 3/5] hw/ppc: SPI controller model - sequencer and shifter Chalapathi V
2024-03-08 19:36 ` Stefan Berger
2024-02-07 16:08 ` [PATCH v1 4/5] hw/ppc: SPI SEEPROM model Chalapathi V
2024-03-08 15:14 ` Stefan Berger
2024-02-07 16:08 ` [PATCH v1 5/5] hw/ppc: SPI controller wiring to P10 chip and create seeprom device Chalapathi V
2024-03-01 16:17 ` [PATCH v1 0/5] hw/ppc: SPI model Chalapathi V
2024-03-01 16:36 ` Cédric Le Goater
2024-03-01 18:33 ` Chalapathi V
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=4b73cdf8-ce5c-424b-b81d-73c1fd72a385@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=calebs@us.ibm.com \
--cc=chalapathi.v@ibm.com \
--cc=chalapathi.v@linux.ibm.com \
--cc=clg@kaod.org \
--cc=fbarrat@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=saif.abrar@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).