]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/tpm/tpm_tis.c
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
[linux-2.6-omap-h63xx.git] / drivers / char / tpm / tpm_tis.c
index 23fa18a6654c3c53d30aaffb0eef51a4b8ff5249..c7a977bc03e81e2b1f38830c62b2034672065538 100644 (file)
@@ -381,7 +381,7 @@ static struct tpm_vendor_specific tpm_tis = {
 
 static irqreturn_t tis_int_probe(int irq, void *dev_id)
 {
-       struct tpm_chip *chip = (struct tpm_chip *) dev_id;
+       struct tpm_chip *chip = dev_id;
        u32 interrupt;
 
        interrupt = ioread32(chip->vendor.iobase +
@@ -399,9 +399,9 @@ static irqreturn_t tis_int_probe(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static irqreturn_t tis_int_handler(int irq, void *dev_id)
+static irqreturn_t tis_int_handler(int dummy, void *dev_id)
 {
-       struct tpm_chip *chip = (struct tpm_chip *) dev_id;
+       struct tpm_chip *chip = dev_id;
        u32 interrupt;
        int i;
 
@@ -435,17 +435,12 @@ module_param(interrupts, bool, 0444);
 MODULE_PARM_DESC(interrupts, "Enable interrupts");
 
 static int tpm_tis_init(struct device *dev, resource_size_t start,
-                       resource_size_t len)
+                       resource_size_t len, unsigned int irq)
 {
        u32 vendor, intfcaps, intmask;
        int rc, i;
        struct tpm_chip *chip;
 
-       if (!start)
-               start = TIS_MEM_BASE;
-       if (!len)
-               len = TIS_MEM_LEN;
-
        if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
                return -ENODEV;
 
@@ -455,6 +450,11 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
                goto out_err;
        }
 
+       if (request_locality(chip, 0) != 0) {
+               rc = -ENODEV;
+               goto out_err;
+       }
+
        vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0));
 
        /* Default timeouts */
@@ -492,11 +492,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
        if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
                dev_dbg(dev, "\tData Avail Int Support\n");
 
-       if (request_locality(chip, 0) != 0) {
-               rc = -ENODEV;
-               goto out_err;
-       }
-
        /* INTERRUPT Setup */
        init_waitqueue_head(&chip->vendor.read_queue);
        init_waitqueue_head(&chip->vendor.int_queue);
@@ -512,7 +507,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
        iowrite32(intmask,
                  chip->vendor.iobase +
                  TPM_INT_ENABLE(chip->vendor.locality));
-       if (interrupts) {
+       if (interrupts)
+               chip->vendor.irq = irq;
+       if (interrupts && !chip->vendor.irq) {
                chip->vendor.irq =
                    ioread8(chip->vendor.iobase +
                            TPM_INT_VECTOR(chip->vendor.locality));
@@ -597,10 +594,17 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
                                      const struct pnp_device_id *pnp_id)
 {
        resource_size_t start, len;
+       unsigned int irq = 0;
+
        start = pnp_mem_start(pnp_dev, 0);
        len = pnp_mem_len(pnp_dev, 0);
 
-       return tpm_tis_init(&pnp_dev->dev, start, len);
+       if (pnp_irq_valid(pnp_dev, 0))
+               irq = pnp_irq(pnp_dev, 0);
+       else
+               interrupts = 0;
+
+       return tpm_tis_init(&pnp_dev->dev, start, len, irq);
 }
 
 static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg)
@@ -619,6 +623,7 @@ static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = {
        {"IFX0102", 0},         /* Infineon */
        {"BCM0101", 0},         /* Broadcom */
        {"NSC1200", 0},         /* National */
+       {"ICO0102", 0},         /* Intel */
        /* Add new here */
        {"", 0},                /* User Specified */
        {"", 0}                 /* Terminator */
@@ -660,7 +665,7 @@ static int __init init_tis(void)
                        return rc;
                if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
                        return PTR_ERR(pdev);
-               if((rc=tpm_tis_init(&pdev->dev, 0, 0)) != 0) {
+               if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
                        platform_device_unregister(pdev);
                        driver_unregister(&tis_drv);
                }