#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
+#include <linux/delay.h>
#include <linux/pci.h>
#include <asm/system.h>
#include "shpchp.h"
static spinlock_t hpc_event_lock;
DEFINE_DBG_BUFFER /* Debug string buffer for entire HPC defined here */
-static struct php_ctlr_state_s *php_ctlr_list_head = 0; /* HPC state linked list */
+static struct php_ctlr_state_s *php_ctlr_list_head; /* HPC state linked list */
static int ctlr_seq_num = 0; /* Controller sequenc # */
static spinlock_t list_lock;
if (!(cmd_status & 0x1))
break;
/* Check every 0.1 sec for a total of 1 sec*/
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ/10);
+ msleep(100);
}
cmd_status = readw(php_ctlr->creg + CMD_STATUS);
if (php_ctlr->irq) {
free_irq(php_ctlr->irq, ctrl);
php_ctlr->irq = 0;
+ pci_disable_msi(php_ctlr->pci_dev);
}
}
if (php_ctlr->pci_dev) {
iounmap(php_ctlr->creg);
release_mem_region(pci_resource_start(php_ctlr->pci_dev, 0), pci_resource_len(php_ctlr->pci_dev, 0));
dbg("%s: before calling iounmap & release_mem_region\n", __FUNCTION__);
- php_ctlr->pci_dev = 0;
+ php_ctlr->pci_dev = NULL;
}
spin_lock(&list_lock);
hp_slot, php_ctlr->callback_instance_id);
/* Clear all slot events */
- temp_dword = 0xe01fffff;
+ temp_dword = 0xe01f3fff;
dbg("%s: Clearing slot events, temp_dword = %x\n",
__FUNCTION__, temp_dword);
writel(temp_dword, php_ctlr->creg + SLOT1 + (4*hp_slot));
info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor,
pdev->subsystem_device);
+
+ if (pci_enable_device(pdev))
+ goto abort_free_ctlr;
if (!request_mem_region(pci_resource_start(pdev, 0) + shpc_base_offset, pci_resource_len(pdev, 0), MY_NAME)) {
err("%s: cannot reserve MMIO region\n", __FUNCTION__);
goto abort_free_ctlr;
}
- php_ctlr->creg = (struct ctrl_reg *)
- ioremap(pci_resource_start(pdev, 0) + shpc_base_offset, pci_resource_len(pdev, 0));
+ php_ctlr->creg = ioremap(pci_resource_start(pdev, 0) + shpc_base_offset, pci_resource_len(pdev, 0));
if (!php_ctlr->creg) {
err("%s: cannot remap MMIO region %lx @ %lx\n", __FUNCTION__, pci_resource_len(pdev, 0),
pci_resource_start(pdev, 0) + shpc_base_offset);
slot_reg = readl(php_ctlr->creg + SLOT1 + 4*hp_slot );
dbg("%s: Default Logical Slot Register %d value %x\n", __FUNCTION__,
hp_slot, slot_reg);
- tempdword = 0xffffffff;
+ tempdword = 0xffff3fff;
writel(tempdword, php_ctlr->creg + SLOT1 + (4*hp_slot));
}
if (php_ctlr_list_head == 0) {
php_ctlr_list_head = php_ctlr;
p = php_ctlr_list_head;
- p->pnext = 0;
+ p->pnext = NULL;
} else {
p = php_ctlr_list_head;
slot_reg = readl(php_ctlr->creg + SLOT1 + 4*hp_slot );
dbg("%s: Default Logical Slot Register %d value %x\n", __FUNCTION__,
hp_slot, slot_reg);
- tempdword = 0xe01fffff;
+ tempdword = 0xe01f3fff;
writel(tempdword, php_ctlr->creg + SLOT1 + (4*hp_slot));
}
if (!shpchp_poll_mode) {