tpm_atmel.c (38b22b6e9f46ab8f73ef5734f0e0a000766a9258) tpm_atmel.c (daacdfa6e7d6e57c5d1b8e72b1c863feb53d8a82)
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>

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

158{
159 u8 version[4];
160 int rc = 0;
161 int lo, hi;
162
163 if (pci_enable_device(pci_dev))
164 return -EIO;
165
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>

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

158{
159 u8 version[4];
160 int rc = 0;
161 int lo, hi;
162
163 if (pci_enable_device(pci_dev))
164 return -EIO;
165
166 lo = tpm_read_index( TPM_ATMEL_BASE_ADDR_LO );
167 hi = tpm_read_index( TPM_ATMEL_BASE_ADDR_HI );
166 lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO);
167 hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI);
168
169 tpm_atmel.base = (hi<<8)|lo;
170 dev_dbg( &pci_dev->dev, "Operating with base: 0x%x\n", tpm_atmel.base);
171
172 /* verify that it is an Atmel part */
168
169 tpm_atmel.base = (hi<<8)|lo;
170 dev_dbg( &pci_dev->dev, "Operating with base: 0x%x\n", tpm_atmel.base);
171
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') {
173 if (tpm_read_index(TPM_ADDR, 4) != 'A' || tpm_read_index(TPM_ADDR, 5) != 'T'
174 || tpm_read_index(TPM_ADDR, 6) != 'M' || tpm_read_index(TPM_ADDR, 7) != 'L') {
175 rc = -ENODEV;
176 goto out_err;
177 }
178
179 /* query chip for its version number */
175 rc = -ENODEV;
176 goto out_err;
177 }
178
179 /* query chip for its version number */
180 if ((version[0] = tpm_read_index(0x00)) != 0xFF) {
181 version[1] = tpm_read_index(0x01);
182 version[2] = tpm_read_index(0x02);
183 version[3] = tpm_read_index(0x03);
180 if ((version[0] = tpm_read_index(TPM_ADDR, 0x00)) != 0xFF) {
181 version[1] = tpm_read_index(TPM_ADDR, 0x01);
182 version[2] = tpm_read_index(TPM_ADDR, 0x02);
183 version[3] = tpm_read_index(TPM_ADDR, 0x03);
184 } else {
185 dev_info(&pci_dev->dev, "version query failed\n");
186 rc = -ENODEV;
187 goto out_err;
188 }
189
190 if ((rc = tpm_register_hardware(pci_dev, &tpm_atmel)) < 0)
191 goto out_err;

--- 50 unchanged lines hidden ---
184 } else {
185 dev_info(&pci_dev->dev, "version query failed\n");
186 rc = -ENODEV;
187 goto out_err;
188 }
189
190 if ((rc = tpm_register_hardware(pci_dev, &tpm_atmel)) < 0)
191 goto out_err;

--- 50 unchanged lines hidden ---