• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef SUPERIO_SCH555x_H
4 #define SUPERIO_SCH555x_H
5 
6 #include <types.h>
7 
8 // Global registers
9 #define SCH555x_DEVICE_ID		0x20
10 #define SCH555x_DEVICE_REV		0x21
11 #define SCH555x_DEVICE_MODE		0x24
12 
13 // Logical device numbers
14 #define SCH555x_LDN_EMI			0x00
15 #define SCH555x_LDN_8042		0x01
16 #define SCH555x_LDN_UART1		0x07
17 #define SCH555x_LDN_UART2		0x08
18 #define SCH555x_LDN_RUNTIME		0x0a
19 #define SCH555x_LDN_FDC			0x0b
20 #define SCH555x_LDN_LPCI		0x0c
21 #define SCH555x_LDN_PP			0x11
22 #define SCH555x_LDN_GLOBAL		0x3f
23 
24 // LPC interface registers
25 #define SCH555x_LPCI_IRQ(i)		(0x40 + (i))
26 // DMA channel register is 2 bytes, we care about the second byte
27 #define SCH555x_LPCI_DMA(i)		(0x50 + (i) * 2 + 1)
28 // BAR offset (inside LPCI) for each LDN
29 #define SCH555x_LPCI_LPCI_BAR		0x60
30 #define SCH555x_LPCI_EMI_BAR		0x64
31 #define SCH555x_LPCI_UART1_BAR		0x68
32 #define SCH555x_LPCI_UART2_BAR		0x6c
33 #define SCH555x_LPCI_RUNTIME_BAR	0x70
34 #define SCH555x_LPCI_8042_BAR		0x78
35 #define SCH555x_LPCI_FDC_BAR		0x7c
36 #define SCH555x_LPCI_PP_BAR		0x80
37 
38 // Runtime registers (in I/O space)
39 #define SCH555x_RUNTIME_PME_STS		0x00
40 #define SCH555x_RUNTIME_PME_EN		0x01
41 #define SCH555x_RUNTIME_PME_EN1		0x05
42 #define SCH555x_RUNTIME_LED		0x25
43 // NOTE: not in the SCH5627P datasheet but Dell's firmware writes to it
44 #define SCH555x_RUNTIME_UNK1		0x35
45 
46 // Needed in the bootblock, thus we map them at a fixed address
47 #define SCH555x_EMI_IOBASE		0xa00
48 #define SCH555x_RUNTIME_IOBASE		0xa40
49 
50 /*
51  * EMI access
52  */
53 
54 uint8_t sch555x_emi_read8(uint16_t addr);
55 uint16_t sch555x_emi_read16(uint16_t addr);
56 uint32_t sch555x_emi_read32(uint16_t addr);
57 void sch555x_emi_write8(uint16_t addr, uint8_t val);
58 void sch555x_emi_write16(uint16_t addr, uint16_t val);
59 void sch555x_emi_write32(uint16_t addr, uint32_t val);
60 
61 /*
62  * Bootblock entry points
63  */
64 
65 void sch555x_early_init(pnp_devfn_t global_dev);
66 void sch555x_enable_serial(pnp_devfn_t uart_dev, uint16_t serial_iobase);
67 
68 #endif
69