2011-02-06 19:03:46 +01:00
/*
2011-04-11 17:02:15 -05:00
* This file contains work - arounds for many known SD / MMC
* and SDIO hardware bugs .
2011-02-06 19:03:46 +01:00
*
2011-04-11 17:02:15 -05:00
* Copyright ( c ) 2011 Andrei Warkentin < andreiw @ motorola . com >
2011-02-06 19:03:46 +01:00
* Copyright ( c ) 2011 Pierre Tardy < tardyp @ gmail . com >
* Inspired from pci fixup code :
* Copyright ( c ) 1999 Martin Mares < mj @ ucw . cz >
*
*/
2013-11-26 15:39:20 -08:00
# include <linux/mmc/sdio_ids.h>
2011-02-06 19:03:46 +01:00
2017-01-13 14:14:14 +01:00
# include "card.h"
2017-02-15 16:35:30 +08:00
static const struct mmc_fixup sdio_fixup_methods [ ] = {
2011-04-11 17:02:15 -05:00
SDIO_FIXUP ( SDIO_VENDOR_ID_TI , SDIO_DEVICE_ID_TI_WL1271 ,
add_quirk , MMC_QUIRK_NONSTD_FUNC_IF ) ,
SDIO_FIXUP ( SDIO_VENDOR_ID_TI , SDIO_DEVICE_ID_TI_WL1271 ,
add_quirk , MMC_QUIRK_DISABLE_CD ) ,
2011-09-15 17:43:04 +02:00
SDIO_FIXUP ( SDIO_VENDOR_ID_STE , SDIO_DEVICE_ID_STE_CW1200 ,
add_quirk , MMC_QUIRK_BROKEN_BYTE_MODE_512 ) ,
2013-11-26 15:39:20 -08:00
SDIO_FIXUP ( SDIO_VENDOR_ID_MARVELL , SDIO_DEVICE_ID_MARVELL_8797_F0 ,
add_quirk , MMC_QUIRK_BROKEN_IRQ_POLLING ) ,
2011-04-11 17:02:15 -05:00
END_FIXUP
2011-02-06 19:03:46 +01:00
} ;
2017-02-15 16:35:28 +08:00
static inline void mmc_fixup_device ( struct mmc_card * card ,
const struct mmc_fixup * table )
2011-02-06 19:03:46 +01:00
{
const struct mmc_fixup * f ;
2011-04-11 17:02:15 -05:00
u64 rev = cid_rev_card ( card ) ;
for ( f = table ; f - > vendor_fixup ; f + + ) {
if ( ( f - > manfid = = CID_MANFID_ANY | |
f - > manfid = = card - > cid . manfid ) & &
( f - > oemid = = CID_OEMID_ANY | |
f - > oemid = = card - > cid . oemid ) & &
( f - > name = = CID_NAME_ANY | |
! strncmp ( f - > name , card - > cid . prod_name ,
sizeof ( card - > cid . prod_name ) ) ) & &
( f - > cis_vendor = = card - > cis . vendor | |
f - > cis_vendor = = ( u16 ) SDIO_ANY_ID ) & &
( f - > cis_device = = card - > cis . device | |
f - > cis_device = = ( u16 ) SDIO_ANY_ID ) & &
2016-06-09 18:09:31 -04:00
( f - > ext_csd_rev = = EXT_CSD_REV_ANY | |
f - > ext_csd_rev = = card - > ext_csd . rev ) & &
2011-04-11 17:02:15 -05:00
rev > = f - > rev_start & & rev < = f - > rev_end ) {
2014-05-20 13:29:21 +02:00
dev_dbg ( & card - > dev , " calling %pf \n " , f - > vendor_fixup ) ;
2011-02-06 19:03:46 +01:00
f - > vendor_fixup ( card , f - > data ) ;
}
}
}