tpm_atmel.c (4eea703caaac025dd422bd3916b14523977f4332) | tpm_atmel.c (9e0d39d8a6a0a8805d05fba22e3fbe80b5c8c4cb) |
---|---|
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> --- 23 unchanged lines hidden (view full) --- 32 ATML_STATUS_BUSY = 0x01, 33 ATML_STATUS_DATA_AVAIL = 0x02, 34 ATML_STATUS_REWRITE = 0x04, 35 ATML_STATUS_READY = 0x08 36}; 37 38static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) 39{ | 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> --- 23 unchanged lines hidden (view full) --- 32 ATML_STATUS_BUSY = 0x01, 33 ATML_STATUS_DATA_AVAIL = 0x02, 34 ATML_STATUS_REWRITE = 0x04, 35 ATML_STATUS_READY = 0x08 36}; 37 38static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) 39{ |
40 struct tpm_atmel_priv *priv = chip->vendor.priv; | 40 struct tpm_atmel_priv *priv = dev_get_drvdata(&chip->dev); |
41 u8 status, *hdr = buf; 42 u32 size; 43 int i; 44 __be32 *native_size; 45 46 /* start reading header */ 47 if (count < 6) 48 return -EIO; --- 42 unchanged lines hidden (view full) --- 91 return -EIO; 92 } 93 94 return size; 95} 96 97static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) 98{ | 41 u8 status, *hdr = buf; 42 u32 size; 43 int i; 44 __be32 *native_size; 45 46 /* start reading header */ 47 if (count < 6) 48 return -EIO; --- 42 unchanged lines hidden (view full) --- 91 return -EIO; 92 } 93 94 return size; 95} 96 97static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) 98{ |
99 struct tpm_atmel_priv *priv = chip->vendor.priv; | 99 struct tpm_atmel_priv *priv = dev_get_drvdata(&chip->dev); |
100 int i; 101 102 dev_dbg(&chip->dev, "tpm_atml_send:\n"); 103 for (i = 0; i < count; i++) { 104 dev_dbg(&chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); 105 iowrite8(buf[i], priv->iobase); 106 } 107 108 return count; 109} 110 111static void tpm_atml_cancel(struct tpm_chip *chip) 112{ | 100 int i; 101 102 dev_dbg(&chip->dev, "tpm_atml_send:\n"); 103 for (i = 0; i < count; i++) { 104 dev_dbg(&chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); 105 iowrite8(buf[i], priv->iobase); 106 } 107 108 return count; 109} 110 111static void tpm_atml_cancel(struct tpm_chip *chip) 112{ |
113 struct tpm_atmel_priv *priv = chip->vendor.priv; | 113 struct tpm_atmel_priv *priv = dev_get_drvdata(&chip->dev); |
114 115 iowrite8(ATML_STATUS_ABORT, priv->iobase + 1); 116} 117 118static u8 tpm_atml_status(struct tpm_chip *chip) 119{ | 114 115 iowrite8(ATML_STATUS_ABORT, priv->iobase + 1); 116} 117 118static u8 tpm_atml_status(struct tpm_chip *chip) 119{ |
120 struct tpm_atmel_priv *priv = chip->vendor.priv; | 120 struct tpm_atmel_priv *priv = dev_get_drvdata(&chip->dev); |
121 122 return ioread8(priv->iobase + 1); 123} 124 125static bool tpm_atml_req_canceled(struct tpm_chip *chip, u8 status) 126{ 127 return (status == ATML_STATUS_READY); 128} --- 8 unchanged lines hidden (view full) --- 137 .req_canceled = tpm_atml_req_canceled, 138}; 139 140static struct platform_device *pdev; 141 142static void atml_plat_remove(void) 143{ 144 struct tpm_chip *chip = dev_get_drvdata(&pdev->dev); | 121 122 return ioread8(priv->iobase + 1); 123} 124 125static bool tpm_atml_req_canceled(struct tpm_chip *chip, u8 status) 126{ 127 return (status == ATML_STATUS_READY); 128} --- 8 unchanged lines hidden (view full) --- 137 .req_canceled = tpm_atml_req_canceled, 138}; 139 140static struct platform_device *pdev; 141 142static void atml_plat_remove(void) 143{ 144 struct tpm_chip *chip = dev_get_drvdata(&pdev->dev); |
145 struct tpm_atmel_priv *priv = chip->vendor.priv; | 145 struct tpm_atmel_priv *priv = dev_get_drvdata(&chip->dev); |
146 147 if (chip) { 148 tpm_chip_unregister(chip); 149 if (priv->have_region) 150 atmel_release_region(priv->base, priv->region_size); 151 atmel_put_base_addr(priv->iobase); 152 platform_device_unregister(pdev); 153 } --- 48 unchanged lines hidden (view full) --- 202 priv->region_size = region_size; 203 204 chip = tpmm_chip_alloc(&pdev->dev, &tpm_atmel); 205 if (IS_ERR(chip)) { 206 rc = PTR_ERR(chip); 207 goto err_unreg_dev; 208 } 209 | 146 147 if (chip) { 148 tpm_chip_unregister(chip); 149 if (priv->have_region) 150 atmel_release_region(priv->base, priv->region_size); 151 atmel_put_base_addr(priv->iobase); 152 platform_device_unregister(pdev); 153 } --- 48 unchanged lines hidden (view full) --- 202 priv->region_size = region_size; 203 204 chip = tpmm_chip_alloc(&pdev->dev, &tpm_atmel); 205 if (IS_ERR(chip)) { 206 rc = PTR_ERR(chip); 207 goto err_unreg_dev; 208 } 209 |
210 chip->vendor.priv = priv; | 210 dev_set_drvdata(&chip->dev, priv); |
211 212 rc = tpm_chip_register(chip); 213 if (rc) 214 goto err_unreg_dev; 215 216 return 0; 217 218err_unreg_dev: --- 24 unchanged lines hidden --- | 211 212 rc = tpm_chip_register(chip); 213 if (rc) 214 goto err_unreg_dev; 215 216 return 0; 217 218err_unreg_dev: --- 24 unchanged lines hidden --- |