Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Priyanka Gupta | 15e28bf | 2010-10-25 17:58:04 -0700 | [diff] [blame] | 2 | /* |
| 3 | * sp5100_tco: TCO timer driver for sp5100 chipsets. |
| 4 | * |
| 5 | * (c) Copyright 2009 Google Inc., All Rights Reserved. |
| 6 | * |
| 7 | * TCO timer driver for sp5100 chipsets |
| 8 | */ |
| 9 | |
Guenter Roeck | 17b2083 | 2017-12-24 13:04:15 -0800 | [diff] [blame^] | 10 | #include <linux/bitops.h> |
| 11 | |
Priyanka Gupta | 15e28bf | 2010-10-25 17:58:04 -0700 | [diff] [blame] | 12 | /* |
| 13 | * Some address definitions for the Watchdog |
| 14 | */ |
Priyanka Gupta | 15e28bf | 2010-10-25 17:58:04 -0700 | [diff] [blame] | 15 | #define SP5100_WDT_MEM_MAP_SIZE 0x08 |
| 16 | #define SP5100_WDT_CONTROL(base) ((base) + 0x00) /* Watchdog Control */ |
| 17 | #define SP5100_WDT_COUNT(base) ((base) + 0x04) /* Watchdog Count */ |
| 18 | |
Guenter Roeck | 17b2083 | 2017-12-24 13:04:15 -0800 | [diff] [blame^] | 19 | #define SP5100_WDT_START_STOP_BIT BIT(0) |
| 20 | #define SP5100_WDT_FIRED BIT(1) |
| 21 | #define SP5100_WDT_ACTION_RESET BIT(2) |
| 22 | #define SP5100_WDT_TRIGGER_BIT BIT(7) |
Priyanka Gupta | 15e28bf | 2010-10-25 17:58:04 -0700 | [diff] [blame] | 23 | |
Priyanka Gupta | 15e28bf | 2010-10-25 17:58:04 -0700 | [diff] [blame] | 24 | #define SP5100_PM_IOPORTS_SIZE 0x02 |
| 25 | |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 26 | /* |
| 27 | * These two IO registers are hardcoded and there doesn't seem to be a way to |
Priyanka Gupta | 15e28bf | 2010-10-25 17:58:04 -0700 | [diff] [blame] | 28 | * read them from a register. |
| 29 | */ |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 30 | |
Guenter Roeck | 2b750cf | 2017-12-24 13:04:06 -0800 | [diff] [blame] | 31 | /* For SP5100/SB7x0/SB8x0 chipset */ |
Priyanka Gupta | 15e28bf | 2010-10-25 17:58:04 -0700 | [diff] [blame] | 32 | #define SP5100_IO_PM_INDEX_REG 0xCD6 |
| 33 | #define SP5100_IO_PM_DATA_REG 0xCD7 |
| 34 | |
Guenter Roeck | 2b750cf | 2017-12-24 13:04:06 -0800 | [diff] [blame] | 35 | /* For SP5100/SB7x0 chipset */ |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 36 | #define SP5100_SB_RESOURCE_MMIO_BASE 0x9C |
| 37 | |
Priyanka Gupta | 15e28bf | 2010-10-25 17:58:04 -0700 | [diff] [blame] | 38 | #define SP5100_PM_WATCHDOG_CONTROL 0x69 |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 39 | #define SP5100_PM_WATCHDOG_BASE 0x6C |
Priyanka Gupta | 15e28bf | 2010-10-25 17:58:04 -0700 | [diff] [blame] | 40 | |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 41 | #define SP5100_PCI_WATCHDOG_MISC_REG 0x41 |
Guenter Roeck | 17b2083 | 2017-12-24 13:04:15 -0800 | [diff] [blame^] | 42 | #define SP5100_PCI_WATCHDOG_DECODE_EN BIT(3) |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 43 | |
Guenter Roeck | 17b2083 | 2017-12-24 13:04:15 -0800 | [diff] [blame^] | 44 | #define SP5100_PM_WATCHDOG_DISABLE ((u8)BIT(0)) |
| 45 | #define SP5100_PM_WATCHDOG_SECOND_RES GENMASK(2, 1) |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 46 | |
| 47 | #define SP5100_DEVNAME "SP5100 TCO" |
| 48 | |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 49 | /* For SB8x0(or later) chipset */ |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 50 | #define SB800_PM_ACPI_MMIO_EN 0x24 |
| 51 | #define SB800_PM_WATCHDOG_CONTROL 0x48 |
| 52 | #define SB800_PM_WATCHDOG_BASE 0x48 |
| 53 | #define SB800_PM_WATCHDOG_CONFIG 0x4C |
| 54 | |
Guenter Roeck | 17b2083 | 2017-12-24 13:04:15 -0800 | [diff] [blame^] | 55 | #define SB800_PCI_WATCHDOG_DECODE_EN BIT(0) |
| 56 | #define SB800_PM_WATCHDOG_DISABLE ((u8)BIT(1)) |
| 57 | #define SB800_PM_WATCHDOG_SECOND_RES GENMASK(1, 0) |
| 58 | #define SB800_ACPI_MMIO_DECODE_EN BIT(0) |
| 59 | #define SB800_ACPI_MMIO_SEL BIT(1) |
Takahisa Tanaka | 740fbdd | 2012-12-02 14:33:18 +0900 | [diff] [blame] | 60 | |
| 61 | #define SB800_PM_WDT_MMIO_OFFSET 0xB00 |
| 62 | |
| 63 | #define SB800_DEVNAME "SB800 TCO" |