1*2874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
20b9364b5SAlexandre Bounine /*
30b9364b5SAlexandre Bounine * IDT RXS Gen.3 Serial RapidIO switch family support
40b9364b5SAlexandre Bounine *
50b9364b5SAlexandre Bounine * Copyright 2016 Integrated Device Technology, Inc.
60b9364b5SAlexandre Bounine */
70b9364b5SAlexandre Bounine
80b9364b5SAlexandre Bounine #include <linux/stat.h>
90b9364b5SAlexandre Bounine #include <linux/module.h>
100b9364b5SAlexandre Bounine #include <linux/rio.h>
110b9364b5SAlexandre Bounine #include <linux/rio_drv.h>
120b9364b5SAlexandre Bounine #include <linux/rio_ids.h>
130b9364b5SAlexandre Bounine #include <linux/delay.h>
140b9364b5SAlexandre Bounine
150b9364b5SAlexandre Bounine #include <asm/page.h>
160b9364b5SAlexandre Bounine #include "../rio.h"
170b9364b5SAlexandre Bounine
180b9364b5SAlexandre Bounine #define RIO_EM_PW_STAT 0x40020
190b9364b5SAlexandre Bounine #define RIO_PW_CTL 0x40204
200b9364b5SAlexandre Bounine #define RIO_PW_CTL_PW_TMR 0xffffff00
210b9364b5SAlexandre Bounine #define RIO_PW_ROUTE 0x40208
220b9364b5SAlexandre Bounine
230b9364b5SAlexandre Bounine #define RIO_EM_DEV_INT_EN 0x40030
240b9364b5SAlexandre Bounine
250b9364b5SAlexandre Bounine #define RIO_PLM_SPx_IMP_SPEC_CTL(x) (0x10100 + (x)*0x100)
260b9364b5SAlexandre Bounine #define RIO_PLM_SPx_IMP_SPEC_CTL_SOFT_RST 0x02000000
270b9364b5SAlexandre Bounine
280b9364b5SAlexandre Bounine #define RIO_PLM_SPx_PW_EN(x) (0x10118 + (x)*0x100)
290b9364b5SAlexandre Bounine #define RIO_PLM_SPx_PW_EN_OK2U 0x40000000
300b9364b5SAlexandre Bounine #define RIO_PLM_SPx_PW_EN_LINIT 0x10000000
310b9364b5SAlexandre Bounine
320b9364b5SAlexandre Bounine #define RIO_BC_L2_Gn_ENTRYx_CSR(n, x) (0x31000 + (n)*0x400 + (x)*0x4)
330b9364b5SAlexandre Bounine #define RIO_SPx_L2_Gn_ENTRYy_CSR(x, n, y) \
340b9364b5SAlexandre Bounine (0x51000 + (x)*0x2000 + (n)*0x400 + (y)*0x4)
350b9364b5SAlexandre Bounine
360b9364b5SAlexandre Bounine static int
idtg3_route_add_entry(struct rio_mport * mport,u16 destid,u8 hopcount,u16 table,u16 route_destid,u8 route_port)370b9364b5SAlexandre Bounine idtg3_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
380b9364b5SAlexandre Bounine u16 table, u16 route_destid, u8 route_port)
390b9364b5SAlexandre Bounine {
400b9364b5SAlexandre Bounine u32 rval;
410b9364b5SAlexandre Bounine u32 entry = route_port;
420b9364b5SAlexandre Bounine int err = 0;
430b9364b5SAlexandre Bounine
440b9364b5SAlexandre Bounine pr_debug("RIO: %s t=0x%x did_%x to p_%x\n",
450b9364b5SAlexandre Bounine __func__, table, route_destid, entry);
460b9364b5SAlexandre Bounine
470b9364b5SAlexandre Bounine if (route_destid > 0xFF)
480b9364b5SAlexandre Bounine return -EINVAL;
490b9364b5SAlexandre Bounine
500b9364b5SAlexandre Bounine if (route_port == RIO_INVALID_ROUTE)
510b9364b5SAlexandre Bounine entry = RIO_RT_ENTRY_DROP_PKT;
520b9364b5SAlexandre Bounine
530b9364b5SAlexandre Bounine if (table == RIO_GLOBAL_TABLE) {
540b9364b5SAlexandre Bounine /* Use broadcast register to update all per-port tables */
550b9364b5SAlexandre Bounine err = rio_mport_write_config_32(mport, destid, hopcount,
560b9364b5SAlexandre Bounine RIO_BC_L2_Gn_ENTRYx_CSR(0, route_destid),
570b9364b5SAlexandre Bounine entry);
580b9364b5SAlexandre Bounine return err;
590b9364b5SAlexandre Bounine }
600b9364b5SAlexandre Bounine
610b9364b5SAlexandre Bounine /*
620b9364b5SAlexandre Bounine * Verify that specified port/table number is valid
630b9364b5SAlexandre Bounine */
640b9364b5SAlexandre Bounine err = rio_mport_read_config_32(mport, destid, hopcount,
650b9364b5SAlexandre Bounine RIO_SWP_INFO_CAR, &rval);
660b9364b5SAlexandre Bounine if (err)
670b9364b5SAlexandre Bounine return err;
680b9364b5SAlexandre Bounine
690b9364b5SAlexandre Bounine if (table >= RIO_GET_TOTAL_PORTS(rval))
700b9364b5SAlexandre Bounine return -EINVAL;
710b9364b5SAlexandre Bounine
720b9364b5SAlexandre Bounine err = rio_mport_write_config_32(mport, destid, hopcount,
730b9364b5SAlexandre Bounine RIO_SPx_L2_Gn_ENTRYy_CSR(table, 0, route_destid),
740b9364b5SAlexandre Bounine entry);
750b9364b5SAlexandre Bounine return err;
760b9364b5SAlexandre Bounine }
770b9364b5SAlexandre Bounine
780b9364b5SAlexandre Bounine static int
idtg3_route_get_entry(struct rio_mport * mport,u16 destid,u8 hopcount,u16 table,u16 route_destid,u8 * route_port)790b9364b5SAlexandre Bounine idtg3_route_get_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
800b9364b5SAlexandre Bounine u16 table, u16 route_destid, u8 *route_port)
810b9364b5SAlexandre Bounine {
820b9364b5SAlexandre Bounine u32 rval;
830b9364b5SAlexandre Bounine int err;
840b9364b5SAlexandre Bounine
850b9364b5SAlexandre Bounine if (route_destid > 0xFF)
860b9364b5SAlexandre Bounine return -EINVAL;
870b9364b5SAlexandre Bounine
880b9364b5SAlexandre Bounine err = rio_mport_read_config_32(mport, destid, hopcount,
890b9364b5SAlexandre Bounine RIO_SWP_INFO_CAR, &rval);
900b9364b5SAlexandre Bounine if (err)
910b9364b5SAlexandre Bounine return err;
920b9364b5SAlexandre Bounine
930b9364b5SAlexandre Bounine /*
940b9364b5SAlexandre Bounine * This switch device does not have the dedicated global routing table.
950b9364b5SAlexandre Bounine * It is substituted by reading routing table of the ingress port of
960b9364b5SAlexandre Bounine * maintenance read requests.
970b9364b5SAlexandre Bounine */
980b9364b5SAlexandre Bounine if (table == RIO_GLOBAL_TABLE)
990b9364b5SAlexandre Bounine table = RIO_GET_PORT_NUM(rval);
1000b9364b5SAlexandre Bounine else if (table >= RIO_GET_TOTAL_PORTS(rval))
1010b9364b5SAlexandre Bounine return -EINVAL;
1020b9364b5SAlexandre Bounine
1030b9364b5SAlexandre Bounine err = rio_mport_read_config_32(mport, destid, hopcount,
1040b9364b5SAlexandre Bounine RIO_SPx_L2_Gn_ENTRYy_CSR(table, 0, route_destid),
1050b9364b5SAlexandre Bounine &rval);
1060b9364b5SAlexandre Bounine if (err)
1070b9364b5SAlexandre Bounine return err;
1080b9364b5SAlexandre Bounine
1090b9364b5SAlexandre Bounine if (rval == RIO_RT_ENTRY_DROP_PKT)
1100b9364b5SAlexandre Bounine *route_port = RIO_INVALID_ROUTE;
1110b9364b5SAlexandre Bounine else
1120b9364b5SAlexandre Bounine *route_port = (u8)rval;
1130b9364b5SAlexandre Bounine
1140b9364b5SAlexandre Bounine return 0;
1150b9364b5SAlexandre Bounine }
1160b9364b5SAlexandre Bounine
1170b9364b5SAlexandre Bounine static int
idtg3_route_clr_table(struct rio_mport * mport,u16 destid,u8 hopcount,u16 table)1180b9364b5SAlexandre Bounine idtg3_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,
1190b9364b5SAlexandre Bounine u16 table)
1200b9364b5SAlexandre Bounine {
1210b9364b5SAlexandre Bounine u32 i;
1220b9364b5SAlexandre Bounine u32 rval;
1230b9364b5SAlexandre Bounine int err;
1240b9364b5SAlexandre Bounine
1250b9364b5SAlexandre Bounine if (table == RIO_GLOBAL_TABLE) {
1260b9364b5SAlexandre Bounine for (i = 0; i <= 0xff; i++) {
1270b9364b5SAlexandre Bounine err = rio_mport_write_config_32(mport, destid, hopcount,
1280b9364b5SAlexandre Bounine RIO_BC_L2_Gn_ENTRYx_CSR(0, i),
1290b9364b5SAlexandre Bounine RIO_RT_ENTRY_DROP_PKT);
1300b9364b5SAlexandre Bounine if (err)
1310b9364b5SAlexandre Bounine break;
1320b9364b5SAlexandre Bounine }
1330b9364b5SAlexandre Bounine
1340b9364b5SAlexandre Bounine return err;
1350b9364b5SAlexandre Bounine }
1360b9364b5SAlexandre Bounine
1370b9364b5SAlexandre Bounine err = rio_mport_read_config_32(mport, destid, hopcount,
1380b9364b5SAlexandre Bounine RIO_SWP_INFO_CAR, &rval);
1390b9364b5SAlexandre Bounine if (err)
1400b9364b5SAlexandre Bounine return err;
1410b9364b5SAlexandre Bounine
1420b9364b5SAlexandre Bounine if (table >= RIO_GET_TOTAL_PORTS(rval))
1430b9364b5SAlexandre Bounine return -EINVAL;
1440b9364b5SAlexandre Bounine
1450b9364b5SAlexandre Bounine for (i = 0; i <= 0xff; i++) {
1460b9364b5SAlexandre Bounine err = rio_mport_write_config_32(mport, destid, hopcount,
1470b9364b5SAlexandre Bounine RIO_SPx_L2_Gn_ENTRYy_CSR(table, 0, i),
1480b9364b5SAlexandre Bounine RIO_RT_ENTRY_DROP_PKT);
1490b9364b5SAlexandre Bounine if (err)
1500b9364b5SAlexandre Bounine break;
1510b9364b5SAlexandre Bounine }
1520b9364b5SAlexandre Bounine
1530b9364b5SAlexandre Bounine return err;
1540b9364b5SAlexandre Bounine }
1550b9364b5SAlexandre Bounine
1560b9364b5SAlexandre Bounine /*
1570b9364b5SAlexandre Bounine * This routine performs device-specific initialization only.
1580b9364b5SAlexandre Bounine * All standard EM configuration should be performed at upper level.
1590b9364b5SAlexandre Bounine */
1600b9364b5SAlexandre Bounine static int
idtg3_em_init(struct rio_dev * rdev)1610b9364b5SAlexandre Bounine idtg3_em_init(struct rio_dev *rdev)
1620b9364b5SAlexandre Bounine {
1630b9364b5SAlexandre Bounine int i, tmp;
1640b9364b5SAlexandre Bounine u32 rval;
1650b9364b5SAlexandre Bounine
1660b9364b5SAlexandre Bounine pr_debug("RIO: %s [%d:%d]\n", __func__, rdev->destid, rdev->hopcount);
1670b9364b5SAlexandre Bounine
1680b9364b5SAlexandre Bounine /* Disable assertion of interrupt signal */
1690b9364b5SAlexandre Bounine rio_write_config_32(rdev, RIO_EM_DEV_INT_EN, 0);
1700b9364b5SAlexandre Bounine
1710b9364b5SAlexandre Bounine /* Disable port-write event notifications during initialization */
1720b9364b5SAlexandre Bounine rio_write_config_32(rdev, rdev->em_efptr + RIO_EM_PW_TX_CTRL,
1730b9364b5SAlexandre Bounine RIO_EM_PW_TX_CTRL_PW_DIS);
1740b9364b5SAlexandre Bounine
1750b9364b5SAlexandre Bounine /* Configure Port-Write notifications for hot-swap events */
1760b9364b5SAlexandre Bounine tmp = RIO_GET_TOTAL_PORTS(rdev->swpinfo);
1770b9364b5SAlexandre Bounine for (i = 0; i < tmp; i++) {
1780b9364b5SAlexandre Bounine
1790b9364b5SAlexandre Bounine rio_read_config_32(rdev,
1800b9364b5SAlexandre Bounine RIO_DEV_PORT_N_ERR_STS_CSR(rdev, i),
1810b9364b5SAlexandre Bounine &rval);
1820b9364b5SAlexandre Bounine if (rval & RIO_PORT_N_ERR_STS_PORT_UA)
1830b9364b5SAlexandre Bounine continue;
1840b9364b5SAlexandre Bounine
1850b9364b5SAlexandre Bounine /* Clear events signaled before enabling notification */
1860b9364b5SAlexandre Bounine rio_write_config_32(rdev,
1870b9364b5SAlexandre Bounine rdev->em_efptr + RIO_EM_PN_ERR_DETECT(i), 0);
1880b9364b5SAlexandre Bounine
1890b9364b5SAlexandre Bounine /* Enable event notifications */
1900b9364b5SAlexandre Bounine rio_write_config_32(rdev,
1910b9364b5SAlexandre Bounine rdev->em_efptr + RIO_EM_PN_ERRRATE_EN(i),
1920b9364b5SAlexandre Bounine RIO_EM_PN_ERRRATE_EN_OK2U | RIO_EM_PN_ERRRATE_EN_U2OK);
1930b9364b5SAlexandre Bounine /* Enable port-write generation on events */
1940b9364b5SAlexandre Bounine rio_write_config_32(rdev, RIO_PLM_SPx_PW_EN(i),
1950b9364b5SAlexandre Bounine RIO_PLM_SPx_PW_EN_OK2U | RIO_PLM_SPx_PW_EN_LINIT);
1960b9364b5SAlexandre Bounine
1970b9364b5SAlexandre Bounine }
1980b9364b5SAlexandre Bounine
1990b9364b5SAlexandre Bounine /* Set Port-Write destination port */
2000b9364b5SAlexandre Bounine tmp = RIO_GET_PORT_NUM(rdev->swpinfo);
2010b9364b5SAlexandre Bounine rio_write_config_32(rdev, RIO_PW_ROUTE, 1 << tmp);
2020b9364b5SAlexandre Bounine
2030b9364b5SAlexandre Bounine
2040b9364b5SAlexandre Bounine /* Enable sending port-write event notifications */
2050b9364b5SAlexandre Bounine rio_write_config_32(rdev, rdev->em_efptr + RIO_EM_PW_TX_CTRL, 0);
2060b9364b5SAlexandre Bounine
2070b9364b5SAlexandre Bounine /* set TVAL = ~50us */
2080b9364b5SAlexandre Bounine rio_write_config_32(rdev,
2090b9364b5SAlexandre Bounine rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x8e << 8);
2100b9364b5SAlexandre Bounine return 0;
2110b9364b5SAlexandre Bounine }
2120b9364b5SAlexandre Bounine
2130b9364b5SAlexandre Bounine
2140b9364b5SAlexandre Bounine /*
2150b9364b5SAlexandre Bounine * idtg3_em_handler - device-specific error handler
2160b9364b5SAlexandre Bounine *
2170b9364b5SAlexandre Bounine * If the link is down (PORT_UNINIT) does nothing - this is considered
2180b9364b5SAlexandre Bounine * as link partner removal from the port.
2190b9364b5SAlexandre Bounine *
2200b9364b5SAlexandre Bounine * If the link is up (PORT_OK) - situation is handled as *new* device insertion.
2210b9364b5SAlexandre Bounine * In this case ERR_STOP bits are cleared by issuing soft reset command to the
2220b9364b5SAlexandre Bounine * reporting port. Inbound and outbound ackIDs are cleared by the reset as well.
2230b9364b5SAlexandre Bounine * This way the port is synchronized with freshly inserted device (assuming it
2240b9364b5SAlexandre Bounine * was reset/powered-up on insertion).
2250b9364b5SAlexandre Bounine *
2260b9364b5SAlexandre Bounine * TODO: This is not sufficient in a situation when a link between two devices
2270b9364b5SAlexandre Bounine * was down and up again (e.g. cable disconnect). For that situation full ackID
2280b9364b5SAlexandre Bounine * realignment process has to be implemented.
2290b9364b5SAlexandre Bounine */
2300b9364b5SAlexandre Bounine static int
idtg3_em_handler(struct rio_dev * rdev,u8 pnum)2310b9364b5SAlexandre Bounine idtg3_em_handler(struct rio_dev *rdev, u8 pnum)
2320b9364b5SAlexandre Bounine {
2330b9364b5SAlexandre Bounine u32 err_status;
2340b9364b5SAlexandre Bounine u32 rval;
2350b9364b5SAlexandre Bounine
2360b9364b5SAlexandre Bounine rio_read_config_32(rdev,
2370b9364b5SAlexandre Bounine RIO_DEV_PORT_N_ERR_STS_CSR(rdev, pnum),
2380b9364b5SAlexandre Bounine &err_status);
2390b9364b5SAlexandre Bounine
2400b9364b5SAlexandre Bounine /* Do nothing for device/link removal */
2410b9364b5SAlexandre Bounine if (err_status & RIO_PORT_N_ERR_STS_PORT_UNINIT)
2420b9364b5SAlexandre Bounine return 0;
2430b9364b5SAlexandre Bounine
2440b9364b5SAlexandre Bounine /* When link is OK we have a device insertion.
2450b9364b5SAlexandre Bounine * Request port soft reset to clear errors if they present.
2460b9364b5SAlexandre Bounine * Inbound and outbound ackIDs will be 0 after reset.
2470b9364b5SAlexandre Bounine */
2480b9364b5SAlexandre Bounine if (err_status & (RIO_PORT_N_ERR_STS_OUT_ES |
2490b9364b5SAlexandre Bounine RIO_PORT_N_ERR_STS_INP_ES)) {
2500b9364b5SAlexandre Bounine rio_read_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum), &rval);
2510b9364b5SAlexandre Bounine rio_write_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum),
2520b9364b5SAlexandre Bounine rval | RIO_PLM_SPx_IMP_SPEC_CTL_SOFT_RST);
2530b9364b5SAlexandre Bounine udelay(10);
2540b9364b5SAlexandre Bounine rio_write_config_32(rdev, RIO_PLM_SPx_IMP_SPEC_CTL(pnum), rval);
2550b9364b5SAlexandre Bounine msleep(500);
2560b9364b5SAlexandre Bounine }
2570b9364b5SAlexandre Bounine
2580b9364b5SAlexandre Bounine return 0;
2590b9364b5SAlexandre Bounine }
2600b9364b5SAlexandre Bounine
2610b9364b5SAlexandre Bounine static struct rio_switch_ops idtg3_switch_ops = {
2620b9364b5SAlexandre Bounine .owner = THIS_MODULE,
2630b9364b5SAlexandre Bounine .add_entry = idtg3_route_add_entry,
2640b9364b5SAlexandre Bounine .get_entry = idtg3_route_get_entry,
2650b9364b5SAlexandre Bounine .clr_table = idtg3_route_clr_table,
2660b9364b5SAlexandre Bounine .em_init = idtg3_em_init,
2670b9364b5SAlexandre Bounine .em_handle = idtg3_em_handler,
2680b9364b5SAlexandre Bounine };
2690b9364b5SAlexandre Bounine
idtg3_probe(struct rio_dev * rdev,const struct rio_device_id * id)2700b9364b5SAlexandre Bounine static int idtg3_probe(struct rio_dev *rdev, const struct rio_device_id *id)
2710b9364b5SAlexandre Bounine {
2720b9364b5SAlexandre Bounine pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
2730b9364b5SAlexandre Bounine
2740b9364b5SAlexandre Bounine spin_lock(&rdev->rswitch->lock);
2750b9364b5SAlexandre Bounine
2760b9364b5SAlexandre Bounine if (rdev->rswitch->ops) {
2770b9364b5SAlexandre Bounine spin_unlock(&rdev->rswitch->lock);
2780b9364b5SAlexandre Bounine return -EINVAL;
2790b9364b5SAlexandre Bounine }
2800b9364b5SAlexandre Bounine
2810b9364b5SAlexandre Bounine rdev->rswitch->ops = &idtg3_switch_ops;
2820b9364b5SAlexandre Bounine
2830b9364b5SAlexandre Bounine if (rdev->do_enum) {
2840b9364b5SAlexandre Bounine /* Disable hierarchical routing support: Existing fabric
2850b9364b5SAlexandre Bounine * enumeration/discovery process (see rio-scan.c) uses 8-bit
2860b9364b5SAlexandre Bounine * flat destination ID routing only.
2870b9364b5SAlexandre Bounine */
2880b9364b5SAlexandre Bounine rio_write_config_32(rdev, 0x5000 + RIO_BC_RT_CTL_CSR, 0);
2890b9364b5SAlexandre Bounine }
2900b9364b5SAlexandre Bounine
2910b9364b5SAlexandre Bounine spin_unlock(&rdev->rswitch->lock);
2920b9364b5SAlexandre Bounine
2930b9364b5SAlexandre Bounine return 0;
2940b9364b5SAlexandre Bounine }
2950b9364b5SAlexandre Bounine
idtg3_remove(struct rio_dev * rdev)2960b9364b5SAlexandre Bounine static void idtg3_remove(struct rio_dev *rdev)
2970b9364b5SAlexandre Bounine {
2980b9364b5SAlexandre Bounine pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
2990b9364b5SAlexandre Bounine spin_lock(&rdev->rswitch->lock);
3000b9364b5SAlexandre Bounine if (rdev->rswitch->ops == &idtg3_switch_ops)
3010b9364b5SAlexandre Bounine rdev->rswitch->ops = NULL;
3020b9364b5SAlexandre Bounine spin_unlock(&rdev->rswitch->lock);
3030b9364b5SAlexandre Bounine }
3040b9364b5SAlexandre Bounine
3050b9364b5SAlexandre Bounine /*
3060b9364b5SAlexandre Bounine * Gen3 switches repeat sending PW messages until a corresponding event flag
3070b9364b5SAlexandre Bounine * is cleared. Use shutdown notification to disable generation of port-write
3080b9364b5SAlexandre Bounine * messages if their destination node is shut down.
3090b9364b5SAlexandre Bounine */
idtg3_shutdown(struct rio_dev * rdev)3100b9364b5SAlexandre Bounine static void idtg3_shutdown(struct rio_dev *rdev)
3110b9364b5SAlexandre Bounine {
3120b9364b5SAlexandre Bounine int i;
3130b9364b5SAlexandre Bounine u32 rval;
3140b9364b5SAlexandre Bounine u16 destid;
3150b9364b5SAlexandre Bounine
3160b9364b5SAlexandre Bounine /* Currently the enumerator node acts also as PW handler */
3170b9364b5SAlexandre Bounine if (!rdev->do_enum)
3180b9364b5SAlexandre Bounine return;
3190b9364b5SAlexandre Bounine
3200b9364b5SAlexandre Bounine pr_debug("RIO: %s(%s)\n", __func__, rio_name(rdev));
3210b9364b5SAlexandre Bounine
3220b9364b5SAlexandre Bounine rio_read_config_32(rdev, RIO_PW_ROUTE, &rval);
3230b9364b5SAlexandre Bounine i = RIO_GET_PORT_NUM(rdev->swpinfo);
3240b9364b5SAlexandre Bounine
3250b9364b5SAlexandre Bounine /* Check port-write destination port */
3260b9364b5SAlexandre Bounine if (!((1 << i) & rval))
3270b9364b5SAlexandre Bounine return;
3280b9364b5SAlexandre Bounine
3290b9364b5SAlexandre Bounine /* Disable sending port-write event notifications if PW destID
3300b9364b5SAlexandre Bounine * matches to one of the enumerator node
3310b9364b5SAlexandre Bounine */
3320b9364b5SAlexandre Bounine rio_read_config_32(rdev, rdev->em_efptr + RIO_EM_PW_TGT_DEVID, &rval);
3330b9364b5SAlexandre Bounine
3340b9364b5SAlexandre Bounine if (rval & RIO_EM_PW_TGT_DEVID_DEV16)
3350b9364b5SAlexandre Bounine destid = rval >> 16;
3360b9364b5SAlexandre Bounine else
3370b9364b5SAlexandre Bounine destid = ((rval & RIO_EM_PW_TGT_DEVID_D8) >> 16);
3380b9364b5SAlexandre Bounine
3390b9364b5SAlexandre Bounine if (rdev->net->hport->host_deviceid == destid) {
3400b9364b5SAlexandre Bounine rio_write_config_32(rdev,
3410b9364b5SAlexandre Bounine rdev->em_efptr + RIO_EM_PW_TX_CTRL, 0);
3420b9364b5SAlexandre Bounine pr_debug("RIO: %s(%s) PW transmission disabled\n",
3430b9364b5SAlexandre Bounine __func__, rio_name(rdev));
3440b9364b5SAlexandre Bounine }
3450b9364b5SAlexandre Bounine }
3460b9364b5SAlexandre Bounine
347c1b1418aSArvind Yadav static const struct rio_device_id idtg3_id_table[] = {
3480b9364b5SAlexandre Bounine {RIO_DEVICE(RIO_DID_IDTRXS1632, RIO_VID_IDT)},
3490b9364b5SAlexandre Bounine {RIO_DEVICE(RIO_DID_IDTRXS2448, RIO_VID_IDT)},
3500b9364b5SAlexandre Bounine { 0, } /* terminate list */
3510b9364b5SAlexandre Bounine };
3520b9364b5SAlexandre Bounine
3530b9364b5SAlexandre Bounine static struct rio_driver idtg3_driver = {
3540b9364b5SAlexandre Bounine .name = "idt_gen3",
3550b9364b5SAlexandre Bounine .id_table = idtg3_id_table,
3560b9364b5SAlexandre Bounine .probe = idtg3_probe,
3570b9364b5SAlexandre Bounine .remove = idtg3_remove,
3580b9364b5SAlexandre Bounine .shutdown = idtg3_shutdown,
3590b9364b5SAlexandre Bounine };
3600b9364b5SAlexandre Bounine
idtg3_init(void)3610b9364b5SAlexandre Bounine static int __init idtg3_init(void)
3620b9364b5SAlexandre Bounine {
3630b9364b5SAlexandre Bounine return rio_register_driver(&idtg3_driver);
3640b9364b5SAlexandre Bounine }
3650b9364b5SAlexandre Bounine
idtg3_exit(void)3660b9364b5SAlexandre Bounine static void __exit idtg3_exit(void)
3670b9364b5SAlexandre Bounine {
3680b9364b5SAlexandre Bounine pr_debug("RIO: %s\n", __func__);
3690b9364b5SAlexandre Bounine rio_unregister_driver(&idtg3_driver);
3700b9364b5SAlexandre Bounine pr_debug("RIO: %s done\n", __func__);
3710b9364b5SAlexandre Bounine }
3720b9364b5SAlexandre Bounine
3730b9364b5SAlexandre Bounine device_initcall(idtg3_init);
3740b9364b5SAlexandre Bounine module_exit(idtg3_exit);
3750b9364b5SAlexandre Bounine
3760b9364b5SAlexandre Bounine MODULE_DESCRIPTION("IDT RXS Gen.3 Serial RapidIO switch family driver");
3770b9364b5SAlexandre Bounine MODULE_AUTHOR("Integrated Device Technology, Inc.");
3780b9364b5SAlexandre Bounine MODULE_LICENSE("GPL");
379