#
1cdb3beb |
|
27-Feb-2024 |
SED4906 <sed4906birdie@gmail.com> |
sdhci: add ACPI-enumerated device support Change-Id: I5c42344b2499bd22581d6b564192decbce937645 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7456 Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
fc5d11e9 |
|
10-Apr-2023 |
Jérôme Duval <jerome.duval@gmail.com> |
busses: remove unneeded PCI_x86.h Change-Id: Ia231eadc02856f68daa0184c12e7d54853ac9322 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6326 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
215b685f |
|
11-Dec-2022 |
X512 <danger_mail@list.ru> |
kernel: Drop non-standard GNU inline assignment syntax * We needed this previously due to our gcc2 compiled kernel. * Now that our kernel is always latest gcc, we can move to the c++20 syntax for inline assignment. * Improves compatibility with clang, less GNU-specific stuff Change-Id: Ib7272a0a52554a31e9a0e788fd3f031db9049795 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5898 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com> Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
#
8b858379 |
|
20-Feb-2022 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci: do the wait for interrupts the straightforward way again In a previous commit I flipped this around because the command interrupt doesn't always trigger on Ricoh controllers. However, this leads to command execution continuing before the interrupt actually triggers on some other controllers. Might solve #17031 but it could also break things on other hardware. Change-Id: I96cba90358f0b04ef1ac319aead898c0f4155114 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4985 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
|
#
455468cb |
|
01-Mar-2022 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci_pci: remove (incomplete) use of MSI MSI was never implemented in this driver and only used for a log during initialization. Remove it for now. This makes it easier to use the driver on non-x86 systems where there is no MSI. Change-Id: I39ccbb82b78ea98c0d045ef07ee9bb28c775e292 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4847 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com> Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
f9e868fc |
|
31-Jan-2022 |
Jérôme Duval <jerome.duval@gmail.com> |
sdhci: accomodate 64-bit PCI BARs * init works better with this. it doesn't work yet, but at least the boot isn't completely borked. * also fix the infinite loop in SoftwareReset() to timeout after 100ms. Change-Id: I76dac8360eaf3575adf7d0b3bf3e2b72daeedb21 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4923 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
ab994345 |
|
27-Jun-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci: actually wait for commands to complete The code allowed execution to continue as soon as the "command inhibit" bit was cleared. This is incorrect: we need to wait for a command result (either command complete, or timeout) to be available before continuing. This should fix #17031. Change-Id: I8f3fe60c2e47582b399952b19c05c6ed2161afd7 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4121 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
e440740a |
|
15-Mar-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci_pci: fix computation of bar index I think this bug was introduced when modifying the code to handle multiple slots. It would result in slots after the first two to use incorrect bar offsets. Should fix one of the problems seen in #16778.
|
#
a59f6b7a |
|
12-Mar-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
mmc_bus: fix possible deadlock when initialization fails Should fix the remaining part of #16778 Change-Id: Ia148f4bde095d33752df788b8f7911ee9cf44c61 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3773 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
e73999aa |
|
26-Jan-2021 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
Build fix.
|
#
20719db9 |
|
26-Jan-2021 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
sdhci_pci: ignore invalid PCI bars. Should fix #16778 Change-Id: I8c8ffa1a7ca5bc4613801563c42d5c5d2b3eb539 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3682 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
2028d638 |
|
17-Jan-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
mmc_disk: implement B_TRIM_DEVICE Change-Id: Ib08a1e196441f35550fe221b912332b4803a04b4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3641 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
5ec64c5c |
|
16-Jan-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sd/mmc: Cleanup and improve reliability Store the bus cookie in the mmc_disk driver and pass it to the bus manager when executing commands. This avoids calling into the device manager at each read and write operation. The code to get the cookie from mmc_disk isn't so nice since it needs to access the grandparent device (the mmc bus root), it would be simpler if this cookie would be available directly from mmc bus devices. We can get card removal and card insertion interrupt at the same time due to insufficient hardware debouncing (the SDHCI spec says we shouldn't, but it happens on Ricoh controllers. Can't blame them, they don't advertise themselves as compliant with the spec). So, check the card status from the interrupt handler and ignore the incorrect interrupts. Fix unreliable card initialization: power must be turned on before starting up the SD clock. Remove a now unneeded delay that was added in an attempt to avoid initial instability. Change-Id: Ibd8d051da1a1d859f3924ee535f4a05d9b6398d4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3639 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
34552f8e |
|
14-Jan-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sd/mmc: enable 4-bit data transfers It works, but performance is still unexpectedly low (getting about 50kB/s write speed) with almost no CPU load. Change-Id: I7da3ee70c8b379c4e6c2250d67f880c78635874f Reviewed-on: https://review.haiku-os.org/c/haiku/+/3630 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
522c141d |
|
12-Jan-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
[WIP] sd/mmc: enable high speed transfers - Switch to 25MHz clock - Switch to 4bit transfers mode (the default is 1bit) Reading and writing SD cards do not seem to work anymore with these changes. I get invalid data on read, and on write, an interrupt is never called in some cases.
|
#
cf155985 |
|
10-Jan-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci_pci: style fix.
|
#
24136793 |
|
08-Jan-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci_pci: support for inserting cards after boot. Change-Id: Ic67ea38bb80b35528ebb1a150d1a916a56184e69 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3617 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
fa1f5839 |
|
07-Jan-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci_pci: fix quirk and interrupt handling for Ricoh device - The quirk was not properly applied due to misuse of the device API - The interrupts could run out of sync, leading to not properly waiting for commands to terminate before reading their result. Add panic to check for that (at the start of the next command) and fix the code. Change-Id: If83b7bbb3c3446d374115ed22c09b91020028578 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3609 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
e41c31cd |
|
05-Jan-2021 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
sdhci: move quirk init to the right place It needs to be done once per device and only after we have decided that the device is supported and should be handled by the driver. Change-Id: Ia00c1fbb151ab181abbfcfaed538cf58985aea07 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3601 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
844c42f0 |
|
04-Jan-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci_pci: fix xupport for Ricoh controllers There is a quirk needed to switch the controller to standard SD mode (copied from FreeBSD). The response type configuration for R7 response was incorrect, this response type does not have a data phase. This made the Ricoh SDHCI implementation generate an unexpected "transfer complete" interrupt, while apparently the implementation in QEMU didn't. The interrupt generation is a bit different from what I got in QEMU when developping the driver, for some commands, we get only a "transfer complete" and no "command complete" interrupt as I'd expect when the command completes. This is handled in the following way: - The interrupt always releases the semaphore to notify that something has happened (once per event) - When the main thread waits for an event, it always uses the same pattern: while (!condition) acquire_sem(...) This pattern makes it not wait at all if the condition is already satisfied. If the interrupt triggers later or already happened when the code gets to execute this while loop, the semaphore can be left with some tokens in it. These will be emptied the next time the thread waits on something. To make sure ths works properly and everything is synchronizing as expected, some extra checks are added before execution of a command to make sure the hardware is in the expected state. There is also lots of extra tracing, I prefer to leave this enabled initially and wait for some other users to test this new driver on their hardware. When we are confident enough that it is compatible with several implementations, we can reduce the tracing or turn it off. Change-Id: Ib9617dbea62f87124dbaad0027b53a13d949641f Reviewed-on: https://review.haiku-os.org/c/haiku/+/3600 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
|
#
d1fee57d |
|
15-Dec-2020 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
mmc_disk: add SDHC support. The main differences: - The initialization sequence requires an additional command (this was already done) - The layout of the CSD register and the way to compute the device geometry from it changes - The read and write commands parameter is a sector number instead of a byte position Change-Id: Ie729e333c9748f36b37acd70c970adfd425cf0b6 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3512 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
|
#
e21a1abe |
|
13-Dec-2020 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
mmc: properly set DMA restrictions - The restrictions are now set by the sdhci bus and retrieved from there by the DMAResources. - Configure SDMA with the maximal available boundary check of 512K and publish the corresponding DMA restrictions. - dma_resource cannot be initialized implicitly as a member of mmc_disk_driver_info because mmc_disk_driver_info is allocated with malloc/free, not new/delete. So we now explicitly allocate and delete it. This allows reads and writes of more than a single block at a time. Change-Id: Ibb97c91543312c7970c28a7a8c68a12708263e32 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3505 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
|
#
9a37366b |
|
12-Dec-2020 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
mmc_disk: add write support Change-Id: I77cf1612569c43e79917ac5a1493b7ab4a04cb47 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3504 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
|
#
7a160a86 |
|
06-Dec-2020 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
mmc_disk: read using "simple DMA" The SDHCI spec also offers an "advanced DMA" mode where we can use scatter-gather lists. It would allow to remove several of the DMA restrictions, but hardware support for it is optional, so we need this version anyway. The geometry is retrieved on demand in the first read or write or in a call to the get geometry or get device size ioctl. It is not possible to retrieve it from the device initialization because that is called as part of the mmc_bus scanning, which needs a specific sequence of commands and keeps the bus locked to prevent drivers to insert their own commands in the middle of that sequence. TODO: - Move the DMA restrictions definition to sdhci_pci and forward it up to mmc_disk (which is the one creating the IOScheduler) - Decide if we want to keep non-DMA support (probably should, but it makes things more complex, because it uses virtual addresses) Change-Id: Ib1dd14eacf62052d747bfb3ef7820bc5a34d3030 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3471 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
|
#
74b60970 |
|
14-Oct-2020 |
Anarchos <sylvain_kerjean@hotmail.com> |
sd/mmc: read, naive method First implementation of reading sectors from an SD card. This is not the best performance for many reasons: - No DMA - Reads only one sector at a time - Cannot read more than 512 bytes per syscall Also there are major limitations: - Cannot read less than 512 bytes. The hardware of course works in full sectors. The mmc_disk driver should go through the io scheduler to make sure requests have a reasonable size and offset, and nothing tries to read just a few bytes in the middle of a sector. - SD cards only (no SDHC, no MMC) Architecture problems: I think too much of the implementation is done in sdhci_pci and should be moved to the upper layers. However it is difficult to say without having implemented DMA (which indeed will be at the low level of the sdhci controller). It doesn't help that the order of operations is a bit different depending on wether there is DMA or not. In DMA mode you first prepare the buffer, then run the command. In non-DMA mode you first send the command, then read the data into the buffer. We need an API at the mmc_bus level that doesn't care about that low-level detail. There are other things that the MMC bus should be doing however, such as switching to different clock speeds depending on which card is activated and how fast it can go. At least the following should be done: - The read method for mmc_bus and sdhci_pci should use a scatter-gather structure as a parameter instead of a single buffer - See if can be integrated into ExecuteCommand at sdhci level (it's essentially a command with an additional data phase) Change-Id: I688b6c694561074535c9c0c2545f06dc04b06e7d Reviewed-on: https://review.haiku-os.org/c/haiku/+/3466 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
f6d7f9f5 |
|
04-Dec-2020 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
sdhci_pci: Remove DumpRegisters function Reading registers can change the state of the device, so we can't do this as a generic debug function. We'll have to more carefully decide which registers to dump in which case. Change-Id: I4a706b749a0dd2f4f0e29b602b90354fbf6d66f8 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3465 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
eb92a834 |
|
26-Jul-2020 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
sd/mmc: fix warnings Change-Id: I5d0c95240cd5594b0f8090f5ec7b3f6ee181dacc Reviewed-on: https://review.haiku-os.org/c/haiku/+/3464 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
47bf2e38 |
|
23-Dec-2018 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci: detect Ricoh SDHCI controllers They don't advertise themselves as standard SDHCI, but are mostly compatible. Only check for the one in my machine for now. Also improve tracing in the probe function. Change-Id: Ia47238fb25b783790fa8caaedf2a71aeb6e29d89 Reviewed-on: https://review.haiku-os.org/c/haiku/+/806 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
d4a66808 |
|
25-Jul-2020 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
sdhci: fix interrupt handling The interrupt handler clears the interrupt register, so the main thread cannot get the errors from there. Save the interrupt state in the handler so that the thread can know if a command succeeded or not. Change-Id: Ibee35c3caed6be8e2552b6c66c4e854a00f5465d Reviewed-on: https://review.haiku-os.org/c/haiku/+/3090 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
cd78ed4d |
|
25-Jul-2020 |
Adrien Destugues <adrien.destugues@opensource.viveris.fr> |
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 Change-Id: Ie70808a5c8b26e6f0f22bd8259a42452903781a3 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3089 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
dedbe94e |
|
17-Feb-2019 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
mmc: register devices for detected cards Change-Id: I90891ead9a425e0e8bd25c2190fe3d430d49411b Reviewed-on: https://review.haiku-os.org/c/haiku/+/1067 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
446dc38f |
|
10-Mar-2019 |
Lee Mon <strongleemon@rambler.ru> |
BugFix: fix some errors found by cppcheck Fix coding style violations and minor errors (race condition in h2generic.cpp). Change-Id: Iec58f2f431de79320579704ac449475f18deb731 Reviewed-on: https://review.haiku-os.org/c/1186 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
518af33f |
|
16-Feb-2019 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
mmc/sd: support for SD v2.0 cards Older cards did not implement CMD8, so handle the command stalling, and proceed with initialization (not querying about SDHC support in that case, as per the spec). Change-Id: Ie842effc2f99e1adf1990b3215be79db493138b5 Reviewed-on: https://review.haiku-os.org/c/1056 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
ff76d2df |
|
10-Feb-2019 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci and mmc implementation sdhci: - Add semaphore for interrupt management - Add basic operations (setting clock, executing a command) - Add early initialization (clocks and power up) - Wrap the bus in a C++ class to ease usage - Expose API to MMC bus manager - TODO: manage card insertion and removal interrupts - TODO: use MSI when available mmc_bus: - Implements SD card management independant of the way we access the bus (later on different drivers can provide the same API as SDHCI) - Worker thread to do the initialization - Implement card initialization process up until getting an RCA from the card. This is the generic part to assign an ID to the card, after this point commands can be targetted at the specific card so it can be handed over to the mmc_disk driver. - TODO: initialization for non-SDHC cards which do not reply to CMD8. Change-Id: I71950ca3ce206378a68fa7f97c19f638183d6cdd Reviewed-on: https://review.haiku-os.org/c/1032 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
601c0fca |
|
10-Feb-2019 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci: silently handle empty interrupts On my system the interrupt line is shared with the PS/2 controller, so there are a lot of unhandled interrupts. Just silently ignore them. Change-Id: Ia6812a5a1d78907622ddebbd03165ed016e26e26 Reviewed-on: https://review.haiku-os.org/c/1031 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
3aef22f7 |
|
10-Feb-2019 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci: implement uninit_bus Also avoid leaking resources in case initialization fails. Change-Id: Ia533182eeeb81b7d52b49510b1f375a4fc55258f Reviewed-on: https://review.haiku-os.org/c/1030 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
cdc4a175 |
|
10-Feb-2019 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci: refactor, get CMD0 working - Define a class for each register, allowing easier access to relevant values. This avoids dealing with bitshifts and magic constants all over the code. - Fix definition of CMD0 and the flags used to submit it. We now get a command completion interrupt, yay! - Make some changes to support v3 and v4 controllers: - Enable PLL (harmless for older versions) - Manage faster and more configurable clock settings Change-Id: I8a97edcb881acc1ac2a8b0a2593930f18e777594 Reviewed-on: https://review.haiku-os.org/c/1029 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
f3755303 |
|
10-Feb-2019 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci: define all registers from spec v4.20 Change-Id: Icf71fc2864bb084292f70c2433029ad2742727c8 Reviewed-on: https://review.haiku-os.org/c/1028 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
#
899da7db |
|
10-Feb-2019 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
sdhci: Cleanup of registrer dump traces - Try to group things on a single line where it makes sense - Use hexadecimal values where appropriate Change-Id: Ia5ebef84db5d511ea2603dfa4ffc9e90f7e86ca7 Reviewed-on: https://review.haiku-os.org/c/1027 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
#
b279d6de |
|
10-Dec-2018 |
Alexander von Gluck IV <kallisti5@unixzen.com> |
busses/mmc/sdhci_pci: Return B_UNHANDLED_INTERRUPT at end of non-void func * I'm making an assumption here this is the desired result since interrupts are unhandled at the end of the function. * Pointed out by gcc
|
#
25b6a6f1 |
|
28-Apr-2018 |
krish_iyer <krishnaniyer97@gmail.com> |
SDHCI MMC Driver 1. SDHCI PCI Bus: Discovering SDHC device from the PCI bus and registers a child node(MMC bus) to which slots are attached. SDHC registers are mapped by MMUIO, they are binded in a structure(struct* registers). A pin based interrupt handler is also installed, which triggers the handler function and interrupts are being taken care of. Added API's to set-up and the clock for SD/MMC card, change frequency and reset the registers. 2. Device Manager: Currently, busses subdir lists are har- dcoded and in order to load the driver. We hard coded the bus dir under PCI devices. 3. MMC Disk Driver: In order to register the slots under /dev/disk/mmc and hence data transfer and other operations can be done. 4. MMC Bus Manager: Setted up a bus manager to create an object to do a particular for eg certain data transfer and get freed until another operation is requested. Change-Id: I369354da6b79adc6b6dfb08fe160334af1392a34 Reviewed-on: https://review.haiku-os.org/318 Reviewed-by: Alexander von Gluck IV <kallisti5@unixzen.com>
|