本文整理汇总了C++中sdio_enable_func函数的典型用法代码示例。如果您正苦于以下问题:C++ sdio_enable_func函数的具体用法?C++ sdio_enable_func怎么用?C++ sdio_enable_func使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sdio_enable_func函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: brcmf_sdioh_enablefuncs
static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev)
{
int err_ret;
u32 fbraddr;
u8 func;
brcmf_dbg(TRACE, "\n");
/* Get the Card's common CIS address */
sdiodev->func_cis_ptr[0] = brcmf_sdioh_get_cisaddr(sdiodev,
SDIO_CCCR_CIS);
brcmf_dbg(INFO, "Card's Common CIS Ptr = 0x%x\n",
sdiodev->func_cis_ptr[0]);
/* Get the Card's function CIS (for each function) */
for (fbraddr = SDIO_FBR_BASE(1), func = 1;
func <= sdiodev->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) {
sdiodev->func_cis_ptr[func] =
brcmf_sdioh_get_cisaddr(sdiodev, SDIO_FBR_CIS + fbraddr);
brcmf_dbg(INFO, "Function %d CIS Ptr = 0x%x\n",
func, sdiodev->func_cis_ptr[func]);
}
/* Enable Function 1 */
sdio_claim_host(sdiodev->func[1]);
err_ret = sdio_enable_func(sdiodev->func[1]);
sdio_release_host(sdiodev->func[1]);
if (err_ret)
brcmf_dbg(ERROR, "Failed to enable F1 Err: 0x%08x\n", err_ret);
return false;
}
示例2: sdio_detect_probe
/*!
* \brief hif_sdio probe function
*
* hif_sdio probe function called by mmc driver when any matched SDIO function
* is detected by it.
*
* \param func
* \param id
*
* \retval 0 register successfully
* \retval < 0 list error code here
*/
static int sdio_detect_probe (
struct sdio_func *func,
const struct sdio_device_id *id
)
{
int chipId = 0;
WMT_DETECT_INFO_FUNC("vendor(0x%x) device(0x%x) num(0x%x)\n", func->vendor, func->device, func->num);
chipId = hif_sdio_match_chipid_by_dev_id(id);
if ((0x6630 == chipId) && (1 == func->num))
{
int ret = 0;
g_func = func;
WMT_DETECT_INFO_FUNC("autok function detected, func:0x%p\n", g_func);
sdio_claim_host(func);
ret = sdio_enable_func(func);
sdio_release_host(func);
if (ret) {
WMT_DETECT_ERR_FUNC("sdio_enable_func failed!\n");
}
}
return 0;
}
示例3: sdioh_sdmmc_card_enablefuncs
static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd)
{
int err_ret;
uint32 fbraddr;
uint8 func;
/* Get the Card's common CIS address */
sd->com_cis_ptr = sdioh_sdmmc_get_cisaddr(sd, SDIO_CCCR_CIS);
sd->func_cis_ptr[0] = sd->com_cis_ptr;//901=0x00001070
/* Get the Card's function CIS (for each function) */
for (fbraddr = SDIOD_FBR_STARTADDR, func = 1;
func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE)
{
sd->func_cis_ptr[func] = sdioh_sdmmc_get_cisaddr(sd, SDIOD_FBR_CISPTR_0 + fbraddr);
//printf("func_cis_ptr[%d]=0x%08x\n", func, sd->func_cis_ptr[func]);
//901 func_cis_ptr[1]=0x00001000
//901 func_cis_ptr[2]=0x00001038
}
/* Enable Function 1 */
err_ret = sdio_enable_func(gInstance->func[1]);
if (err_ret)
{
BCMDEBUG("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x", err_ret);
}
return FALSE;
}
示例4: wl12xx_sdio_power_on
static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
{
int ret;
struct sdio_func *func = dev_to_sdio_func(glue->dev);
struct mmc_card *card = func->card;
ret = pm_runtime_get_sync(&card->dev);
if (ret < 0) {
pm_runtime_put_noidle(&card->dev);
dev_err(glue->dev, "%s: failed to get_sync(%d)\n",
__func__, ret);
return ret;
}
sdio_claim_host(func);
/*
* To guarantee that the SDIO card is power cycled, as required to make
* the FW programming to succeed, let's do a brute force HW reset.
*/
mmc_hw_reset(card->host);
sdio_enable_func(func);
sdio_release_host(func);
return 0;
}
示例5: esdio_power_on
static int esdio_power_on(struct esp_sdio_ctrl *sctrl)
{
int err = 0;
if (sctrl->off == false)
return err;
sdio_claim_host(sctrl->func);
err = sdio_enable_func(sctrl->func);
if (err) {
esp_dbg(ESP_DBG_ERROR, "Unable to enable sdio func: %d\n", err);
sdio_release_host(sctrl->func);
return err;
}
sdio_release_host(sctrl->func);
/* ensure device is up */
msleep(5);
sctrl->off = false;
return err;
}
示例6: woal_sdio_probe
/** @brief This function handles client driver probe.
*
* @param func A pointer to sdio_func structure.
* @param id A pointer to sdio_device_id structure.
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE/error code
*/
int
woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
int ret = MLAN_STATUS_SUCCESS;
struct sdio_mmc_card *card = NULL;
ENTER();
PRINTM(MMSG, "vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n",
func->vendor, func->device, func->class, func->num);
card = kzalloc(sizeof(struct sdio_mmc_card), GFP_KERNEL);
if (!card) {
PRINTM(MFATAL,
"Failed to allocate memory in probe function!\n");
LEAVE();
return -ENOMEM;
}
card->func = func;
#ifdef MMC_QUIRK_BLKSZ_FOR_BYTE_MODE
/* The byte mode patch is available in kernel MMC driver which fixes
one issue in MP-A transfer. bit1: use func->cur_blksize for byte
mode */
func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
func->card->quirks |= MMC_QUIRK_LENIENT_FN0;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
/* wait for chip fully wake up */
if (!func->enable_timeout)
func->enable_timeout = 200;
#endif
sdio_claim_host(func);
ret = sdio_enable_func(func);
if (ret) {
sdio_disable_func(func);
sdio_release_host(func);
kfree(card);
PRINTM(MFATAL, "sdio_enable_func() failed: ret=%d\n", ret);
LEAVE();
return -EIO;
}
sdio_release_host(func);
if (NULL == woal_add_card(card)) {
PRINTM(MERROR, "woal_add_card failed\n");
kfree(card);
sdio_claim_host(func);
sdio_disable_func(func);
sdio_release_host(func);
ret = MLAN_STATUS_FAILURE;
}
LEAVE();
return ret;
}
示例7: wl1271_sdio_set_power
static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
{
struct sdio_func *func = wl_to_func(wl);
int ret;
/* Let the SDIO stack handle wlan_enable control, so we
* keep host claimed while wlan is in use to keep wl1271
* alive.
*/
if (enable) {
/* Power up the card */
ret = pm_runtime_get_sync(&func->dev);
if (ret < 0)
goto out;
sdio_claim_host(func);
sdio_enable_func(func);
sdio_release_host(func);
} else {
sdio_claim_host(func);
sdio_disable_func(func);
sdio_release_host(func);
/* Power down the card */
ret = pm_runtime_put_sync(&func->dev);
}
out:
return ret;
}
示例8: cw1200_sdio_probe
/* Probe Function to be called by SDIO stack when device is discovered */
static int cw1200_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
struct sbus_priv *self;
int status;
cw1200_dbg(CW1200_DBG_INIT, "Probe called\n");
self = kzalloc(sizeof(*self), GFP_KERNEL);
if (!self) {
cw1200_dbg(CW1200_DBG_ERROR, "Can't allocate SDIO sbus_priv.");
return -ENOMEM;
}
spin_lock_init(&self->lock);
self->pdata = cw1200_get_platform_data();
self->func = func;
sdio_set_drvdata(func, self);
sdio_claim_host(func);
sdio_enable_func(func);
sdio_release_host(func);
status = cw1200_probe(&cw1200_sdio_sbus_ops,
self, &func->dev, &self->core);
if (status) {
sdio_claim_host(func);
sdio_disable_func(func);
sdio_release_host(func);
sdio_set_drvdata(func, NULL);
kfree(self);
}
return status;
}
示例9: wl1271_sdio_power_on
static int wl1271_sdio_power_on(struct wl1271 *wl)
{
struct sdio_func *func = wl_to_func(wl);
int ret;
/* If enabled, tell runtime PM not to power off the card */
if (pm_runtime_enabled(&func->dev)) {
ret = pm_runtime_get_sync(&func->dev);
if (ret) {
printk (KERN_ERR "%s:pm_runtime_get_sync: %d\n", __func__, ret );
goto out;
}
} else {
/* Runtime PM is disabled: power up the card manually */
ret = mmc_power_restore_host(func->card->host);
if (ret < 0) {
printk (KERN_ERR "%s:mmc_power_restore_host: %d\n", __func__, ret );
goto out;
}
}
sdio_claim_host(func);
sdio_enable_func(func);
out:
return ret;
}
示例10: wl12xx_sdio_power_on
static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
{
int ret;
struct sdio_func *func = dev_to_sdio_func(glue->dev);
struct mmc_card *card = func->card;
ret = pm_runtime_get_sync(&card->dev);
if (ret) {
/*
* Runtime PM might be temporarily disabled, or the device
* might have a positive reference counter. Make sure it is
* really powered on.
*/
ret = mmc_power_restore_host(card->host);
if (ret < 0) {
pm_runtime_put_sync(&card->dev);
goto out;
}
}
sdio_claim_host(func);
sdio_enable_func(func);
sdio_release_host(func);
out:
return ret;
}
示例11: emapi_sdio_probe
static int emapi_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
{
int rc;
emapi_setfunc(NULL);
printk("emapi router - class 0x%x, Vendor 0x%x, Device 0x%x\n",
func->class, func->vendor, func->device);
if (func->vendor != VENDOR_ID || func->device != DEVICE_ID)
return -ENODEV;
sdio_claim_host(func);
rc = sdio_enable_func(func);
if (rc)
goto sdio_err1;
rc = sdio_claim_irq(func, emapi_sdio_irq);
if (rc)
goto sdio_err2;
rc = sdio_set_block_size(func, 512);
if (rc)
goto sdio_err2;
emapi_setfunc(func);
return 0;
sdio_err2:
sdio_disable_func(func);
sdio_err1:
sdio_release_host(func);
return rc;
}
示例12: mtk_sdio_probe
static int mtk_sdio_probe (
struct sdio_func *func,
const struct sdio_device_id *id
)
{
int ret = 0;
int i = 0;
//printk(KERN_INFO DRV_NAME "mtk_sdio_probe()\n");
ASSERT(func);
ASSERT(id);
//printk(KERN_INFO DRV_NAME "Basic struct size checking...\n");
//printk(KERN_INFO DRV_NAME "sizeof(struct device) = %d\n", sizeof(struct device));
//printk(KERN_INFO DRV_NAME "sizeof(struct mmc_host) = %d\n", sizeof(struct mmc_host));
//printk(KERN_INFO DRV_NAME "sizeof(struct mmc_card) = %d\n", sizeof(struct mmc_card));
//printk(KERN_INFO DRV_NAME "sizeof(struct mmc_driver) = %d\n", sizeof(struct mmc_driver));
//printk(KERN_INFO DRV_NAME "sizeof(struct mmc_data) = %d\n", sizeof(struct mmc_data));
//printk(KERN_INFO DRV_NAME "sizeof(struct mmc_command) = %d\n", sizeof(struct mmc_command));
//printk(KERN_INFO DRV_NAME "sizeof(struct mmc_request) = %d\n", sizeof(struct mmc_request));
//printk(KERN_INFO DRV_NAME "sizeof(struct sdio_func) = %d\n", sizeof(struct sdio_func));
//printk(KERN_INFO DRV_NAME "Card information checking...\n");
//printk(KERN_INFO DRV_NAME "func = 0x%p\n", func);
//printk(KERN_INFO DRV_NAME "Number of info = %d:\n", func->card->num_info);
for (i = 0; i < func->card->num_info; i++) {
//printk(KERN_INFO DRV_NAME "info[%d]: %s\n", i, func->card->info[i]);
}
sdio_claim_host(func);
ret = sdio_enable_func(func);
sdio_release_host(func);
if (ret) {
//printk(KERN_INFO DRV_NAME"sdio_enable_func failed!\n");
goto out;
}
//printk(KERN_INFO DRV_NAME"sdio_enable_func done!\n");
if (pfWlanProbe((PVOID)func) != WLAN_STATUS_SUCCESS) {
//printk(KERN_WARNING DRV_NAME"pfWlanProbe fail!call pfWlanRemove()\n");
pfWlanRemove();
ret = -1;
}
else {
#if CFG_DBG_GPIO_PINS
//printk(KERN_INFO "[%s] init debug gpio, 20100815 \n", __FUNCTION__);
/* Debug pins initialization */
debug_gpio_init();
#endif
}
out:
//printk(KERN_INFO DRV_NAME"mtk_sdio_probe() done(%d)\n", ret);
return ret;
}
示例13: sdioDrv_EnableFunction
int sdioDrv_EnableFunction(unsigned int uFunc)
{
PDEBUG("%s: func %d\n", __func__, uFunc);
/* currently only wlan sdio function is supported */
BUG_ON(uFunc != SDIO_WLAN_FUNC);
BUG_ON(tiwlan_func[uFunc] == NULL);
return sdio_enable_func(tiwlan_func[uFunc]);
}
示例14: wlan_setup
int wlan_setup()
{
int ret;
scratch_reg = 0x34;
ret = sdio_enable_func(1);
if(ret)
{
bufferPrintf("wlan: cannot enable function\r\n");
return -1;
}
ret = sdio_claim_irq(1, wlan_interrupt, 0);
if(ret)
{
bufferPrintf("wlan: cannot claim irq\r\n");
return -1;
}
ioport = sdio_readb(1, 0x0, &ret);
if(ret)
{
bufferPrintf("wlan: cannot read ioport\r\n");
return -1;
}
ioport |= sdio_readb(1, 0x1, &ret) << 8;
if(ret)
{
bufferPrintf("wlan: cannot read ioport\r\n");
return -1;
}
ioport |= sdio_readb(1, 0x2, &ret) << 16;
if(ret)
{
bufferPrintf("wlan: cannot read ioport\r\n");
return -1;
}
bufferPrintf("wlan: ioport = 0x%x\r\n", ioport);
uint16_t scratch = wlan_read_scratch(&ret);
if(ret)
{
bufferPrintf("wlan: cannot read scratch register\r\n");
return -1;
}
bufferPrintf("wlan: firmware status = 0x%x\r\n", scratch);
return 0;
}
示例15: brcmf_sdioh_f0_write_byte
static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev,
uint regaddr, u8 *byte)
{
struct sdio_func *sdfunc = sdiodev->func[0];
int err_ret;
/*
* Can only directly write to some F0 registers.
* Handle F2 enable/disable and Abort command
* as a special case.
*/
if (regaddr == SDIO_CCCR_IOEx) {
sdfunc = sdiodev->func[2];
if (sdfunc) {
sdio_claim_host(sdfunc);
if (*byte & SDIO_FUNC_ENABLE_2) {
/* Enable Function 2 */
err_ret = sdio_enable_func(sdfunc);
if (err_ret)
brcmf_dbg(ERROR,
"enable F2 failed:%d\n",
err_ret);
} else {
/* Disable Function 2 */
err_ret = sdio_disable_func(sdfunc);
if (err_ret)
brcmf_dbg(ERROR,
"Disable F2 failed:%d\n",
err_ret);
}
sdio_release_host(sdfunc);
}
} else if ((regaddr == SDIO_CCCR_ABORT) ||
(regaddr == SDIO_CCCR_IENx)) {
sdfunc = kmemdup(sdiodev->func[0], sizeof(struct sdio_func),
GFP_KERNEL);
if (!sdfunc)
return -ENOMEM;
sdfunc->num = 0;
sdio_claim_host(sdfunc);
sdio_writeb(sdfunc, *byte, regaddr, &err_ret);
sdio_release_host(sdfunc);
kfree(sdfunc);
} else if (regaddr < 0xF0) {
brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr);
err_ret = -EPERM;
} else {
sdio_claim_host(sdfunc);
sdio_f0_writeb(sdfunc, *byte, regaddr, &err_ret);
sdio_release_host(sdfunc);
}
return err_ret;
}