* [PATCH 1/2] mci: improve packing of struct mci
@ 2024-04-03 9:03 Ahmad Fatoum
2024-04-03 9:03 ` [PATCH 2/2] mci: remove FIXME in rca description Ahmad Fatoum
2024-04-03 12:25 ` [PATCH 1/2] mci: improve packing of struct mci Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-04-03 9:03 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
rca will be at least 4-byte aligned due to being after a 4-byte member.
It's only 2 byte long though and followed by another 4 byte member,
wasting 2 bytes. Fill those up with the two 1-byte bool members we have.
This includes a change of type for high_capacity: This is ok, because
only 0 or 1 are ever saved into it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/mci.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/mci.h b/include/mci.h
index 52bf84ecdbe2..5781fb8ea381 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -559,15 +559,14 @@ struct mci {
struct mci_host *host; /**< the host for this card */
struct device dev; /**< the device for our disk (mcix) */
unsigned version;
- bool sdio; /**< card is a SDIO card */
- /** != 0 when a high capacity card is connected (OCR -> OCR_HCS) */
- int high_capacity;
unsigned card_caps; /**< Card's capabilities */
unsigned ocr; /**< card's "operation condition register" */
unsigned scr[2];
unsigned csd[4]; /**< card's "card specific data register" */
unsigned cid[4]; /**< card's "card identification register" */
unsigned short rca; /* FIXME */
+ bool sdio; /**< card is a SDIO card */
+ bool high_capacity; /**< high capacity card is connected (OCR -> OCR_HCS) */
unsigned tran_speed; /**< Maximum transfer speed */
/** currently used data block length for read accesses */
unsigned read_bl_len;
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] mci: remove FIXME in rca description
2024-04-03 9:03 [PATCH 1/2] mci: improve packing of struct mci Ahmad Fatoum
@ 2024-04-03 9:03 ` Ahmad Fatoum
2024-04-03 12:25 ` [PATCH 1/2] mci: improve packing of struct mci Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-04-03 9:03 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The FIXME was added in the commit introducing the file many years ago.
The RCA is a bit special in that it's unused for SPI, reported by the
card for MMC and set by the host for SD. There are comments describing
this in the MCI core, so just explain the abbreviation in the
documentation comment.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/mci.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/mci.h b/include/mci.h
index 5781fb8ea381..2274ca8e97d5 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -564,7 +564,7 @@ struct mci {
unsigned scr[2];
unsigned csd[4]; /**< card's "card specific data register" */
unsigned cid[4]; /**< card's "card identification register" */
- unsigned short rca; /* FIXME */
+ unsigned short rca; /**< relative card address */
bool sdio; /**< card is a SDIO card */
bool high_capacity; /**< high capacity card is connected (OCR -> OCR_HCS) */
unsigned tran_speed; /**< Maximum transfer speed */
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] mci: improve packing of struct mci
2024-04-03 9:03 [PATCH 1/2] mci: improve packing of struct mci Ahmad Fatoum
2024-04-03 9:03 ` [PATCH 2/2] mci: remove FIXME in rca description Ahmad Fatoum
@ 2024-04-03 12:25 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-04-03 12:25 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Wed, 03 Apr 2024 11:03:52 +0200, Ahmad Fatoum wrote:
> rca will be at least 4-byte aligned due to being after a 4-byte member.
> It's only 2 byte long though and followed by another 4 byte member,
> wasting 2 bytes. Fill those up with the two 1-byte bool members we have.
>
> This includes a change of type for high_capacity: This is ok, because
> only 0 or 1 are ever saved into it.
>
> [...]
Applied, thanks!
[1/2] mci: improve packing of struct mci
https://git.pengutronix.de/cgit/barebox/commit/?id=126a04803941 (link may not be stable)
[2/2] mci: remove FIXME in rca description
https://git.pengutronix.de/cgit/barebox/commit/?id=fa6c38a55d8d (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-03 12:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03 9:03 [PATCH 1/2] mci: improve packing of struct mci Ahmad Fatoum
2024-04-03 9:03 ` [PATCH 2/2] mci: remove FIXME in rca description Ahmad Fatoum
2024-04-03 12:25 ` [PATCH 1/2] mci: improve packing of struct mci Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox