blob: 848a36456d4666ea14aaa3b09a9f4c1dd065d115 [file] [log] [blame]
Norman James6a58a272015-10-07 14:34:16 -05001#ifndef __AST_H
2#define __AST_H
3
4/*
5 * AHB bus registers
6 */
7
8/* SPI Flash controller #1 (BMC) */
9#define BMC_SPI_FCTL_BASE 0x1E620000
10#define BMC_SPI_FCTL_CTRL (BMC_SPI_FCTL_BASE + 0x10)
11#define BMC_SPI_FREAD_TIMING (BMC_SPI_FCTL_BASE + 0x94)
12#define BMC_FLASH_BASE 0x20000000
13
14/* SPI Flash controller #2 (PNOR) */
15#define PNOR_SPI_FCTL_BASE 0x1E630000
16#define PNOR_SPI_FCTL_CONF (PNOR_SPI_FCTL_BASE + 0x00)
17#define PNOR_SPI_FCTL_CTRL (PNOR_SPI_FCTL_BASE + 0x04)
18#define PNOR_SPI_FREAD_TIMING (PNOR_SPI_FCTL_BASE + 0x14)
19#define PNOR_FLASH_BASE 0x30000000
20
21/* LPC registers */
22#define LPC_BASE 0x1e789000
23#define LPC_HICR6 (LPC_BASE + 0x80)
24#define LPC_HICR7 (LPC_BASE + 0x88)
25#define LPC_HICR8 (LPC_BASE + 0x8c)
26
27/* SCU registers */
28#define SCU_BASE 0x1e6e2000
29#define SCU_HW_STRAPPING (SCU_BASE + 0x70)
30
31/*
32 * AHB Accessors
33 */
34#ifndef __SKIBOOT__
35#include "io.h"
36#else
37
38/*
39 * Register accessors, return byteswapped values
40 * (IE. LE registers)
41 */
42void ast_ahb_writel(uint32_t val, uint32_t reg);
43uint32_t ast_ahb_readl(uint32_t reg);
44
45/*
46 * copy to/from accessors. Cannot cross IDSEL boundaries (256M)
47 */
48int ast_copy_to_ahb(uint32_t reg, const void *src, uint32_t len);
49int ast_copy_from_ahb(void *dst, uint32_t reg, uint32_t len);
50
51void ast_io_init(void);
52
53#endif /* __SKIBOOT__ */
54
55/*
56 * SPI Flash controllers
57 */
58#define AST_SF_TYPE_PNOR 0
59#define AST_SF_TYPE_BMC 1
60
61struct spi_flash_ctrl;
62int ast_sf_open(uint8_t type, struct spi_flash_ctrl **ctrl);
63void ast_sf_close(struct spi_flash_ctrl *ctrl);
64
65
66#endif /* __AST_H */