fixing building errors and warnings when components
Subsystems (5)
v2 cover fixing building errors and warnings when components
V2:
In this Version, comments from reviewers were addressed and also, added another change: PATCH v2 4/4
In this change we glue the variant attributes (vops, etc) at the time of the platform probing, so they can be used by the driver when it doing its initialization phase.
V1:
The following combination of components, when SCSI_UFS_QCOM=y and PHY_QCOM_UFS=m is illegal and causes build errors. The 3rd patch in the series enables the SCSI_UFS_QCOM component to be compiled as a module (by changing its configuration to tristate). So now, compiling SCSI_UFS_QCOM=m forces PHY_QCOM_UFS=m, and SCSI_UFS_QCOM=y forces PHY_QCOM_UFS=y.
In addition, when PHY_QCOM_UFS=m, external functions in phy-ufs-qcom.c should be exported. The 1st patch fixes it.
Another issue that we see when SCSI_UFS_QCOM=m is a warning that the 2nd patch fixes.
notice:
checkpatch gives an error on the commit message of patch 1/3 in the series. Ignore as the commit message is the build errors that this patch fixes.
Yaniv Gardi (4):
phy: qcom-ufs: fix build error when the component is built as a module
scsi: ufs-qcom: fix compilation warning if compiled as a module
scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component
scsi: ufs: probe and init of variant driver from the platform device
.../devicetree/bindings/ufs/ufshcd-pltfrm.txt | 8 ++++ drivers/phy/phy-qcom-ufs.c | 11 +++++ drivers/scsi/ufs/Kconfig | 2 +- drivers/scsi/ufs/ufs-qcom.c | 47 +++++++++++++++++++++- drivers/scsi/ufs/ufshcd-pltfrm.c | 33 +++++++++------ 5 files changed, 86 insertions(+), 15 deletions(-)
Signature · 4 lines
1.8.5.2 -- QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v2 1/4 phy: qcom-ufs: fix build error when the component is built as a module
Export the following functions in order to avoid build errors when the component PHY_QCOM_UFS is compiled as a module:
ERROR: "ufs_qcom_phy_disable_ref_clk" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_enable_ref_clk" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_is_pcs_ready" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_disable_iface_clk" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_start_serdes" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_calibrate_phy" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_enable_dev_ref_clk" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_set_tx_lane_enable" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_disable_dev_ref_clk" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_save_controller_version" [drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_enable_iface_clk" [drivers/scsi/ufs/ufs-qcom.ko] undefined! make[1]: *** [__modpost] Error 1
--- drivers/phy/phy-qcom-ufs.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/phy/phy-qcom-ufs.c +11 -0
@@ -432,6 +432,7 @@ out_disable_src: out:return ret; } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_enable_ref_clk); static int ufs_qcom_phy_disable_vreg(struct phy *phy,
@@ -474,6 +475,7 @@ void ufs_qcom_phy_disable_ref_clk(struct phy *generic_phy) phy->is_ref_clk_enabled = false; } } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_disable_ref_clk);#define UFS_REF_CLK_EN (1 << 5)
@@ -517,11 +519,13 @@ void ufs_qcom_phy_enable_dev_ref_clk(struct phy *generic_phy) {ufs_qcom_phy_dev_ref_clk_ctrl (generic_phy, true); } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_enable_dev_ref_clk);void ufs_qcom_phy_disable_dev_ref_clk (struct phy *generic_phy) {ufs_qcom_phy_dev_ref_clk_ctrl (generic_phy, false); } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_disable_dev_ref_clk);/* Turn ON M-PHY RMMI interface clocks */ int ufs_qcom_phy_enable_iface_clk (struct phy *generic_phy)
@@ -550,6 +554,7 @@ int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy) out:return ret; } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_enable_iface_clk);/* Turn OFF M-PHY RMMI interface clocks */ void ufs_qcom_phy_disable_iface_clk (struct phy *generic_phy)
@@ -562,6 +567,7 @@ void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy) phy->is_iface_clk_enabled = false; } } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_disable_iface_clk);int ufs_qcom_phy_start_serdes (struct phy *generic_phy) {
@@ -578,6 +584,7 @@ int ufs_qcom_phy_start_serdes(struct phy *generic_phy)return ret; } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_start_serdes);int ufs_qcom_phy_set_tx_lane_enable (struct phy *generic_phy,u32 tx_lanes) {
@@ -595,6 +602,7 @@ int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)return ret; } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_set_tx_lane_enable);void ufs_qcom_phy_save_controller_version (struct phy *generic_phy,u8 major,u16 minor,u16 step)
@@ -605,6 +613,7 @@ void ufs_qcom_phy_save_controller_version(struct phy *generic_phy, ufs_qcom_phy->host_ctrl_rev_minor = minor; ufs_qcom_phy->host_ctrl_rev_step = step; } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_save_controller_version);int ufs_qcom_phy_calibrate_phy (struct phy *generic_phy,bool is_rate_B) {
@@ -625,6 +634,7 @@ int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)return ret; } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_calibrate_phy);int ufs_qcom_phy_remove (struct phy *generic_phy,struct ufs_qcom_phy *ufs_qcom_phy)
@@ -662,6 +672,7 @@ int ufs_qcom_phy_is_pcs_ready(struct phy *generic_phy)return ufs_qcom_phy->phy_spec_ops->is_physical_coding_sublayer_ready (ufs_qcom_phy); } +EXPORT_SYMBOL_GPL (ufs_qcom_phy_is_pcs_ready);int ufs_qcom_phy_power_on (struct phy *generic_phy) {
Signature · 4 lines
1.8.5.2 -- QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v2 2/4 scsi: ufs-qcom: fix compilation warning if compiled as a module
In reply to Yaniv GardiThis change fixes a compilation warning that happens if SCSI_UFS_QCOM is compiled as a module.
Also this patch fixes an error happens when insmod the module:
"ufs_qcom: module license 'unspecified' taints kernel."
--- drivers/scsi/ufs/ufs-qcom.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufs-qcom.c +6 -1
@@ -885,12 +885,15 @@ out:#define ANDROID_BOOT_DEV_MAX 30static char android_boot_dev[ANDROID_BOOT_DEV_MAX ]; -static int get_android_boot_dev (char *str) + +#ifndef MODULE +static int __init get_android_boot_dev (char *str) {strlcpy (android_boot_dev, str,ANDROID_BOOT_DEV_MAX );return 1 ; }__setup ("androidboot.bootdevice=" , get_android_boot_dev); +#endif /** * ufs_qcom_init - bind phy with controller
@@ -1014,3 +1017,5 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { .resume = ufs_qcom_resume, };EXPORT_SYMBOL (ufs_hba_qcom_vops); + +MODULE_LICENSE ("GPL v2" );
Signature · 4 lines
1.8.5.2 -- QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v2 3/4 scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component
In reply to Yaniv GardiThis change is required in order to be able to build the component as a module.
--- drivers/scsi/ufs/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/Kconfig +1 -1
@@ -72,7 +72,7 @@ config SCSI_UFSHCD_PLATFORM If unsure, say N. config SCSI_UFS_QCOM - bool "QCOM specific hooks to UFS controller platform driver" + tristate "QCOM specific hooks to UFS controller platform driver" depends on SCSI_UFSHCD_PLATFORM && ARCH_QCOM select PHY_QCOM_UFS help
Signature · 4 lines
1.8.5.2 -- QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v2 4/4 scsi: ufs: probe and init of variant driver from the platform device
In reply to Yaniv GardiIt does so by adding the following changes:
1. Introducing SCSI_UFS_QCOM as a platform device. Its probe function registers a set of vops to its driver_data.
2. Adding an optional device tree sub-node, under SCSI_UFSHCD_PLATFORM. Now, the probe function of SCSI_UFSHCD_PLATFORM invokes the probe function of its sub-node (if it exists), by calling of_platform_populate(). It ensures that vops are set, and ready to be used, by the time the UFSHCD driver starts its initialization procedure.
--- .../devicetree/bindings/ufs/ufshcd-pltfrm.txt | 8 +++++ drivers/scsi/ufs/ufs-qcom.c | 40 ++++++++++++++++++++++ drivers/scsi/ufs/ufshcd-pltfrm.c | 33 +++++++++++------- 3 files changed, 68 insertions(+), 13 deletions(-)
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +8 -0
@@ -55,3 +55,11 @@ Example: clock-names = "core_clk", "ref_clk", "iface_clk"; freq-table-hz = <100000000 200000000>, <0 0>, <0 0>; }; + +This is an example to a variant sub-node of ufshc: + ufs_variant { + compatible = "qcom,ufs_variant"; + }; + +This sub-node holds various specific information that is not defined in the +standard and that may differ between platforms.
drivers/scsi/ufs/ufs-qcom.c +40 -0
@@ -1018,4 +1018,44 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { };EXPORT_SYMBOL (ufs_hba_qcom_vops); +/** +* ufs_qcom_probe - probe routine of the driver +* @pdev: pointer to Platform device handle +* +* Always return 0 +*/ +static int ufs_qcom_probe (struct platform_device *pdev) +{ +dev_set_drvdata (&pdev->dev, (void *)&ufs_hba_qcom_vops); +return 0 ; +} + +/** +* ufs_qcom_remove - set driver_data of the device to NULL +* @pdev: pointer to platform device handle +* +* Always return 0 +*/ +static int ufs_qcom_remove (struct platform_device *pdev) +{ +dev_set_drvdata (&pdev->dev,NULL ); +return 0 ; +} + +static const struct of_device_id ufs_qcom_of_match[] = { + { .compatible ="qcom,ufs_variant" }, + {}, +}; + +static struct platform_driver ufs_qcom_pltform = { + .probe = ufs_qcom_probe, + .remove = ufs_qcom_remove, + .driver = { + .name ="ufs_qcom" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (ufs_qcom_of_match), + }, +}; +module_platform_driver (ufs_qcom_pltform); +MODULE_LICENSE ("GPL v2" );
drivers/scsi/ufs/ufshcd-pltfrm.c +20 -13
@@ -36,22 +36,11 @@#include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/of.h> +#include <linux/of_platform.h> #include "ufshcd.h" static const struct of_device_id ufs_of_match[]; -static struct ufs_hba_variant_ops *get_variant_ops (struct device *dev) -{ -if (dev->of_node) { -const struct of_device_id *match; - - match =of_match_node (ufs_of_match, dev->of_node); -if (match) -return (struct ufs_hba_variant_ops *)match->data; - } - -return NULL ; -}static int ufshcd_parse_clock_info (struct ufs_hba *hba) {
@@ -300,6 +289,9 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev)struct resource *mem_res;int irq, err;struct device *dev = &pdev->dev; +struct device_node *node = pdev->dev.of_node; +struct device_node *ufs_variant_node; +struct platform_device *ufs_variant_pdev; mem_res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); mmio_base =devm_ioremap_resource (dev, mem_res);
@@ -321,7 +313,22 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); + + ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n" ); + }else { + ufs_variant_pdev =of_find_device_by_node (ufs_variant_node); + +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +dev_get_drvdata (&ufs_variant_pdev->dev); + } err =ufshcd_parse_clock_info (hba);if (err) {
Signature · 4 lines
1.8.5.2 -- QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
drivers/scsi/ufs/ufs-qcom.c
Quoted 4 lines · Yaniv Gardi
drivers/scsi/ufs/ufs-qcom.c +0
-0EXPORT_SYMBOL (ufs_hba_qcom_vops);
Nothing uses this export. It's still a (static) symbol that is not included in any header. I think this export serves no purpose. Am I missing something subtle here?
drivers/scsi/ufs/ufs-qcom.c static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { · line 1029
Quoted 9 lines
drivers/scsi/ufs/ufs-qcom.c +9
-0+/** +* ufs_qcom_probe - probe routine of the driver +* @pdev: pointer to Platform device handle +* +* Always return 0 +*/ +static int ufs_qcom_probe (struct platform_device *pdev) +{ +dev_set_drvdata (&pdev->dev, (void *)&ufs_hba_qcom_vops);
(Cast to void * should not be needed.)
Quoted 44 lines
drivers/scsi/ufs/ufs-qcom.c +30
-0+return 0 ; +} + +/** +* ufs_qcom_remove - set driver_data of the device to NULL +* @pdev: pointer to platform device handle +* +* Always return 0 +*/ +static int ufs_qcom_remove (struct platform_device *pdev) +{ +dev_set_drvdata (&pdev->dev,NULL ); +return 0 ; +} + +static const struct of_device_id ufs_qcom_of_match[] = { + { .compatible ="qcom,ufs_variant" }, + {}, +}; + +static struct platform_driver ufs_qcom_pltform = { + .probe = ufs_qcom_probe, + .remove = ufs_qcom_remove, + .driver = { + .name ="ufs_qcom" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (ufs_qcom_of_match), + }, +}; +module_platform_driver (ufs_qcom_pltform);drivers/scsi/ufs/ufshcd-pltfrm.c +8
-1+struct device_node *node = pdev->dev.of_node; +struct device_node *ufs_variant_node; +struct platform_device *ufs_variant_pdev; - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); +
drivers/scsi/ufs/ufshcd-pltfrm.c static int ufshcd_pltfrm_probe(struct platform_device *pdev) · line 330
Quoted 10 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +10
-0+ ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n" ); + }else { + ufs_variant_pdev =of_find_device_by_node (ufs_variant_node); + +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +dev_get_drvdata (&ufs_variant_pdev->dev);
(Another cast that I think is not needed.)
drivers/scsi/ufs/ufshcd-pltfrm.c
Quoted 1 line
drivers/scsi/ufs/ufshcd-pltfrm.c +1
-0+ }
If I scanned this correctly, the dev_set_drvdata() and dev_get_drvdata() pair adds an actual user of ufs_hba_qcom_vops. So that ends the obvious issue I think the code currently has. And I gladly defer to the scsi people to determine whether that is done the right way.
Thanks,
Paul Bolle
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 6 lines · Paul Bolle
drivers/scsi/ufs/ufs-qcom.c static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { · line 1029
Quoted 3 lines · Yaniv Gardi
drivers/scsi/ufs/ufs-qcom.c +3
-0+static int ufs_qcom_probe (struct platform_device *pdev) +{ +dev_set_drvdata (&pdev->dev, (void *)&ufs_hba_qcom_vops);(Cast to void * should not be needed.)
Only if ufs_hba_qcom_vops wasn't a _const_ struct ufs_hba_variant_ops, that is. Never mind.
Paul Bolle
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
In reply to Paul BolleQuoted 10 lines · Yaniv Gardi
drivers/scsi/ufs/ufs-qcom.c
Quoted 4 lines
drivers/scsi/ufs/ufs-qcom.c +0
-0EXPORT_SYMBOL (ufs_hba_qcom_vops);Nothing uses this export. It's still a (static) symbol that is not included in any header. I think this export serves no purpose. Am I missing something subtle here?
correct Paul. I will remove it.
Quoted 69 lines
drivers/scsi/ufs/ufs-qcom.c static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { · line 1029
Quoted 9 lines
drivers/scsi/ufs/ufs-qcom.c +9
-0+/** +* ufs_qcom_probe - probe routine of the driver +* @pdev: pointer to Platform device handle +* +* Always return 0 +*/ +static int ufs_qcom_probe (struct platform_device *pdev) +{ +dev_set_drvdata (&pdev->dev, (void *)&ufs_hba_qcom_vops);(Cast to void * should not be needed.)
Quoted 44 lines
drivers/scsi/ufs/ufs-qcom.c +30
-0+return 0 ; +} + +/** +* ufs_qcom_remove - set driver_data of the device to NULL +* @pdev: pointer to platform device handle +* +* Always return 0 +*/ +static int ufs_qcom_remove (struct platform_device *pdev) +{ +dev_set_drvdata (&pdev->dev,NULL ); +return 0 ; +} + +static const struct of_device_id ufs_qcom_of_match[] = { + { .compatible ="qcom,ufs_variant" }, + {}, +}; + +static struct platform_driver ufs_qcom_pltform = { + .probe = ufs_qcom_probe, + .remove = ufs_qcom_remove, + .driver = { + .name ="ufs_qcom" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (ufs_qcom_of_match), + }, +}; +module_platform_driver (ufs_qcom_pltform);drivers/scsi/ufs/ufshcd-pltfrm.c +8
-1+struct device_node *node = pdev->dev.of_node; +struct device_node *ufs_variant_node; +struct platform_device *ufs_variant_pdev; - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); +drivers/scsi/ufs/ufshcd-pltfrm.c static int ufshcd_pltfrm_probe(struct platform_device *pdev) · line 330
Quoted 10 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +10
-0+ ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n" ); + }else { + ufs_variant_pdev =of_find_device_by_node (ufs_variant_node); + +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +dev_get_drvdata (&ufs_variant_pdev->dev);(Another cast that I think is not needed.)
Quoted 7 lines
drivers/scsi/ufs/ufshcd-pltfrm.c
Quoted 1 line
drivers/scsi/ufs/ufshcd-pltfrm.c +1
-0+ }If I scanned this correctly, the
dev_set_drvdata()anddev_get_drvdata()pair adds an actual user ofufs_hba_qcom_vops. So that ends the obvious issue I think the code currently has. And I gladly defer to the scsi people to determine whether that is done the right way.
yes, you got it right.
these 2 routines use the vops structure, that binds the driver and the variant (in our case qcom)
thanks for your time, Paul
Quoted 10 lines
Thanks,
Paul Bolle
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
In reply to Paul BolleThanks Paul for the review and comments.
please see inline.
Quoted 10 lines · Yaniv Gardi
drivers/scsi/ufs/ufs-qcom.c
Quoted 4 lines
drivers/scsi/ufs/ufs-qcom.c +0
-0EXPORT_SYMBOL (ufs_hba_qcom_vops);Nothing uses this export. It's still a (static) symbol that is not included in any header. I think this export serves no purpose. Am I missing something subtle here?
you are correct. it will be removed.
Quoted 12 lines
drivers/scsi/ufs/ufs-qcom.c static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { · line 1029
Quoted 9 lines
drivers/scsi/ufs/ufs-qcom.c +9
-0+/** +* ufs_qcom_probe - probe routine of the driver +* @pdev: pointer to Platform device handle +* +* Always return 0 +*/ +static int ufs_qcom_probe (struct platform_device *pdev) +{ +dev_set_drvdata (&pdev->dev, (void *)&ufs_hba_qcom_vops);(Cast to void * should not be needed.)
when removing the cast there is compilation error:ufs-qcom.c: warning: passing argument 2 of ‘dev_set_drvdata’ discards ‘const’ qualifier from pointer target type
error, forbidden warning: ufs-qcom.c
Quoted 48 lines
Quoted 48 lines
drivers/scsi/ufs/ufs-qcom.c +30
-0+return 0 ; +} + +/** +* ufs_qcom_remove - set driver_data of the device to NULL +* @pdev: pointer to platform device handle +* +* Always return 0 +*/ +static int ufs_qcom_remove (struct platform_device *pdev) +{ +dev_set_drvdata (&pdev->dev,NULL ); +return 0 ; +} + +static const struct of_device_id ufs_qcom_of_match[] = { + { .compatible ="qcom,ufs_variant" }, + {}, +}; + +static struct platform_driver ufs_qcom_pltform = { + .probe = ufs_qcom_probe, + .remove = ufs_qcom_remove, + .driver = { + .name ="ufs_qcom" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (ufs_qcom_of_match), + }, +}; +module_platform_driver (ufs_qcom_pltform);drivers/scsi/ufs/ufshcd-pltfrm.c +12
-1+struct device_node *node = pdev->dev.of_node; +struct device_node *ufs_variant_node; +struct platform_device *ufs_variant_pdev; - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); + + ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n" );
Quoted 8 lines
drivers/scsi/ufs/ufshcd-pltfrm.c static int ufshcd_pltfrm_probe(struct platform_device *pdev) · line 330
Quoted 6 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +6
-0+ }else { + ufs_variant_pdev =of_find_device_by_node (ufs_variant_node); + +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +dev_get_drvdata (&ufs_variant_pdev->dev);(Another cast that I think is not needed.)
here you are right - this one can be removed and will be
Quoted 11 lines
drivers/scsi/ufs/ufshcd-pltfrm.c
Quoted 2 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +1
-0+ }If I scanned this correctly, the
dev_set_drvdata()anddev_get_drvdata()pair adds an actual user ofufs_hba_qcom_vops. So that ends the obvious issue I think the code currently has. And I gladly defer to the scsi people to determine whether that is done the right way.Thanks,
Quoted 7 lines
Paul Bolle
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
In reply to Yaniv GardiHi Yaniv,
2015-06-03 18:37 GMT+09:00 Yaniv Gardi <[email protected]>:
Quoted 11 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +6
-1@@ -321,7 +313,22 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); + + ufs_variant_node =of_get_next_available_child (node,NULL );
drivers/scsi/ufs/ufshcd-pltfrm.c static int ufshcd_pltfrm_probe(struct platform_device *pdev) · line 331
Quoted 10 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +10
-0+ +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n" ); + }else { + ufs_variant_pdev =of_find_device_by_node (ufs_variant_node); + +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +dev_get_drvdata (&ufs_variant_pdev->dev); + }
I have no strong objection to 'ufs_variant' sub-node. But why can't we simply add an of_device_id to ufs_of_match, like below:
static const struct of_device_id ufs_of_match[] = {
{ .compatible = "jedec,ufs-1.1"},
#if IS_ENABLED(SCSI_UFS_QCOM)
{ .compatible = "qcom,ufs", .data = &ufs_hba_qcom_vops },
#neidf
{},
};and get hba->vops by get_variant_ops()?
There is something similar indrivers/net/ethernet/freescale/fsl_pq_mdio.c
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 40 lines
Hi Yaniv,
2015-06-03 18:37 GMT+09:00 Yaniv Gardi <[email protected]>:
Quoted 20 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +11
-1@@ -321,7 +313,22 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); + + ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n"); + }else { + ufs_variant_pdev =
of_find_device_by_node(ufs_variant_node);drivers/scsi/ufs/ufshcd-pltfrm.c static int ufshcd_pltfrm_probe(struct platform_device *pdev) · line 331
Quoted 5 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +5
-0+ +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +dev_get_drvdata (&ufs_variant_pdev->dev); + }I have no strong objection to '
ufs_variant' sub-node. But why can't we simply add anof_device_idtoufs_of_match, like below:static const struct of_device_id ufs_of_match[] = { { .compatible = "jedec,ufs-1.1"}, #if IS_ENABLED(SCSI_UFS_QCOM) { .compatible = "qcom,ufs", .data = &ufs_hba_qcom_vops }, #neidf {}, };
Quoted 2 lines
and get
hba->vopsbyget_variant_ops()?
Hi Mita,
thanks for your comments.
The whole idea, of having a sub-node which includes all variant specific attributes is to separate the UFS Platform device component, from the need to know "qcom" or any other future variant.
I believe it keeps the code more modular, and clean - meaning - no #ifdef's and no need to include all variant attributes inside the driver DT node.
in that case, we simply have a DT node that is compatible to the Jdec standard, and sub-node to include variant info.
I hope you agree with this new design, since it provides a good answer to every future variant that will be added, without the need to change the platform file.
thanks for your time, Mita
please share your thoughts.
Quoted 7 lines
There is something similar in
drivers/net/ethernet/freescale/fsl_pq_mdio.c
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
2015-06-05 5:53 GMT+09:00 <[email protected]>:
Quoted 55 lines
Quoted 40 lines
Hi Yaniv,
2015-06-03 18:37 GMT+09:00 Yaniv Gardi <[email protected]>:
Quoted 20 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +11
-1@@ -321,7 +313,22 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); + + ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n"); + }else { + ufs_variant_pdev =
of_find_device_by_node(ufs_variant_node);drivers/scsi/ufs/ufshcd-pltfrm.c static int ufshcd_pltfrm_probe(struct platform_device *pdev) · line 331
Quoted 5 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +5
-0+ +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +dev_get_drvdata (&ufs_variant_pdev->dev); + }I have no strong objection to '
ufs_variant' sub-node. But why can't we simply add anof_device_idtoufs_of_match, like below:static const struct of_device_id ufs_of_match[] = { { .compatible = "jedec,ufs-1.1"}, #if IS_ENABLED(SCSI_UFS_QCOM) { .compatible = "qcom,ufs", .data = &ufs_hba_qcom_vops }, #neidf {}, };Quoted 2 lines
and get
hba->vopsbyget_variant_ops()?Hi Mita,
thanks for your comments.The whole idea, of having a sub-node which includes all variant specific attributes is to separate the UFS Platform device component, from the need to know "qcom" or any other future variant.
I believe it keeps the code more modular, and clean - meaning - no #ifdef's and no need to include all variant attributes inside the driver DT node.
in that case, we simply have a DT node that is compatible to the Jdec standard, and sub-node to include variant info.
Quoted 3 lines
I hope you agree with this new design, since it provides a good answer to every future variant that will be added, without the need to change the platform file.
Thanks for your explanation, I agree with it.
I found two problems in the current code, but both can be fixed relatively easily as described below:
1) If ufshcd-pltfrm driver is loaded before ufs-qcom driver, ufshcd_pltfrm_probe() can't find a ufs_variant device.
In order to trigger re-probing ufs device when ufs-qcom driver has been loaded, ufshcd_pltfrm_probe() should return -EPROBE_DEFER in case 'ufs_variant' sub-node exists and no hba->vops found.
2) Nothing prevents ufs-qcom module from being unloaded while the variant_ops is referenced by ufshcd-pltfrm.
It can be fixed by incrementing module refcount of ufs_variant module by __module_get(ufs_variant_pdev->dev.driver->owener) in ufshcd_pltfrm_probe(), and module_put() in ufshcd_pltfrm_remove() to descrement the refcount.
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 75 lines
2015-06-05 5:53 GMT+09:00 <[email protected]>:
Quoted 57 lines
Quoted 41 lines
Hi Yaniv,
2015-06-03 18:37 GMT+09:00 Yaniv Gardi <[email protected]>:
Quoted 24 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +11
-1@@ -321,7 +313,22 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); + + ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n"); + }else { + ufs_variant_pdev =
of_find_device_by_node(ufs_variant_node);drivers/scsi/ufs/ufshcd-pltfrm.c +4
-0+ +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +Quoted 2 lines
dev_get_drvdata(&ufs_variant_pdev->dev);
+ }I have no strong objection to '
ufs_variant' sub-node. But why can't we simply add anof_device_idtoufs_of_match, like below:static const struct of_device_id ufs_of_match[] = { { .compatible = "jedec,ufs-1.1"}, #if IS_ENABLED(SCSI_UFS_QCOM) { .compatible = "qcom,ufs", .data = &ufs_hba_qcom_vops }, #neidf {}, };Quoted 2 lines
and get
hba->vopsbyget_variant_ops()?Hi Mita,
thanks for your comments.The whole idea, of having a sub-node which includes all variant specific attributes is to separate the UFS Platform device component, from the need
to know "qcom" or any other future variant.
I believe it keeps the code more modular, and clean - meaning - no #ifdef's and no need to include all variant attributes inside the driver DT node.
in that case, we simply have a DT node that is compatible to the Jdec standard, and sub-node to include variant info.Quoted 4 lines
I hope you agree with this new design, since it provides a good answer to every future variant that will be added, without the need to change the
platform file.Thanks for your explanation, I agree with it.
I found two problems in the current code, but both can be fixed relatively easily as described below:
1) If ufshcd-pltfrm driver is loaded before ufs-qcom driver,
ufshcd_pltfrm_probe()can't find aufs_variantdevice.In order to trigger re-probing ufs device when ufs-qcom driver has been loaded,
ufshcd_pltfrm_probe()should return -EPROBE_DEFER in case 'ufs_variant' sub-node exists and nohba->vopsfound.
Quoted 8 lines
2) Nothing prevents ufs-qcom module from being unloaded while the
variant_opsis referenced by ufshcd-pltfrm.It can be fixed by incrementing module refcount of
ufs_variantmodule by__module_get(ufs_variant_pdev->dev.driver->owener)inufshcd_pltfrm_probe(), andmodule_put()inufshcd_pltfrm_remove()to descrement the refcount.
again, Mita, your comments are very appreciated.
1)
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens always), then the calling to of_platform_populate() which is added, guarantees that ufs-qcom probe will be called and finish, before ufshcd_pltfrm probe continues.
so ufs_variant device is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom probe will be called and finish before dealing with ufs_variant device in ufshcd_pltfrm probe.
2) you are right. the fix added as you suggested.
let us know your thoughts about the V3 once it's uploaded
thanks
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
2015-06-08 0:32 GMT+09:00 <[email protected]>:
Quoted 5 lines
1)
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens always), then the calling toof_platform_populate()which is added, guarantees that ufs-qcom probe will be called and finish, beforeufshcd_pltfrmprobe continues.
I'm worrying the case ufshcd_pltfrm_probe() is called when ufshcd-pltfrm module is installed but ufs-qcom module is _not_ installed yet, where ufshcd-pltfrm and ufs-qcom are both built as loadable modules.
In this case, of_platform_populate() in ufshcd_pltfrm_probe() doesn't invoke ufs-qcom probe, does it? So I suggested using deferred probe infrastructure by returning -EPROBE_DEFER.
Quoted 6 lines
so
ufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom probe will be called and finish before dealing withufs_variantdevice inufshcd_pltfrmprobe.2) you are right. the fix added as you suggested.
Thanks for fixing it. But a little more work is needed in v3, I'll leave a comment to v3.
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
In reply to [email protected]Quoted 86 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]> wrote:
Quoted 75 lines
2015-06-05 5:53 GMT+09:00 <[email protected]>:
Quoted 57 lines
Quoted 41 lines
Hi Yaniv,
2015-06-03 18:37 GMT+09:00 Yaniv Gardi <[email protected]>:
Quoted 24 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +11
-1@@ -321,7 +313,22 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); + + ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n"); + }else { + ufs_variant_pdev =
of_find_device_by_node(ufs_variant_node);drivers/scsi/ufs/ufshcd-pltfrm.c +4
-0+ +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +Quoted 2 lines
dev_get_drvdata(&ufs_variant_pdev->dev);
+ }I have no strong objection to '
ufs_variant' sub-node. But why can't we simply add anof_device_idtoufs_of_match, like below:static const struct of_device_id ufs_of_match[] = { { .compatible = "jedec,ufs-1.1"}, #if IS_ENABLED(SCSI_UFS_QCOM) { .compatible = "qcom,ufs", .data = &ufs_hba_qcom_vops }, #neidf {}, };Quoted 2 lines
and get
hba->vopsbyget_variant_ops()?Hi Mita,
thanks for your comments.The whole idea, of having a sub-node which includes all variant specific attributes is to separate the UFS Platform device component, from the need
to know "qcom" or any other future variant.
I believe it keeps the code more modular, and clean - meaning - no #ifdef's and no need to include all variant attributes inside the driver DT node.
in that case, we simply have a DT node that is compatible to the Jdec standard, and sub-node to include variant info.Quoted 4 lines
I hope you agree with this new design, since it provides a good answer to every future variant that will be added, without the need to change the
platform file.Thanks for your explanation, I agree with it.
I found two problems in the current code, but both can be fixed relatively easily as described below:
1) If ufshcd-pltfrm driver is loaded before ufs-qcom driver,
ufshcd_pltfrm_probe()can't find aufs_variantdevice.In order to trigger re-probing ufs device when ufs-qcom driver has been loaded,
ufshcd_pltfrm_probe()should return -EPROBE_DEFER in case 'ufs_variant' sub-node exists and nohba->vopsfound.Quoted 8 lines
2) Nothing prevents ufs-qcom module from being unloaded while the
variant_opsis referenced by ufshcd-pltfrm.It can be fixed by incrementing module refcount of
ufs_variantmodule by__module_get(ufs_variant_pdev->dev.driver->owener)inufshcd_pltfrm_probe(), andmodule_put()inufshcd_pltfrm_remove()to descrement the refcount.again, Mita, your comments are very appreciated.
Quoted 9 lines
1)
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens always), then the calling toof_platform_populate()which is added, guarantees that ufs-qcom probe will be called and finish, beforeufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom probe will be called and finish before dealing withufs_variantdevice inufshcd_pltfrmprobe.
This is due to the fact that you have 2 platform drivers. You should only have 1 (and 1 node). If you really think you need 2, then you should do like many other common *HCIs do and make the base UFS driver a set of library functions that drivers can use or call. Look at EHCI, AHCI, SDHCI, etc. for inspiration.
Rob
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 102 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]> wrote:
Quoted 89 lines
Quoted 78 lines
2015-06-05 5:53 GMT+09:00 <[email protected]>:
Quoted 60 lines
Quoted 42 lines
Hi Yaniv,
2015-06-03 18:37 GMT+09:00 Yaniv Gardi <[email protected]>:
Quoted 24 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +11
-1@@ -321,7 +313,22 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); + + ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n"); + }else { + ufs_variant_pdev =
of_find_device_by_node(ufs_variant_node);drivers/scsi/ufs/ufshcd-pltfrm.c +4
-0+ +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +Quoted 2 lines
dev_get_drvdata(&ufs_variant_pdev->dev);
+ }I have no strong objection to '
ufs_variant' sub-node. But why can't we
simply add anof_device_idtoufs_of_match, like below:static const struct of_device_id ufs_of_match[] = { { .compatible = "jedec,ufs-1.1"}, #if IS_ENABLED(SCSI_UFS_QCOM) { .compatible = "qcom,ufs", .data = &ufs_hba_qcom_vops }, #neidf {}, };Quoted 2 lines
and get
hba->vopsbyget_variant_ops()?Hi Mita,
thanks for your comments.The whole idea, of having a sub-node which includes all variant specific
attributes is to separate the UFS Platform device component, from the need
to know "qcom" or any other future variant.
I believe it keeps the code more modular, and clean - meaning - no #ifdef's and no need to include all variant attributes inside the driver
DT node.
in that case, we simply have a DT node that is compatible to the Jdec standard, and sub-node to include variant info.Quoted 4 lines
I hope you agree with this new design, since it provides a good answer to every future variant that will be added, without the need to change the
platform file.Thanks for your explanation, I agree with it.
I found two problems in the current code, but both can be fixed relatively easily as described below:
1) If ufshcd-pltfrm driver is loaded before ufs-qcom driver,
ufshcd_pltfrm_probe()can't find aufs_variantdevice.In order to trigger re-probing ufs device when ufs-qcom driver has been loaded,
ufshcd_pltfrm_probe()should return -EPROBE_DEFER in case 'ufs_variant' sub-node exists and nohba->vopsfound.Quoted 8 lines
2) Nothing prevents ufs-qcom module from being unloaded while the
variant_opsis referenced by ufshcd-pltfrm.It can be fixed by incrementing module refcount of
ufs_variantmodule by__module_get(ufs_variant_pdev->dev.driver->owener)inufshcd_pltfrm_probe(), andmodule_put()inufshcd_pltfrm_remove()to descrement the refcount.again, Mita, your comments are very appreciated.
Quoted 11 lines
1)
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens
always), then the calling toof_platform_populate()which is added, guarantees that ufs-qcom probe will be called and finish, beforeufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom probe will be called and finish before dealing withufs_variantdevice inufshcd_pltfrmprobe.
Quoted 5 lines
This is due to the fact that you have 2 platform drivers. You should only have 1 (and 1 node). If you really think you need 2, then you should do like many other common *HCIs do and make the base UFS driver a set of library functions that drivers can use or call. Look at EHCI, AHCI, SDHCI, etc. for inspiration.
Hi Rob,
We did look at SDHCI and decided to go with this design due to its simplicity and lack of library functions. Yaniv described the proper flow of probing and, as we understand things, it is guaranteed to work as designed.
Furthermore, the design of having a subcore in the dts is used in the Linux kernel. Please have a look at drivers/usb/dwc3 where - as an example
- both dwc3-msm and dwc3-exynox invoke the probing function in core.c (i.e. the shared underlying Synopsys USB dwc3 core) by calling of_platform_populate().
Do you see a benefit in the SDHCi implementation?
Quoted 7 lines
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 2 lines · Dov Levenglick
Quoted 2 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]…
Quoted 1 line
Quoted 1 line
2015-06-05 5:53 GMT+09:00 <[email protected]>:
[...]
Quoted 23 lines
Quoted 11 lines
Quoted 10 lines
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens
always), then the calling toof_platform_populate()which is added, guarantees that ufs-qcom probe will be called and finish, beforeufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom probe will be called and finish before dealing withufs_variantdevice inufshcd_pltfrmprobe.Quoted 5 lines
This is due to the fact that you have 2 platform drivers. You should only have 1 (and 1 node). If you really think you need 2, then you should do like many other common *HCIs do and make the base UFS driver a set of library functions that drivers can use or call. Look at EHCI, AHCI, SDHCI, etc. for inspiration.
Hi Rob,
We did look at SDHCI and decided to go with this design due to its simplicity and lack of library functions. Yaniv described the proper flow of probing and, as we understand things, it is guaranteed to work as designed.
Quoted 5 lines
Furthermore, the design of having a subcore in the dts is used in the Linux kernel. Please have a look at
drivers/usb/dwc3where - as an example
- both dwc3-msm and dwc3-exynox invoke the probing function incore.c(i.e. the shared underlying Synopsys USB dwc3 core) by callingof_platform_populate().
That binding has the same problem. Please don't propagate that. There is no point in a sub-node in this case.
Quoted 1 line
Do you see a benefit in the SDHCi implementation?
Yes, it does not let the kernel driver design dictate the hardware description.
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 41 lines
Quoted 2 lines · Dov Levenglick
Quoted 2 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
2015-06-05 5:53 GMT+09:00 <[email protected]>:
[...]
Quoted 24 lines
Quoted 11 lines
Quoted 10 lines
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens
always), then the calling toof_platform_populate()which is added, guarantees that ufs-qcom probe will be called and finish, beforeufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom probe will be called and finish before dealing withufs_variantdevice inufshcd_pltfrmprobe.Quoted 5 lines
This is due to the fact that you have 2 platform drivers. You should only have 1 (and 1 node). If you really think you need 2, then you should do like many other common *HCIs do and make the base UFS driver a set of library functions that drivers can use or call. Look at EHCI, AHCI, SDHCI, etc. for inspiration.
Hi Rob,
We did look at SDHCI and decided to go with this design due to its simplicity and lack of library functions. Yaniv described the proper flow
of probing and, as we understand things, it is guaranteed to work as designed.Quoted 6 lines
Furthermore, the design of having a subcore in the dts is used in the Linux kernel. Please have a look at
drivers/usb/dwc3where - as an example
- both dwc3-msm and dwc3-exynox invoke the probing function incore.c(i.e. the shared underlying Synopsys USB dwc3 core) by callingof_platform_populate().That binding has the same problem. Please don't propagate that. There is no point in a sub-node in this case.
Quoted 7 lines
Quoted 1 line
Do you see a benefit in the SDHCi implementation?
Yes, it does not let the kernel driver design dictate the hardware description.
Rob
Hi Rob,
We appear to be having a philosophical disagreement on the practicality of designing the ufshcd variant's implementation - in other words, we disagree on the proper design pattern to follow here.
If I understand correctly, you are concerned with a design pattern wherein a generic implementation is wrapped - at the device-tree level - in a variant implementation. The main reason for your concern is that you don't want the "kernel driver design dictate the hardware description".
We considered this point when we suggested our implementation (both before and after you raised it) and reached the conclusion that - while an important consideration - it should not be the prevailing one. I believe that you will agree once you read the reasoning. What guided us was the following:
1. Keep our change minimal.
2. Keep our patch in line with known design patterns in the kernel.
3. Have our patch extend the existing solution rather than reinvent it.
It is the 3rd point that is most important to this discussion, since UFS has already been deployed by various vendors and is used by OEM. Changing ufshcd to a set of library functions that would be called by variants would necessarily introduce a significant change to the code flow in many places and would pose a backward compatibility issue. By using the tried and tested pattern of subnodes in the dts we were able to keep the change simple, succinct, understandable, maintainable and backward compatible. In fact, the entire logic tying of the generic implementation to the variant takes ~20 lines of code - both short and elegant.
As to your concern, while I understand it and understand the underlying logic, I don't think that it should outweigh the other considerations that I outlined here.
Dov
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 67 lines · Dov Levenglick
Quoted 41 lines
Quoted 2 lines · Dov Levenglick
Quoted 2 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
2015-06-05 5:53 GMT+09:00 <[email protected]>:
[...]
Quoted 24 lines
Quoted 11 lines
Quoted 10 lines
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens
always), then the calling toof_platform_populate()which is added, guarantees that ufs-qcom probe will be called and finish, beforeufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom probe will be called and finish before dealing withufs_variantdevice inufshcd_pltfrmprobe.Quoted 5 lines
This is due to the fact that you have 2 platform drivers. You should only have 1 (and 1 node). If you really think you need 2, then you should do like many other common *HCIs do and make the base UFS driver a set of library functions that drivers can use or call. Look at EHCI, AHCI, SDHCI, etc. for inspiration.
Hi Rob,
We did look at SDHCI and decided to go with this design due to its simplicity and lack of library functions. Yaniv described the proper flow
of probing and, as we understand things, it is guaranteed to work as designed.Quoted 6 lines
Furthermore, the design of having a subcore in the dts is used in the Linux kernel. Please have a look at
drivers/usb/dwc3where - as an example
- both dwc3-msm and dwc3-exynox invoke the probing function incore.c(i.e. the shared underlying Synopsys USB dwc3 core) by callingof_platform_populate().That binding has the same problem. Please don't propagate that. There is no point in a sub-node in this case.
Quoted 7 lines
Quoted 1 line
Do you see a benefit in the SDHCi implementation?
Yes, it does not let the kernel driver design dictate the hardware description.
Rob
Hi Rob,
We appear to be having a philosophical disagreement on the practicality of designing the ufshcd variant's implementation - in other words, we disagree on the proper design pattern to follow here.
If I understand correctly, you are concerned with a design pattern wherein a generic implementation is wrapped - at the device-tree level - in a variant implementation. The main reason for your concern is that you don't want the "kernel driver design dictate the hardware description".We considered this point when we suggested our implementation (both before and after you raised it) and reached the conclusion that - while an important consideration - it should not be the prevailing one. I believe that you will agree once you read the reasoning. What guided us was the following:
1. Keep our change minimal.
2. Keep our patch in line with known design patterns in the kernel.
3. Have our patch extend the existing solution rather than reinvent it.
Quoted 9 lines
It is the 3rd point that is most important to this discussion, since UFS has already been deployed by various vendors and is used by OEM. Changing ufshcd to a set of library functions that would be called by variants would necessarily introduce a significant change to the code flow in many places and would pose a backward compatibility issue. By using the tried and tested pattern of subnodes in the dts we were able to keep the change simple, succinct, understandable, maintainable and backward compatible. In fact, the entire logic tying of the generic implementation to the variant takes ~20 lines of code - both short and elegant.
The DWC3 binding does this and nothing else that I'm aware of. This hardly makes for a common pattern. If you really want to split this to 2 devices, you can create platform devices without having a DT node.
If you want to convince me this is the right approach for the binding then you need to convince me the h/w is actually split this way and there is functionality separate from the licensed IP.
Rob
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 96 lines
Quoted 75 lines · Dov Levenglick
Quoted 45 lines
Quoted 2 lines · Dov Levenglick
Quoted 2 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
2015-06-05 5:53 GMT+09:00 <[email protected]>:
[...]
Quoted 28 lines
Quoted 13 lines
Quoted 4 lines
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens
always), then the calling toof_platform_populate()which is added, guarantees that ufs-qcom probe will be called and finish, beforeQuoted 8 lines
ufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom
probe will be called and finish before dealing withufs_variantdevice
inufshcd_pltfrmprobe.Quoted 7 lines
This is due to the fact that you have 2 platform drivers. You should only have 1 (and 1 node). If you really think you need 2, then you should do like many other common *HCIs do and make the base UFS driver
a set of library functions that drivers can use or call. Look at EHCI,
AHCI, SDHCI, etc. for inspiration.Hi Rob,
We did look at SDHCI and decided to go with this design due to its simplicity and lack of library functions. Yaniv described the proper flow
of probing and, as we understand things, it is guaranteed to work as designed.Quoted 6 lines
Furthermore, the design of having a subcore in the dts is used in the Linux kernel. Please have a look at
drivers/usb/dwc3where - as an example
- both dwc3-msm and dwc3-exynox invoke the probing function incore.c(i.e. the shared underlying Synopsys USB dwc3 core) by callingof_platform_populate().That binding has the same problem. Please don't propagate that. There is no point in a sub-node in this case.
Quoted 7 lines
Quoted 1 line
Do you see a benefit in the SDHCi implementation?
Yes, it does not let the kernel driver design dictate the hardware description.
Rob
Hi Rob,
We appear to be having a philosophical disagreement on the practicality of
designing the ufshcd variant's implementation - in other words, we disagree on the proper design pattern to follow here.
If I understand correctly, you are concerned with a design pattern wherein
a generic implementation is wrapped - at the device-tree level - in a variant implementation. The main reason for your concern is that you don't
want the "kernel driver design dictate the hardware description".We considered this point when we suggested our implementation (both before
and after you raised it) and reached the conclusion that - while an important consideration - it should not be the prevailing one. I believe that you will agree once you read the reasoning. What guided us was the following:
1. Keep our change minimal.
2. Keep our patch in line with known design patterns in the kernel.
3. Have our patch extend the existing solution rather than reinvent it.Quoted 14 lines
It is the 3rd point that is most important to this discussion, since UFS has already been deployed by various vendors and is used by OEM. Changing
ufshcd to a set of library functions that would be called by variants would necessarily introduce a significant change to the code flow in many
places and would pose a backward compatibility issue. By using the tried and tested pattern of subnodes in the dts we were able to keep the change
simple, succinct, understandable, maintainable and backward compatible. In
fact, the entire logic tying of the generic implementation to the variant
takes ~20 lines of code - both short and elegant.The DWC3 binding does this and nothing else that I'm aware of. This hardly makes for a common pattern. If you really want to split this to 2 devices, you can create platform devices without having a DT node.
Quoted 6 lines
If you want to convince me this is the right approach for the binding then you need to convince me the h/w is actually split this way and there is functionality separate from the licensed IP.
Rob
I don't understand the challenge that you just posed. It is clear from our implementation that there is the standard and variants thereof. I know this to be a fact on the processors that we are working on.
Furthermore, although I didn't check each and every result in the search, of_platform_populate is used in more locations than dwc3 and at least a few of them seem have be using the same paradigm as ours
(http://lxr.free-electrons.com/ident?i=of_platform_populate).
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 103 lines · Dov Levenglick
Quoted 96 lines
Quoted 75 lines · Dov Levenglick
Quoted 45 lines
Quoted 2 lines · Dov Levenglick
Quoted 2 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
2015-06-05 5:53 GMT+09:00 <[email protected]>:
[...]
Quoted 28 lines
Quoted 13 lines
Quoted 4 lines
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens
always), then the calling toof_platform_populate()which is added, guarantees that ufs-qcom probe will be called and finish, beforeQuoted 8 lines
ufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom
probe will be called and finish before dealing withufs_variantdevice
inufshcd_pltfrmprobe.Quoted 7 lines
This is due to the fact that you have 2 platform drivers. You should only have 1 (and 1 node). If you really think you need 2, then you should do like many other common *HCIs do and make the base UFS driver
a set of library functions that drivers can use or call. Look at EHCI,
AHCI, SDHCI, etc. for inspiration.Hi Rob,
We did look at SDHCI and decided to go with this design due to its simplicity and lack of library functions. Yaniv described the proper flow
of probing and, as we understand things, it is guaranteed to work as designed.Quoted 6 lines
Furthermore, the design of having a subcore in the dts is used in the Linux kernel. Please have a look at
drivers/usb/dwc3where - as an example
- both dwc3-msm and dwc3-exynox invoke the probing function incore.c(i.e. the shared underlying Synopsys USB dwc3 core) by callingof_platform_populate().That binding has the same problem. Please don't propagate that. There is no point in a sub-node in this case.
Quoted 7 lines
Quoted 1 line
Do you see a benefit in the SDHCi implementation?
Yes, it does not let the kernel driver design dictate the hardware description.
Rob
Hi Rob,
We appear to be having a philosophical disagreement on the practicality of
designing the ufshcd variant's implementation - in other words, we disagree on the proper design pattern to follow here.
If I understand correctly, you are concerned with a design pattern wherein
a generic implementation is wrapped - at the device-tree level - in a variant implementation. The main reason for your concern is that you don't
want the "kernel driver design dictate the hardware description".We considered this point when we suggested our implementation (both before
and after you raised it) and reached the conclusion that - while an important consideration - it should not be the prevailing one. I believe that you will agree once you read the reasoning. What guided us was the following:
1. Keep our change minimal.
2. Keep our patch in line with known design patterns in the kernel.
3. Have our patch extend the existing solution rather than reinvent it.Quoted 14 lines
It is the 3rd point that is most important to this discussion, since UFS has already been deployed by various vendors and is used by OEM. Changing
ufshcd to a set of library functions that would be called by variants would necessarily introduce a significant change to the code flow in many
places and would pose a backward compatibility issue. By using the tried and tested pattern of subnodes in the dts we were able to keep the change
simple, succinct, understandable, maintainable and backward compatible. In
fact, the entire logic tying of the generic implementation to the variant
takes ~20 lines of code - both short and elegant.The DWC3 binding does this and nothing else that I'm aware of. This hardly makes for a common pattern. If you really want to split this to 2 devices, you can create platform devices without having a DT node.
Quoted 6 lines
If you want to convince me this is the right approach for the binding then you need to convince me the h/w is actually split this way and there is functionality separate from the licensed IP.
Rob
Quoted 8 lines
I don't understand the challenge that you just posed. It is clear from our implementation that there is the standard and variants thereof. I know this to be a fact on the processors that we are working on.
Furthermore, although I didn't check each and every result in the search,
of_platform_populateis used in more locations than dwc3 and at least a few of them seem have be using the same paradigm as ours
(http://lxr.free-electrons.com/ident?i=of_platform_populate).
You can ignore everything under arch/ as those are root level calls. Most of the rest of the list are devices which have multiple unrelated functions such as PMICs or system controllers which are perfectly valid uses of of_platform_populate. That leaves at most 10 examples that may or may not have good bindings. 10 out of hundreds of drivers in the kernel hardly makes for a pattern to follow.
Let me be perfectly clear on the binding as is: NAK. I'm done replying until you propose something different.
Rob
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Hi James,
Rob raises a point that we don't agree with. On the other hand, we are not capable of convincing him in the validity of our approach - we are at an impasse.
I would like to point out that our approach was reviewed by Paul and Mita (external reviewers) and neither of them had the objection that Rob has. I urge you to go over this thread, where both sides raised points and argued their cases. We are going to need your call on this so that we can move forward.
Thanks,
Dov
Quoted 134 lines
Quoted 119 lines · Dov Levenglick
Quoted 107 lines
Quoted 92 lines · Dov Levenglick
Quoted 49 lines
Quoted 2 lines · Dov Levenglick
Quoted 2 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
2015-06-05 5:53 GMT+09:00 <[email protected]>:
[...]
Quoted 30 lines
Quoted 14 lines
Quoted 5 lines
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens
always), then the calling toof_platform_populate()which is added,
guarantees that ufs-qcom probe will be called and finish, beforeQuoted 8 lines
ufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom
probe will be called and finish before dealing withufs_variantdevice
inufshcd_pltfrmprobe.Quoted 8 lines
This is due to the fact that you have 2 platform drivers. You should
only have 1 (and 1 node). If you really think you need 2, then you should do like many other common *HCIs do and make the base UFS driver
a set of library functions that drivers can use or call. Look at EHCI,
AHCI, SDHCI, etc. for inspiration.Hi Rob,
We did look at SDHCI and decided to go with this design due to its simplicity and lack of library functions. Yaniv described the proper flow
of probing and, as we understand things, it is guaranteed to work as designed.Quoted 8 lines
Furthermore, the design of having a subcore in the dts is used in the
Linux kernel. Please have a look atdrivers/usb/dwc3where - as an example
- both dwc3-msm and dwc3-exynox invoke the probing function incore.c
(i.e. the shared underlying Synopsys USB dwc3 core) by callingof_platform_populate().That binding has the same problem. Please don't propagate that. There is no point in a sub-node in this case.
Quoted 7 lines
Quoted 1 line
Do you see a benefit in the SDHCi implementation?
Yes, it does not let the kernel driver design dictate the hardware description.
Rob
Hi Rob,
We appear to be having a philosophical disagreement on the practicality
of
designing the ufshcd variant's implementation - in other words, we disagree on the proper design pattern to follow here.
If I understand correctly, you are concerned with a design pattern wherein
a generic implementation is wrapped - at the device-tree level - in a variant implementation. The main reason for your concern is that you don't
want the "kernel driver design dictate the hardware description".We considered this point when we suggested our implementation (both before
and after you raised it) and reached the conclusion that - while an important consideration - it should not be the prevailing one. I believe
that you will agree once you read the reasoning. What guided us was the
following:
1. Keep our change minimal.
2. Keep our patch in line with known design patterns in the kernel.
3. Have our patch extend the existing solution rather than reinvent it.It is the 3rd point that is most important to this discussion, since UFS
has already been deployed by various vendors and is used by OEM. Changing
ufshcd to a set of library functions that would be called by variants would necessarily introduce a significant change to the code flow in many
places and would pose a backward compatibility issue. By using the triedQuoted 8 lines
and tested pattern of subnodes in the dts we were able to keep the change
simple, succinct, understandable, maintainable and backward compatible.
In
fact, the entire logic tying of the generic implementation to the variant
takes ~20 lines of code - both short and elegant.The DWC3 binding does this and nothing else that I'm aware of. This hardly makes for a common pattern. If you really want to split this to 2 devices, you can create platform devices without having a DT node.
Quoted 6 lines
If you want to convince me this is the right approach for the binding then you need to convince me the h/w is actually split this way and there is functionality separate from the licensed IP.
Rob
I don't understand the challenge that you just posed. It is clear from our
implementation that there is the standard and variants thereof. I know this to be a fact on the processors that we are working on.Quoted 5 lines
Furthermore, although I didn't check each and every result in the search,
of_platform_populateis used in more locations than dwc3 and at least a few of them seem have be using the same paradigm as ours
(http://lxr.free-electrons.com/ident?i=of_platform_populate).You can ignore everything under
arch/as those are root level calls. Most of the rest of the list are devices which have multiple unrelated functions such as PMICs or system controllers which are perfectly valid uses ofof_platform_populate. That leaves at most 10 examples that may or may not have good bindings. 10 out of hundreds of drivers in the kernel hardly makes for a pattern to follow.
Quoted 9 lines
Let me be perfectly clear on the binding as is: NAK. I'm done replying until you propose something different.
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
James Bottomley
maintainerRe: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 9 lines · Dov Levenglick
Hi James,
Rob raises a point that we don't agree with. On the other hand, we are not capable of convincing him in the validity of our approach - we are at an impasse.
I would like to point out that our approach was reviewed by Paul and Mita (external reviewers) and neither of them had the objection that Rob has. I urge you to go over this thread, where both sides raised points and argued their cases. We are going to need your call on this so that we can move forward.
The dispute is about device tree bindings. While I could override a NAK in the subsystem I maintain, I'm not going to when it comes from the maintainer of the device tree subsystem on a subject that's his province of expertise, not mine.
Please agree on what the bindings should look like and then resubmit the driver.
James
Quoted 158 lines
Thanks,
DovQuoted 134 lines
Quoted 119 lines · Dov Levenglick
Quoted 107 lines
Quoted 92 lines · Dov Levenglick
Quoted 49 lines
Quoted 2 lines · Dov Levenglick
Quoted 2 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
2015-06-05 5:53 GMT+09:00 <[email protected]>:
[...]
Quoted 30 lines
Quoted 14 lines
Quoted 5 lines
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens
always), then the calling toof_platform_populate()which is added,
guarantees that ufs-qcom probe will be called and finish, beforeQuoted 8 lines
ufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom
probe will be called and finish before dealing withufs_variantdevice
inufshcd_pltfrmprobe.Quoted 8 lines
This is due to the fact that you have 2 platform drivers. You should
only have 1 (and 1 node). If you really think you need 2, then you should do like many other common *HCIs do and make the base UFS driver
a set of library functions that drivers can use or call. Look at EHCI,
AHCI, SDHCI, etc. for inspiration.Hi Rob,
We did look at SDHCI and decided to go with this design due to its simplicity and lack of library functions. Yaniv described the proper flow
of probing and, as we understand things, it is guaranteed to work as designed.Quoted 8 lines
Furthermore, the design of having a subcore in the dts is used in the
Linux kernel. Please have a look atdrivers/usb/dwc3where - as an example
- both dwc3-msm and dwc3-exynox invoke the probing function incore.c
(i.e. the shared underlying Synopsys USB dwc3 core) by callingof_platform_populate().That binding has the same problem. Please don't propagate that. There is no point in a sub-node in this case.
Quoted 7 lines
Quoted 1 line
Do you see a benefit in the SDHCi implementation?
Yes, it does not let the kernel driver design dictate the hardware description.
Rob
Hi Rob,
We appear to be having a philosophical disagreement on the practicality
of
designing the ufshcd variant's implementation - in other words, we disagree on the proper design pattern to follow here.
If I understand correctly, you are concerned with a design pattern wherein
a generic implementation is wrapped - at the device-tree level - in a variant implementation. The main reason for your concern is that you don't
want the "kernel driver design dictate the hardware description".We considered this point when we suggested our implementation (both before
and after you raised it) and reached the conclusion that - while an important consideration - it should not be the prevailing one. I believe
that you will agree once you read the reasoning. What guided us was the
following:
1. Keep our change minimal.
2. Keep our patch in line with known design patterns in the kernel.
3. Have our patch extend the existing solution rather than reinvent it.It is the 3rd point that is most important to this discussion, since UFS
has already been deployed by various vendors and is used by OEM. Changing
ufshcd to a set of library functions that would be called by variants would necessarily introduce a significant change to the code flow in many
places and would pose a backward compatibility issue. By using the triedQuoted 8 lines
and tested pattern of subnodes in the dts we were able to keep the change
simple, succinct, understandable, maintainable and backward compatible.
In
fact, the entire logic tying of the generic implementation to the variant
takes ~20 lines of code - both short and elegant.The DWC3 binding does this and nothing else that I'm aware of. This hardly makes for a common pattern. If you really want to split this to 2 devices, you can create platform devices without having a DT node.
Quoted 6 lines
If you want to convince me this is the right approach for the binding then you need to convince me the h/w is actually split this way and there is functionality separate from the licensed IP.
Rob
I don't understand the challenge that you just posed. It is clear from our
implementation that there is the standard and variants thereof. I know this to be a fact on the processors that we are working on.Quoted 5 lines
Furthermore, although I didn't check each and every result in the search,
of_platform_populateis used in more locations than dwc3 and at least a few of them seem have be using the same paradigm as ours
(http://lxr.free-electrons.com/ident?i=of_platform_populate).You can ignore everything under
arch/as those are root level calls. Most of the rest of the list are devices which have multiple unrelated functions such as PMICs or system controllers which are perfectly valid uses ofof_platform_populate. That leaves at most 10 examples that may or may not have good bindings. 10 out of hundreds of drivers in the kernel hardly makes for a pattern to follow.Quoted 9 lines
Let me be perfectly clear on the binding as is: NAK. I'm done replying until you propose something different.
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Quoted 19 lines · Dov Levenglick
Quoted 4 lines
Hi James,
Rob raises a point that we don't agree with. On the other hand, we are not
capable of convincing him in the validity of our approach - we are at anQuoted 8 lines
impasse.
I would like to point out that our approach was reviewed by Paul and Mita
(external reviewers) and neither of them had the objection that Rob has. I urge you to go over this thread, where both sides raised points and argued their cases. We are going to need your call on this so that we can
move forward.The dispute is about device tree bindings. While I could override a NAK in the subsystem I maintain, I'm not going to when it comes from the maintainer of the device tree subsystem on a subject that's his province of expertise, not mine.
Quoted 5 lines
Please agree on what the bindings should look like and then resubmit the driver.
James
Hi James & Rob,
Until this point I thought that this was a disagreement within the confines of the scsi list. I was not aware of Rob's position as a maintainer of the device tree subsystem.
We will take this offline with Rob and come back with a solution that works for everyone.
Thanks,
Dov
Quoted 176 lines
Quoted 176 lines
Thanks,
DovQuoted 3 lines
Quoted 1 line · Dov Levenglick
Quoted 1 line
On Wed, Jun 17, 2015 at 2:42 AM, Dov Levenglick
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 2 lines · Dov Levenglick
Quoted 2 lines · On Sun, Jun 7, 2015 at 10:32 AM, <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
2015-06-05 5:53 GMT+09:00 <[email protected]>:
[...]
Quoted 1 line
Quoted 1 line
Quoted 1 line
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what
actually
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
happens
always), then the calling toof_platform_populate()which is added,
guarantees that ufs-qcom probe will be called and finish,before
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
ufshcd_pltfrmprobe continues.
soufs_variantdevice is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom
probe will be called and finish before dealing withufs_variantdevice
inufshcd_pltfrmprobe.Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
This is due to the fact that you have 2 platform drivers. You should
only have 1 (and 1 node). If you really think you need 2, thenyou
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
should do like many other common *HCIs do and make the base UFS driver
a set of library functions that drivers can use or call. Look at EHCI,
AHCI, SDHCI, etc. for inspiration.Hi Rob,
We did look at SDHCI and decided to go with this design due toits
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
simplicity and lack of library functions. Yaniv described the proper
flow
of probing and, as we understand things, it is guaranteed to work as
designed.Furthermore, the design of having a subcore in the dts is used in the
Linux kernel. Please have a look atdrivers/usb/dwc3where - asan
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 5 lines
example
- both dwc3-msm and dwc3-exynox invoke the probing function incore.c
(i.e. the shared underlying Synopsys USB dwc3 core) by callingof_platform_populate().That binding has the same problem. Please don't propagate that. There
is no point in a sub-node in this case.Quoted 1 line
Do you see a benefit in the SDHCi implementation?
Yes, it does not let the kernel driver design dictate the hardware description.
Rob
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Hi Rob,
We appear to be having a philosophical disagreement on the practicality
of
designing the ufshcd variant's implementation - in other words, we disagree on the proper design pattern to follow here.
If I understand correctly, you are concerned with a design pattern wherein
a generic implementation is wrapped - at the device-tree level - ina
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
variant implementation. The main reason for your concern is that
you
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
don't
want the "kernel driver design dictate the hardware description".We considered this point when we suggested our implementation (both before
and after you raised it) and reached the conclusion that - while an important consideration - it should not be the prevailing one. I believe
that you will agree once you read the reasoning. What guided us was the
following:
1. Keep our change minimal.
2. Keep our patch in line with known design patterns in the kernel.
3. Have our patch extend the existing solution rather than reinvent it.Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
It is the 3rd point that is most important to this discussion,
since
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
UFS
has already been deployed by various vendors and is used by OEM. Changing
ufshcd to a set of library functions that would be called byvariants
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
would necessarily introduce a significant change to the code flow
in
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
many
places and would pose a backward compatibility issue. By using the tried
and tested pattern of subnodes in the dts we were able to keep the change
simple, succinct, understandable, maintainable and backward compatible.
In
fact, the entire logic tying of the generic implementation to the variant
takes ~20 lines of code - both short and elegant.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
The DWC3 binding does this and nothing else that I'm aware of. This hardly makes for a common pattern. If you really want to split this
to
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
2 devices, you can create platform devices without having a DT node.
If you want to convince me this is the right approach for the
binding
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
then you need to convince me the h/w is actually split this way and there is functionality separate from the licensed IP.
Rob
I don't understand the challenge that you just posed. It is clear
from
Quoted 2 lines
Quoted 2 lines
our
implementation that there is the standard and variants thereof. Iknow
Quoted 5 lines
Quoted 5 lines
this to be a fact on the processors that we are working on.
Furthermore, although I didn't check each and every result in the search,
of_platform_populateis used in more locations than dwc3 and at leasta
Quoted 10 lines
Quoted 2 lines
few of them seem have be using the same paradigm as ours
(http://lxr.free-electrons.com/ident?i=of_platform_populate).You can ignore everything under
arch/as those are root level calls. Most of the rest of the list are devices which have multiple unrelated functions such as PMICs or system controllers which are perfectly valid uses ofof_platform_populate. That leaves at most 10 examples that may or may not have good bindings. 10 out of hundreds of drivers in the kernel hardly makes for a pattern to follow.Quoted 6 lines
Let me be perfectly clear on the binding as is: NAK. I'm done replying until you propose something different.
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi"in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlQUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Quoted 9 lines
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
In reply to Akinobu MitaQuoted 19 lines · Akinobu Mita
Hi Yaniv,
2015-06-03 18:37 GMT+09:00 Yaniv Gardi <[email protected]>:
Quoted 16 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +11
-1@@ -321,7 +313,22 @@ static int ufshcd_pltfrm_probe(struct platform_device *pdev) goto out; } - hba->vops =get_variant_ops (&pdev->dev); + err =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (err) +dev_err (&pdev->dev, +"%s: of_platform_populate() failed\n" , __func__); + + ufs_variant_node =of_get_next_available_child (node,NULL ); + +if (!ufs_variant_node) { +dev_dbg (&pdev->dev,"failed to find ufs_variant_node child\n" ); + }else { + ufs_variant_pdev =of_find_device_by_node (ufs_variant_node);
Quoted 8 lines
drivers/scsi/ufs/ufshcd-pltfrm.c static int ufshcd_pltfrm_probe(struct platform_device *pdev) · line 331
Quoted 5 lines
drivers/scsi/ufs/ufshcd-pltfrm.c +5
-0+ +if (ufs_variant_pdev) + hba->vops = (struct ufs_hba_variant_ops *) +dev_get_drvdata (&ufs_variant_pdev->dev); + }I have no strong objection to '
ufs_variant' sub-node. But why can't we simply add anof_device_idtoufs_of_match, like below:
But I do have objections on both the naming and having a sub-node.
Quoted 5 lines
static const struct of_device_id ufs_of_match[] = {
{ .compatible = "jedec,ufs-1.1"},
#if IS_ENABLED(SCSI_UFS_QCOM)
{ .compatible = "qcom,ufs", .data = &ufs_hba_qcom_vops },Be more specific: qcom,<socname>-ufs
Quoted 1 line
#neidf
Drop the ifdef.
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html