From Adrien Destugues <pulkomandy@xxxxxxxxx>:
Adrien Destugues has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/3089 ;)
Change subject: sdhci: fix response type definitions
......................................................................
sdhci: fix response type definitions
These are apparently ignored by the Ricoh controller I did my previous
testing on, but QEMU is more strict about them
---
M src/add-ons/kernel/busses/mmc/sdhci_pci.cpp
M src/add-ons/kernel/busses/mmc/sdhci_pci.h
2 files changed, 32 insertions(+), 18 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/89/3089/1
diff --git a/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp
b/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp
index 83faa49..6e599b0 100644
--- a/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp
+++ b/src/add-ons/kernel/busses/mmc/sdhci_pci.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2019 Haiku, Inc. All rights reserved.
+ * Copyright 2018-2020 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -240,17 +240,19 @@
return B_ERROR;
}
- if (replyType == Command::kNoReplyType) {
- // No response
- } else if (replyType == Command::kR2Type) {
- // 128 bit response
- response[0] = fRegisters->response[0];
- response[1] = fRegisters->response[1];
- response[2] = fRegisters->response[2];
- response[3] = fRegisters->response[3];
- } else {
- // 32 bit response
- *response = fRegisters->response[0];
+ switch (replyType & Command::kReplySizeMask) {
+ case Command::k32BitResponse:
+ *response = fRegisters->response[0];
+ break;
+ case Command::k128BitResponse:
+ response[0] = fRegisters->response[0];
+ response[1] = fRegisters->response[1];
+ response[2] = fRegisters->response[2];
+ response[3] = fRegisters->response[3];
+ break;
+ default:
+ // No response
+ break;
}
ERROR("Command execution complete\n");
diff --git a/src/add-ons/kernel/busses/mmc/sdhci_pci.h
b/src/add-ons/kernel/busses/mmc/sdhci_pci.h
index 68bf7e5..34c0bd6 100644
--- a/src/add-ons/kernel/busses/mmc/sdhci_pci.h
+++ b/src/add-ons/kernel/busses/mmc/sdhci_pci.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2019 Haiku, Inc. All rights reserved.
+ * Copyright 2018-2020 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -30,12 +30,24 @@
fBits = (command << 8) | type;
}
+ static const uint8_t kDataPresent = 0x20;
+ static const uint8_t kCheckIndex = 0x10;
+ static const uint8_t kCRCEnable = 0x8;
+ static const uint8_t kSubCommand = 0x4;
+ static const uint8_t kReplySizeMask = 0x3;
+ static const uint8_t k32BitResponse = 0x2;
+ static const uint8_t k128BitResponse = 0x1;
+
+ // For simplicity pre-define the standard response types from
the SD
+ // card specification
static const uint8_t kNoReplyType = 0;
- static const uint8_t kR1Type = 0x1C;
- static const uint8_t kR2Type = 0x09;
- static const uint8_t kR3Type = 0x02;
- static const uint8_t kR6Type = 0x1C;
- static const uint8_t kR7Type = 0x3C;
+ static const uint8_t kR1Type = kCheckIndex | kCRCEnable
+ | k32BitResponse;
+ static const uint8_t kR2Type = kCRCEnable | k128BitResponse;
+ static const uint8_t kR3Type = k32BitResponse;
+ static const uint8_t kR6Type = kCheckIndex | k32BitResponse;
+ static const uint8_t kR7Type = kDataPresent | kCheckIndex |
kCRCEnable
+ | k32BitResponse;
private:
volatile uint16_t fBits;
--
To view, visit https://review.haiku-os.org/c/haiku/+/3089
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ie70808a5c8b26e6f0f22bd8259a42452903781a3
Gerrit-Change-Number: 3089
Gerrit-PatchSet: 1
Gerrit-Owner: Adrien Destugues <pulkomandy@xxxxxxxxx>
Gerrit-MessageType: newchange