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

drivers/fsi: Use asynchronous slave mode

For slaves that are behind a software-clocked master, we want FSI CFAMs
to run asynchronously to the FSI clock, so set up our slaves to be in
async mode.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jeremy Kerr and committed by
Greg Kroah-Hartman
4af889b0 7f9e8f76

+24 -1
+21 -1
drivers/fsi/fsi-core.c
··· 49 49 #define FSI_SMODE 0x0 /* R/W: Mode register */ 50 50 #define FSI_SISC 0x8 /* R/W: Interrupt condition */ 51 51 #define FSI_SSTAT 0x14 /* R : Slave status */ 52 + #define FSI_LLMODE 0x100 /* R/W: Link layer mode register */ 52 53 53 54 /* 54 55 * SMODE fields ··· 64 63 #define FSI_SMODE_SD_MASK 0xf /* Send delay mask */ 65 64 #define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */ 66 65 #define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */ 66 + 67 + /* 68 + * LLMODE fields 69 + */ 70 + #define FSI_LLMODE_ASYNC 0x1 67 71 68 72 #define FSI_SLAVE_SIZE_23b 0x800000 69 73 ··· 563 557 564 558 static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) 565 559 { 560 + uint32_t chip_id, llmode; 566 561 struct fsi_slave *slave; 567 - uint32_t chip_id; 568 562 uint8_t crc; 569 563 int rc; 570 564 ··· 598 592 "can't set smode on slave:%02x:%02x %d\n", 599 593 link, id, rc); 600 594 return -ENODEV; 595 + } 596 + 597 + /* If we're behind a master that doesn't provide a self-running bus 598 + * clock, put the slave into async mode 599 + */ 600 + if (master->flags & FSI_MASTER_FLAG_SWCLOCK) { 601 + llmode = cpu_to_be32(FSI_LLMODE_ASYNC); 602 + rc = fsi_master_write(master, link, id, 603 + FSI_SLAVE_BASE + FSI_LLMODE, 604 + &llmode, sizeof(llmode)); 605 + if (rc) 606 + dev_warn(&master->dev, 607 + "can't set llmode on slave:%02x:%02x %d\n", 608 + link, id, rc); 601 609 } 602 610 603 611 /* We can communicate with a slave; create the slave device and
+1
drivers/fsi/fsi-master-gpio.c
··· 554 554 master->gpio_mux = gpio; 555 555 556 556 master->master.n_links = 1; 557 + master->master.flags = FSI_MASTER_FLAG_SWCLOCK; 557 558 master->master.read = fsi_master_gpio_read; 558 559 master->master.write = fsi_master_gpio_write; 559 560 master->master.term = fsi_master_gpio_term;
+2
drivers/fsi/fsi-master.h
··· 19 19 20 20 #include <linux/device.h> 21 21 22 + #define FSI_MASTER_FLAG_SWCLOCK 0x1 23 + 22 24 struct fsi_master { 23 25 struct device dev; 24 26 int idx;