Skip to contentSkip to conversation

scsi: ufs-msm: add UFS controller support for Qualcomm MSM chips

PATCH [email protected] 1 participant 1 message Aug 22, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 10 lines
Quoted 10 lines · Yaniv Gardi
Quoted 9 lines

The files in this change implement the UFS HW (controller & PHY) specific behavior in Qualcomm MSM chips.

---

Documentation/devicetree/bindings/ufs/ufs-msm.txt  |   37 +
.../devicetree/bindings/ufs/ufshcd-pltfrm.txt      |    4 +
drivers/scsi/ufs/Kconfig                           |   12 +
drivers/scsi/ufs/Makefile                          |    4 +
drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.c            |  254 +++++
drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.h            |  216 ++++
drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.c            |  368 +++++++
drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.h            |  735

+++++++++++++

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/scsi/ufs/ufs-msm-phy.c | 646 ++++++++++++

drivers/scsi/ufs/ufs-msm-phy.h | 193 ++++

Quoted 5 lines
Quoted 1 line

Any reason not to put the phy driver in drivers/phy ?

Yes. Phy driver introduces a generic phy framework.
And as a framework it provides with API's, callbacks,
And data structures.
I think the right place to have the >implementation< of the ufs-msm-phy

code

Quoted 1 line

Is under drivers/scsi/ufs as it's more related to ufs than it's related

to

Quoted 1 line

the framework itself.

I would agree with Kumar that PHY specific platform driver (which uses the generic PHY framwork) can actually go under drivers/phy/*, if i look at the 3.17-rc1, there are many platform specific phy drivers under drivers/phy/.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/scsi/ufs/ufs-msm.c | 1105
++++++++++++++++++++
drivers/scsi/ufs/ufs-msm.h | 158 +++

12 files changed, 3732 insertions(+)

create mode 100644 Documentation/devicetree/bindings/ufs/ufs-msm.txt

create mode 100644 drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.c

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

create mode 100644 drivers/scsi/ufs/ufs-msm-phy-qmp-20nm.h create mode 100644 drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.c create mode 100644 drivers/scsi/ufs/ufs-msm-phy-qmp-28nm.h create mode 100644 drivers/scsi/ufs/ufs-msm-phy.c create mode 100644 drivers/scsi/ufs/ufs-msm-phy.h create mode 100644 drivers/scsi/ufs/ufs-msm.c create mode 100644 drivers/scsi/ufs/ufs-msm.h

Seems like we should spit this into two patches, one for the phy and

one

Quoted 1 line
Quoted 1 line

for the UFS driver itself. Maybe even three, one for the 20nm phy, one

for the 28nm phy, and one for ufs-msm.c,h.

Quoted 1 line

we could try to split it, but since we didn't split this change into

functional sub-changes, we decided to upload this change as a whole, as one change without the other wouldn't work anyhow, and they are both needed for proper functionality.

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/ufs/ufs-msm.txt

Quoted 5 lines
Quoted 5 lines

Documentation/devicetree/bindings/ufs/ufs-msm.txt

Quoted 4 lines

new file mode 100644
index 0000000..b5caace

Documentation/devicetree/bindings/ufs/ufs-msm.txt new file +0 -0

This should probably be bindings/phy/qcom-ufs-phy.txt

If Yaniv also agrees that Qualcomm UFS MSM PHY specific driver should move under drivers/phy then yes, "ufs-msm.txt" should also move under bindings/phy/.

Btw, regarding using "qcom-ufs-phy.txt" instead "ufs-msm.txt", i would agree that we need to add "phy" in file name but not sure we would like to replace "msm" with "qcom" because we used "msm" prefix/postfix almost everywhere.

Quoted 4 lines
Quoted 4 lines

Documentation/devicetree/bindings/ufs/ufs-msm.txt line 3

Quoted 4 lines
Documentation/devicetree/bindings/ufs/ufs-msm.txt new file +3 -0
@@ -0,0 +1,37 @@
+* MSM 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.

Quoted 2 lines
Quoted 2 lines

Documentation/devicetree/bindings/ufs/ufs-msm.txt line 5

Quoted 2 lines
Documentation/devicetree/bindings/ufs/ufs-msm.txt new file +2 -0
+
+To bind UFS PHY with UFS host controller, the controller node should

+contain a phandle reference to UFS PHY node.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/ufs/ufs-msm.txt new file +3 -0
+
+Required properties:
+- compatible        : compatible list, contains

"qcom,ufs-msm-phy-qmp-28nm"
+ or "qcom,ufs-msm-phy-qmp-20nm" according to the

relevant

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

+ phy in use

Do we really need ‘-msm’ in the compat name?

That's the convention we followed for all file names and hence carry forwarded to compatible name as well. Any specific issues with it?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+- reg               : <registers mapping>
+- #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

Quoted 3 lines
Quoted 3 lines

Documentation/devicetree/bindings/ufs/ufs-msm.txt

Quoted 3 lines
Documentation/devicetree/bindings/ufs/ufs-msm.txt new file +3 -0
+
+Optional properties:
+- vdda-phy-max-microamp : specifies max. load that can be drawn from

phy supply

Quoted 1 line
Quoted 1 line
Quoted 1 line

+- vdda-pll-max-microamp : specifies max. load that can be drawn from

pll supply

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/ufs/ufs-msm.txt new file +10 -0
+
+Example:
+
+	ufsphy1: ufsphy@0xfc597000 {
+		compatible = "qcom,ufs-msm-phy-qmp-28nm";
+		reg = <0xfc597000 0x800>;
+		#phy-cells = <0>;
+		vdda-phy-supply = <&pma8084_l4>;
+		vdda-pll-supply = <&pma8084_l12>;
+		vdda-phy-max-microamp = <50000>;
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
Documentation/devicetree/bindings/ufs/ufs-msm.txt new file +7 -0
+		vdda-pll-max-microamp = <1000>;
+	};
+
+	ufshc@0xfc598000 {
+		...
+		phys = <&ufsphy1>;
+	};
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

index e73a619..378585c 100644

Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +0 -1
@@ -9,6 +9,9 @@ Required properties:
- reg               : <registers mapping>

Optional properties:

+- phys			: phandle to UFS PHY node
+- phy-names		: the string "ufs_msm_phy" when is found in a node,

along

Quoted 2 lines
Quoted 2 lines

Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt

Quoted 1 line
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +1 -0
+			  with "phys" attribute, provides phandle to UFS PHY node

seems like the phy-names should be more generic like “ufsphy"

Agreed, in facts this "phy-names" property is no longer required. Yaniv, can you please remove this.

Quoted 1 line
Quoted 1 line
Quoted 1 line

- vcc-supply : phandle to VCC supply regulator node -

vccq-supply : phandle to VCCQ supply regulator node -
vccq2-supply : phandle to VCCQ2 supply regulator node @@
-39,6 +42,7 @@ Example:

Quoted 7 lines
Quoted 7 lines

drivers/scsi/ufs/Kconfig index

Quoted 7 lines
		reg = <0xfc598000 0x800>;
		interrupts = <0 28 0>;
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +1 -0
+		ufs-phy = <&ufsphy>;
		vcc-supply = <&xxx_reg1>;
		vcc-supply-1p8;
		vccq-supply = <&xxx_reg2>;
drivers/scsi/ufs/Kconfig index renamed from drivers/scsi/ufs/Kconfig +0 -0

6e07b2a..a8259e0 100644

Quoted 10 lines
Quoted 10 lines

drivers/scsi/ufs/Kconfig config SCSI_UFSHCD_PLATFORM · line 75

Quoted 9 lines
drivers/scsi/ufs/Kconfig +4 -0
@@ -70,3 +70,15 @@ config SCSI_UFSHCD_PLATFORM
 	If you have a controller with this interface, say Y or M here.
 	  If unsure, say N.
+
+config SCSI_UFS_MSM
+	bool "MSM specific hooks to UFS controller platform driver"
+	depends on SCSI_UFSHCD_PLATFORM && ARCH_MSM

This should probably be ARCH_QCOM instead of ARCH_MSM

ok. will check this. Thanks.

Quoted 2 lines
Quoted 2 lines

drivers/scsi/ufs/Kconfig config SCSI_UFSHCD_PLATFORM · line 77

Quoted 2 lines
drivers/scsi/ufs/Kconfig +2 -0
+	help
+	  This selects the MSM specific additions to UFSHCD platform driver.

+ UFS host on MSM needs some vendor specific configuration before +
accessing the hardware which includes PHY configuration and vendor + specific registers.

Quoted 11 lines
Quoted 9 lines

drivers/scsi/ufs/Kconfig config SCSI_UFSHCD_PLATFORM · line 80

Quoted 3 lines
drivers/scsi/ufs/Kconfig +3 -0
+
+	  Select this if you have UFS controller on MSM chipset.
+	  If unsure, say N.

[ snip ]
- k
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in

the body of a message to [email protected]

Quoted 1 line

More majordomo info at http://vger.kernel.org/majordomo-info.html