Date: Fri, 4 May 2012 12:23:06 -0400 From: Patrick Kelsey <kelsey@ieee.org> To: freebsd-mips@freebsd.org Subject: Re: [PATCH] MMC/SD SPI-mode driver Message-ID: <CAD44qMUTc06kQQo9aa9gZ-eYFrJMAYd1L1cnBz25XBzPJ7zcyw@mail.gmail.com> In-Reply-To: <CAD44qMW5jyno5BB%2BQg0Tg_wZA3opK%2BYVUzXHO69Y27ZKtDm7Ew@mail.gmail.com> References: <CAD44qMW5jyno5BB%2BQg0Tg_wZA3opK%2BYVUzXHO69Y27ZKtDm7Ew@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--0023544706e0e22de504bf385516 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Mar 10, 2012 at 9:13 PM, Patrick Kelsey <kelsey@ieee.org> wrote: > There are two .diff files attached to this message. The first is an > MMC/SD SPI-mode driver (mmcspi) that implements the existing mmc/sd > bridge interface and talks to the spibus interface (the latter with a > few modifications). The second is the changes to the ar71xx_spi > driver that I made to support the mmcspi driver. I developed these > patches using a MikroTik RB450G and tested it with 31 different > microSD cards. > > Change details for mmcspi.diff: > > Existing mmc/sd stack: > - Added concept of bus type (bus_type_sd vs. bus_type_spi) > - Fixed some typos > - Fixed some math errors in csd decode > - Fixed bad lookup table > - Fixed bad arg to mmc_send_app_op_cond() during probe > - Added setting of block length on card > - Added detection (and skipping) of password-locked cards > - Avoid card select and bus timing commands when bus type is bus_type_spi > - Added new command flag MMC_CMD_IS_APP to annotate ACMD_x commands > > Existing spibus interface: > - Incorporated Luiz Otavio O Souza's acquire/release/write patch > - Added configuration methods > - Added flag to allow transactions with chip select high (needed for > proper sd card init) > > > Change details for ar71xx_spi.diff > - Incorporated Luiz Otavio O Souza's patch implementing his changes to > spibus_if > - Added configuration methods and clock setting support > > I updated the patches to apply cleanly against -HEAD (r234999) and removed a lookup table bug fix in mmc.c that has since been fixed separately. -Patrick --0023544706e0e22de504bf385516 Content-Type: application/octet-stream; name="mmcspi_r234999.diff" Content-Disposition: attachment; filename="mmcspi_r234999.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h1tgbboq2 SW5kZXg6IHN5cy9hcm0vYXQ5MS9hdDkxX21jaS5jCj09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5cy9hcm0vYXQ5 MS9hdDkxX21jaS5jCShyZXZpc2lvbiAyMzQ5OTkpCisrKyBzeXMvYXJtL2F0OTEvYXQ5MV9tY2ku Ywkod29ya2luZyBjb3B5KQpAQCAtNjk5LDYgKzY5OSw5IEBACiAJc3dpdGNoICh3aGljaCkgewog CWRlZmF1bHQ6CiAJCXJldHVybiAoRUlOVkFMKTsKKwljYXNlIE1NQ0JSX0lWQVJfQlVTX1RZUEU6 CisJCSooaW50ICopcmVzdWx0ID0gYnVzX3R5cGVfc2Q7CisJCWJyZWFrOwogCWNhc2UgTU1DQlJf SVZBUl9CVVNfTU9ERToKIAkJKihpbnQgKilyZXN1bHQgPSBzYy0+aG9zdC5pb3MuYnVzX21vZGU7 CiAJCWJyZWFrOwpAQCAtNzgyLDYgKzc4NSw3IEBACiAJCXNjLT5ob3N0Lmlvcy52ZGQgPSB2YWx1 ZTsKIAkJYnJlYWs7CiAJLyogVGhlc2UgYXJlIHJlYWQtb25seSAqLworCWNhc2UgTU1DQlJfSVZB Ul9CVVNfVFlQRToKIAljYXNlIE1NQ0JSX0lWQVJfQ0FQUzoKIAljYXNlIE1NQ0JSX0lWQVJfSE9T VF9PQ1I6CiAJY2FzZSBNTUNCUl9JVkFSX0ZfTUlOOgpJbmRleDogc3lzL2NvbmYvZmlsZXMKPT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PQotLS0gc3lzL2NvbmYvZmlsZXMJKHJldmlzaW9uIDIzNDk5OSkKKysrIHN5cy9jb25m L2ZpbGVzCSh3b3JraW5nIGNvcHkpCkBAIC0xNjA2LDYgKzE2MDYsNyBAQAogZGV2L21tYy9tbWNi cl9pZi5tCQlzdGFuZGFyZAogZGV2L21tYy9tbWNidXNfaWYubQkJc3RhbmRhcmQKIGRldi9tbWMv bW1jc2QuYwkJCW9wdGlvbmFsIG1tY3NkCitkZXYvbW1jL21tY3NwaS5jCQlvcHRpb25hbCBtbWNz cGkKIGRldi9tbi9pZl9tbi5jCQkJb3B0aW9uYWwgbW4gcGNpCiBkZXYvbXBzL21wcy5jCQkJb3B0 aW9uYWwgbXBzCiBkZXYvbXBzL21wc19jb25maWcuYwkJb3B0aW9uYWwgbXBzCkluZGV4OiBzeXMv bW9kdWxlcy9tbWNzcGkvTWFrZWZpbGUKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gc3lzL21vZHVsZXMvbW1jc3Bp L01ha2VmaWxlCShyZXZpc2lvbiAwKQorKysgc3lzL21vZHVsZXMvbW1jc3BpL01ha2VmaWxlCShy ZXZpc2lvbiAwKQpAQCAtMCwwICsxLDcgQEAKKworLlBBVEg6ICR7LkNVUkRJUn0vLi4vLi4vZGV2 L21tYworCitLTU9EPQltbWNzcGkKK1NSQ1M9CW1tY3NwaS5jIG1tY2JyX2lmLmggc3BpYnVzX2lm LmggZGV2aWNlX2lmLmggYnVzX2lmLmgKKworLmluY2x1ZGUgPGJzZC5rbW9kLm1rPgpJbmRleDog c3lzL2Rldi9tbWMvbW1jYnJ2YXIuaAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMvZGV2L21tYy9tbWNicnZh ci5oCShyZXZpc2lvbiAyMzQ5OTkpCisrKyBzeXMvZGV2L21tYy9tbWNicnZhci5oCSh3b3JraW5n IGNvcHkpCkBAIC02MCw2ICs2MCw3IEBACiAjaW5jbHVkZSAibW1jYnJfaWYuaCIKIAogZW51bSBt bWNicl9kZ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9sZW5ndGgpOworCisJVFJBQ0VfRVhJVChkZXYpOworCXJldHVybiAoTU1DX0VS Ul9OT05FKTsKK30KKworCitzdGF0aWMgdW5zaWduZWQgaW50CittbWNzcGlfc2hpZnRfY29weSh1 aW50OF90ICpkZXN0LCB1aW50OF90ICpzcmMsIHVuc2lnbmVkIGludCBkZXN0X2xlbiwKKwkJICB1 bnNpZ25lZCBpbnQgc2hpZnQpCit7CisJdW5zaWduZWQgaW50IGk7CisKKwlpZiAoMCA9PSBzaGlm dCkgeworCQltZW1jcHkoZGVzdCwgc3JjLCBkZXN0X2xlbik7CisJfSBlbHNlIHsKKwkJZm9yIChp ID0gMDsgaSA8IGRlc3RfbGVuOyBpKyspIHsKKwkJCWRlc3RbaV0gPQorCQkJICAgIChzcmNbaV0g PDwgc2hpZnQpIHwgCisJCQkgICAgKHNyY1tpICsgMV0gPj4gKDggLSBzaGlmdCkpOworCQl9CisJ fQorCisJcmV0dXJuIChkZXN0X2xlbik7Cit9CisKKworc3RhdGljIHVuc2lnbmVkIGludAorbW1j c3BpX2dldF9yZXNwb25zZV90b2tlbihkZXZpY2VfdCBkZXYsIHVpbnQ4X3QgbWFzaywgdWludDhf dCB2YWx1ZSwKKwkJCSAgdW5zaWduZWQgaW50IGxlbiwgdW5zaWduZWQgaW50IGhhc19idXN5LAor CQkJICB1aW50OF90ICpyc3BidWYpCit7CisJaW50IGk7CisJdW5zaWduZWQgaW50IGVycjsKKwl1 bnNpZ25lZCBpbnQgb2Zmc2V0OworCXVuc2lnbmVkIGludCBzaGlmdCA9IDA7CisJdW5zaWduZWQg aW50IHJlbWFpbmluZzsKKwlib29sZWFuX3QgZm91bmQ7CisJdWludDhfdCBwb2xsYnVmWzIgKiBN TUNTUElfTUFYX1JTUF9MRU5dOworCXN0cnVjdCBiaW50aW1lIHN0YXJ0LCBlbGFwc2VkOworCisJ VFJBQ0VfRU5URVIoZGV2KTsKKworCS8qCisJICogVGhpcyBsb29wIHNlYXJjaGVzIGRhdGEgY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xNiAqIG51bV9saW5lczsKKworCWZvcihpID0gMDsg aSA8IG51bV9saW5lczsgaSsrKSB7CisJCWRldmljZV9wcmludGYoZGV2LCAiJXM6IiwgbGFiZWwp OworCQlmb3IoaiA9IDA7IGogPCAxNjsgaisrKSB7CisJCQlwcmludGYoIiAlMDJ4IiwgZGF0YVtp ICogMTYgKyBqXSk7IAorCQl9CisJCXByaW50ZigiXG4iKTsKKwl9CisKKwlpZiAocmVzaWR1YWwp IHsKKwkJZGV2aWNlX3ByaW50ZihkZXYsICIlczoiLCBsYWJlbCk7CisJCWZvcihqID0gMDsgaiA8 IHJlc2lkdWFsOyBqKyspIHsKKwkJCXByaW50ZigiICUwMngiLCBkYXRhW251bV9saW5lcyAqIDE2 ICsgal0pOyAKKwkJfQorCQlwcmludGYoIlxuIik7CisJfQorCisJVFJBQ0VfRVhJVChkZXYpOwor fQorCisKK3N0YXRpYyB2b2lkCittbWNzcGlfZHVtcF9zcGlfYnVzKGRldmljZV90IGRldiwgdW5z aWduZWQgaW50IGxlbikKK3sKKwlUUkFDRV9FTlRFUihkZXYpOworCisJdW5zaWduZWQgaW50IG51 bV9ibG9ja3MgPSBsZW4gLyBNTUNTUElfREFUQV9CTE9DS19MRU47CisJdW5zaWduZWQgaW50IHJl c2lkdWFsID0gbGVuIC0gbnVtX2Jsb2NrcyAqIE1NQ1NQSV9EQVRBX0JMT0NLX0xFTjsKKwl1bnNp Z25lZCBpbnQgaTsKKworCWZvcihpID0gMDsgaSA8IG51bV9ibG9ja3M7IGkrKykgeworCQlpZiAo TU1DX0VSUl9OT05FICE9CisJCSAgICBtbWNzcGlfZG9fc3BpX3JlYWQoZGV2LCBqdW5rYnVmLCBN TUNTUElfREFUQV9CTE9DS19MRU4pKSB7CisJCQlkZXZpY2VfcHJpbnRmKGRldiwgInNwaSByZWFk IGZhaWxlZFxuIik7CisJCQlyZXR1cm47CisJCX0KKworCQltbWNzcGlfZHVtcF9kYXRhKGRldiwg ImJ1c19kYXRhIiwganVua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mQgc2VsZWN0IHRoZSBkZXZpY2UKKyMKK01FVEhPRCB2b2lkIGFj cXVpcmVfYnVzIHsKKwlkZXZpY2VfdCBkZXY7CisJZGV2aWNlX3QgY2hpbGQ7Cit9OworCisjCisj IFJlbGVhc2UgYnVzIGFuZCBkZXNlbGVjdCB0aGUgZGV2aWNlCisjCitNRVRIT0Qgdm9pZCByZWxl YXNlX2J1cyB7CisJZGV2aWNlX3QgZGV2OworCWRldmljZV90IGNoaWxkOworfTsKKworIwogIyBE byBhIHNwaSBjb21tYW5kCiAjCiBNRVRIT0QgaW50IHRyYW5zZmVyIHsKQEAgLTM5LDMgKzU1LDI4 IEBACiAJZGV2aWNlX3QgY2hpbGQ7CiAJc3RydWN0IHNwaV9jb21tYW5kICpjbWQ7CiB9OworCisj CisjIFdyaXRlIGEgY29tbWFuZCB0byBzcGlidXMKKyMKK01FVEhPRCBpbnQgd3JpdGUgeworCWRl dmljZV90IGRldjsKKwl1aW50MzJfdCByZWc7CisJdWludDMyX3QgZGF0YTsKK307CisKKyMKKyMg R2V0IHNwaWJ1cyBjb25maWd1cmF0aW9uCisjCitNRVRIT0QgaW50IGdldF9jb25maWcgeworCWRl dmljZV90IGRldjsKKwlzdHJ1Y3Qgc3BpX2NvbmZpZyAqY2ZnOworfTsKKworIworIyBTZXQgc3Bp YnVzIGNvbmZpZ3VyYXRpb24KKyMKK01FVEhPRCBpbnQgc2V0X2NvbmZpZyB7CisJZGV2aWNlX3Qg ZGV2OworCXN0cnVjdCBzcGlfY29uZmlnICpjZmc7Cit9Owo= --0023544706e0e22de504bf385516 Content-Type: application/octet-stream; name="ar71xx_spi_r234999.diff" Content-Disposition: attachment; filename="ar71xx_spi_r234999.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h1tgbi423 SW5kZXg6IHN5cy9taXBzL2F0aGVyb3MvYXI3MXh4X3NwaS5jCj09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT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Y3MpCQkoKDcg LSBjcykgPDwgMTYpCiAjZGVmaW5lCQkJU1BJX0lPX0NUUkxfQ0xLCQkJKDEgPDwgOCkKICNkZWZp bmUJCQlTUElfSU9fQ1RSTF9ETwkJCTEKICNkZWZpbmUJCUFSNzFYWF9TUElfUkRTCQkweDBDCg== --0023544706e0e22de504bf385516--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAD44qMUTc06kQQo9aa9gZ-eYFrJMAYd1L1cnBz25XBzPJ7zcyw>