[PATCH linux dev-4.10 2/7] drivers/fsi: Add Client IRQ Enable / Disable
Christopher Bostic
cbostic at linux.vnet.ibm.com
Wed May 10 07:38:57 AEST 2017
From: Eddie James <eajames at us.ibm.com>
Allow FSI client drivers to enable and disable their engine
IRQ's via the exported interfaces fsi_enable_irq and
fsi_disable_irq.
Signed-off-by: Eddie James <eajames at us.ibm.com>
Signed-off-by: Christopher Bostic <cbostic at linux.vnet.ibm.com>
---
drivers/fsi/fsi-core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 73fdb69..ca3021f 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -973,12 +973,57 @@ void fsi_driver_unregister(struct fsi_driver *fsi_drv)
int fsi_enable_irq(struct fsi_device *dev)
{
+ int rc;
+ uint32_t si1m;
+ uint32_t bit = 0x80000000 >> dev->si1s_bit;
+ struct fsi_master *master = dev->slave->master;
+
+ if (!dev->irq_handler)
+ return -EINVAL;
+
+ rc = master->read(master, 0, 0, FSI_SLAVE_BASE + FSI_SI1M, &si1m,
+ sizeof(uint32_t));
+ if (rc) {
+ dev_err(&master->dev, "Coudn't read si1m:%d\n", rc);
+ return rc;
+ }
+
+ si1m |= bit;
+ rc = master->write(master, 0, 0, FSI_SLAVE_BASE + FSI_SI1M, &si1m,
+ sizeof(uint32_t));
+ if (rc) {
+ dev_err(&master->dev, "Coudn't write si1m:%d\n", rc);
+ return rc;
+ }
+
+ master->ipoll |= bit;
return 0;
}
EXPORT_SYMBOL(fsi_enable_irq);
void fsi_disable_irq(struct fsi_device *dev)
{
+ int rc;
+ uint32_t si1m;
+ uint32_t bits = ~(0x80000000 >> dev->si1s_bit);
+ struct fsi_master *master = dev->slave->master;
+
+ master->ipoll &= bits;
+
+ rc = master->read(master, 0, 0, FSI_SLAVE_BASE + FSI_SI1M, &si1m,
+ sizeof(uint32_t));
+ if (rc) {
+ dev_err(&master->dev, "Couldn't read si1m:%d\n", rc);
+ return;
+ }
+
+ si1m &= bits;
+ rc = master->write(master, 0, 0, FSI_SLAVE_BASE + FSI_SI1M, &si1m,
+ sizeof(uint32_t));
+ if (rc) {
+ dev_err(&master->dev, "Coudn't write si1m:%d\n", rc);
+ return;
+ }
}
EXPORT_SYMBOL(fsi_disable_irq);
--
1.8.2.2
More information about the openbmc
mailing list