Lines Matching +full:smbus +full:- +full:timeout +full:- +full:disable
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>,
6 Copyright (C) 2005 - 2008 Jean Delvare <jdelvare@suse.de>
30 Note: we assume there can only be one device, with one SMBus interface.
50 /* SMBus address offsets */
62 /* SMBus data in configuration space can be found in two places,
84 MODULE_PARM_DESC(force, "Forcibly enable the SMBus. DANGEROUS!");
91 "Forcibly enable the SMBus at the given address. "
118 for (; i < I2C_SMBUS_BLOCK_MAX - 1; i++) in vt596_dump_regs()
127 /* Return -1 on error, 0 on success */
132 int timeout = 0; in vt596_transaction() local
136 /* Make sure the SMBus host is ready to start transmitting */ in vt596_transaction()
138 dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). " in vt596_transaction()
143 dev_err(&vt596_adapter.dev, "SMBus reset failed! " in vt596_transaction()
145 return -EBUSY; in vt596_transaction()
156 } while ((temp & 0x01) && (++timeout < MAX_TIMEOUT)); in vt596_transaction()
158 /* If the SMBus is still busy, we give up */ in vt596_transaction()
159 if (timeout == MAX_TIMEOUT) { in vt596_transaction()
160 result = -ETIMEDOUT; in vt596_transaction()
161 dev_err(&vt596_adapter.dev, "SMBus timeout!\n"); in vt596_transaction()
165 result = -EIO; in vt596_transaction()
171 result = -EIO; in vt596_transaction()
172 dev_err(&vt596_adapter.dev, "SMBus collision!\n"); in vt596_transaction()
176 result = -ENXIO; in vt596_transaction()
209 outb_p(data->byte, SMBHSTDAT0); in vt596_access()
215 outb_p(data->word & 0xff, SMBHSTDAT0); in vt596_access()
216 outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); in vt596_access()
222 outb_p(data->word & 0xff, SMBHSTDAT0); in vt596_access()
223 outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); in vt596_access()
230 outb_p(data->block[0], SMBHSTDAT0); in vt596_access()
235 u8 len = data->block[0]; in vt596_access()
241 outb_p(data->block[i], SMBBLKDAT); in vt596_access()
265 data->byte = inb_p(SMBHSTDAT0); in vt596_access()
269 data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); in vt596_access()
273 data->block[0] = inb_p(SMBHSTDAT0); in vt596_access()
274 if (data->block[0] > I2C_SMBUS_BLOCK_MAX) in vt596_access()
275 data->block[0] = I2C_SMBUS_BLOCK_MAX; in vt596_access()
277 for (i = 1; i <= data->block[0]; i++) in vt596_access()
278 data->block[i] = inb_p(SMBBLKDAT); in vt596_access()
286 return -EOPNOTSUPP; in vt596_access()
317 /* Determine the address of the SMBus areas */ in vt596_probe()
324 if ((pci_read_config_word(pdev, id->driver_data, &vt596_smba)) || in vt596_probe()
327 if (id->device == PCI_DEVICE_ID_VIA_82C596_3 && in vt596_probe()
333 dev_err(&pdev->dev, "Cannot configure " in vt596_probe()
334 "SMBus I/O Base address\n"); in vt596_probe()
335 return -ENODEV; in vt596_probe()
341 dev_err(&pdev->dev, "SMBus base address " in vt596_probe()
342 "uninitialized - upgrade BIOS or use " in vt596_probe()
344 return -ENODEV; in vt596_probe()
350 return -ENODEV; in vt596_probe()
353 dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n", in vt596_probe()
355 return -ENODEV; in vt596_probe()
360 sure, we disable the VT596 first. */ in vt596_probe()
363 pci_write_config_word(pdev, id->driver_data, vt596_smba); in vt596_probe()
365 dev_warn(&pdev->dev, "WARNING: SMBus interface set to new " in vt596_probe()
376 dev_info(&pdev->dev, "Enabling SMBus device\n"); in vt596_probe()
378 dev_err(&pdev->dev, "SMBUS: Error: Host SMBus " in vt596_probe()
379 "controller not enabled! - upgrade BIOS or " in vt596_probe()
381 error = -ENODEV; in vt596_probe()
386 dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba); in vt596_probe()
388 switch (pdev->device) { in vt596_probe()
405 if (pdev->revision >= 0x40) in vt596_probe()
410 vt596_adapter.dev.parent = &pdev->dev; in vt596_probe()
412 "SMBus Via Pro adapter at %04x", vt596_smba); in vt596_probe()
426 return -ENODEV; in vt596_probe()
495 MODULE_DESCRIPTION("vt82c596 SMBus driver");