Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198811
b: refs/heads/master
c: 7a88d62
h: refs/heads/master
i:
  198809: a958674
  198807: 5c07052
v: v3
  • Loading branch information
Alexandre Bounine authored and Linus Torvalds committed May 27, 2010
1 parent 03b6019 commit 26240ff
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 058f88d672b3161fe511ebe2996c3faef63c1c8e
refs/heads/master: 7a88d6286240f1e8a0cf9c07252e1576169020f5
33 changes: 33 additions & 0 deletions trunk/drivers/rapidio/switches/idtcps.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#define CPS_NO_ROUTE 0xdf

#define IDTCPS_RIO_DOMAIN 0xf20020

static int
idtcps_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
u16 table, u16 route_destid, u8 route_port)
Expand Down Expand Up @@ -82,12 +84,43 @@ idtcps_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,
return 0;
}

static int
idtcps_set_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
u8 sw_domain)
{
/*
* Switch domain configuration operates only at global level
*/
rio_mport_write_config_32(mport, destid, hopcount,
IDTCPS_RIO_DOMAIN, (u32)sw_domain);
return 0;
}

static int
idtcps_get_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
u8 *sw_domain)
{
u32 regval;

/*
* Switch domain configuration operates only at global level
*/
rio_mport_read_config_32(mport, destid, hopcount,
IDTCPS_RIO_DOMAIN, &regval);

*sw_domain = (u8)(regval & 0xff);

return 0;
}

static int idtcps_switch_init(struct rio_dev *rdev, int do_enum)
{
pr_debug("RIO: %s for %s\n", __func__, rio_name(rdev));
rdev->rswitch->add_entry = idtcps_route_add_entry;
rdev->rswitch->get_entry = idtcps_route_get_entry;
rdev->rswitch->clr_table = idtcps_route_clr_table;
rdev->rswitch->set_domain = idtcps_set_domain;
rdev->rswitch->get_domain = idtcps_get_domain;
rdev->rswitch->em_init = NULL;
rdev->rswitch->em_handle = NULL;

Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/rapidio/switches/tsi500.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ static int tsi500_switch_init(struct rio_dev *rdev, int do_enum)
rdev->rswitch->add_entry = tsi500_route_add_entry;
rdev->rswitch->get_entry = tsi500_route_get_entry;
rdev->rswitch->clr_table = NULL;
rdev->rswitch->set_domain = NULL;
rdev->rswitch->get_domain = NULL;
rdev->rswitch->em_init = NULL;
rdev->rswitch->em_handle = NULL;

Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/rapidio/switches/tsi568.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ static int tsi568_switch_init(struct rio_dev *rdev, int do_enum)
rdev->rswitch->add_entry = tsi568_route_add_entry;
rdev->rswitch->get_entry = tsi568_route_get_entry;
rdev->rswitch->clr_table = tsi568_route_clr_table;
rdev->rswitch->set_domain = NULL;
rdev->rswitch->get_domain = NULL;
rdev->rswitch->em_init = tsi568_em_init;
rdev->rswitch->em_handle = NULL;

Expand Down
45 changes: 45 additions & 0 deletions trunk/drivers/rapidio/switches/tsi57x.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@
#define SPP_ROUTE_CFG_PORT(n) (0x11074 + 0x100*n)

#define TSI578_SP_MODE(n) (0x11004 + n*0x100)
#define TSI578_SP_MODE_GLBL 0x10004
#define TSI578_SP_MODE_PW_DIS 0x08000000
#define TSI578_SP_MODE_LUT_512 0x01000000

#define TSI578_SP_CTL_INDEP(n) (0x13004 + n*0x100)
#define TSI578_SP_LUT_PEINF(n) (0x13010 + n*0x100)
#define TSI578_SP_CS_TX(n) (0x13014 + n*0x100)
#define TSI578_SP_INT_STATUS(n) (0x13018 + n*0x100)

#define TSI578_GLBL_ROUTE_BASE 0x10078

static int
tsi57x_route_add_entry(struct rio_mport *mport, u16 destid, u8 hopcount,
u16 table, u16 route_destid, u8 route_port)
Expand Down Expand Up @@ -112,6 +116,45 @@ tsi57x_route_clr_table(struct rio_mport *mport, u16 destid, u8 hopcount,
return 0;
}

static int
tsi57x_set_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
u8 sw_domain)
{
u32 regval;

/*
* Switch domain configuration operates only at global level
*/

/* Turn off flat (LUT_512) mode */
rio_mport_read_config_32(mport, destid, hopcount,
TSI578_SP_MODE_GLBL, &regval);
rio_mport_write_config_32(mport, destid, hopcount, TSI578_SP_MODE_GLBL,
regval & ~TSI578_SP_MODE_LUT_512);
/* Set switch domain base */
rio_mport_write_config_32(mport, destid, hopcount,
TSI578_GLBL_ROUTE_BASE,
(u32)(sw_domain << 24));
return 0;
}

static int
tsi57x_get_domain(struct rio_mport *mport, u16 destid, u8 hopcount,
u8 *sw_domain)
{
u32 regval;

/*
* Switch domain configuration operates only at global level
*/
rio_mport_read_config_32(mport, destid, hopcount,
TSI578_GLBL_ROUTE_BASE, &regval);

*sw_domain = (u8)(regval >> 24);

return 0;
}

static int
tsi57x_em_init(struct rio_dev *rdev)
{
Expand Down Expand Up @@ -258,6 +301,8 @@ static int tsi57x_switch_init(struct rio_dev *rdev, int do_enum)
rdev->rswitch->add_entry = tsi57x_route_add_entry;
rdev->rswitch->get_entry = tsi57x_route_get_entry;
rdev->rswitch->clr_table = tsi57x_route_clr_table;
rdev->rswitch->set_domain = tsi57x_set_domain;
rdev->rswitch->get_domain = tsi57x_get_domain;
rdev->rswitch->em_init = tsi57x_em_init;
rdev->rswitch->em_handle = tsi57x_em_handler;

Expand Down
4 changes: 4 additions & 0 deletions trunk/include/linux/rio.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ struct rio_switch {
u16 table, u16 route_destid, u8 * route_port);
int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
u16 table);
int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
u8 sw_domain);
int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
u8 *sw_domain);
int (*em_init) (struct rio_dev *dev);
int (*em_handle) (struct rio_dev *dev, u8 swport);
};
Expand Down

0 comments on commit 26240ff

Please sign in to comment.