#include #include #include #include #include #define HNBU_CHIPID 0x01 /* Two 16bit values: PCI vendor & device id */ static int b43_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { struct ssb_bus *ssb; struct sdio_func_tuple *tuple; u16 vendor, device; int error = -ENOMEM; printk(KERN_INFO "%s\n", __func__); tuple = func->tuples; while (tuple) { switch (tuple->code) { case 0x80: switch (tuple->data[0]) { case HNBU_CHIPID: if (tuple->size != 5) break; vendor = tuple->data[1] | (tuple->data[2]<<8); device = tuple->data[3] | (tuple->data[4]<<8); printk(KERN_INFO "Chip ID %04x:%04x\n", vendor, device); break; default: printk(KERN_INFO "tuple: code %u size %u\n", tuple->data[0], tuple->size - 1); break; } break; default: break; } tuple = tuple->next; } sdio_claim_host(func); /* FIX ME */ sdio_set_block_size(func, 64); error = sdio_enable_func(func); sdio_release_host(func); if (error) { printk(KERN_ERR "sdio_enble_func failed\n"); goto err_out; } ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); if (!ssb) { printk(KERN_ERR "failed to allocate ssb\n"); goto err_disable_func; } error = ssb_bus_sdiobus_register(ssb, func); if (error) goto err_free_ssb; sdio_set_drvdata(func, ssb); goto out; err_free_ssb: kfree(ssb); err_disable_func: sdio_disable_func(func); err_out: if (error) printk(KERN_ERR "%s: error %d\n", __func__, error); out: return error; } static void b43_sdio_remove(struct sdio_func *func) { struct ssb_bus *ssb = sdio_get_drvdata(func); printk(KERN_INFO "%s\n", __func__); sdio_disable_func(func); if (ssb) { kfree(ssb); sdio_set_drvdata(func, NULL); } return; } #define VENDOR_BROADCOM_PCMCIA 0x02d0 #define SD4318_BOARD 0x044b static const struct sdio_device_id b43_sdio_ids[] = { { SDIO_DEVICE(0x02d0, 0x044b) }, {}, }; static struct sdio_driver b43_sdio_driver = { .name = "b43sdio", .id_table = b43_sdio_ids, .probe = b43_sdio_probe, .remove = b43_sdio_remove, }; int b43_sdio_init(void) { int error; printk(KERN_INFO "%s\n", __func__); error = sdio_register_driver(&b43_sdio_driver); return error; } void b43_sdio_exit(void) { printk(KERN_INFO "%s\n", __func__); sdio_unregister_driver(&b43_sdio_driver); }