Lines Matching +full:smbus +full:- +full:timeout +full:- +full:disable
1 // SPDX-License-Identifier: GPL-2.0-or-later
16 +------------------------+--------------------+-------------------+
18 +------------------------+--------------------+-------------------+
20 | SMBus registers offset | 0x80 | 0xE0 |
25 +------------------------+--------------------+-------------------+
28 Note: we assume there can only be one device, with one SMBus interface.
43 /* SIS630/730/964 SMBus registers */
58 #define MSTO_EN 0x40 /* Host Master Timeout Enable */
100 /* SMBus base address */
126 /* Make sure the SMBus host is ready to start transmitting. */ in sis630_transaction_start()
129 dev_dbg(&adap->dev, "SMBus busy (%02x). Resetting...\n", temp); in sis630_transaction_start()
130 /* kill smbus transaction */ in sis630_transaction_start()
135 dev_dbg(&adap->dev, "Failed! (%02x)\n", temp); in sis630_transaction_start()
136 return -EBUSY; in sis630_transaction_start()
138 dev_dbg(&adap->dev, "Successful!\n"); in sis630_transaction_start()
145 dev_dbg(&adap->dev, "saved clock 0x%02x\n", *oldclock); in sis630_transaction_start()
147 /* disable timeout interrupt, in sis630_transaction_start()
166 int temp, result = 0, timeout = 0; in sis630_transaction_wait() local
175 } while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT)); in sis630_transaction_wait()
177 /* If the SMBus is still busy, we give up */ in sis630_transaction_wait()
178 if (timeout > MAX_TIMEOUT) { in sis630_transaction_wait()
179 dev_dbg(&adap->dev, "SMBus Timeout!\n"); in sis630_transaction_wait()
180 result = -ETIMEDOUT; in sis630_transaction_wait()
184 dev_dbg(&adap->dev, "Error: Failed bus transaction\n"); in sis630_transaction_wait()
185 result = -ENXIO; in sis630_transaction_wait()
189 dev_err(&adap->dev, "Bus collision!\n"); in sis630_transaction_wait()
190 result = -EAGAIN; in sis630_transaction_wait()
201 dev_dbg(&adap->dev, in sis630_transaction_end()
211 dev_dbg(&adap->dev, in sis630_transaction_end()
236 len = data->block[0]; in sis630_block_data()
243 dev_dbg(&adap->dev, in sis630_block_data()
244 "set data 0x%02x\n", data->block[i]); in sis630_block_data()
246 sis630_write(SMB_BYTE + (i - 1) % 8, data->block[i]); in sis630_block_data()
248 dev_dbg(&adap->dev, in sis630_block_data()
255 } else if ((i - 1) % 8 == 7 || i == len) { in sis630_block_data()
256 dev_dbg(&adap->dev, in sis630_block_data()
259 dev_dbg(&adap->dev, in sis630_block_data()
272 dev_dbg(&adap->dev, in sis630_block_data()
280 data->block[0] = len = 0; in sis630_block_data()
288 dev_dbg(&adap->dev, "trans_wait failed\n"); in sis630_block_data()
293 data->block[0] = sis630_read(SMB_COUNT); in sis630_block_data()
296 if (data->block[0] > 32) in sis630_block_data()
297 data->block[0] = 32; in sis630_block_data()
299 dev_dbg(&adap->dev, in sis630_block_data()
300 "block data read len=0x%x\n", data->block[0]); in sis630_block_data()
302 for (i = 0; i < 8 && len < data->block[0]; i++, len++) { in sis630_block_data()
303 dev_dbg(&adap->dev, in sis630_block_data()
305 data->block[len + 1] = sis630_read(SMB_BYTE + in sis630_block_data()
309 dev_dbg(&adap->dev, in sis630_block_data()
314 } while (len < data->block[0]); in sis630_block_data()
347 sis630_write(SMB_BYTE, data->byte); in sis630_access()
356 sis630_write(SMB_BYTE, data->word & 0xff); in sis630_access()
357 sis630_write(SMB_BYTE + 1, (data->word & 0xff00) >> 8); in sis630_access()
369 dev_warn(&adap->dev, "Unsupported transaction %d\n", size); in sis630_access()
370 return -EOPNOTSUPP; in sis630_access()
385 data->byte = sis630_read(SMB_BYTE); in sis630_access()
389 data->word = sis630_read(SMB_BYTE) + in sis630_access()
422 dev_err(&sis630_dev->dev, in sis630_setup()
426 return -ENODEV; in sis630_setup()
430 Enable ACPI first , so we can accsess reg 74-75 in sis630_setup()
434 dev_err(&sis630_dev->dev, "Error: Can't read bios ctl reg\n"); in sis630_setup()
435 retval = -ENODEV; in sis630_setup()
441 dev_err(&sis630_dev->dev, "Error: Can't enable ACPI\n"); in sis630_setup()
442 retval = -ENODEV; in sis630_setup()
449 dev_err(&sis630_dev->dev, in sis630_setup()
451 retval = -ENODEV; in sis630_setup()
455 dev_dbg(&sis630_dev->dev, "ACPI base at 0x%04hx\n", acpi_base); in sis630_setup()
462 dev_dbg(&sis630_dev->dev, "SMBus base at 0x%04hx\n", smbus_base); in sis630_setup()
472 dev_err(&sis630_dev->dev, in sis630_setup()
473 "I/O Region 0x%04x-0x%04x for SMBus already in use.\n", in sis630_setup()
475 smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1); in sis630_setup()
476 retval = -EBUSY; in sis630_setup()
513 dev_err(&dev->dev, in sis630_probe()
516 return -ENODEV; in sis630_probe()
520 sis630_adapter.dev.parent = &dev->dev; in sis630_probe()
523 "SMBus SIS630 adapter at %04x", smbus_base + SMB_STS); in sis630_probe()
549 MODULE_DESCRIPTION("SIS630 SMBus driver");