[PATCH] MMC/SD SPI-mode driver
Adrian Chadd
adrian at freebsd.org
Wed Apr 10 23:22:52 UTC 2013
On 10 April 2013 11:50, Ian Lepore <ian at freebsd.org> wrote:
> Maybe something like this could work?
>
> static int
> ar71xx_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
> {
> if (cmd->cs == sc->magic_mapped_flash_chipsel &&
> cmd->tx_cmd == NULL && cmd->tx_data == NULL &&
> *(uint8_t *)cmd->rx_cmd == SPIFLASH_READ_OPCODE &&
> /* maybe some other constraints I don't know about */
> /* maybe even check that child is the mx25l driver */)
> return do_magic_mapped_read(...);
> else
> return do_mundane_nonmapped_transfer(...);
> }
So you're special casing it in the bus code rather than the driver
code. It's still ugly, but it's hid from the driver.
Adrian
More information about the freebsd-mips
mailing list