Re: [PATCH V4 2/2] spmi: pmic_arb: add support for hw version 2

From: Ivan T. Ivanov
Date: Mon Feb 23 2015 - 04:59:36 EST


Hi Gilad,

On Thu, 2015-02-19 at 15:54 -0700, Gilad Avidov wrote:
> Qualcomm PMIC Arbiter version-2 changes from version-1 are:
>
> - Some different register offsets.
> - New channel register space, one per PMIC peripheral (ppid).
> All tx traffic uses these channels.
> - New observer register space. All rx trafic uses this space.
> - Different command format for spmi command registers.
>
> Acked-by: Sagar Dharia <sdharia@xxxxxxxxxxxxxx>
> Signed-off-by: Gilad Avidov <gavidov@xxxxxxxxxxxxxx
>

<snip>

> @@ -645,12 +796,67 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
> pa->spmic = ctrl;
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
> - pa->base = devm_ioremap_resource(&ctrl->dev, res);
> - if (IS_ERR(pa->base)) {
> - err = PTR_ERR(pa->base);
> + core = devm_ioremap_resource(&ctrl->dev, res);
> + if (IS_ERR(core)) {
> + err = PTR_ERR(core);
> goto err_put_ctrl;
> }
>
> + hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
> + is_v1 = (hw_ver < PMIC_ARB_VERSION_V2_MIN);
> +
> + dev_info(&ctrl->dev, "PMIC Arb Version-%d (0x%x)\n", (is_v1 ? 1 : 2),
> + hw_ver);
> +
> + if (is_v1) {
> + pa->ver_ops = &pmic_arb_v1;
> + pa->wr_base = core;
> + pa->rd_base = core;
> + } else {
> + u8 chan;
> + u16 ppid;
> + u32 regval;
> +
> + pa->ver_ops = &pmic_arb_v2;
> + devm_iounmap(&ctrl->dev, core);
> +
> + pa->ppid_to_chan = devm_kzalloc(&ctrl->dev,
> + PPID_TO_CHAN_TABLE_SZ, GFP_KERNEL);
> + if (!pa->ppid_to_chan) {
> + err = -ENOMEM;
> + goto err_put_ctrl;
> + }
> + /*
> + * PMIC_ARB_REG_CHNL is a table in HW mapping channel to ppid.
> + * ppid_to_chan is an in-memory invert of that table.
> + */
> + for (chan = 0; chan < PMIC_ARB_MAX_CHNL; ++chan) {
> + regval = readl_relaxed(pa->rd_base +

rd_base is not initialized at this point.

> +
> PMIC_ARB_REG_CHNL(chan));
> + if (!regval)
> + continue;
> +
> + ppid = (regval >> 8) & 0xFFF;
> + pa->ppid_to_chan[ppid] = chan;
> + }
> +
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> + "obsrvr");
> + pa->rd_base = devm_ioremap_resource(&ctrl->dev, res);

and they are compile warnings:

drivers/spmi/spmi-pmic-arb.c: In function âpmic_arb_read_cmdâ:
drivers/spmi/spmi-pmic-arb.c:310:4: warning: format â%dâ expects argument of type âintâ, but argument 4 has type âsize_tâ [-Wformat=]
PMIC_ARB_MAX_TRANS_BYTES, len);
^
drivers/spmi/spmi-pmic-arb.c: In function âpmic_arb_write_cmdâ:
drivers/spmi/spmi-pmic-arb.c:357:4: warning: format â%dâ expects argument of type âintâ, but argument 4 has type âsize_tâ [-Wformat=]
PMIC_ARB_MAX_TRANS_BYTES, len);
^

Ivan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/