Do not use read-modify-write on MSC control register.
The register is write-only, so just write only bits we want. Submitted by: jmcneill
This commit is contained in:
parent
249579387f
commit
47abdb10a0
@ -412,13 +412,9 @@ static int
|
||||
jz4780_mmc_reset(struct jz4780_mmc_softc *sc)
|
||||
{
|
||||
int timeout;
|
||||
int reg;
|
||||
|
||||
/* Stop the clock */
|
||||
reg = JZ_MMC_READ_4(sc, JZ_MSC_CTRL);
|
||||
reg &= ~(JZ_CLOCK_CTRL_M);
|
||||
reg |= JZ_CLOCK_STOP;
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, reg);
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, JZ_CLOCK_STOP);
|
||||
|
||||
timeout = 1000;
|
||||
while (--timeout > 0) {
|
||||
@ -432,9 +428,7 @@ jz4780_mmc_reset(struct jz4780_mmc_softc *sc)
|
||||
}
|
||||
|
||||
/* Reset */
|
||||
reg = JZ_MMC_READ_4(sc, JZ_MSC_CTRL);
|
||||
reg |= JZ_RESET;
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, reg);
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, JZ_RESET);
|
||||
|
||||
timeout = 10;
|
||||
while (--timeout > 0) {
|
||||
@ -647,7 +641,7 @@ jz4780_mmc_request(device_t bus, device_t child, struct mmc_request *req)
|
||||
{
|
||||
struct jz4780_mmc_softc *sc;
|
||||
struct mmc_command *cmd;
|
||||
uint32_t cmdat, ctrl, iwait;
|
||||
uint32_t cmdat, iwait;
|
||||
int blksz;
|
||||
|
||||
sc = device_get_softc(bus);
|
||||
@ -731,9 +725,7 @@ jz4780_mmc_request(device_t bus, device_t child, struct mmc_request *req)
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CMD, cmd->opcode);
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CMDAT, cmdat);
|
||||
|
||||
ctrl = JZ_MMC_READ_4(sc, JZ_MSC_CTRL);
|
||||
ctrl |= JZ_START_OP | JZ_CLOCK_START;
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, ctrl);
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, JZ_START_OP | JZ_CLOCK_START);
|
||||
|
||||
callout_reset(&sc->sc_timeoutc, sc->sc_timeout * hz,
|
||||
jz4780_mmc_timeout, sc);
|
||||
@ -853,8 +845,7 @@ jz4780_mmc_disable_clock(struct jz4780_mmc_softc *sc)
|
||||
{
|
||||
int timeout;
|
||||
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL,
|
||||
JZ_MMC_READ_4(sc, JZ_MSC_CTRL) | JZ_CLOCK_STOP);
|
||||
JZ_MMC_WRITE_4(sc, JZ_MSC_CTRL, JZ_CLOCK_STOP);
|
||||
|
||||
for (timeout = 1000; timeout > 0; timeout--)
|
||||
if ((JZ_MMC_READ_4(sc, JZ_MSC_STAT) & JZ_CLK_EN) == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user