FreeBSD Bugzilla – Attachment 214992 Details for
Bug 204521
[new driver] [request] Port rtsx from OpenBSD to FreeBSD
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
do not read BIPR to often..
refactorcarddetection.diff (text/plain), 2.70 KB, created by
Jesper Schmitz Mouridsen
on 2020-05-28 20:54:00 UTC
(
hide
)
Description:
do not read BIPR to often..
Filename:
MIME Type:
Creator:
Jesper Schmitz Mouridsen
Created:
2020-05-28 20:54:00 UTC
Size:
2.70 KB
patch
obsolete
>diff --git a/rtsx.c b/rtsx.c >index 13ce3df..e46f0dc 100644 >--- a/rtsx.c >+++ b/rtsx.c >@@ -434,6 +434,11 @@ rtsx_intr(void *arg) > /* start task to handle SD card status change */ > /* from dwmmc.c */ > if (status & RTSX_SD_INT) { >+ if(status & RTSX_SD_EXIST) { >+ sc->rtsx_flags |= RTSX_F_CARD_PRESENT; >+ } else { >+ sc->rtsx_flags &= ~RTSX_F_CARD_PRESENT; >+ } > device_printf(sc->rtsx_dev, "Card inserted/removed\n"); > rtsx_handle_card_present(sc); > } >@@ -488,8 +493,8 @@ rtsx_handle_card_present(struct rtsx_softc *sc) > bool was_present; > bool is_present; > >- was_present = sc->rtsx_mmc_dev != NULL; >- is_present = rtsx_is_card_present(sc); >+ was_present = sc->rtsx_mmc_dev != NULL; >+ is_present = rtsx_is_card_present(sc); > > if (!was_present && is_present) { > /* small delay for the controller */ >@@ -506,10 +511,9 @@ rtsx_card_task(void *arg, int pending __unused) > { > struct rtsx_softc *sc = arg; > >- RTSX_LOCK(sc); > >+ RTSX_LOCK(sc); > if (rtsx_is_card_present(sc)) { >- sc->rtsx_flags |= RTSX_F_CARD_PRESENT; > /* Card is present, attach if necessary */ > if (sc->rtsx_mmc_dev == NULL) { > if (bootverbose) >@@ -527,16 +531,16 @@ rtsx_card_task(void *arg, int pending __unused) > RTSX_UNLOCK(sc); > > } else { >- sc->rtsx_flags &= ~RTSX_F_CARD_PRESENT; > /* Card isn't present, detach if necessary */ > if (sc->rtsx_mmc_dev != NULL) { > if (bootverbose) > device_printf(sc->rtsx_dev, "Card removed\n"); >- >+ RTSX_UNLOCK(sc); > if (device_delete_child(sc->rtsx_dev, sc->rtsx_mmc_dev)) > device_printf(sc->rtsx_dev, "Detaching MMC bus failed\n"); >- sc->rtsx_mmc_dev = NULL; >- RTSX_UNLOCK(sc); >+ RTSX_LOCK(sc); >+ sc->rtsx_mmc_dev = NULL; >+ RTSX_UNLOCK(sc); > } else > RTSX_UNLOCK(sc); > } >@@ -545,10 +549,7 @@ rtsx_card_task(void *arg, int pending __unused) > static int > rtsx_is_card_present(struct rtsx_softc *sc) > { >- uint32_t status; >- >- status = READ4(sc, RTSX_BIPR); >- return (status & RTSX_SD_EXIST); >+ return ISSET(sc->rtsx_flags,RTSX_F_CARD_PRESENT); > } > > static int >@@ -591,7 +592,8 @@ rtsx_init(struct rtsx_softc *sc) > /* Clear any pending interrupts. */ > status = READ4(sc, RTSX_BIPR); > WRITE4(sc, RTSX_BIPR, status); >- >+ if (status & RTSX_SD_EXIST) >+ sc->rtsx_flags |= RTSX_F_CARD_PRESENT; > /* Enable interrupts. */ > WRITE4(sc, RTSX_BIER, > RTSX_TRANS_OK_INT_EN | RTSX_TRANS_FAIL_INT_EN | RTSX_SD_INT_EN); >@@ -2206,7 +2208,8 @@ rtsx_attach(device_t dev) > * Schedule a card detection as we won't get an interrupt > * if the card is inserted when we attach > */ >- rtsx_card_task(sc, 0); >+ >+ rtsx_card_task(sc, 0); > > if (bootverbose) > device_printf(dev, "Device attached\n");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 204521
:
209887
|
214731
|
214733
|
214797
|
214840
|
214925
|
214987
| 214992 |
215518
|
215853
|
215874
|
215893
|
215894