162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Common routines for the Motorola SPS MPC106/8240/107 Host bridge/Mem 362306a36Sopenharmony_ci * ctlr/EPIC/etc. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Author: Mark A. Greer 662306a36Sopenharmony_ci * mgreer@mvista.com 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * 2001 (c) MontaVista, Software, Inc. This file is licensed under 962306a36Sopenharmony_ci * the terms of the GNU General Public License version 2. This program 1062306a36Sopenharmony_ci * is licensed "as is" without any warranty of any kind, whether express 1162306a36Sopenharmony_ci * or implied. 1262306a36Sopenharmony_ci */ 1362306a36Sopenharmony_ci#ifndef __PPC_KERNEL_MPC10X_H 1462306a36Sopenharmony_ci#define __PPC_KERNEL_MPC10X_H 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#include <linux/pci_ids.h> 1762306a36Sopenharmony_ci#include <asm/pci-bridge.h> 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/* 2062306a36Sopenharmony_ci * The values here don't completely map everything but should work in most 2162306a36Sopenharmony_ci * cases. 2262306a36Sopenharmony_ci * 2362306a36Sopenharmony_ci * MAP A (PReP Map) 2462306a36Sopenharmony_ci * Processor: 0x80000000 - 0x807fffff -> PCI I/O: 0x00000000 - 0x007fffff 2562306a36Sopenharmony_ci * Processor: 0xc0000000 - 0xdfffffff -> PCI MEM: 0x00000000 - 0x1fffffff 2662306a36Sopenharmony_ci * PCI MEM: 0x80000000 -> Processor System Memory: 0x00000000 2762306a36Sopenharmony_ci * 2862306a36Sopenharmony_ci * MAP B (CHRP Map) 2962306a36Sopenharmony_ci * Processor: 0xfe000000 - 0xfebfffff -> PCI I/O: 0x00000000 - 0x00bfffff 3062306a36Sopenharmony_ci * Processor: 0x80000000 - 0xbfffffff -> PCI MEM: 0x80000000 - 0xbfffffff 3162306a36Sopenharmony_ci * PCI MEM: 0x00000000 -> Processor System Memory: 0x00000000 3262306a36Sopenharmony_ci */ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci/* 3562306a36Sopenharmony_ci * Define the vendor/device IDs for the various bridges--should be added to 3662306a36Sopenharmony_ci * <linux/pci_ids.h> 3762306a36Sopenharmony_ci */ 3862306a36Sopenharmony_ci#define MPC10X_BRIDGE_106 ((PCI_DEVICE_ID_MOTOROLA_MPC106 << 16) | \ 3962306a36Sopenharmony_ci PCI_VENDOR_ID_MOTOROLA) 4062306a36Sopenharmony_ci#define MPC10X_BRIDGE_8240 ((0x0003 << 16) | PCI_VENDOR_ID_MOTOROLA) 4162306a36Sopenharmony_ci#define MPC10X_BRIDGE_107 ((0x0004 << 16) | PCI_VENDOR_ID_MOTOROLA) 4262306a36Sopenharmony_ci#define MPC10X_BRIDGE_8245 ((0x0006 << 16) | PCI_VENDOR_ID_MOTOROLA) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci/* Define the type of map to use */ 4562306a36Sopenharmony_ci#define MPC10X_MEM_MAP_A 1 4662306a36Sopenharmony_ci#define MPC10X_MEM_MAP_B 2 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci/* Map A (PReP Map) Defines */ 4962306a36Sopenharmony_ci#define MPC10X_MAPA_CNFG_ADDR 0x80000cf8 5062306a36Sopenharmony_ci#define MPC10X_MAPA_CNFG_DATA 0x80000cfc 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci#define MPC10X_MAPA_ISA_IO_BASE 0x80000000 5362306a36Sopenharmony_ci#define MPC10X_MAPA_ISA_MEM_BASE 0xc0000000 5462306a36Sopenharmony_ci#define MPC10X_MAPA_DRAM_OFFSET 0x80000000 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#define MPC10X_MAPA_PCI_INTACK_ADDR 0xbffffff0 5762306a36Sopenharmony_ci#define MPC10X_MAPA_PCI_IO_START 0x00000000 5862306a36Sopenharmony_ci#define MPC10X_MAPA_PCI_IO_END (0x00800000 - 1) 5962306a36Sopenharmony_ci#define MPC10X_MAPA_PCI_MEM_START 0x00000000 6062306a36Sopenharmony_ci#define MPC10X_MAPA_PCI_MEM_END (0x20000000 - 1) 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci#define MPC10X_MAPA_PCI_MEM_OFFSET (MPC10X_MAPA_ISA_MEM_BASE - \ 6362306a36Sopenharmony_ci MPC10X_MAPA_PCI_MEM_START) 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci/* Map B (CHRP Map) Defines */ 6662306a36Sopenharmony_ci#define MPC10X_MAPB_CNFG_ADDR 0xfec00000 6762306a36Sopenharmony_ci#define MPC10X_MAPB_CNFG_DATA 0xfee00000 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci#define MPC10X_MAPB_ISA_IO_BASE 0xfe000000 7062306a36Sopenharmony_ci#define MPC10X_MAPB_ISA_MEM_BASE 0x80000000 7162306a36Sopenharmony_ci#define MPC10X_MAPB_DRAM_OFFSET 0x00000000 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define MPC10X_MAPB_PCI_INTACK_ADDR 0xfef00000 7462306a36Sopenharmony_ci#define MPC10X_MAPB_PCI_IO_START 0x00000000 7562306a36Sopenharmony_ci#define MPC10X_MAPB_PCI_IO_END (0x00c00000 - 1) 7662306a36Sopenharmony_ci#define MPC10X_MAPB_PCI_MEM_START 0x80000000 7762306a36Sopenharmony_ci#define MPC10X_MAPB_PCI_MEM_END (0xc0000000 - 1) 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci#define MPC10X_MAPB_PCI_MEM_OFFSET (MPC10X_MAPB_ISA_MEM_BASE - \ 8062306a36Sopenharmony_ci MPC10X_MAPB_PCI_MEM_START) 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci/* Miscellaneous Configuration register offsets */ 8362306a36Sopenharmony_ci#define MPC10X_CFG_PIR_REG 0x09 8462306a36Sopenharmony_ci#define MPC10X_CFG_PIR_HOST_BRIDGE 0x00 8562306a36Sopenharmony_ci#define MPC10X_CFG_PIR_AGENT 0x01 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci#define MPC10X_CFG_EUMBBAR 0x78 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci#define MPC10X_CFG_PICR1_REG 0xa8 9062306a36Sopenharmony_ci#define MPC10X_CFG_PICR1_ADDR_MAP_MASK 0x00010000 9162306a36Sopenharmony_ci#define MPC10X_CFG_PICR1_ADDR_MAP_A 0x00010000 9262306a36Sopenharmony_ci#define MPC10X_CFG_PICR1_ADDR_MAP_B 0x00000000 9362306a36Sopenharmony_ci#define MPC10X_CFG_PICR1_SPEC_PCI_RD 0x00000004 9462306a36Sopenharmony_ci#define MPC10X_CFG_PICR1_ST_GATH_EN 0x00000040 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#define MPC10X_CFG_PICR2_REG 0xac 9762306a36Sopenharmony_ci#define MPC10X_CFG_PICR2_COPYBACK_OPT 0x00000001 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci#define MPC10X_CFG_MAPB_OPTIONS_REG 0xe0 10062306a36Sopenharmony_ci#define MPC10X_CFG_MAPB_OPTIONS_CFAE 0x80 /* CPU_FD_ALIAS_EN */ 10162306a36Sopenharmony_ci#define MPC10X_CFG_MAPB_OPTIONS_PFAE 0x40 /* PCI_FD_ALIAS_EN */ 10262306a36Sopenharmony_ci#define MPC10X_CFG_MAPB_OPTIONS_DR 0x20 /* DLL_RESET */ 10362306a36Sopenharmony_ci#define MPC10X_CFG_MAPB_OPTIONS_PCICH 0x08 /* PCI_COMPATIBILITY_HOLE */ 10462306a36Sopenharmony_ci#define MPC10X_CFG_MAPB_OPTIONS_PROCCH 0x04 /* PROC_COMPATIBILITY_HOLE */ 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci/* Define offsets for the memory controller registers in the config space */ 10762306a36Sopenharmony_ci#define MPC10X_MCTLR_MEM_START_1 0x80 /* Banks 0-3 */ 10862306a36Sopenharmony_ci#define MPC10X_MCTLR_MEM_START_2 0x84 /* Banks 4-7 */ 10962306a36Sopenharmony_ci#define MPC10X_MCTLR_EXT_MEM_START_1 0x88 /* Banks 0-3 */ 11062306a36Sopenharmony_ci#define MPC10X_MCTLR_EXT_MEM_START_2 0x8c /* Banks 4-7 */ 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci#define MPC10X_MCTLR_MEM_END_1 0x90 /* Banks 0-3 */ 11362306a36Sopenharmony_ci#define MPC10X_MCTLR_MEM_END_2 0x94 /* Banks 4-7 */ 11462306a36Sopenharmony_ci#define MPC10X_MCTLR_EXT_MEM_END_1 0x98 /* Banks 0-3 */ 11562306a36Sopenharmony_ci#define MPC10X_MCTLR_EXT_MEM_END_2 0x9c /* Banks 4-7 */ 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define MPC10X_MCTLR_MEM_BANK_ENABLES 0xa0 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci/* Define some offset in the EUMB */ 12062306a36Sopenharmony_ci#define MPC10X_EUMB_SIZE 0x00100000 /* Total EUMB size (1MB) */ 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci#define MPC10X_EUMB_MU_OFFSET 0x00000000 /* Msg Unit reg offset */ 12362306a36Sopenharmony_ci#define MPC10X_EUMB_MU_SIZE 0x00001000 /* Msg Unit reg size */ 12462306a36Sopenharmony_ci#define MPC10X_EUMB_DMA_OFFSET 0x00001000 /* DMA Unit reg offset */ 12562306a36Sopenharmony_ci#define MPC10X_EUMB_DMA_SIZE 0x00001000 /* DMA Unit reg size */ 12662306a36Sopenharmony_ci#define MPC10X_EUMB_ATU_OFFSET 0x00002000 /* Addr xlate reg offset */ 12762306a36Sopenharmony_ci#define MPC10X_EUMB_ATU_SIZE 0x00001000 /* Addr xlate reg size */ 12862306a36Sopenharmony_ci#define MPC10X_EUMB_I2C_OFFSET 0x00003000 /* I2C Unit reg offset */ 12962306a36Sopenharmony_ci#define MPC10X_EUMB_I2C_SIZE 0x00001000 /* I2C Unit reg size */ 13062306a36Sopenharmony_ci#define MPC10X_EUMB_DUART_OFFSET 0x00004000 /* DUART Unit reg offset (8245) */ 13162306a36Sopenharmony_ci#define MPC10X_EUMB_DUART_SIZE 0x00001000 /* DUART Unit reg size (8245) */ 13262306a36Sopenharmony_ci#define MPC10X_EUMB_EPIC_OFFSET 0x00040000 /* EPIC offset in EUMB */ 13362306a36Sopenharmony_ci#define MPC10X_EUMB_EPIC_SIZE 0x00030000 /* EPIC size */ 13462306a36Sopenharmony_ci#define MPC10X_EUMB_PM_OFFSET 0x000fe000 /* Performance Monitor reg offset (8245) */ 13562306a36Sopenharmony_ci#define MPC10X_EUMB_PM_SIZE 0x00001000 /* Performance Monitor reg size (8245) */ 13662306a36Sopenharmony_ci#define MPC10X_EUMB_WP_OFFSET 0x000ff000 /* Data path diagnostic, watchpoint reg offset */ 13762306a36Sopenharmony_ci#define MPC10X_EUMB_WP_SIZE 0x00001000 /* Data path diagnostic, watchpoint reg size */ 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_cienum ppc_sys_devices { 14062306a36Sopenharmony_ci MPC10X_IIC1, 14162306a36Sopenharmony_ci MPC10X_DMA0, 14262306a36Sopenharmony_ci MPC10X_DMA1, 14362306a36Sopenharmony_ci MPC10X_UART0, 14462306a36Sopenharmony_ci MPC10X_UART1, 14562306a36Sopenharmony_ci NUM_PPC_SYS_DEVS, 14662306a36Sopenharmony_ci}; 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ciint mpc10x_bridge_init(struct pci_controller *hose, 14962306a36Sopenharmony_ci uint current_map, 15062306a36Sopenharmony_ci uint new_map, 15162306a36Sopenharmony_ci uint phys_eumb_base); 15262306a36Sopenharmony_ciunsigned long mpc10x_get_mem_size(uint mem_map); 15362306a36Sopenharmony_ciint mpc10x_enable_store_gathering(struct pci_controller *hose); 15462306a36Sopenharmony_ciint mpc10x_disable_store_gathering(struct pci_controller *hose); 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci/* For MPC107 boards that use the built-in openpic */ 15762306a36Sopenharmony_civoid mpc10x_set_openpic(void); 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_civoid avr_uart_configure(void); 16062306a36Sopenharmony_civoid avr_uart_send(const char c); 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci#endif /* __PPC_KERNEL_MPC10X_H */ 163