All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avri Altman <Avri.Altman@wdc.com>
To: Chanho Park <chanho61.park@samsung.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Cc: Bean Huo <beanhuo@micron.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"hch@infradead.org" <hch@infradead.org>,
	Can Guo <cang@codeaurora.org>, Jaegeuk Kim <jaegeuk@kernel.org>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Gyunghoon Kwon <goodjob.kwon@samsung.com>,
	Sowon Na <sowon.na@samsung.com>,
	"linux-samsung-soc@vger.kernel.org" 
	<linux-samsung-soc@vger.kernel.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Kiwoong Kim <kwmad.kim@samsung.com>
Subject: RE: [PATCH v4 15/16] scsi: ufs: ufs-exynos: introduce exynosauto v9 virtual host
Date: Thu, 14 Oct 2021 19:03:01 +0000	[thread overview]
Message-ID: <DM6PR04MB6575717817EDD8C549F2D539FCB89@DM6PR04MB6575.namprd04.prod.outlook.com> (raw)
In-Reply-To: <20211007080934.108804-16-chanho61.park@samsung.com>

> 
> This patch introduces virtual host driver of exynosauto v9 ufs mHCI.
> VH(Virtual Host) only supports data transfer functions. So, most of physical
> features are broken. So, we need to set below quirks.
> - UFSHCD_QUIRK_BROKEN_UIC_CMD
> - UFSHCD_QUIRK_SKIP_PH_CONFIGURATION
Oh - you set it here.
Maybe just add a comment in your commit log of patches 1 & 2 that you are doing it later.

> Before initialization, the VH is necessary to wait until PH is ready.
> It's implemented as polling at the moment.
> 
> Cc: Alim Akhtar <alim.akhtar@samsung.com>
> Cc: Kiwoong Kim <kwmad.kim@samsung.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> ---
>  drivers/scsi/ufs/ufs-exynos.c | 84 +++++++++++++++++++++++++++++++++++
>  1 file changed, 84 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index
> 32f73c906018..c2b654027b0f 100644
> --- a/drivers/scsi/ufs/ufs-exynos.c
> +++ b/drivers/scsi/ufs/ufs-exynos.c
> @@ -121,6 +121,8 @@
>  #define HCI_MH_ALLOWABLE_TRAN_OF_VH            0x30C
>  #define HCI_MH_IID_IN_TASK_TAG                 0X308
> 
> +#define PH_READY_TIMEOUT_MS                    (5 * MSEC_PER_SEC)
> +
>  enum {
>         UNIPRO_L1_5 = 0,/* PHY Adapter */
>         UNIPRO_L2,      /* Data Link */
> @@ -1403,6 +1405,68 @@ static int exynos_ufs_resume(struct ufs_hba *hba,
> enum ufs_pm_op pm_op)
>         return 0;
>  }
> 
> +static int exynosauto_ufs_vh_link_startup_notify(struct ufs_hba *hba,
> +                                                enum
> +ufs_notify_change_status status) {
> +       if (status == POST_CHANGE) {
> +               ufshcd_set_link_active(hba);
> +               ufshcd_set_ufs_dev_active(hba);
> +               hba->wlun_dev_clr_ua = true;
wlun_dev_clr_ua no longer exists - needs rebase

> +       }
> +
> +       return 0;
> +}
> +
> +static int exynosauto_ufs_vh_wait_ph_ready(struct ufs_hba *hba) {
> +       u32 mbox;
> +       ktime_t start, stop;
> +
> +       start = ktime_get();
> +       stop = ktime_add(start, ms_to_ktime(PH_READY_TIMEOUT_MS));
> +
> +       do {
> +               mbox = ufshcd_readl(hba, PH2VH_MBOX);
> +               if ((mbox & MH_MSG_MASK) == MH_MSG_PH_READY)
> +                       return 0;
Maybe add a comment here that the mbox protocol will be defined later.

Thanks,
Avri
> +
> +               usleep_range(40, 50);
> +       } while (ktime_before(ktime_get(), stop));
> +
> +       return -ETIME;
> +}
> +
> +static int exynosauto_ufs_vh_init(struct ufs_hba *hba) {
> +       struct device *dev = hba->dev;
> +       struct platform_device *pdev = to_platform_device(dev);
> +       struct exynos_ufs *ufs;
> +       int ret;
> +
> +       ufs = devm_kzalloc(dev, sizeof(*ufs), GFP_KERNEL);
> +       if (!ufs)
> +               return -ENOMEM;
> +
> +       /* exynos-specific hci */
> +       ufs->reg_hci = devm_platform_ioremap_resource_byname(pdev,
> "vs_hci");
> +       if (IS_ERR(ufs->reg_hci)) {
> +               dev_err(dev, "cannot ioremap for hci vendor register\n");
> +               return PTR_ERR(ufs->reg_hci);
> +       }
> +
> +       ret = exynosauto_ufs_vh_wait_ph_ready(hba);
> +       if (ret)
> +               return ret;
> +
> +       ufs->drv_data = device_get_match_data(dev);
> +       if (!ufs->drv_data)
> +               return -ENODEV;
> +
> +       exynos_ufs_priv_init(hba, ufs);
> +
> +       return 0;
> +}
> +
>  static struct ufs_hba_variant_ops ufs_hba_exynos_ops = {
>         .name                           = "exynos_ufs",
>         .init                           = exynos_ufs_init,
> @@ -1417,6 +1481,12 @@ static struct ufs_hba_variant_ops
> ufs_hba_exynos_ops = {
>         .resume                         = exynos_ufs_resume,
>  };
> 
> +static struct ufs_hba_variant_ops ufs_hba_exynosauto_vh_ops = {
> +       .name                           = "exynosauto_ufs_vh",
> +       .init                           = exynosauto_ufs_vh_init,
> +       .link_startup_notify            = exynosauto_ufs_vh_link_startup_notify,
> +};
> +
>  static int exynos_ufs_probe(struct platform_device *pdev)  {
>         int err;
> @@ -1485,6 +1555,18 @@ static struct exynos_ufs_drv_data
> exynosauto_ufs_drvs = {
>         .post_pwr_change        = exynosauto_ufs_post_pwr_change,
>  };
> 
> +static struct exynos_ufs_drv_data exynosauto_ufs_vh_drvs = {
> +       .vops                   = &ufs_hba_exynosauto_vh_ops,
> +       .quirks                 = UFSHCD_QUIRK_PRDT_BYTE_GRAN |
> +                                 UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR |
> +                                 UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR |
> +                                 UFSHCI_QUIRK_BROKEN_HCE |
> +                                 UFSHCD_QUIRK_BROKEN_UIC_CMD |
> +                                 UFSHCD_QUIRK_SKIP_PH_CONFIGURATION |
> +                                 UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING,
> +       .opts                   = EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX,
> +};
> +
>  static struct exynos_ufs_drv_data exynos_ufs_drvs = {
>         .uic_attr               = &exynos7_uic_attr,
>         .quirks                 = UFSHCD_QUIRK_PRDT_BYTE_GRAN |
> @@ -1512,6 +1594,8 @@ static const struct of_device_id
> exynos_ufs_of_match[] = {
>           .data       = &exynos_ufs_drvs },
>         { .compatible = "samsung,exynosautov9-ufs",
>           .data       = &exynosauto_ufs_drvs },
> +       { .compatible = "samsung,exynosautov9-ufs-vh",
> +         .data       = &exynosauto_ufs_vh_drvs },
>         {},
>  };
> 
> --
> 2.33.0


  reply	other threads:[~2021-10-14 19:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20211007081133epcas2p31f973709609d82dbbc76bd7b51232cb2@epcas2p3.samsung.com>
2021-10-07  8:09 ` [PATCH v4 00/16] introduce exynosauto v9 ufs driver Chanho Park
     [not found]   ` <CGME20211007081133epcas2p3ca173361432aabe2ce9b923465a08570@epcas2p3.samsung.com>
2021-10-07  8:09     ` [PATCH v4 01/16] scsi: ufs: add quirk to handle broken UIC command Chanho Park
2021-10-14 10:48       ` Avri Altman
     [not found]   ` <CGME20211007081134epcas2p4b6c0673d5b47cd04d9aefcd3d07c75cc@epcas2p4.samsung.com>
2021-10-07  8:09     ` [PATCH v4 02/16] scsi: ufs: add quirk to enable host controller without ph configuration Chanho Park
2021-10-14 10:49       ` Avri Altman
     [not found]   ` <CGME20211007081134epcas2p27513b5eed7fc78424709f70fa651a877@epcas2p2.samsung.com>
2021-10-07  8:09     ` [PATCH v4 03/16] scsi: ufs: ufs-exynos: change pclk available max value Chanho Park
     [not found]   ` <CGME20211007081134epcas2p4af32ee0344c2c17f478709da5acc7a87@epcas2p4.samsung.com>
2021-10-07  8:09     ` [PATCH v4 04/16] scsi: ufs: ufs-exynos: simplify drv_data retrieval Chanho Park
     [not found]   ` <CGME20211007081134epcas2p4121be716aafc8900713e331026eceaa8@epcas2p4.samsung.com>
2021-10-07  8:09     ` [PATCH v4 05/16] scsi: ufs: ufs-exynos: add refclkout_stop control Chanho Park
     [not found]   ` <CGME20211007081134epcas2p46aebdd54f2e5263e0662a1adbd93613a@epcas2p4.samsung.com>
2021-10-07  8:09     ` [PATCH v4 06/16] scsi: ufs: ufs-exynos: add setup_clocks callback Chanho Park
     [not found]   ` <CGME20211007081134epcas2p49d174a4da55c5042e2bee42c249678c3@epcas2p4.samsung.com>
2021-10-07  8:09     ` [PATCH v4 07/16] scsi: ufs: ufs-exynos: correct timeout value setting registers Chanho Park
2021-10-14 12:12       ` Avri Altman
2021-10-15  9:53         ` Chanho Park
     [not found]   ` <CGME20211007081134epcas2p1f4e1d77c82c3cd7647c0fa9f1fdca053@epcas2p1.samsung.com>
2021-10-07  8:09     ` [PATCH v4 08/16] scsi: ufs: ufs-exynos: support custom version of ufs_hba_variant_ops Chanho Park
     [not found]   ` <CGME20211007081134epcas2p3cf933b0e8c52de665161fb978ec8e577@epcas2p3.samsung.com>
2021-10-07  8:09     ` [PATCH v4 09/16] scsi: ufs: ufs-exynos: add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR option Chanho Park
     [not found]   ` <CGME20211007081134epcas2p2eb19706624f722e96aec7bbdda9f8e4d@epcas2p2.samsung.com>
2021-10-07  8:09     ` [PATCH v4 10/16] scsi: ufs: ufs-exynos: factor out priv data init Chanho Park
     [not found]   ` <CGME20211007081135epcas2p22a653765a6e520d1da1ba1ceb3f7fa25@epcas2p2.samsung.com>
2021-10-07  8:09     ` [PATCH v4 11/16] scsi: ufs: ufs-exynos: add pre/post_hce_enable drv callbacks Chanho Park
     [not found]   ` <CGME20211007081135epcas2p365e055851e41fa5e95e00e641037da41@epcas2p3.samsung.com>
2021-10-07  8:09     ` [PATCH v4 12/16] scsi: ufs: ufs-exynos: support exynosauto v9 ufs driver Chanho Park
     [not found]   ` <CGME20211007081135epcas2p2d577fc8dec75471cf42024eda6a45690@epcas2p2.samsung.com>
2021-10-07  8:09     ` [PATCH v4 13/16] dt-bindings: ufs: exynos-ufs: add io-coherency property Chanho Park
2021-10-15 13:50       ` Rob Herring
2021-10-18  0:26         ` Chanho Park
2021-10-18 13:23           ` Rob Herring
2021-10-18 11:07         ` Chanho Park
     [not found]   ` <CGME20211007081135epcas2p410e67850fdd25fc762b0bfa49c6e24f1@epcas2p4.samsung.com>
2021-10-07  8:09     ` [PATCH v4 14/16] scsi: ufs: ufs-exynos: multi-host configuration for exynosauto Chanho Park
2021-10-14 18:51       ` Avri Altman
2021-10-15 11:44         ` Chanho Park
2021-10-18  5:34       ` Inki Dae
     [not found]   ` <CGME20211007081135epcas2p372f122a0f601f0108bdd593ca0105f3c@epcas2p3.samsung.com>
2021-10-07  8:09     ` [PATCH v4 15/16] scsi: ufs: ufs-exynos: introduce exynosauto v9 virtual host Chanho Park
2021-10-14 19:03       ` Avri Altman [this message]
2021-10-15 12:13         ` Chanho Park
     [not found]   ` <CGME20211007081135epcas2p37b429e366099fd28e517d3d354a848b8@epcas2p3.samsung.com>
2021-10-07  8:09     ` [PATCH v4 16/16] dt-bindings: ufs: exynos-ufs: add exynosautov9 compatible Chanho Park
2021-10-14 10:04   ` [PATCH v4 00/16] introduce exynosauto v9 ufs driver Avri Altman
2021-10-15 11:57     ` Chanho Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR04MB6575717817EDD8C549F2D539FCB89@DM6PR04MB6575.namprd04.prod.outlook.com \
    --to=avri.altman@wdc.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=chanho61.park@samsung.com \
    --cc=goodjob.kwon@samsung.com \
    --cc=hch@infradead.org \
    --cc=jaegeuk@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=jh80.chung@samsung.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=kwmad.kim@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sowon.na@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.