Re: [PATCH v1 01/17] scsi: ufs-qcom: add number of lanes per direction
From: Akinobu Mita
Date: Wed Oct 21 2015 - 11:47:51 EST
2015-09-13 23:52 GMT+09:00 Yaniv Gardi <ygardi@xxxxxxxxxxxxxx>:
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 1c37a7d..9638553 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -40,6 +40,7 @@
> #include <linux/async.h>
> #include <linux/devfreq.h>
>
> +#include <linux/of.h>
> #include "ufshcd.h"
> #include "unipro.h"
> #define UFSHCD_REQ_SENSE_SIZE 18
> @@ -87,6 +88,8 @@
> /* Interrupt aggregation default timeout, unit: 40us */
> #define INT_AGGR_DEF_TO 0x02
>
> +#define UFSHCD_DEFAULT_LANES_PER_DIRECTION 2
> +
> #define ufshcd_toggle_vreg(_dev, _vreg, _on) \
> ({ \
> int _ret; \
> @@ -5765,6 +5768,21 @@ static struct devfreq_dev_profile ufs_devfreq_profile = {
> .get_dev_status = ufshcd_devfreq_get_dev_status,
> };
>
> +static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba)
> +{
> + struct device *dev = hba->dev;
> + int ret;
> +
> + ret = of_property_read_u32(dev->of_node, "lanes-per-direction",
> + &hba->lanes_per_direction);
> + if (ret) {
> + dev_dbg(hba->dev,
> + "%s: failed to read lanes-per-direction, ret=%d\n",
> + __func__, ret);
> + hba->lanes_per_direction = UFSHCD_DEFAULT_LANES_PER_DIRECTION;
> + }
> +}
> +
> /**
> * ufshcd_init - Driver initialization routine
> * @hba: per-adapter instance
> @@ -5788,6 +5806,8 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
> hba->mmio_base = mmio_base;
> hba->irq = irq;
>
> + ufshcd_init_lanes_per_dir(hba);
> +
> err = ufshcd_hba_init(hba);
> if (err)
> goto out_error;
Should this be called in ufshcd_pltfrm_init() and move
ufshcd_init_lanes_per_dir() to
ufshcd-pltfrm.c? Because all 'of_' stuffs are in ufshcd-pltfrm.c.
--
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/