fsi: master: Add boolean parameter to link_enable function
Add the ability to disable a link with a boolean parameter to the link_enable function. This is necessary so that the master can disable links that it isn't using; for example, links to slaves that fail initialization. Signed-off-by: Eddie James <eajames@linux.ibm.com> Signed-off-by: Joel Stanley <joel@jms.id.au>
This commit is contained in:
parent
3c3c484850
commit
04635a30dd
|
@ -1157,7 +1157,7 @@ static int fsi_master_write(struct fsi_master *master, int link,
|
||||||
static int fsi_master_link_enable(struct fsi_master *master, int link)
|
static int fsi_master_link_enable(struct fsi_master *master, int link)
|
||||||
{
|
{
|
||||||
if (master->link_enable)
|
if (master->link_enable)
|
||||||
return master->link_enable(master, link);
|
return master->link_enable(master, link, true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,7 +301,8 @@ static int aspeed_master_write(struct fsi_master *master, int link,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int aspeed_master_link_enable(struct fsi_master *master, int link)
|
static int aspeed_master_link_enable(struct fsi_master *master, int link,
|
||||||
|
bool enable)
|
||||||
{
|
{
|
||||||
struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(master);
|
struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(master);
|
||||||
int idx, bit, ret;
|
int idx, bit, ret;
|
||||||
|
@ -312,6 +313,10 @@ static int aspeed_master_link_enable(struct fsi_master *master, int link)
|
||||||
|
|
||||||
reg = cpu_to_be32(0x80000000 >> bit);
|
reg = cpu_to_be32(0x80000000 >> bit);
|
||||||
|
|
||||||
|
if (!enable)
|
||||||
|
return opb_writel(aspeed, ctrl_base + FSI_MCENP0 + (4 * idx),
|
||||||
|
reg);
|
||||||
|
|
||||||
ret = opb_writel(aspeed, ctrl_base + FSI_MSENP0 + (4 * idx), reg);
|
ret = opb_writel(aspeed, ctrl_base + FSI_MSENP0 + (4 * idx), reg);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1039,7 +1039,8 @@ static void fsi_master_acf_setup_external(struct fsi_master_acf *master)
|
||||||
gpiod_direction_input(master->gpio_data);
|
gpiod_direction_input(master->gpio_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fsi_master_acf_link_enable(struct fsi_master *_master, int link)
|
static int fsi_master_acf_link_enable(struct fsi_master *_master, int link,
|
||||||
|
bool enable)
|
||||||
{
|
{
|
||||||
struct fsi_master_acf *master = to_fsi_master_acf(_master);
|
struct fsi_master_acf *master = to_fsi_master_acf(_master);
|
||||||
int rc = -EBUSY;
|
int rc = -EBUSY;
|
||||||
|
@ -1049,7 +1050,7 @@ static int fsi_master_acf_link_enable(struct fsi_master *_master, int link)
|
||||||
|
|
||||||
mutex_lock(&master->lock);
|
mutex_lock(&master->lock);
|
||||||
if (!master->external_mode) {
|
if (!master->external_mode) {
|
||||||
gpiod_set_value(master->gpio_enable, 1);
|
gpiod_set_value(master->gpio_enable, enable ? 1 : 0);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
mutex_unlock(&master->lock);
|
mutex_unlock(&master->lock);
|
||||||
|
|
|
@ -678,7 +678,8 @@ static void fsi_master_gpio_init_external(struct fsi_master_gpio *master)
|
||||||
gpiod_direction_input(master->gpio_data);
|
gpiod_direction_input(master->gpio_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fsi_master_gpio_link_enable(struct fsi_master *_master, int link)
|
static int fsi_master_gpio_link_enable(struct fsi_master *_master, int link,
|
||||||
|
bool enable)
|
||||||
{
|
{
|
||||||
struct fsi_master_gpio *master = to_fsi_master_gpio(_master);
|
struct fsi_master_gpio *master = to_fsi_master_gpio(_master);
|
||||||
int rc = -EBUSY;
|
int rc = -EBUSY;
|
||||||
|
@ -688,7 +689,7 @@ static int fsi_master_gpio_link_enable(struct fsi_master *_master, int link)
|
||||||
|
|
||||||
mutex_lock(&master->cmd_lock);
|
mutex_lock(&master->cmd_lock);
|
||||||
if (!master->external_mode) {
|
if (!master->external_mode) {
|
||||||
gpiod_set_value(master->gpio_enable, 1);
|
gpiod_set_value(master->gpio_enable, enable ? 1 : 0);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
mutex_unlock(&master->cmd_lock);
|
mutex_unlock(&master->cmd_lock);
|
||||||
|
|
|
@ -77,7 +77,8 @@ static int hub_master_break(struct fsi_master *master, int link)
|
||||||
return hub_master_write(master, link, 0, addr, &cmd, sizeof(cmd));
|
return hub_master_write(master, link, 0, addr, &cmd, sizeof(cmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hub_master_link_enable(struct fsi_master *master, int link)
|
static int hub_master_link_enable(struct fsi_master *master, int link,
|
||||||
|
bool enable)
|
||||||
{
|
{
|
||||||
struct fsi_master_hub *hub = to_fsi_master_hub(master);
|
struct fsi_master_hub *hub = to_fsi_master_hub(master);
|
||||||
int idx, bit;
|
int idx, bit;
|
||||||
|
@ -89,6 +90,10 @@ static int hub_master_link_enable(struct fsi_master *master, int link)
|
||||||
|
|
||||||
reg = cpu_to_be32(0x80000000 >> bit);
|
reg = cpu_to_be32(0x80000000 >> bit);
|
||||||
|
|
||||||
|
if (!enable)
|
||||||
|
return fsi_device_write(hub->upstream, FSI_MCENP0 + (4 * idx),
|
||||||
|
®, 4);
|
||||||
|
|
||||||
rc = fsi_device_write(hub->upstream, FSI_MSENP0 + (4 * idx), ®, 4);
|
rc = fsi_device_write(hub->upstream, FSI_MSENP0 + (4 * idx), ®, 4);
|
||||||
|
|
||||||
mdelay(FSI_LINK_ENABLE_SETUP_TIME);
|
mdelay(FSI_LINK_ENABLE_SETUP_TIME);
|
||||||
|
|
|
@ -130,7 +130,8 @@ struct fsi_master {
|
||||||
uint32_t addr, const void *val, size_t size);
|
uint32_t addr, const void *val, size_t size);
|
||||||
int (*term)(struct fsi_master *, int link, uint8_t id);
|
int (*term)(struct fsi_master *, int link, uint8_t id);
|
||||||
int (*send_break)(struct fsi_master *, int link);
|
int (*send_break)(struct fsi_master *, int link);
|
||||||
int (*link_enable)(struct fsi_master *, int link);
|
int (*link_enable)(struct fsi_master *, int link,
|
||||||
|
bool enable);
|
||||||
int (*link_config)(struct fsi_master *, int link,
|
int (*link_config)(struct fsi_master *, int link,
|
||||||
u8 t_send_delay, u8 t_echo_delay);
|
u8 t_send_delay, u8 t_echo_delay);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue