slim:msm: Change to register access for RX path if required

MSM controller for slimbus usually uses a BAM pipe to receive control
data. However, some targets may not have a BAM pipe assinged for
receiving this data. In that case, RX data should be received using
direct register access instead.
Introduce a Device-Tree property to change this access.

Change-Id: I9bb1502f25e0e855937bc6fb4131f55348d04794
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
This commit is contained in:
Sagar Dharia 2012-07-31 19:06:21 -06:00 committed by Stephen Boyd
parent 53cc583054
commit 450560c84c
2 changed files with 15 additions and 7 deletions

View file

@ -25,6 +25,9 @@ Optional property:
- qcom,max-clk-gear: Maximum clock gear at which this controller can be run
(range: 1-10)
Default value will be 10 if this entry is not specified
- qcom,rxreg-access: This boolean indicates that slimbus RX should use direct
register access to receive data. This flag is only needed if
BAM pipe is not available to receive data from slimbus
Example:
slim@fe12f000 {
cell-index = <1>;
@ -35,4 +38,5 @@ Example:
interrupts = <0 163 0 0 164 0>;
interrupt-names = "slimbus_irq", "slimbus_bam_irq";
qcom,min-clk-gear = <10>;
qcom,rxreg-access;
};

View file

@ -1746,9 +1746,6 @@ msm_slim_sps_init(struct msm_slim_ctrl *dev, struct resource *bam_mem)
},
};
if (!dev->use_rx_msgqs)
goto init_rx_msgq;
bam_props.ee = dev->ee;
bam_props.virt_addr = dev->bam.base;
bam_props.phys_addr = bam_mem->start;
@ -1784,7 +1781,7 @@ init_rx_msgq:
ret = msm_slim_init_rx_msgq(dev);
if (ret)
dev_err(dev->dev, "msm_slim_init_rx_msgq failed 0x%x\n", ret);
if (!dev->use_rx_msgqs && bam_handle) {
if (ret && bam_handle) {
sps_deregister_bam_device(bam_handle);
dev->bam.hdl = 0L;
}
@ -1850,6 +1847,7 @@ static int __devinit msm_slim_probe(struct platform_device *pdev)
struct resource *bam_mem, *bam_io;
struct resource *slim_mem, *slim_io;
struct resource *irq, *bam_irq;
bool rxreg_access = false;
slim_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"slimbus_physical");
if (!slim_mem) {
@ -1922,13 +1920,15 @@ static int __devinit msm_slim_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Cell index not specified:%d", ret);
goto err_of_init_failed;
}
rxreg_access = of_property_read_bool(pdev->dev.of_node,
"qcom,rxreg-access");
/* Optional properties */
ret = of_property_read_u32(pdev->dev.of_node,
"qcom,min-clk-gear", &dev->ctrl.min_cg);
ret = of_property_read_u32(pdev->dev.of_node,
"qcom,max-clk-gear", &dev->ctrl.max_cg);
pr_err("min_cg:%d, max_cg:%d, ret:%d", dev->ctrl.min_cg,
dev->ctrl.max_cg, ret);
pr_debug("min_cg:%d, max_cg:%d, rxreg: %d", dev->ctrl.min_cg,
dev->ctrl.max_cg, rxreg_access);
} else {
dev->ctrl.nr = pdev->id;
}
@ -1947,7 +1947,11 @@ static int __devinit msm_slim_probe(struct platform_device *pdev)
mutex_init(&dev->tx_lock);
spin_lock_init(&dev->rx_lock);
dev->ee = 1;
dev->use_rx_msgqs = 1;
if (rxreg_access)
dev->use_rx_msgqs = 0;
else
dev->use_rx_msgqs = 1;
dev->irq = irq->start;
dev->bam.irq = bam_irq->start;