Re: [PATCH v4 6/8] scsi: ufs: make the UFS variant a platform device

2015-09-02 Thread ygardi
> On Sun, Aug 30, 2015 at 9:52 AM, Yaniv Gardi 
> wrote:
>> This change turns the UFS variant (SCSI_UFS_QCOM) into a UFS
>> a platform device.
>> In order to do so a few additional changes are required:
>> 1. The ufshcd-pltfrm is no longer serves as a platform device.
>>Now it only serves as a group of platform APIs such as PM APIs
>>(runtime suspend/resume, system suspend/resume etc), parsers of
>>clocks, regulators and pm_levels from DT.
>> 2. What used to be the old platform "probe" is now "only"
>>a pltfrm_init() routine, that does exactly the same, but only
>>being called by the new probe function of the UFS variant.
>>
>> Signed-off-by: Yaniv Gardi 
>>
>> ---
>>  Documentation/devicetree/bindings/ufs/ufs-qcom.txt | 57 ++
>>  .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |  4 +-
>
> For the binding:
>
> Reviewed-by: Rob Herring 
>
> A comment on the driver part still.
>
>> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
>> index 329ac84..8027435 100644
>> --- a/drivers/scsi/ufs/ufs-qcom.c
>> +++ b/drivers/scsi/ufs/ufs-qcom.c
>
> [...]
>
>> +static int ufs_qcom_probe(struct platform_device *pdev)
>> +{
>> +   int err;
>> +   struct device *dev = &pdev->dev;
>> +   struct ufs_hba *hba;
>> +
>> +   /* Perform generic probe */
>> +   err = ufshcd_pltfrm_init(pdev, &ufs_hba_qcom_vops);
>> +   if (err) {
>> +   dev_err(dev, "ufshcd_pltfrm_init() failed %d\n", err);
>> +   goto out;
>> +   }
>> +
>> +   hba = platform_get_drvdata(pdev);
>
> I thought this was not necessary?

skipped my eye. i'm uploading another version without this redundant check

>
>> +   if (unlikely(!hba)) {
>> +   dev_err(dev, "no hba structure after successful
>> probing\n");
>> +   goto dealloc_host;
>> +   }
>> +
>> +   return 0;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


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


Re: [PATCH v4 6/8] scsi: ufs: make the UFS variant a platform device

2015-09-01 Thread Rob Herring
On Sun, Aug 30, 2015 at 9:52 AM, Yaniv Gardi  wrote:
> This change turns the UFS variant (SCSI_UFS_QCOM) into a UFS
> a platform device.
> In order to do so a few additional changes are required:
> 1. The ufshcd-pltfrm is no longer serves as a platform device.
>Now it only serves as a group of platform APIs such as PM APIs
>(runtime suspend/resume, system suspend/resume etc), parsers of
>clocks, regulators and pm_levels from DT.
> 2. What used to be the old platform "probe" is now "only"
>a pltfrm_init() routine, that does exactly the same, but only
>being called by the new probe function of the UFS variant.
>
> Signed-off-by: Yaniv Gardi 
>
> ---
>  Documentation/devicetree/bindings/ufs/ufs-qcom.txt | 57 ++
>  .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |  4 +-

For the binding:

Reviewed-by: Rob Herring 

A comment on the driver part still.

> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index 329ac84..8027435 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c

[...]

> +static int ufs_qcom_probe(struct platform_device *pdev)
> +{
> +   int err;
> +   struct device *dev = &pdev->dev;
> +   struct ufs_hba *hba;
> +
> +   /* Perform generic probe */
> +   err = ufshcd_pltfrm_init(pdev, &ufs_hba_qcom_vops);
> +   if (err) {
> +   dev_err(dev, "ufshcd_pltfrm_init() failed %d\n", err);
> +   goto out;
> +   }
> +
> +   hba = platform_get_drvdata(pdev);

I thought this was not necessary?

> +   if (unlikely(!hba)) {
> +   dev_err(dev, "no hba structure after successful probing\n");
> +   goto dealloc_host;
> +   }
> +
> +   return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 6/8] scsi: ufs: make the UFS variant a platform device

2015-08-30 Thread Yaniv Gardi
This change turns the UFS variant (SCSI_UFS_QCOM) into a UFS
a platform device.
In order to do so a few additional changes are required:
1. The ufshcd-pltfrm is no longer serves as a platform device.
   Now it only serves as a group of platform APIs such as PM APIs
   (runtime suspend/resume, system suspend/resume etc), parsers of
   clocks, regulators and pm_levels from DT.
2. What used to be the old platform "probe" is now "only"
   a pltfrm_init() routine, that does exactly the same, but only
   being called by the new probe function of the UFS variant.

Signed-off-by: Yaniv Gardi 

---
 Documentation/devicetree/bindings/ufs/ufs-qcom.txt | 57 ++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |  4 +-
 drivers/scsi/ufs/ufs-qcom.c| 78 +-
 drivers/scsi/ufs/ufshcd-pltfrm.c   | 92 ++
 drivers/scsi/ufs/ufshcd-pltfrm.h   | 41 ++
 drivers/scsi/ufs/ufshcd.c  | 10 +++
 drivers/scsi/ufs/ufshcd.h  |  1 +
 7 files changed, 211 insertions(+), 72 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-qcom.txt
 create mode 100644 drivers/scsi/ufs/ufshcd-pltfrm.h

diff --git a/Documentation/devicetree/bindings/ufs/ufs-qcom.txt 
b/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
new file mode 100644
index 000..452e4ef
--- /dev/null
+++ b/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
@@ -0,0 +1,57 @@
+* Qualcomm Technologies Inc Universal Flash Storage (UFS) PHY
+
+UFSPHY nodes are defined to describe on-chip UFS PHY hardware macro.
+Each UFS PHY node should have its own node.
+
+To bind UFS PHY with UFS host controller, the controller node should
+contain a phandle reference to UFS PHY node.
+
+Required properties:
+- compatible: compatible list, contains "qcom,ufs-phy-qmp-20nm"
+ or "qcom,ufs-phy-qmp-14nm" according to the relevant phy 
in use.
+- reg   : should contain PHY register address space (mandatory),
+- reg-names : indicates various resources passed to driver (via reg 
proptery) by name.
+  Required "reg-names" is "phy_mem".
+- #phy-cells: This property shall be set to 0
+- vdda-phy-supply   : phandle to main PHY supply for analog domain
+- vdda-pll-supply   : phandle to PHY PLL and Power-Gen block power supply
+- clocks   : List of phandle and clock specifier pairs
+- clock-names   : List of clock input name strings sorted in the same
+ order as the clocks property. "ref_clk_src", "ref_clk",
+ "tx_iface_clk" & "rx_iface_clk" are mandatory but
+ "ref_clk_parent" is optional
+
+Optional properties:
+- vdda-phy-max-microamp : specifies max. load that can be drawn from phy supply
+- vdda-pll-max-microamp : specifies max. load that can be drawn from pll supply
+- vddp-ref-clk-supply   : phandle to UFS device ref_clk pad power supply
+- vddp-ref-clk-max-microamp : specifies max. load that can be drawn from this 
supply
+- vddp-ref-clk-always-on : specifies if this supply needs to be kept always on
+
+Example:
+
+   ufsphy1: ufsphy@0xfc597000 {
+   compatible = "qcom,ufs-phy-qmp-20nm";
+   reg = <0xfc597000 0x800>;
+   reg-names = "phy_mem";
+   #phy-cells = <0>;
+   vdda-phy-supply = <&pma8084_l4>;
+   vdda-pll-supply = <&pma8084_l12>;
+   vdda-phy-max-microamp = <5>;
+   vdda-pll-max-microamp = <1000>;
+   clock-names = "ref_clk_src",
+   "ref_clk_parent",
+   "ref_clk",
+   "tx_iface_clk",
+   "rx_iface_clk";
+   clocks = <&clock_rpm clk_ln_bb_clk>,
+   <&clock_gcc clk_pcie_1_phy_ldo >,
+   <&clock_gcc clk_ufs_phy_ldo>,
+   <&clock_gcc clk_gcc_ufs_tx_cfg_clk>,
+   <&clock_gcc clk_gcc_ufs_rx_cfg_clk>;
+   };
+
+   ufshc@0xfc598000 {
+   ...
+   phys = <&ufsphy1>;
+   };
diff --git a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt 
b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
index 5357919..c0f10d3 100644
--- a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
+++ b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
@@ -4,7 +4,9 @@ UFSHC nodes are defined to describe on-chip UFS host 
controllers.
 Each UFS controller instance should have its own node.
 
 Required properties:
-- compatible: compatible list, contains "jedec,ufs-1.1"
+- compatible: compatible list, contains "jedec,ufs-1.1" or
+ "qcom,msm8994-ufshc" or "qcom,msm8996-ufshc"
+ followed by "qcom,ufshc"
 - interrupts: 
 - reg   : 
 
diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-