tpm_atmel.c (e5451c8f8330e03ad3cfa16048b4daf961af434f) | tpm_atmel.c (8cfffc9d4d3786d3b496a021d7224e06328bac7d) |
---|---|
1/* 2 * Copyright (C) 2004 IBM Corporation 3 * 4 * Authors: 5 * Leendert van Doorn <leendert@watson.ibm.com> 6 * Dave Safford <safford@watson.ibm.com> 7 * Reiner Sailer <sailer@watson.ibm.com> 8 * Kylene Hall <kjhall@us.ibm.com> --- 35 unchanged lines hidden (view full) --- 44 45 /* start reading header */ 46 if (count < 6) 47 return -EIO; 48 49 for (i = 0; i < 6; i++) { 50 status = ioread8(chip->vendor.iobase + 1); 51 if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 1/* 2 * Copyright (C) 2004 IBM Corporation 3 * 4 * Authors: 5 * Leendert van Doorn <leendert@watson.ibm.com> 6 * Dave Safford <safford@watson.ibm.com> 7 * Reiner Sailer <sailer@watson.ibm.com> 8 * Kylene Hall <kjhall@us.ibm.com> --- 35 unchanged lines hidden (view full) --- 44 45 /* start reading header */ 46 if (count < 6) 47 return -EIO; 48 49 for (i = 0; i < 6; i++) { 50 status = ioread8(chip->vendor.iobase + 1); 51 if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
52 dev_err(chip->pdev, "error reading header\n"); | 52 dev_err(&chip->dev, "error reading header\n"); |
53 return -EIO; 54 } 55 *buf++ = ioread8(chip->vendor.iobase); 56 } 57 58 /* size of the data received */ 59 native_size = (__force __be32 *) (hdr + 2); 60 size = be32_to_cpu(*native_size); 61 62 if (count < size) { | 53 return -EIO; 54 } 55 *buf++ = ioread8(chip->vendor.iobase); 56 } 57 58 /* size of the data received */ 59 native_size = (__force __be32 *) (hdr + 2); 60 size = be32_to_cpu(*native_size); 61 62 if (count < size) { |
63 dev_err(chip->pdev, | 63 dev_err(&chip->dev, |
64 "Recv size(%d) less than available space\n", size); 65 for (; i < size; i++) { /* clear the waiting data anyway */ 66 status = ioread8(chip->vendor.iobase + 1); 67 if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 64 "Recv size(%d) less than available space\n", size); 65 for (; i < size; i++) { /* clear the waiting data anyway */ 66 status = ioread8(chip->vendor.iobase + 1); 67 if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
68 dev_err(chip->pdev, "error reading data\n"); | 68 dev_err(&chip->dev, "error reading data\n"); |
69 return -EIO; 70 } 71 } 72 return -EIO; 73 } 74 75 /* read all the data available */ 76 for (; i < size; i++) { 77 status = ioread8(chip->vendor.iobase + 1); 78 if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 69 return -EIO; 70 } 71 } 72 return -EIO; 73 } 74 75 /* read all the data available */ 76 for (; i < size; i++) { 77 status = ioread8(chip->vendor.iobase + 1); 78 if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
79 dev_err(chip->pdev, "error reading data\n"); | 79 dev_err(&chip->dev, "error reading data\n"); |
80 return -EIO; 81 } 82 *buf++ = ioread8(chip->vendor.iobase); 83 } 84 85 /* make sure data available is gone */ 86 status = ioread8(chip->vendor.iobase + 1); 87 88 if (status & ATML_STATUS_DATA_AVAIL) { | 80 return -EIO; 81 } 82 *buf++ = ioread8(chip->vendor.iobase); 83 } 84 85 /* make sure data available is gone */ 86 status = ioread8(chip->vendor.iobase + 1); 87 88 if (status & ATML_STATUS_DATA_AVAIL) { |
89 dev_err(chip->pdev, "data available is stuck\n"); | 89 dev_err(&chip->dev, "data available is stuck\n"); |
90 return -EIO; 91 } 92 93 return size; 94} 95 96static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) 97{ 98 int i; 99 | 90 return -EIO; 91 } 92 93 return size; 94} 95 96static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) 97{ 98 int i; 99 |
100 dev_dbg(chip->pdev, "tpm_atml_send:\n"); | 100 dev_dbg(&chip->dev, "tpm_atml_send:\n"); |
101 for (i = 0; i < count; i++) { | 101 for (i = 0; i < count; i++) { |
102 dev_dbg(chip->pdev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); | 102 dev_dbg(&chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); |
103 iowrite8(buf[i], chip->vendor.iobase); 104 } 105 106 return count; 107} 108 109static void tpm_atml_cancel(struct tpm_chip *chip) 110{ --- 117 unchanged lines hidden --- | 103 iowrite8(buf[i], chip->vendor.iobase); 104 } 105 106 return count; 107} 108 109static void tpm_atml_cancel(struct tpm_chip *chip) 110{ --- 117 unchanged lines hidden --- |