tpm_atmel.c (a6df7da8f7ee99e6fd1995fad852bacb978a6447) tpm_atmel.c (e1a23c6671f2bfd6e5e112848f01334ca39ea2b1)
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>

--- 8 unchanged lines hidden (view full) ---

17 * published by the Free Software Foundation, version 2 of the
18 * License.
19 *
20 */
21
22#include "tpm.h"
23
24/* Atmel definitions */
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>

--- 8 unchanged lines hidden (view full) ---

17 * published by the Free Software Foundation, version 2 of the
18 * License.
19 *
20 */
21
22#include "tpm.h"
23
24/* Atmel definitions */
25enum tpm_atmel_addr{
26 TPM_ATML_BASE = 0x400
25enum tpm_atmel_addr {
26 TPM_ATMEL_BASE_ADDR_LO = 0x08,
27 TPM_ATMEL_BASE_ADDR_HI = 0x09
27};
28
29/* write status bits */
30enum tpm_atmel_write_status {
31 ATML_STATUS_ABORT = 0x01,
32 ATML_STATUS_LASTBYTE = 0x04
33};
34/* read status bits */

--- 108 unchanged lines hidden (view full) ---

143
144static struct tpm_vendor_specific tpm_atmel = {
145 .recv = tpm_atml_recv,
146 .send = tpm_atml_send,
147 .cancel = tpm_atml_cancel,
148 .req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL,
149 .req_complete_val = ATML_STATUS_DATA_AVAIL,
150 .req_canceled = ATML_STATUS_READY,
28};
29
30/* write status bits */
31enum tpm_atmel_write_status {
32 ATML_STATUS_ABORT = 0x01,
33 ATML_STATUS_LASTBYTE = 0x04
34};
35/* read status bits */

--- 108 unchanged lines hidden (view full) ---

144
145static struct tpm_vendor_specific tpm_atmel = {
146 .recv = tpm_atml_recv,
147 .send = tpm_atml_send,
148 .cancel = tpm_atml_cancel,
149 .req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL,
150 .req_complete_val = ATML_STATUS_DATA_AVAIL,
151 .req_canceled = ATML_STATUS_READY,
151 .base = TPM_ATML_BASE,
152 .attr_group = &atmel_attr_grp,
153 .miscdev = { .fops = &atmel_ops, },
154};
155
156static int __devinit tpm_atml_init(struct pci_dev *pci_dev,
157 const struct pci_device_id *pci_id)
158{
159 u8 version[4];
160 int rc = 0;
152 .attr_group = &atmel_attr_grp,
153 .miscdev = { .fops = &atmel_ops, },
154};
155
156static int __devinit tpm_atml_init(struct pci_dev *pci_dev,
157 const struct pci_device_id *pci_id)
158{
159 u8 version[4];
160 int rc = 0;
161 int lo, hi;
161
162 if (pci_enable_device(pci_dev))
163 return -EIO;
164
162
163 if (pci_enable_device(pci_dev))
164 return -EIO;
165
165 if (tpm_lpc_bus_init(pci_dev, TPM_ATML_BASE)) {
166 rc = -ENODEV;
167 goto out_err;
168 }
166 lo = tpm_read_index( TPM_ATMEL_BASE_ADDR_LO );
167 hi = tpm_read_index( TPM_ATMEL_BASE_ADDR_HI );
169
168
169 tpm_atmel.base = (hi<<8)|lo;
170 dev_dbg( &pci_dev->dev, "Operating with base: 0x%x\n", tpm_atmel.base);
171
170 /* verify that it is an Atmel part */
171 if (tpm_read_index(4) != 'A' || tpm_read_index(5) != 'T'
172 || tpm_read_index(6) != 'M' || tpm_read_index(7) != 'L') {
173 rc = -ENODEV;
174 goto out_err;
175 }
176
177 /* query chip for its version number */

--- 62 unchanged lines hidden ---
172 /* verify that it is an Atmel part */
173 if (tpm_read_index(4) != 'A' || tpm_read_index(5) != 'T'
174 || tpm_read_index(6) != 'M' || tpm_read_index(7) != 'L') {
175 rc = -ENODEV;
176 goto out_err;
177 }
178
179 /* query chip for its version number */

--- 62 unchanged lines hidden ---