// SPDX-License-Identifier: GPL-2.0-or-later /* * smssdio.c - Siano 1xxx SDIO interface driver * * Copyright 2008 Pierre Ossman * * Based on code by Siano Mobile Silicon, Inc., * Copyright (C) 2006-2008, Uri Shkolnik * * This hardware is a bit odd in that all transfers should be done * to/from the SMSSDIO_DATA register, yet the "increase address" bit * always needs to be set. * * Also, buffers from the card are always aligned to 128 byte * boundaries.
*/
/* * General cleanup notes: * * - only typedefs should be name *_t * * - use ERR_PTR and friends for smscore_register_device() * * - smscore_getbuffer should zero fields * * Fix stop command
*/
/* * The interrupt register has no defined meaning. It is just * a way of turning of the level triggered interrupt.
*/
(void)sdio_readb(func, SMSSDIO_INT, &ret); if (ret) {
pr_err("Unable to read interrupt register!\n"); return;
}
if (smsdev->split_cb == NULL) {
cb = smscore_getbuffer(smsdev->coredev); if (!cb) {
pr_err("Unable to allocate data buffer!\n"); return;
}
ret = sdio_memcpy_fromio(smsdev->func,
cb->p,
SMSSDIO_DATA,
SMSSDIO_BLOCK_SIZE); if (ret) {
pr_err("Error %d reading initial block!\n", ret); return;
}
hdr = cb->p;
if (hdr->msg_flags & MSG_HDR_FLAG_SPLIT_MSG) {
smsdev->split_cb = cb; return;
}
/* * First attempt to transfer all of it in one go...
*/
ret = sdio_memcpy_fromio(smsdev->func,
buffer,
SMSSDIO_DATA,
size); if (ret && ret != -EINVAL) {
smscore_putbuffer(smsdev->coredev, cb);
pr_err("Error %d reading data from card!\n", ret); return;
}
/* * ..then fall back to one block at a time if that is * not possible... * * (we have to do this manually because of the * problem with the "increase address" bit)
*/ if (ret == -EINVAL) { while (size) {
ret = sdio_memcpy_fromio(smsdev->func,
buffer, SMSSDIO_DATA,
smsdev->func->cur_blksize); if (ret) {
smscore_putbuffer(smsdev->coredev, cb);
pr_err("Error %d reading data from card!\n",
ret); return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.