[PATCH v6 08/16] MIPS: lantiq: Convert the fpi bus driver to a platform_driver
Andy Shevchenko
andy.shevchenko at gmail.com
Fri Jun 30 05:19:16 PDT 2017
On Fri, Jun 30, 2017 at 12:39 AM, Hauke Mehrtens <hauke at hauke-m.de> wrote:
> Instead of hacking the configuration of the FPI bus into the arch code
> add an own bus driver for this internal bus. The FPI bus is the main
> bus of the SoC. This bus driver makes sure the bus is configured
> correctly before the child drivers are getting initialized. This driver
> will probably also be used on different SoC later.
> + /* RCU configuration is optional */
> + rcu_regmap = syscon_regmap_lookup_by_phandle(np, "lantiq,rcu");
> + if (!IS_ERR_OR_NULL(rcu_regmap)) {
It's still concerning me.
If the API is correctly designed then it should look something like
if (IS_ERR(...))
return PTR_ERR(...);
if (!...) {
...stuff for optional case...
}
> + ret = device_property_read_u32(dev, "lantiq,offset-endianness",
> + &rcu_ahb_endianness_reg_offset);
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to get RCU reg offset\n");
> + return -EINVAL;
> + }
> +
> + if (regmap_update_bits(rcu_regmap,
> + rcu_ahb_endianness_reg_offset,
> + RCU_VR9_BE_AHB1S,
> + RCU_VR9_BE_AHB1S))
> + dev_warn(&pdev->dev,
> + "Failed to configure RCU AHB endianness\n");
> + }
> +
> + /* disable fpi burst */
> + ltq_w32_mask(XBAR_FPI_BURST_EN, 0, xbar_membase + XBAR_ALWAYS_LAST);
> +
> + return of_platform_populate(dev->of_node, NULL, NULL, dev);
> +}
--
With Best Regards,
Andy Shevchenko
More information about the linux-mtd
mailing list