Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
fsl_rio.h
Go to the documentation of this file.
1 /*
2  * Freescale MPC85xx/MPC86xx RapidIO support
3  *
4  * Copyright 2009 Sysgo AG
5  * Thomas Moll <[email protected]>
6  * - fixed maintenance access routines, check for aligned access
7  *
8  * Copyright 2009 Integrated Device Technology, Inc.
9  * Alex Bounine <[email protected]>
10  * - Added Port-Write message handling
11  * - Added Machine Check exception handling
12  *
13  * Copyright (C) 2007, 2008, 2010, 2011 Freescale Semiconductor, Inc.
14  * Zhang Wei <[email protected]>
15  * Lian Minghuan-B31939 <[email protected]>
16  * Liu Gang <[email protected]>
17  *
18  * Copyright 2005 MontaVista Software, Inc.
19  * Matt Porter <[email protected]>
20  *
21  * This program is free software; you can redistribute it and/or modify it
22  * under the terms of the GNU General Public License as published by the
23  * Free Software Foundation; either version 2 of the License, or (at your
24  * option) any later version.
25  */
26 
27 #ifndef __FSL_RIO_H
28 #define __FSL_RIO_H
29 
30 #include <linux/rio.h>
31 #include <linux/rio_drv.h>
32 #include <linux/kfifo.h>
33 
34 #define RIO_REGS_WIN(mport) (((struct rio_priv *)(mport->priv))->regs_win)
35 
36 #define RIO_MAINT_WIN_SIZE 0x400000
37 #define RIO_LTLEDCSR 0x0608
38 
39 #define DOORBELL_ROWAR_EN 0x80000000
40 #define DOORBELL_ROWAR_TFLOWLV 0x08000000 /* highest priority level */
41 #define DOORBELL_ROWAR_PCI 0x02000000 /* PCI window */
42 #define DOORBELL_ROWAR_NREAD 0x00040000 /* NREAD */
43 #define DOORBELL_ROWAR_MAINTRD 0x00070000 /* maintenance read */
44 #define DOORBELL_ROWAR_RES 0x00002000 /* wrtpy: reserverd */
45 #define DOORBELL_ROWAR_MAINTWD 0x00007000
46 #define DOORBELL_ROWAR_SIZE 0x0000000b /* window size is 4k */
47 
48 #define RIO_ATMU_REGS_PORT1_OFFSET 0x10c00
49 #define RIO_ATMU_REGS_PORT2_OFFSET 0x10e00
50 #define RIO_S_DBELL_REGS_OFFSET 0x13400
51 #define RIO_S_PW_REGS_OFFSET 0x134e0
52 #define RIO_ATMU_REGS_DBELL_OFFSET 0x10C40
53 
54 #define MAX_MSG_UNIT_NUM 2
55 #define MAX_PORT_NUM 4
56 
57 struct rio_atmu_regs {
63  u32 pad2[3];
64 };
65 
67  void *virt;
69 };
70 
72  void *virt;
77 };
78 
79 struct fsl_rio_dbell {
81  struct device *dev;
84  int bellirq;
85 };
86 
87 struct fsl_rio_pw {
88  struct device *dev;
91  int pwirq;
93  struct kfifo pw_fifo;
95 };
96 
97 struct rio_priv {
98  struct device *dev;
103  void *rmm_handle; /* RapidIO message manager(unit) Handle */
104 };
105 
106 extern void __iomem *rio_regs_win;
107 extern void __iomem *rmu_regs_win;
108 
110 
111 extern struct fsl_rio_dbell *dbell;
112 extern struct fsl_rio_pw *pw;
113 
114 extern int fsl_rio_setup_rmu(struct rio_mport *mport,
115  struct device_node *node);
116 extern int fsl_rio_port_write_init(struct fsl_rio_pw *pw);
117 extern int fsl_rio_pw_enable(struct rio_mport *mport, int enable);
118 extern void fsl_rio_port_error_handler(int offset);
119 extern int fsl_rio_doorbell_init(struct fsl_rio_dbell *dbell);
120 
121 extern int fsl_rio_doorbell_send(struct rio_mport *mport,
122  int index, u16 destid, u16 data);
123 extern int fsl_add_outb_message(struct rio_mport *mport,
124  struct rio_dev *rdev,
125  int mbox, void *buffer, size_t len);
126 extern int fsl_open_outb_mbox(struct rio_mport *mport,
127  void *dev_id, int mbox, int entries);
128 extern void fsl_close_outb_mbox(struct rio_mport *mport, int mbox);
129 extern int fsl_open_inb_mbox(struct rio_mport *mport,
130  void *dev_id, int mbox, int entries);
131 extern void fsl_close_inb_mbox(struct rio_mport *mport, int mbox);
132 extern int fsl_add_inb_buffer(struct rio_mport *mport, int mbox, void *buf);
133 extern void *fsl_get_inb_message(struct rio_mport *mport, int mbox);
134 
135 #endif