[PATCH] MMC/SD SPI-mode driver
Warner Losh
imp at bsdimp.com
Wed Apr 10 23:51:38 UTC 2013
On Apr 10, 2013, at 5:22 PM, Adrian Chadd wrote:
> 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.
At least in the bus code we won't have to put this code into each of our SPI flash drivers...
Warner
More information about the freebsd-mips
mailing list