Lines Matching full:smbus

3  * SMBus 2.0 driver for AMD-8111 IO-Hub.
21 MODULE_DESCRIPTION("AMD8111 SMBus 2.0 driver");
68 static int amd_ec_wait_write(struct amd_smbus *smbus) in amd_ec_wait_write() argument
72 while ((inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_IBF) && --timeout) in amd_ec_wait_write()
76 dev_warn(&smbus->dev->dev, in amd_ec_wait_write()
84 static int amd_ec_wait_read(struct amd_smbus *smbus) in amd_ec_wait_read() argument
88 while ((~inb(smbus->base + AMD_EC_SC) & AMD_EC_SC_OBF) && --timeout) in amd_ec_wait_read()
92 dev_warn(&smbus->dev->dev, in amd_ec_wait_read()
100 static int amd_ec_read(struct amd_smbus *smbus, unsigned char address, in amd_ec_read() argument
105 status = amd_ec_wait_write(smbus); in amd_ec_read()
108 outb(AMD_EC_CMD_RD, smbus->base + AMD_EC_CMD); in amd_ec_read()
110 status = amd_ec_wait_write(smbus); in amd_ec_read()
113 outb(address, smbus->base + AMD_EC_DATA); in amd_ec_read()
115 status = amd_ec_wait_read(smbus); in amd_ec_read()
118 *data = inb(smbus->base + AMD_EC_DATA); in amd_ec_read()
123 static int amd_ec_write(struct amd_smbus *smbus, unsigned char address, in amd_ec_write() argument
128 status = amd_ec_wait_write(smbus); in amd_ec_write()
131 outb(AMD_EC_CMD_WR, smbus->base + AMD_EC_CMD); in amd_ec_write()
133 status = amd_ec_wait_write(smbus); in amd_ec_write()
136 outb(address, smbus->base + AMD_EC_DATA); in amd_ec_write()
138 status = amd_ec_wait_write(smbus); in amd_ec_write()
141 outb(data, smbus->base + AMD_EC_DATA); in amd_ec_write()
147 * ACPI 2.0 chapter 13 SMBus 2.0 EC register model
193 struct amd_smbus *smbus = adap->algo_data; in amd8111_access() local
209 status = amd_ec_write(smbus, AMD_SMB_CMD, in amd8111_access()
218 status = amd_ec_write(smbus, AMD_SMB_CMD, command); in amd8111_access()
222 status = amd_ec_write(smbus, AMD_SMB_DATA, in amd8111_access()
231 status = amd_ec_write(smbus, AMD_SMB_CMD, command); in amd8111_access()
235 status = amd_ec_write(smbus, AMD_SMB_DATA, in amd8111_access()
239 status = amd_ec_write(smbus, AMD_SMB_DATA + 1, in amd8111_access()
248 status = amd_ec_write(smbus, AMD_SMB_CMD, command); in amd8111_access()
254 status = amd_ec_write(smbus, AMD_SMB_BCNT, len); in amd8111_access()
259 amd_ec_write(smbus, AMD_SMB_DATA + i, in amd8111_access()
271 status = amd_ec_write(smbus, AMD_SMB_CMD, command); in amd8111_access()
274 status = amd_ec_write(smbus, AMD_SMB_BCNT, len); in amd8111_access()
280 amd_ec_write(smbus, AMD_SMB_DATA + i, in amd8111_access()
289 status = amd_ec_write(smbus, AMD_SMB_CMD, command); in amd8111_access()
292 status = amd_ec_write(smbus, AMD_SMB_DATA, in amd8111_access()
296 status = amd_ec_write(smbus, AMD_SMB_DATA + 1, in amd8111_access()
307 status = amd_ec_write(smbus, AMD_SMB_CMD, command); in amd8111_access()
310 status = amd_ec_write(smbus, AMD_SMB_BCNT, len); in amd8111_access()
314 status = amd_ec_write(smbus, AMD_SMB_DATA + i, in amd8111_access()
328 status = amd_ec_write(smbus, AMD_SMB_ADDR, addr << 1); in amd8111_access()
331 status = amd_ec_write(smbus, AMD_SMB_PRTCL, protocol); in amd8111_access()
335 status = amd_ec_read(smbus, AMD_SMB_STS, temp + 0); in amd8111_access()
341 status = amd_ec_read(smbus, AMD_SMB_STS, temp + 0); in amd8111_access()
348 status = amd_ec_read(smbus, AMD_SMB_STS, temp + 0); in amd8111_access()
362 status = amd_ec_read(smbus, AMD_SMB_DATA, &data->byte); in amd8111_access()
369 status = amd_ec_read(smbus, AMD_SMB_DATA, temp + 0); in amd8111_access()
372 status = amd_ec_read(smbus, AMD_SMB_DATA + 1, temp + 1); in amd8111_access()
380 status = amd_ec_read(smbus, AMD_SMB_BCNT, &len); in amd8111_access()
387 status = amd_ec_read(smbus, AMD_SMB_DATA + i, in amd8111_access()
424 struct amd_smbus *smbus; in amd8111_probe() local
430 smbus = kzalloc(sizeof(struct amd_smbus), GFP_KERNEL); in amd8111_probe()
431 if (!smbus) in amd8111_probe()
434 smbus->dev = dev; in amd8111_probe()
435 smbus->base = pci_resource_start(dev, 0); in amd8111_probe()
436 smbus->size = pci_resource_len(dev, 0); in amd8111_probe()
444 if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) { in amd8111_probe()
449 smbus->adapter.owner = THIS_MODULE; in amd8111_probe()
450 snprintf(smbus->adapter.name, sizeof(smbus->adapter.name), in amd8111_probe()
451 "SMBus2 AMD8111 adapter at %04x", smbus->base); in amd8111_probe()
452 smbus->adapter.class = I2C_CLASS_HWMON; in amd8111_probe()
453 smbus->adapter.algo = &smbus_algorithm; in amd8111_probe()
454 smbus->adapter.algo_data = smbus; in amd8111_probe()
457 smbus->adapter.dev.parent = &dev->dev; in amd8111_probe()
459 pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0); in amd8111_probe()
460 error = i2c_add_adapter(&smbus->adapter); in amd8111_probe()
464 pci_set_drvdata(dev, smbus); in amd8111_probe()
468 release_region(smbus->base, smbus->size); in amd8111_probe()
470 kfree(smbus); in amd8111_probe()
476 struct amd_smbus *smbus = pci_get_drvdata(dev); in amd8111_remove() local
478 i2c_del_adapter(&smbus->adapter); in amd8111_remove()
479 release_region(smbus->base, smbus->size); in amd8111_remove()
480 kfree(smbus); in amd8111_remove()