Commit abc3aeae authored by Liu Gang's avatar Liu Gang Committed by Kumar Gala

fsl-rio: Add two ports and rapidio message units support

Usually, freescale rapidio endpoint can support one or two 1x or 4X
LP-Serial link interfaces, and rapidio message transactions can be
implemented by two message units. This adds the support of two
rapidio ports and initializes message unit 0 and message unit 1. And
these ports and message units can work simultaneously.
Signed-off-by: default avatarLi Yang <leoli@freescale.com>
Signed-off-by: default avatarJin Qing <b24347@freescale.com>
Signed-off-by: default avatarLiu Gang <Gang.Liu@freescale.com>
Acked-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 6ec4bedb
This diff is collapsed.
...@@ -36,13 +36,36 @@ ...@@ -36,13 +36,36 @@
#define RIO_MAINT_WIN_SIZE 0x400000 #define RIO_MAINT_WIN_SIZE 0x400000
#define RIO_LTLEDCSR 0x0608 #define RIO_LTLEDCSR 0x0608
#define DOORBELL_ROWAR_EN 0x80000000
#define DOORBELL_ROWAR_TFLOWLV 0x08000000 /* highest priority level */
#define DOORBELL_ROWAR_PCI 0x02000000 /* PCI window */
#define DOORBELL_ROWAR_NREAD 0x00040000 /* NREAD */
#define DOORBELL_ROWAR_MAINTRD 0x00070000 /* maintenance read */
#define DOORBELL_ROWAR_RES 0x00002000 /* wrtpy: reserverd */
#define DOORBELL_ROWAR_MAINTWD 0x00007000
#define DOORBELL_ROWAR_SIZE 0x0000000b /* window size is 4k */
#define RIO_ATMU_REGS_PORT1_OFFSET 0x10c00
#define RIO_ATMU_REGS_PORT2_OFFSET 0x10e00
#define RIO_S_DBELL_REGS_OFFSET 0x13400
#define RIO_S_PW_REGS_OFFSET 0x134e0
#define RIO_ATMU_REGS_DBELL_OFFSET 0x10C40
#define MAX_MSG_UNIT_NUM 2
#define MAX_PORT_NUM 4
struct rio_atmu_regs { struct rio_atmu_regs {
u32 rowtar; u32 rowtar;
u32 rowtear; u32 rowtear;
u32 rowbar; u32 rowbar;
u32 pad2; u32 pad1;
u32 rowar; u32 rowar;
u32 pad3[3]; u32 pad2[3];
};
struct rio_dbell_ring {
void *virt;
dma_addr_t phys;
}; };
struct rio_port_write_msg { struct rio_port_write_msg {
...@@ -53,26 +76,60 @@ struct rio_port_write_msg { ...@@ -53,26 +76,60 @@ struct rio_port_write_msg {
u32 discard_count; u32 discard_count;
}; };
struct rio_priv { struct fsl_rio_dbell {
struct rio_mport *mport[MAX_PORT_NUM];
struct device *dev; struct device *dev;
void __iomem *regs_win; struct rio_dbell_regs __iomem *dbell_regs;
struct rio_atmu_regs __iomem *atmu_regs; struct rio_dbell_ring dbell_ring;
struct rio_atmu_regs __iomem *maint_atmu_regs; int bellirq;
void __iomem *maint_win; };
struct fsl_rio_pw {
struct device *dev;
struct rio_pw_regs __iomem *pw_regs;
struct rio_port_write_msg port_write_msg; struct rio_port_write_msg port_write_msg;
int pwirq; int pwirq;
struct work_struct pw_work; struct work_struct pw_work;
struct kfifo pw_fifo; struct kfifo pw_fifo;
spinlock_t pw_fifo_lock; spinlock_t pw_fifo_lock;
};
struct rio_priv {
struct device *dev;
void __iomem *regs_win;
struct rio_atmu_regs __iomem *atmu_regs;
struct rio_atmu_regs __iomem *maint_atmu_regs;
void __iomem *maint_win;
void *rmm_handle; /* RapidIO message manager(unit) Handle */ void *rmm_handle; /* RapidIO message manager(unit) Handle */
}; };
extern void __iomem *rio_regs_win; extern void __iomem *rio_regs_win;
extern void __iomem *rmu_regs_win;
extern resource_size_t rio_law_start;
extern struct fsl_rio_dbell *dbell;
extern struct fsl_rio_pw *pw;
extern int fsl_rio_setup_rmu(struct rio_mport *mport, extern int fsl_rio_setup_rmu(struct rio_mport *mport,
struct device_node *node); struct device_node *node);
extern int fsl_rio_port_write_init(struct rio_mport *mport); extern int fsl_rio_port_write_init(struct fsl_rio_pw *pw);
extern int fsl_rio_pw_enable(struct rio_mport *mport, int enable); extern int fsl_rio_pw_enable(struct rio_mport *mport, int enable);
extern void fsl_rio_port_error_handler(struct rio_mport *port, int offset); extern void fsl_rio_port_error_handler(int offset);
extern int fsl_rio_doorbell_init(struct fsl_rio_dbell *dbell);
extern int fsl_rio_doorbell_send(struct rio_mport *mport,
int index, u16 destid, u16 data);
extern int fsl_add_outb_message(struct rio_mport *mport,
struct rio_dev *rdev,
int mbox, void *buffer, size_t len);
extern int fsl_open_outb_mbox(struct rio_mport *mport,
void *dev_id, int mbox, int entries);
extern void fsl_close_outb_mbox(struct rio_mport *mport, int mbox);
extern int fsl_open_inb_mbox(struct rio_mport *mport,
void *dev_id, int mbox, int entries);
extern void fsl_close_inb_mbox(struct rio_mport *mport, int mbox);
extern int fsl_add_inb_buffer(struct rio_mport *mport, int mbox, void *buf);
extern void *fsl_get_inb_message(struct rio_mport *mport, int mbox);
#endif #endif
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment