Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eddie James and committed by
Joel Stanley
04635a30 3c3c4848

+21 -8
+1 -1
drivers/fsi/fsi-core.c
··· 1157 1157 static int fsi_master_link_enable(struct fsi_master *master, int link) 1158 1158 { 1159 1159 if (master->link_enable) 1160 - return master->link_enable(master, link); 1160 + return master->link_enable(master, link, true); 1161 1161 1162 1162 return 0; 1163 1163 }
+6 -1
drivers/fsi/fsi-master-aspeed.c
··· 301 301 return 0; 302 302 } 303 303 304 - static int aspeed_master_link_enable(struct fsi_master *master, int link) 304 + static int aspeed_master_link_enable(struct fsi_master *master, int link, 305 + bool enable) 305 306 { 306 307 struct fsi_master_aspeed *aspeed = to_fsi_master_aspeed(master); 307 308 int idx, bit, ret; ··· 312 311 bit = link % 32; 313 312 314 313 reg = cpu_to_be32(0x80000000 >> bit); 314 + 315 + if (!enable) 316 + return opb_writel(aspeed, ctrl_base + FSI_MCENP0 + (4 * idx), 317 + reg); 315 318 316 319 ret = opb_writel(aspeed, ctrl_base + FSI_MSENP0 + (4 * idx), reg); 317 320 if (ret)
+3 -2
drivers/fsi/fsi-master-ast-cf.c
··· 1039 1039 gpiod_direction_input(master->gpio_data); 1040 1040 } 1041 1041 1042 - static int fsi_master_acf_link_enable(struct fsi_master *_master, int link) 1042 + static int fsi_master_acf_link_enable(struct fsi_master *_master, int link, 1043 + bool enable) 1043 1044 { 1044 1045 struct fsi_master_acf *master = to_fsi_master_acf(_master); 1045 1046 int rc = -EBUSY; ··· 1050 1049 1051 1050 mutex_lock(&master->lock); 1052 1051 if (!master->external_mode) { 1053 - gpiod_set_value(master->gpio_enable, 1); 1052 + gpiod_set_value(master->gpio_enable, enable ? 1 : 0); 1054 1053 rc = 0; 1055 1054 } 1056 1055 mutex_unlock(&master->lock);
+3 -2
drivers/fsi/fsi-master-gpio.c
··· 678 678 gpiod_direction_input(master->gpio_data); 679 679 } 680 680 681 - static int fsi_master_gpio_link_enable(struct fsi_master *_master, int link) 681 + static int fsi_master_gpio_link_enable(struct fsi_master *_master, int link, 682 + bool enable) 682 683 { 683 684 struct fsi_master_gpio *master = to_fsi_master_gpio(_master); 684 685 int rc = -EBUSY; ··· 689 688 690 689 mutex_lock(&master->cmd_lock); 691 690 if (!master->external_mode) { 692 - gpiod_set_value(master->gpio_enable, 1); 691 + gpiod_set_value(master->gpio_enable, enable ? 1 : 0); 693 692 rc = 0; 694 693 } 695 694 mutex_unlock(&master->cmd_lock);
+6 -1
drivers/fsi/fsi-master-hub.c
··· 77 77 return hub_master_write(master, link, 0, addr, &cmd, sizeof(cmd)); 78 78 } 79 79 80 - static int hub_master_link_enable(struct fsi_master *master, int link) 80 + static int hub_master_link_enable(struct fsi_master *master, int link, 81 + bool enable) 81 82 { 82 83 struct fsi_master_hub *hub = to_fsi_master_hub(master); 83 84 int idx, bit; ··· 89 88 bit = link % 32; 90 89 91 90 reg = cpu_to_be32(0x80000000 >> bit); 91 + 92 + if (!enable) 93 + return fsi_device_write(hub->upstream, FSI_MCENP0 + (4 * idx), 94 + &reg, 4); 92 95 93 96 rc = fsi_device_write(hub->upstream, FSI_MSENP0 + (4 * idx), &reg, 4); 94 97
+2 -1
drivers/fsi/fsi-master.h
··· 130 130 uint32_t addr, const void *val, size_t size); 131 131 int (*term)(struct fsi_master *, int link, uint8_t id); 132 132 int (*send_break)(struct fsi_master *, int link); 133 - int (*link_enable)(struct fsi_master *, int link); 133 + int (*link_enable)(struct fsi_master *, int link, 134 + bool enable); 134 135 int (*link_config)(struct fsi_master *, int link, 135 136 u8 t_send_delay, u8 t_echo_delay); 136 137 };