xref: /linux/arch/powerpc/sysdev/fsl_rio.h (revision 6ec4bedbf153a8ef71aeba99a40efef556b57798)
1*6ec4bedbSLiu Gang /*
2*6ec4bedbSLiu Gang  * Freescale MPC85xx/MPC86xx RapidIO support
3*6ec4bedbSLiu Gang  *
4*6ec4bedbSLiu Gang  * Copyright 2009 Sysgo AG
5*6ec4bedbSLiu Gang  * Thomas Moll <thomas.moll@sysgo.com>
6*6ec4bedbSLiu Gang  * - fixed maintenance access routines, check for aligned access
7*6ec4bedbSLiu Gang  *
8*6ec4bedbSLiu Gang  * Copyright 2009 Integrated Device Technology, Inc.
9*6ec4bedbSLiu Gang  * Alex Bounine <alexandre.bounine@idt.com>
10*6ec4bedbSLiu Gang  * - Added Port-Write message handling
11*6ec4bedbSLiu Gang  * - Added Machine Check exception handling
12*6ec4bedbSLiu Gang  *
13*6ec4bedbSLiu Gang  * Copyright (C) 2007, 2008, 2010, 2011 Freescale Semiconductor, Inc.
14*6ec4bedbSLiu Gang  * Zhang Wei <wei.zhang@freescale.com>
15*6ec4bedbSLiu Gang  * Lian Minghuan-B31939 <Minghuan.Lian@freescale.com>
16*6ec4bedbSLiu Gang  * Liu Gang <Gang.Liu@freescale.com>
17*6ec4bedbSLiu Gang  *
18*6ec4bedbSLiu Gang  * Copyright 2005 MontaVista Software, Inc.
19*6ec4bedbSLiu Gang  * Matt Porter <mporter@kernel.crashing.org>
20*6ec4bedbSLiu Gang  *
21*6ec4bedbSLiu Gang  * This program is free software; you can redistribute  it and/or modify it
22*6ec4bedbSLiu Gang  * under  the terms of  the GNU General  Public License as published by the
23*6ec4bedbSLiu Gang  * Free Software Foundation;  either version 2 of the  License, or (at your
24*6ec4bedbSLiu Gang  * option) any later version.
25*6ec4bedbSLiu Gang  */
26*6ec4bedbSLiu Gang 
27*6ec4bedbSLiu Gang #ifndef __FSL_RIO_H
28*6ec4bedbSLiu Gang #define __FSL_RIO_H
29*6ec4bedbSLiu Gang 
30*6ec4bedbSLiu Gang #include <linux/rio.h>
31*6ec4bedbSLiu Gang #include <linux/rio_drv.h>
32*6ec4bedbSLiu Gang #include <linux/kfifo.h>
33*6ec4bedbSLiu Gang 
34*6ec4bedbSLiu Gang #define RIO_REGS_WIN(mport)	(((struct rio_priv *)(mport->priv))->regs_win)
35*6ec4bedbSLiu Gang 
36*6ec4bedbSLiu Gang #define RIO_MAINT_WIN_SIZE	0x400000
37*6ec4bedbSLiu Gang #define RIO_LTLEDCSR		0x0608
38*6ec4bedbSLiu Gang 
39*6ec4bedbSLiu Gang struct rio_atmu_regs {
40*6ec4bedbSLiu Gang 	 u32 rowtar;
41*6ec4bedbSLiu Gang 	 u32 rowtear;
42*6ec4bedbSLiu Gang 	 u32 rowbar;
43*6ec4bedbSLiu Gang 	 u32 pad2;
44*6ec4bedbSLiu Gang 	 u32 rowar;
45*6ec4bedbSLiu Gang 	 u32 pad3[3];
46*6ec4bedbSLiu Gang };
47*6ec4bedbSLiu Gang 
48*6ec4bedbSLiu Gang struct rio_port_write_msg {
49*6ec4bedbSLiu Gang 	 void *virt;
50*6ec4bedbSLiu Gang 	 dma_addr_t phys;
51*6ec4bedbSLiu Gang 	 u32 msg_count;
52*6ec4bedbSLiu Gang 	 u32 err_count;
53*6ec4bedbSLiu Gang 	 u32 discard_count;
54*6ec4bedbSLiu Gang };
55*6ec4bedbSLiu Gang 
56*6ec4bedbSLiu Gang struct rio_priv {
57*6ec4bedbSLiu Gang 	struct device *dev;
58*6ec4bedbSLiu Gang 	void __iomem *regs_win;
59*6ec4bedbSLiu Gang 	struct rio_atmu_regs __iomem *atmu_regs;
60*6ec4bedbSLiu Gang 	struct rio_atmu_regs __iomem *maint_atmu_regs;
61*6ec4bedbSLiu Gang 	void __iomem *maint_win;
62*6ec4bedbSLiu Gang 	struct rio_port_write_msg port_write_msg;
63*6ec4bedbSLiu Gang 	int pwirq;
64*6ec4bedbSLiu Gang 	struct work_struct pw_work;
65*6ec4bedbSLiu Gang 	struct kfifo pw_fifo;
66*6ec4bedbSLiu Gang 	spinlock_t pw_fifo_lock;
67*6ec4bedbSLiu Gang 	void *rmm_handle; /* RapidIO message manager(unit) Handle */
68*6ec4bedbSLiu Gang };
69*6ec4bedbSLiu Gang 
70*6ec4bedbSLiu Gang extern void __iomem *rio_regs_win;
71*6ec4bedbSLiu Gang 
72*6ec4bedbSLiu Gang extern int fsl_rio_setup_rmu(struct rio_mport *mport,
73*6ec4bedbSLiu Gang 	struct device_node *node);
74*6ec4bedbSLiu Gang extern int fsl_rio_port_write_init(struct rio_mport *mport);
75*6ec4bedbSLiu Gang extern int fsl_rio_pw_enable(struct rio_mport *mport, int enable);
76*6ec4bedbSLiu Gang extern void fsl_rio_port_error_handler(struct rio_mport *port, int offset);
77*6ec4bedbSLiu Gang 
78*6ec4bedbSLiu Gang #endif
79