Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b189fdb authored by Alexandre Bounine's avatar Alexandre Bounine Committed by Linus Torvalds
Browse files

rapidio: add query_mport operation



Add mport query operation to report master port RapidIO capabilities and
run time configuration to upper level drivers.

Signed-off-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d2a321f3
Loading
Loading
Loading
Loading
+17 −0
Original line number Original line Diff line number Diff line
@@ -67,6 +67,23 @@ u16 rio_local_get_device_id(struct rio_mport *port)
	return (RIO_GET_DID(port->sys_size, result));
	return (RIO_GET_DID(port->sys_size, result));
}
}


/**
 * rio_query_mport - Query mport device attributes
 * @port: mport device to query
 * @mport_attr: mport attributes data structure
 *
 * Returns attributes of specified mport through the
 * pointer to attributes data structure.
 */
int rio_query_mport(struct rio_mport *port,
		    struct rio_mport_attr *mport_attr)
{
	if (!port->ops->query_mport)
		return -ENODATA;
	return port->ops->query_mport(port, mport_attr);
}
EXPORT_SYMBOL(rio_query_mport);

/**
/**
 * rio_add_device- Adds a RIO device to the device model
 * rio_add_device- Adds a RIO device to the device model
 * @rdev: RIO device
 * @rdev: RIO device
+49 −0
Original line number Original line Diff line number Diff line
@@ -314,6 +314,50 @@ struct rio_net {
	struct rio_id_table destid_table;  /* destID allocation table */
	struct rio_id_table destid_table;  /* destID allocation table */
};
};


enum rio_link_speed {
	RIO_LINK_DOWN = 0, /* SRIO Link not initialized */
	RIO_LINK_125 = 1, /* 1.25 GBaud  */
	RIO_LINK_250 = 2, /* 2.5 GBaud   */
	RIO_LINK_312 = 3, /* 3.125 GBaud */
	RIO_LINK_500 = 4, /* 5.0 GBaud   */
	RIO_LINK_625 = 5  /* 6.25 GBaud  */
};

enum rio_link_width {
	RIO_LINK_1X  = 0,
	RIO_LINK_1XR = 1,
	RIO_LINK_2X  = 3,
	RIO_LINK_4X  = 2,
	RIO_LINK_8X  = 4,
	RIO_LINK_16X = 5
};

enum rio_mport_flags {
	RIO_MPORT_DMA	 = (1 << 0), /* supports DMA data transfers */
	RIO_MPORT_DMA_SG = (1 << 1), /* DMA supports HW SG mode */
	RIO_MPORT_IBSG	 = (1 << 2), /* inbound mapping supports SG */
};

/**
 * struct rio_mport_attr - RIO mport device attributes
 * @flags: mport device capability flags
 * @link_speed: SRIO link speed value (as defined by RapidIO specification)
 * @link_width:	SRIO link width value (as defined by RapidIO specification)
 * @dma_max_sge: number of SG list entries that can be handled by DMA channel(s)
 * @dma_max_size: max number of bytes in single DMA transfer (SG entry)
 * @dma_align: alignment shift for DMA operations (as for other DMA operations)
 */
struct rio_mport_attr {
	int flags;
	int link_speed;
	int link_width;

	/* DMA capability info: valid only if RIO_MPORT_DMA flag is set */
	int dma_max_sge;
	int dma_max_size;
	int dma_align;
};

/* Low-level architecture-dependent routines */
/* Low-level architecture-dependent routines */


/**
/**
@@ -333,6 +377,7 @@ struct rio_net {
 * @get_inb_message: Callback to get a message from an inbound mailbox queue.
 * @get_inb_message: Callback to get a message from an inbound mailbox queue.
 * @map_inb: Callback to map RapidIO address region into local memory space.
 * @map_inb: Callback to map RapidIO address region into local memory space.
 * @unmap_inb: Callback to unmap RapidIO address region mapped with map_inb().
 * @unmap_inb: Callback to unmap RapidIO address region mapped with map_inb().
 * @query_mport: Callback to query mport device attributes.
 */
 */
struct rio_ops {
struct rio_ops {
	int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
	int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -358,6 +403,8 @@ struct rio_ops {
	int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart,
	int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart,
			u64 rstart, u32 size, u32 flags);
			u64 rstart, u32 size, u32 flags);
	void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart);
	void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart);
	int (*query_mport)(struct rio_mport *mport,
			   struct rio_mport_attr *attr);
};
};


#define RIO_RESOURCE_MEM	0x00000100
#define RIO_RESOURCE_MEM	0x00000100
@@ -481,5 +528,7 @@ extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
extern void rio_close_inb_mbox(struct rio_mport *, int);
extern void rio_close_inb_mbox(struct rio_mport *, int);
extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
extern void rio_close_outb_mbox(struct rio_mport *, int);
extern void rio_close_outb_mbox(struct rio_mport *, int);
extern int rio_query_mport(struct rio_mport *port,
			   struct rio_mport_attr *mport_attr);


#endif				/* LINUX_RIO_H */
#endif				/* LINUX_RIO_H */
+3 −0
Original line number Original line Diff line number Diff line
@@ -238,6 +238,8 @@
#define  RIO_PORT_N_ACK_INBOUND		0x3f000000
#define  RIO_PORT_N_ACK_INBOUND		0x3f000000
#define  RIO_PORT_N_ACK_OUTSTAND	0x00003f00
#define  RIO_PORT_N_ACK_OUTSTAND	0x00003f00
#define  RIO_PORT_N_ACK_OUTBOUND	0x0000003f
#define  RIO_PORT_N_ACK_OUTBOUND	0x0000003f
#define RIO_PORT_N_CTL2_CSR(x)		(0x0054 + x*0x20)
#define  RIO_PORT_N_CTL2_SEL_BAUD	0xf0000000
#define RIO_PORT_N_ERR_STS_CSR(x)	(0x0058 + x*0x20)
#define RIO_PORT_N_ERR_STS_CSR(x)	(0x0058 + x*0x20)
#define  RIO_PORT_N_ERR_STS_PW_OUT_ES	0x00010000 /* Output Error-stopped */
#define  RIO_PORT_N_ERR_STS_PW_OUT_ES	0x00010000 /* Output Error-stopped */
#define  RIO_PORT_N_ERR_STS_PW_INP_ES	0x00000100 /* Input Error-stopped */
#define  RIO_PORT_N_ERR_STS_PW_INP_ES	0x00000100 /* Input Error-stopped */
@@ -249,6 +251,7 @@
#define  RIO_PORT_N_CTL_PWIDTH		0xc0000000
#define  RIO_PORT_N_CTL_PWIDTH		0xc0000000
#define  RIO_PORT_N_CTL_PWIDTH_1	0x00000000
#define  RIO_PORT_N_CTL_PWIDTH_1	0x00000000
#define  RIO_PORT_N_CTL_PWIDTH_4	0x40000000
#define  RIO_PORT_N_CTL_PWIDTH_4	0x40000000
#define  RIO_PORT_N_CTL_IPW		0x38000000 /* Initialized Port Width */
#define  RIO_PORT_N_CTL_P_TYP_SER	0x00000001
#define  RIO_PORT_N_CTL_P_TYP_SER	0x00000001
#define  RIO_PORT_N_CTL_LOCKOUT		0x00000002
#define  RIO_PORT_N_CTL_LOCKOUT		0x00000002
#define  RIO_PORT_N_CTL_EN_RX_SER	0x00200000
#define  RIO_PORT_N_CTL_EN_RX_SER	0x00200000