diff options
author | Liu Gang <Gang.Liu@freescale.com> | 2011-11-12 20:02:29 +0800 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2011-11-24 02:01:34 -0600 |
commit | abc3aeae3aaa5c319d02f12649e17ea5929999aa (patch) | |
tree | 1eb64b3c01ce6ae488c9f5f0460b602d654b5a2a /arch/powerpc/sysdev/fsl_rio.h | |
parent | 6ec4bedbf153a8ef71aeba99a40efef556b57798 (diff) |
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: Li Yang <leoli@freescale.com>
Signed-off-by: Jin Qing <b24347@freescale.com>
Signed-off-by: Liu Gang <Gang.Liu@freescale.com>
Acked-by: Alexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev/fsl_rio.h')
-rw-r--r-- | arch/powerpc/sysdev/fsl_rio.h | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/arch/powerpc/sysdev/fsl_rio.h b/arch/powerpc/sysdev/fsl_rio.h index f888a1effd4..ae8e27405a0 100644 --- a/arch/powerpc/sysdev/fsl_rio.h +++ b/arch/powerpc/sysdev/fsl_rio.h @@ -36,13 +36,36 @@ #define RIO_MAINT_WIN_SIZE 0x400000 #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 { u32 rowtar; u32 rowtear; u32 rowbar; - u32 pad2; + u32 pad1; u32 rowar; - u32 pad3[3]; + u32 pad2[3]; +}; + +struct rio_dbell_ring { + void *virt; + dma_addr_t phys; }; struct rio_port_write_msg { @@ -53,26 +76,60 @@ struct rio_port_write_msg { u32 discard_count; }; -struct rio_priv { +struct fsl_rio_dbell { + struct rio_mport *mport[MAX_PORT_NUM]; 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; + struct rio_dbell_regs __iomem *dbell_regs; + struct rio_dbell_ring dbell_ring; + int bellirq; +}; + +struct fsl_rio_pw { + struct device *dev; + struct rio_pw_regs __iomem *pw_regs; struct rio_port_write_msg port_write_msg; int pwirq; struct work_struct pw_work; struct kfifo pw_fifo; 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 */ }; 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, 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 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 |