Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249013
b: refs/heads/master
c: 60a9bc5
h: refs/heads/master
i:
  249011: fce2207
v: v3
  • Loading branch information
Luis R. Rodriguez authored and Greg Kroah-Hartman committed Apr 5, 2011
1 parent 2c547e4 commit aba5b19
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 88 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 09b6b5e916afa32a4a4a4c9d7cb3ed00563d6b0e
refs/heads/master: 60a9bc57804bd6a629ff1016fea43766f3f6eaf3
172 changes: 85 additions & 87 deletions trunk/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@
static int hifDeviceSuspend(struct device *dev);
static int hifDeviceResume(struct device *dev);
#endif /* CONFIG_PM */
static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id);
static void hifDeviceRemoved(struct sdio_func *func);
static void delHifDevice(struct hif_device * device);
static int Func0_CMD52WriteByte(struct mmc_card *card, unsigned int address, unsigned char byte);
static int Func0_CMD52ReadByte(struct mmc_card *card, unsigned int address, unsigned char *byte);

static int hifEnableFunc(struct hif_device *device, struct sdio_func *func);
static int hifDisableFunc(struct hif_device *device, struct sdio_func *func);
OSDRV_CALLBACKS osdrvCallbacks;

int reset_sdio_on_unload = 0;
module_param(reset_sdio_on_unload, int, 0644);

Expand All @@ -88,21 +90,86 @@ static struct hif_device *ath6kl_get_hifdev(struct sdio_func *func)
return (struct hif_device *) sdio_get_drvdata(func);
}

/* ------ Static Variables ------ */
static const struct sdio_device_id ar6k_id_table[] = {
{ SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6002_BASE | 0x0)) },
{ SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6002_BASE | 0x1)) },
{ SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x0)) },
{ SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x1)) },
{ /* null */ },
static const struct sdio_device_id ath6kl_hifdev_ids[] = {
{ SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6002_BASE | 0x0)) },
{ SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6002_BASE | 0x1)) },
{ SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x0)) },
{ SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x1)) },
{ /* null */ },
};
MODULE_DEVICE_TABLE(sdio, ar6k_id_table);

static struct sdio_driver ar6k_driver = {
.name = "ar6k_wlan",
.id_table = ar6k_id_table,
.probe = hifDeviceInserted,
.remove = hifDeviceRemoved,
MODULE_DEVICE_TABLE(sdio, ath6kl_hifdev_ids);

static int ath6kl_hifdev_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
int ret;
struct hif_device *device;
int count;

AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("ath6kl: Function: 0x%X, Vendor ID: 0x%X, "
"Device ID: 0x%X, block size: 0x%X/0x%X\n",
func->num, func->vendor, func->device,
func->max_blksize, func->cur_blksize));

ath6kl_alloc_hifdev(func);
device = ath6kl_get_hifdev(func);

device->id = id;
device->is_disabled = true;

spin_lock_init(&device->lock);
spin_lock_init(&device->asynclock);

DL_LIST_INIT(&device->ScatterReqHead);

/* Try to allow scatter unless globally overridden */
if (!nohifscattersupport)
device->scatter_enabled = true;

A_MEMZERO(device->busRequest, sizeof(device->busRequest));

for (count = 0; count < BUS_REQUEST_MAX_NUM; count++) {
sema_init(&device->busRequest[count].sem_req, 0);
hifFreeBusRequest(device, &device->busRequest[count]);
}

sema_init(&device->sem_async, 0);

ret = hifEnableFunc(device, func);

return ret;
}

static void ath6kl_hifdev_remove(struct sdio_func *func)
{
int status = 0;
struct hif_device *device;
AR_DEBUG_ASSERT(func != NULL);

device = ath6kl_get_hifdev(func);
if (device->claimedContext != NULL)
status = osdrvCallbacks.
deviceRemovedHandler(device->claimedContext, device);

if (device->is_disabled)
device->is_disabled = false;
else
status = hifDisableFunc(device, func);

CleanupHIFScatterResources(device);

delHifDevice(device);
AR_DEBUG_ASSERT(status == 0);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
}

static struct sdio_driver ath6kl_hifdev_driver = {
.name = "ath6kl_hifdev",
.id_table = ath6kl_hifdev_ids,
.probe = ath6kl_hifdev_probe,
.remove = ath6kl_hifdev_remove,
};

#if defined(CONFIG_PM)
Expand All @@ -119,14 +186,11 @@ static struct dev_pm_ops ar6k_device_pm_ops = {
/* make sure we only unregister when registered. */
static int registered = 0;

OSDRV_CALLBACKS osdrvCallbacks;
extern u32 onebitmode;
extern u32 busspeedlow;
extern u32 debughif;

static void ResetAllCards(void);
static int hifDisableFunc(struct hif_device *device, struct sdio_func *func);
static int hifEnableFunc(struct hif_device *device, struct sdio_func *func);

#ifdef DEBUG

Expand Down Expand Up @@ -156,10 +220,10 @@ int HIFInit(OSDRV_CALLBACKS *callbacks)

#if defined(CONFIG_PM)
if (callbacks->deviceSuspendHandler && callbacks->deviceResumeHandler)
ar6k_driver.drv.pm = &ar6k_device_pm_ops;
ath6kl_hifdev_driver.drv.pm = &ar6k_device_pm_ops;
#endif /* CONFIG_PM */

r = sdio_register_driver(&ar6k_driver);
r = sdio_register_driver(&ath6kl_hifdev_driver);
if (r < 0)
return r;

Expand Down Expand Up @@ -777,7 +841,7 @@ HIFShutDownDevice(struct hif_device *device)
registered = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("AR6000: Unregistering with the bus driver\n"));
sdio_unregister_driver(&ar6k_driver);
sdio_unregister_driver(&ath6kl_hifdev_driver);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("AR6000: Unregistered\n"));
}
Expand Down Expand Up @@ -837,48 +901,6 @@ static int enable_task(void *param)
}
#endif

static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id)
{
int ret;
struct hif_device * device;
int count;

AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("AR6000: hifDeviceInserted, Function: 0x%X, Vendor ID: 0x%X, Device ID: 0x%X, block size: 0x%X/0x%X\n",
func->num, func->vendor, func->device, func->max_blksize, func->cur_blksize));

ath6kl_alloc_hifdev(func);
device = ath6kl_get_hifdev(func);

device->id = id;
device->is_disabled = true;

spin_lock_init(&device->lock);

spin_lock_init(&device->asynclock);

DL_LIST_INIT(&device->ScatterReqHead);

if (!nohifscattersupport) {
/* try to allow scatter operation on all instances,
* unless globally overridden */
device->scatter_enabled = true;
}

/* Initialize the bus requests to be used later */
A_MEMZERO(device->busRequest, sizeof(device->busRequest));
for (count = 0; count < BUS_REQUEST_MAX_NUM; count ++) {
sema_init(&device->busRequest[count].sem_req, 0);
hifFreeBusRequest(device, &device->busRequest[count]);
}
sema_init(&device->sem_async, 0);

ret = hifEnableFunc(device, func);

return ret;
}


void
HIFAckInterrupt(struct hif_device *device)
{
Expand Down Expand Up @@ -1139,30 +1161,6 @@ static int hifDeviceResume(struct device *dev)
}
#endif /* CONFIG_PM */

static void hifDeviceRemoved(struct sdio_func *func)
{
int status = 0;
struct hif_device *device;
AR_DEBUG_ASSERT(func != NULL);

AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceRemoved\n"));
device = ath6kl_get_hifdev(func);
if (device->claimedContext != NULL) {
status = osdrvCallbacks.deviceRemovedHandler(device->claimedContext, device);
}

if (device->is_disabled) {
device->is_disabled = false;
} else {
status = hifDisableFunc(device, func);
}
CleanupHIFScatterResources(device);

delHifDevice(device);
AR_DEBUG_ASSERT(status == 0);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
}

/*
* This should be moved to AR6K HTC layer.
*/
Expand Down

0 comments on commit aba5b19

Please sign in to comment.