diff options
-rw-r--r-- | drivers/fsi/fsi-core.c | 22 | ||||
-rw-r--r-- | drivers/fsi/fsi-master-gpio.c | 1 | ||||
-rw-r--r-- | drivers/fsi/fsi-master.h | 2 |
3 files changed, 24 insertions, 1 deletions
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index c9ff8d3b3f03..b56f4ed5c488 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c | |||
@@ -49,6 +49,7 @@ static const int engine_page_size = 0x400; | |||
49 | #define FSI_SMODE 0x0 /* R/W: Mode register */ | 49 | #define FSI_SMODE 0x0 /* R/W: Mode register */ |
50 | #define FSI_SISC 0x8 /* R/W: Interrupt condition */ | 50 | #define FSI_SISC 0x8 /* R/W: Interrupt condition */ |
51 | #define FSI_SSTAT 0x14 /* R : Slave status */ | 51 | #define FSI_SSTAT 0x14 /* R : Slave status */ |
52 | #define FSI_LLMODE 0x100 /* R/W: Link layer mode register */ | ||
52 | 53 | ||
53 | /* | 54 | /* |
54 | * SMODE fields | 55 | * SMODE fields |
@@ -64,6 +65,11 @@ static const int engine_page_size = 0x400; | |||
64 | #define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */ | 65 | #define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */ |
65 | #define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */ | 66 | #define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */ |
66 | 67 | ||
68 | /* | ||
69 | * LLMODE fields | ||
70 | */ | ||
71 | #define FSI_LLMODE_ASYNC 0x1 | ||
72 | |||
67 | #define FSI_SLAVE_SIZE_23b 0x800000 | 73 | #define FSI_SLAVE_SIZE_23b 0x800000 |
68 | 74 | ||
69 | static DEFINE_IDA(master_ida); | 75 | static DEFINE_IDA(master_ida); |
@@ -557,8 +563,8 @@ static void fsi_slave_release(struct device *dev) | |||
557 | 563 | ||
558 | static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) | 564 | static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) |
559 | { | 565 | { |
566 | uint32_t chip_id, llmode; | ||
560 | struct fsi_slave *slave; | 567 | struct fsi_slave *slave; |
561 | uint32_t chip_id; | ||
562 | uint8_t crc; | 568 | uint8_t crc; |
563 | int rc; | 569 | int rc; |
564 | 570 | ||
@@ -594,6 +600,20 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id) | |||
594 | return -ENODEV; | 600 | return -ENODEV; |
595 | } | 601 | } |
596 | 602 | ||
603 | /* If we're behind a master that doesn't provide a self-running bus | ||
604 | * clock, put the slave into async mode | ||
605 | */ | ||
606 | if (master->flags & FSI_MASTER_FLAG_SWCLOCK) { | ||
607 | llmode = cpu_to_be32(FSI_LLMODE_ASYNC); | ||
608 | rc = fsi_master_write(master, link, id, | ||
609 | FSI_SLAVE_BASE + FSI_LLMODE, | ||
610 | &llmode, sizeof(llmode)); | ||
611 | if (rc) | ||
612 | dev_warn(&master->dev, | ||
613 | "can't set llmode on slave:%02x:%02x %d\n", | ||
614 | link, id, rc); | ||
615 | } | ||
616 | |||
597 | /* We can communicate with a slave; create the slave device and | 617 | /* We can communicate with a slave; create the slave device and |
598 | * register. | 618 | * register. |
599 | */ | 619 | */ |
diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c index a5d6e705b3c5..ae2618768508 100644 --- a/drivers/fsi/fsi-master-gpio.c +++ b/drivers/fsi/fsi-master-gpio.c | |||
@@ -554,6 +554,7 @@ static int fsi_master_gpio_probe(struct platform_device *pdev) | |||
554 | master->gpio_mux = gpio; | 554 | master->gpio_mux = gpio; |
555 | 555 | ||
556 | master->master.n_links = 1; | 556 | master->master.n_links = 1; |
557 | master->master.flags = FSI_MASTER_FLAG_SWCLOCK; | ||
557 | master->master.read = fsi_master_gpio_read; | 558 | master->master.read = fsi_master_gpio_read; |
558 | master->master.write = fsi_master_gpio_write; | 559 | master->master.write = fsi_master_gpio_write; |
559 | master->master.term = fsi_master_gpio_term; | 560 | master->master.term = fsi_master_gpio_term; |
diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h index 7764b0079d28..12f7b119567d 100644 --- a/drivers/fsi/fsi-master.h +++ b/drivers/fsi/fsi-master.h | |||
@@ -19,6 +19,8 @@ | |||
19 | 19 | ||
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | 21 | ||
22 | #define FSI_MASTER_FLAG_SWCLOCK 0x1 | ||
23 | |||
22 | struct fsi_master { | 24 | struct fsi_master { |
23 | struct device dev; | 25 | struct device dev; |
24 | int idx; | 26 | int idx; |