162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci *
362306a36Sopenharmony_ci *	Low-Level PCI Support for SH7751 targets
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Dustin McIntire (dustin@sensoria.com) (c) 2001
662306a36Sopenharmony_ci *  Paul Mundt (lethal@linux-sh.org) (c) 2003
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef _PCI_SH7751_H_
1062306a36Sopenharmony_ci#define _PCI_SH7751_H_
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/* Platform Specific Values */
1362306a36Sopenharmony_ci#define SH7751_VENDOR_ID             0x1054
1462306a36Sopenharmony_ci#define SH7751_DEVICE_ID             0x3505
1562306a36Sopenharmony_ci#define SH7751R_DEVICE_ID            0x350e
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/* SH7751 Specific Values */
1862306a36Sopenharmony_ci#define SH7751_PCI_CONFIG_BASE	     0xFD000000  /* Config space base addr */
1962306a36Sopenharmony_ci#define SH7751_PCI_CONFIG_SIZE       0x1000000   /* Config space size */
2062306a36Sopenharmony_ci#define SH7751_PCI_MEMORY_BASE	     0xFD000000  /* Memory space base addr */
2162306a36Sopenharmony_ci#define SH7751_PCI_MEM_SIZE          0x01000000  /* Size of Memory window */
2262306a36Sopenharmony_ci#define SH7751_PCI_IO_BASE           0xFE240000  /* IO space base address */
2362306a36Sopenharmony_ci#define SH7751_PCI_IO_SIZE           0x40000     /* Size of IO window */
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define SH7751_PCIREG_BASE           0xFE200000  /* PCI regs base address */
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define SH7751_PCICONF0            0x0           /* PCI Config Reg 0 */
2862306a36Sopenharmony_ci  #define SH7751_PCICONF0_DEVID      0xFFFF0000  /* Device ID */
2962306a36Sopenharmony_ci  #define SH7751_PCICONF0_VNDID      0x0000FFFF  /* Vendor ID */
3062306a36Sopenharmony_ci#define SH7751_PCICONF1            0x4           /* PCI Config Reg 1 */
3162306a36Sopenharmony_ci  #define SH7751_PCICONF1_DPE        0x80000000  /* Data Parity Error */
3262306a36Sopenharmony_ci  #define SH7751_PCICONF1_SSE        0x40000000  /* System Error Status */
3362306a36Sopenharmony_ci  #define SH7751_PCICONF1_RMA        0x20000000  /* Master Abort */
3462306a36Sopenharmony_ci  #define SH7751_PCICONF1_RTA        0x10000000  /* Target Abort Rx Status */
3562306a36Sopenharmony_ci  #define SH7751_PCICONF1_STA        0x08000000  /* Target Abort Exec Status */
3662306a36Sopenharmony_ci  #define SH7751_PCICONF1_DEV        0x06000000  /* Timing Status */
3762306a36Sopenharmony_ci  #define SH7751_PCICONF1_DPD        0x01000000  /* Data Parity Status */
3862306a36Sopenharmony_ci  #define SH7751_PCICONF1_FBBC       0x00800000  /* Back 2 Back Status */
3962306a36Sopenharmony_ci  #define SH7751_PCICONF1_UDF        0x00400000  /* User Defined Status */
4062306a36Sopenharmony_ci  #define SH7751_PCICONF1_66M        0x00200000  /* 66Mhz Operation Status */
4162306a36Sopenharmony_ci  #define SH7751_PCICONF1_PM         0x00100000  /* Power Management Status */
4262306a36Sopenharmony_ci  #define SH7751_PCICONF1_PBBE       0x00000200  /* Back 2 Back Control */
4362306a36Sopenharmony_ci  #define SH7751_PCICONF1_SER        0x00000100  /* SERR Output Control */
4462306a36Sopenharmony_ci  #define SH7751_PCICONF1_WCC        0x00000080  /* Wait Cycle Control */
4562306a36Sopenharmony_ci  #define SH7751_PCICONF1_PER        0x00000040  /* Parity Error Response */
4662306a36Sopenharmony_ci  #define SH7751_PCICONF1_VPS        0x00000020  /* VGA Pallet Snoop */
4762306a36Sopenharmony_ci  #define SH7751_PCICONF1_MWIE       0x00000010  /* Memory Write+Invalidate */
4862306a36Sopenharmony_ci  #define SH7751_PCICONF1_SPC        0x00000008  /* Special Cycle Control */
4962306a36Sopenharmony_ci  #define SH7751_PCICONF1_BUM        0x00000004  /* Bus Master Control */
5062306a36Sopenharmony_ci  #define SH7751_PCICONF1_MES        0x00000002  /* Memory Space Control */
5162306a36Sopenharmony_ci  #define SH7751_PCICONF1_IOS        0x00000001  /* I/O Space Control */
5262306a36Sopenharmony_ci#define SH7751_PCICONF2            0x8           /* PCI Config Reg 2 */
5362306a36Sopenharmony_ci  #define SH7751_PCICONF2_BCC        0xFF000000  /* Base Class Code */
5462306a36Sopenharmony_ci  #define SH7751_PCICONF2_SCC        0x00FF0000  /* Sub-Class Code */
5562306a36Sopenharmony_ci  #define SH7751_PCICONF2_RLPI       0x0000FF00  /* Programming Interface */
5662306a36Sopenharmony_ci  #define SH7751_PCICONF2_REV        0x000000FF  /* Revision ID */
5762306a36Sopenharmony_ci#define SH7751_PCICONF3            0xC           /* PCI Config Reg 3 */
5862306a36Sopenharmony_ci  #define SH7751_PCICONF3_BIST7      0x80000000  /* Bist Supported */
5962306a36Sopenharmony_ci  #define SH7751_PCICONF3_BIST6      0x40000000  /* Bist Executing */
6062306a36Sopenharmony_ci  #define SH7751_PCICONF3_BIST3_0    0x0F000000  /* Bist Passed */
6162306a36Sopenharmony_ci  #define SH7751_PCICONF3_HD7        0x00800000  /* Single Function device */
6262306a36Sopenharmony_ci  #define SH7751_PCICONF3_HD6_0      0x007F0000  /* Configuration Layout */
6362306a36Sopenharmony_ci  #define SH7751_PCICONF3_LAT        0x0000FF00  /* Latency Timer */
6462306a36Sopenharmony_ci  #define SH7751_PCICONF3_CLS        0x000000FF  /* Cache Line Size */
6562306a36Sopenharmony_ci#define SH7751_PCICONF4            0x10          /* PCI Config Reg 4 */
6662306a36Sopenharmony_ci  #define SH7751_PCICONF4_BASE       0xFFFFFFFC  /* I/O Space Base Addr */
6762306a36Sopenharmony_ci  #define SH7751_PCICONF4_ASI        0x00000001  /* Address Space Type */
6862306a36Sopenharmony_ci#define SH7751_PCICONF5            0x14          /* PCI Config Reg 5 */
6962306a36Sopenharmony_ci  #define SH7751_PCICONF5_BASE       0xFFFFFFF0  /* Mem Space Base Addr */
7062306a36Sopenharmony_ci  #define SH7751_PCICONF5_LAP        0x00000008  /* Prefetch Enabled */
7162306a36Sopenharmony_ci  #define SH7751_PCICONF5_LAT        0x00000006  /* Local Memory type */
7262306a36Sopenharmony_ci  #define SH7751_PCICONF5_ASI        0x00000001  /* Address Space Type */
7362306a36Sopenharmony_ci#define SH7751_PCICONF6            0x18          /* PCI Config Reg 6 */
7462306a36Sopenharmony_ci  #define SH7751_PCICONF6_BASE       0xFFFFFFF0  /* Mem Space Base Addr */
7562306a36Sopenharmony_ci  #define SH7751_PCICONF6_LAP        0x00000008  /* Prefetch Enabled */
7662306a36Sopenharmony_ci  #define SH7751_PCICONF6_LAT        0x00000006  /* Local Memory type */
7762306a36Sopenharmony_ci  #define SH7751_PCICONF6_ASI        0x00000001  /* Address Space Type */
7862306a36Sopenharmony_ci/* PCICONF7 - PCICONF10 are undefined */
7962306a36Sopenharmony_ci#define SH7751_PCICONF11           0x2C          /* PCI Config Reg 11 */
8062306a36Sopenharmony_ci  #define SH7751_PCICONF11_SSID      0xFFFF0000  /* Subsystem ID */
8162306a36Sopenharmony_ci  #define SH7751_PCICONF11_SVID      0x0000FFFF  /* Subsystem Vendor ID */
8262306a36Sopenharmony_ci/* PCICONF12 is undefined */
8362306a36Sopenharmony_ci#define SH7751_PCICONF13           0x34          /* PCI Config Reg 13 */
8462306a36Sopenharmony_ci  #define SH7751_PCICONF13_CPTR      0x000000FF  /* PM function pointer */
8562306a36Sopenharmony_ci/* PCICONF14 is undefined */
8662306a36Sopenharmony_ci#define SH7751_PCICONF15           0x3C          /* PCI Config Reg 15 */
8762306a36Sopenharmony_ci  #define SH7751_PCICONF15_IPIN      0x000000FF  /* Interrupt Pin */
8862306a36Sopenharmony_ci#define SH7751_PCICONF16           0x40          /* PCI Config Reg 16 */
8962306a36Sopenharmony_ci  #define SH7751_PCICONF16_PMES      0xF8000000  /* PME Support */
9062306a36Sopenharmony_ci  #define SH7751_PCICONF16_D2S       0x04000000  /* D2 Support */
9162306a36Sopenharmony_ci  #define SH7751_PCICONF16_D1S       0x02000000  /* D1 Support */
9262306a36Sopenharmony_ci  #define SH7751_PCICONF16_DSI       0x00200000  /* Bit Device Init. */
9362306a36Sopenharmony_ci  #define SH7751_PCICONF16_PMCK      0x00080000  /* Clock for PME req. */
9462306a36Sopenharmony_ci  #define SH7751_PCICONF16_VER       0x00070000  /* PM Version */
9562306a36Sopenharmony_ci  #define SH7751_PCICONF16_NIP       0x0000FF00  /* Next Item Pointer */
9662306a36Sopenharmony_ci  #define SH7751_PCICONF16_CID       0x000000FF  /* Capability Identifier */
9762306a36Sopenharmony_ci#define SH7751_PCICONF17           0x44          /* PCI Config Reg 17 */
9862306a36Sopenharmony_ci  #define SH7751_PCICONF17_DATA      0xFF000000  /* Data field for PM */
9962306a36Sopenharmony_ci  #define SH7751_PCICONF17_PMES      0x00800000  /* PME Status */
10062306a36Sopenharmony_ci  #define SH7751_PCICONF17_DSCL      0x00600000  /* Data Scaling Value */
10162306a36Sopenharmony_ci  #define SH7751_PCICONF17_DSEL      0x001E0000  /* Data Select */
10262306a36Sopenharmony_ci  #define SH7751_PCICONF17_PMEN      0x00010000  /* PME Enable */
10362306a36Sopenharmony_ci  #define SH7751_PCICONF17_PWST      0x00000003  /* Power State */
10462306a36Sopenharmony_ci/* SH7715 Internal PCI Registers */
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci/* Memory Control Registers */
10762306a36Sopenharmony_ci#define SH7751_BCR1                0xFF800000    /* Memory BCR1 Register */
10862306a36Sopenharmony_ci#define SH7751_BCR2                0xFF800004    /* Memory BCR2 Register */
10962306a36Sopenharmony_ci#define SH7751_BCR3                0xFF800050    /* Memory BCR3 Register */
11062306a36Sopenharmony_ci#define SH7751_BCR4                0xFE0A00F0    /* Memory BCR4 Register */
11162306a36Sopenharmony_ci#define SH7751_WCR1                0xFF800008    /* Wait Control 1 Register */
11262306a36Sopenharmony_ci#define SH7751_WCR2                0xFF80000C    /* Wait Control 2 Register */
11362306a36Sopenharmony_ci#define SH7751_WCR3                0xFF800010    /* Wait Control 3 Register */
11462306a36Sopenharmony_ci#define SH7751_MCR                 0xFF800014    /* Memory Control Register */
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci/* General Memory Config Addresses */
11762306a36Sopenharmony_ci#define SH7751_CS0_BASE_ADDR       0x0
11862306a36Sopenharmony_ci#define SH7751_MEM_REGION_SIZE     0x04000000
11962306a36Sopenharmony_ci#define SH7751_CS1_BASE_ADDR       (SH7751_CS0_BASE_ADDR + SH7751_MEM_REGION_SIZE)
12062306a36Sopenharmony_ci#define SH7751_CS2_BASE_ADDR       (SH7751_CS1_BASE_ADDR + SH7751_MEM_REGION_SIZE)
12162306a36Sopenharmony_ci#define SH7751_CS3_BASE_ADDR       (SH7751_CS2_BASE_ADDR + SH7751_MEM_REGION_SIZE)
12262306a36Sopenharmony_ci#define SH7751_CS4_BASE_ADDR       (SH7751_CS3_BASE_ADDR + SH7751_MEM_REGION_SIZE)
12362306a36Sopenharmony_ci#define SH7751_CS5_BASE_ADDR       (SH7751_CS4_BASE_ADDR + SH7751_MEM_REGION_SIZE)
12462306a36Sopenharmony_ci#define SH7751_CS6_BASE_ADDR       (SH7751_CS5_BASE_ADDR + SH7751_MEM_REGION_SIZE)
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci#endif /* _PCI_SH7751_H_ */
127