Lines Matching +full:reset +full:- +full:on +full:- +full:timeout

1 // SPDX-License-Identifier: GPL-2.0-or-later
10 This is the driver for the SMB Host controller on
25 on the PCI bus. An output of lspci will show something similar
34 ACPI-compliant Power Management Unit (PMU).
42 The SMB Target controller on the M15X3 is not enabled.
82 /* this is what the Award 1004 BIOS sets them to on a ASUS P5A MB.
127 - SMB I/O address is initialized in ali15x3_setup()
128 - Device is enabled in ali15x3_setup()
129 - We can use the addresses in ali15x3_setup()
133 The data sheet says that the address registers are read-only in ali15x3_setup()
145 ali15x3_smba &= (0xffff & ~(ALI15X3_SMB_IOSIZE - 1)); in ali15x3_setup()
147 dev_err(&ALI15X3_dev->dev, "ALI15X3_smb region uninitialized " in ali15x3_setup()
148 "- upgrade BIOS or use force_addr=0xaddr\n"); in ali15x3_setup()
149 return -ENODEV; in ali15x3_setup()
153 ali15x3_smba = force_addr & ~(ALI15X3_SMB_IOSIZE - 1); in ali15x3_setup()
157 return -EBUSY; in ali15x3_setup()
161 dev_err(&ALI15X3_dev->dev, in ali15x3_setup()
164 return -ENODEV; in ali15x3_setup()
170 dev_info(&ALI15X3_dev->dev, "forcing ISA address 0x%04X\n", in ali15x3_setup()
178 if ((a & ~(ALI15X3_SMB_IOSIZE - 1)) != ali15x3_smba) { in ali15x3_setup()
180 dev_err(&ALI15X3_dev->dev, in ali15x3_setup()
181 "force address failed - not supported?\n"); in ali15x3_setup()
188 dev_info(&ALI15X3_dev->dev, "enabling SMBus device\n"); in ali15x3_setup()
195 dev_info(&ALI15X3_dev->dev, "enabling SMBus controller\n"); in ali15x3_setup()
207 dev_dbg(&ALI15X3_dev->dev, "ALI15X3 using Interrupt 9 for SMBus.\n"); in ali15x3_setup()
210 dev_dbg(&ALI15X3_dev->dev, "SMBREV = 0x%X\n", temp); in ali15x3_setup()
211 dev_dbg(&ALI15X3_dev->dev, "iALI15X3_smba = 0x%X\n", ali15x3_smba); in ali15x3_setup()
216 return -ENODEV; in ali15x3_setup()
224 int timeout = 0; in ali15x3_transaction() local
226 dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, " in ali15x3_transaction()
239 previous transaction, resulting in a "SMBus Timeout" Dev. in ali15x3_transaction()
240 I've tried the following to reset a stuck busy bit. in ali15x3_transaction()
241 1. Reset the controller with an ABORT command. in ali15x3_transaction()
244 2. Reset the controller and the other SMBus devices with a in ali15x3_transaction()
249 Worst case, nothing seems to work except power reset. in ali15x3_transaction()
251 /* Abort - reset the host controller */ in ali15x3_transaction()
253 Try resetting entire SMB bus, including other devices - in ali15x3_transaction()
254 This may not work either - it clears the BUSY bit but in ali15x3_transaction()
255 then the BUSY bit may come back on when you try and use the chip again. in ali15x3_transaction()
258 dev_info(&adap->dev, "Resetting entire SMB Bus to " in ali15x3_transaction()
266 /* do a clear-on-write */ in ali15x3_transaction()
270 /* this is probably going to be correctable only by a power reset in ali15x3_transaction()
273 dev_err(&adap->dev, "SMBus reset failed! (0x%02x) - " in ali15x3_transaction()
274 "controller or device on bus is probably hung\n", in ali15x3_transaction()
276 return -EBUSY; in ali15x3_transaction()
289 timeout = 0; in ali15x3_transaction()
294 && (timeout++ < MAX_TIMEOUT)); in ali15x3_transaction()
297 if (timeout > MAX_TIMEOUT) in ali15x3_transaction()
298 result = -ETIMEDOUT; in ali15x3_transaction()
301 result = -EIO; in ali15x3_transaction()
302 dev_dbg(&adap->dev, "Error: Failed bus transaction\n"); in ali15x3_transaction()
312 result = -ENXIO; in ali15x3_transaction()
313 dev_dbg(&adap->dev, in ali15x3_transaction()
320 result = -EIO; in ali15x3_transaction()
321 dev_err(&adap->dev, "Error: device error\n"); in ali15x3_transaction()
323 dev_dbg(&adap->dev, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, " in ali15x3_transaction()
330 /* Return negative errno on error. */
337 int timeout; in ali15x3_access() local
339 /* clear all the bits (clear-on-write) */ in ali15x3_access()
343 for (timeout = 0; in ali15x3_access()
344 (timeout < MAX_TIMEOUT) && !(temp & ALI15X3_STS_IDLE); in ali15x3_access()
345 timeout++) { in ali15x3_access()
349 if (timeout >= MAX_TIMEOUT) { in ali15x3_access()
350 dev_err(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp); in ali15x3_access()
371 outb_p(data->byte, SMBHSTDAT0); in ali15x3_access()
379 outb_p(data->word & 0xff, SMBHSTDAT0); in ali15x3_access()
380 outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); in ali15x3_access()
389 len = data->block[0]; in ali15x3_access()
392 data->block[0] = len; in ali15x3_access()
396 data->block[0] = len; in ali15x3_access()
399 /* Reset SMBBLKDAT */ in ali15x3_access()
402 outb_p(data->block[i], SMBBLKDAT); in ali15x3_access()
407 dev_warn(&adap->dev, "Unsupported transaction %d\n", size); in ali15x3_access()
408 return -EOPNOTSUPP; in ali15x3_access()
423 data->byte = inb_p(SMBHSTDAT0); in ali15x3_access()
426 data->byte = inb_p(SMBHSTDAT0); in ali15x3_access()
429 data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); in ali15x3_access()
435 data->block[0] = len; in ali15x3_access()
436 /* Reset SMBBLKDAT */ in ali15x3_access()
438 for (i = 1; i <= data->block[0]; i++) { in ali15x3_access()
439 data->block[i] = inb_p(SMBBLKDAT); in ali15x3_access()
440 dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n", in ali15x3_access()
441 len, i, data->block[i]); in ali15x3_access()
478 dev_err(&dev->dev, in ali15x3_probe()
480 return -ENODEV; in ali15x3_probe()
484 ali15x3_adapter.dev.parent = &dev->dev; in ali15x3_probe()