All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support
@ 2013-10-14 15:42 ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-14 15:42 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This modifies and documents R-Car SATA device tree (DT) bindings.
The "sata-<SoC>" format is now used for the "compatible" property.
Also, a platform device id table is introduced for non-DT support.
The device id naming is consistent with the "compatible" DT
property format.

R-Car Gen2 SATA PHY support is added. PHY initialization method
is chosen, based on the device id.

Valentine Barshak (2):
  sata_rcar: Adjust and document device tree bindings
  sata_rcar: Add R-Car Gen2 SATA support

 .../devicetree/bindings/ata/sata_rcar.txt          |  19 ++++
 arch/arm/boot/dts/r8a7779.dtsi                     |   2 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
 5 files changed, 118 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support
@ 2013-10-14 15:42 ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-14 15:42 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This modifies and documents R-Car SATA device tree (DT) bindings.
The "sata-<SoC>" format is now used for the "compatible" property.
Also, a platform device id table is introduced for non-DT support.
The device id naming is consistent with the "compatible" DT
property format.

R-Car Gen2 SATA PHY support is added. PHY initialization method
is chosen, based on the device id.

Valentine Barshak (2):
  sata_rcar: Adjust and document device tree bindings
  sata_rcar: Add R-Car Gen2 SATA support

 .../devicetree/bindings/ata/sata_rcar.txt          |  19 ++++
 arch/arm/boot/dts/r8a7779.dtsi                     |   2 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
 5 files changed, 118 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
  2013-10-14 15:42 ` Valentine Barshak
@ 2013-10-14 15:42   ` Valentine Barshak
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-14 15:42 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This converts the R-Car SATA DT compatibility string to
the <unit>-<soc> format which is the preferred one for
all SH-Mobile devices. The DT bindings are documented.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
 arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
 drivers/ata/sata_rcar.c                             |  2 +-
 3 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
new file mode 100644
index 0000000..2465183
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -0,0 +1,16 @@
+* Renesas R-Car SATA
+
+Required properties:
+- compatible		: must be "renesas,sata-r8a7779"
+- reg			: address range of the SATA registers.
+- interrupt-parent	: interrupt parent controller phandle
+- interrupts		: must consist of one interrupt specifier.
+
+Example:
+
+sata: sata@fc600000 {
+	compatible = "renesas,sata-r8a7779";
+	reg = <0xfc600000 0x2000>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 100 0x4>;
+};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index da61d27..b1747f5 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -201,7 +201,7 @@
 	};
 
 	sata: sata@fc600000 {
-		compatible = "renesas,rcar-sata";
+		compatible = "renesas,sata-r8a7779";
 		reg = <0xfc600000 0x2000>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 100 0x4>;
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index c2d95e9..c4cd738 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 #endif
 
 static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },
+	{ .compatible = "renesas,sata-r8a7779", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sata_rcar_match);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
@ 2013-10-14 15:42   ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-14 15:42 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This converts the R-Car SATA DT compatibility string to
the <unit>-<soc> format which is the preferred one for
all SH-Mobile devices. The DT bindings are documented.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
 arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
 drivers/ata/sata_rcar.c                             |  2 +-
 3 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
new file mode 100644
index 0000000..2465183
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -0,0 +1,16 @@
+* Renesas R-Car SATA
+
+Required properties:
+- compatible		: must be "renesas,sata-r8a7779"
+- reg			: address range of the SATA registers.
+- interrupt-parent	: interrupt parent controller phandle
+- interrupts		: must consist of one interrupt specifier.
+
+Example:
+
+sata: sata@fc600000 {
+	compatible = "renesas,sata-r8a7779";
+	reg = <0xfc600000 0x2000>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 100 0x4>;
+};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index da61d27..b1747f5 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -201,7 +201,7 @@
 	};
 
 	sata: sata@fc600000 {
-		compatible = "renesas,rcar-sata";
+		compatible = "renesas,sata-r8a7779";
 		reg = <0xfc600000 0x2000>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 100 0x4>;
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index c2d95e9..c4cd738 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 #endif
 
 static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },
+	{ .compatible = "renesas,sata-r8a7779", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sata_rcar_match);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
  2013-10-14 15:42 ` Valentine Barshak
@ 2013-10-14 15:42   ` Valentine Barshak
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-14 15:42 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

R-Car Gen2 SoCs have a different PHY which is not compatible
with the older R-Car H1 (R8A7779) version.
This adds OF/platform device id tables and PHY initialization
callbacks for the following Gen2 SoCs:
  * R-Car H2: R8A7790;
  * R-Car M2: R8A7791.

PHY initialization method is chosen, based on the device id.
Default PHY settings are applied for Gen2 SoCs, which should
suit the Gen2 boards available.

The R8A7779 platform code is modified to use "sata-r8a7779"
device id.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
 4 files changed, 102 insertions(+), 19 deletions(-)

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
index 2465183..b5a41bf 100644
--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -1,7 +1,10 @@
 * Renesas R-Car SATA
 
 Required properties:
-- compatible		: must be "renesas,sata-r8a7779"
+- compatible		: must be one of the following:
+			  - "renesas,sata-r8a7779" for R-Car H1
+			  - "renesas,sata-r8a7790" for R-Car H2
+			  - "renesas,sata-r8a7791" for R-Car M2
 - reg			: address range of the SATA registers.
 - interrupt-parent	: interrupt parent controller phandle
 - interrupts		: must consist of one interrupt specifier.
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index badb8b7..6593237 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
 	/* MSTP32 clocks */
 	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
 	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
-	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
+	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
 	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
 	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
 	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 13049e9..6aac99e 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
 };
 
 static struct platform_device sata_device = {
-	.name		= "sata_rcar",
+	.name		= "sata-r8a7779",
 	.id		= -1,
 	.resource	= sata_resources,
 	.num_resources	= ARRAY_SIZE(sata_resources),
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index c4cd738..80fc2e1 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/ata.h>
 #include <linux/libata.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
@@ -123,12 +124,37 @@
 
 #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
 
+/* Gen2 Physical Layer Control Registers */
+#define RCAR_GEN2_PHY_CTL1_REG		0x1704
+#define RCAR_GEN2_PHY_CTL1		0x34180002
+#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
+
+#define RCAR_GEN2_PHY_CTL2_REG		0x170C
+#define RCAR_GEN2_PHY_CTL2		0x00002303
+
+#define RCAR_GEN2_PHY_CTL3_REG		0x171C
+#define RCAR_GEN2_PHY_CTL3		0x000B0194
+
+#define RCAR_GEN2_PHY_CTL4_REG		0x1724
+#define RCAR_GEN2_PHY_CTL4		0x00030994
+
+#define RCAR_GEN2_PHY_CTL5_REG		0x1740
+#define RCAR_GEN2_PHY_CTL5		0x03004001
+#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
+#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
+
+enum sata_rcar_type {
+	RCAR_GEN1_SATA,
+	RCAR_GEN2_SATA,
+};
+
 struct sata_rcar_priv {
 	void __iomem *base;
 	struct clk *clk;
+	enum sata_rcar_type type;
 };
 
-static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
+static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
 {
 	void __iomem *base = priv->base;
 
@@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
 	iowrite32(0, base + SATAPHYRESET_REG);
 }
 
-static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
-				int group)
+static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
+				     u32 val, int group)
 {
 	void __iomem *base = priv->base;
 	int timeout;
@@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
 	iowrite32(0, base + SATAPHYADDR_REG);
 }
 
+static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
+{
+	sata_rcar_gen1_phy_preinit(priv);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+}
+
+static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
+{
+	void __iomem *base = priv->base;
+
+	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
+		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
+}
+
 static void sata_rcar_freeze(struct ata_port *ap)
 {
 	struct sata_rcar_priv *priv = ap->host->private_data;
@@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	u32 val;
 
 	/* reset and setup phy */
-	sata_rcar_phy_initialize(priv);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+	switch (priv->type) {
+	case RCAR_GEN1_SATA:
+		sata_rcar_gen1_phy_init(priv);
+		break;
+	case RCAR_GEN2_SATA:
+		sata_rcar_gen2_phy_init(priv);
+		break;
+	default:
+		dev_warn(host->dev, "SATA phy is not initialized\n");
+		break;
+	}
 
 	/* SATA-IP reset state */
 	val = ioread32(base + ATAPI_CONTROL1_REG);
@@ -770,8 +823,34 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
 }
 
+static struct of_device_id sata_rcar_match[] = {
+	{
+		.compatible = "renesas,sata-r8a7779",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7790",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{
+		.compatible = "renesas,sata-r8a7791",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, sata_rcar_match);
+
+static const struct platform_device_id sata_rcar_id_table[] = {
+	{ "sata-r8a7779", RCAR_GEN1_SATA },
+	{ "sata-r8a7790", RCAR_GEN2_SATA },
+	{ "sata-r8a7791", RCAR_GEN2_SATA },
+	{ },
+};
+MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
+
 static int sata_rcar_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id;
 	struct ata_host *host;
 	struct sata_rcar_priv *priv;
 	struct resource *mem;
@@ -787,6 +866,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
+	of_id = of_match_device(sata_rcar_match, &pdev->dev);
+	if (of_id)
+		priv->type = (enum sata_rcar_type)of_id->data;
+	else
+		priv->type = platform_get_device_id(pdev)->driver_data;
+
 	priv->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->clk)) {
 		dev_err(&pdev->dev, "failed to get access to sata clock\n");
@@ -892,15 +977,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 };
 #endif
 
-static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,sata-r8a7779", },
-	{},
-};
-MODULE_DEVICE_TABLE(of, sata_rcar_match);
-
 static struct platform_driver sata_rcar_driver = {
 	.probe		= sata_rcar_probe,
 	.remove		= sata_rcar_remove,
+	.id_table	= sata_rcar_id_table,
 	.driver = {
 		.name		= DRV_NAME,
 		.owner		= THIS_MODULE,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
@ 2013-10-14 15:42   ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-14 15:42 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

R-Car Gen2 SoCs have a different PHY which is not compatible
with the older R-Car H1 (R8A7779) version.
This adds OF/platform device id tables and PHY initialization
callbacks for the following Gen2 SoCs:
  * R-Car H2: R8A7790;
  * R-Car M2: R8A7791.

PHY initialization method is chosen, based on the device id.
Default PHY settings are applied for Gen2 SoCs, which should
suit the Gen2 boards available.

The R8A7779 platform code is modified to use "sata-r8a7779"
device id.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
 4 files changed, 102 insertions(+), 19 deletions(-)

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
index 2465183..b5a41bf 100644
--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -1,7 +1,10 @@
 * Renesas R-Car SATA
 
 Required properties:
-- compatible		: must be "renesas,sata-r8a7779"
+- compatible		: must be one of the following:
+			  - "renesas,sata-r8a7779" for R-Car H1
+			  - "renesas,sata-r8a7790" for R-Car H2
+			  - "renesas,sata-r8a7791" for R-Car M2
 - reg			: address range of the SATA registers.
 - interrupt-parent	: interrupt parent controller phandle
 - interrupts		: must consist of one interrupt specifier.
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index badb8b7..6593237 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
 	/* MSTP32 clocks */
 	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
 	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
-	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
+	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
 	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
 	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
 	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 13049e9..6aac99e 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
 };
 
 static struct platform_device sata_device = {
-	.name		= "sata_rcar",
+	.name		= "sata-r8a7779",
 	.id		= -1,
 	.resource	= sata_resources,
 	.num_resources	= ARRAY_SIZE(sata_resources),
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index c4cd738..80fc2e1 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/ata.h>
 #include <linux/libata.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
@@ -123,12 +124,37 @@
 
 #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
 
+/* Gen2 Physical Layer Control Registers */
+#define RCAR_GEN2_PHY_CTL1_REG		0x1704
+#define RCAR_GEN2_PHY_CTL1		0x34180002
+#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
+
+#define RCAR_GEN2_PHY_CTL2_REG		0x170C
+#define RCAR_GEN2_PHY_CTL2		0x00002303
+
+#define RCAR_GEN2_PHY_CTL3_REG		0x171C
+#define RCAR_GEN2_PHY_CTL3		0x000B0194
+
+#define RCAR_GEN2_PHY_CTL4_REG		0x1724
+#define RCAR_GEN2_PHY_CTL4		0x00030994
+
+#define RCAR_GEN2_PHY_CTL5_REG		0x1740
+#define RCAR_GEN2_PHY_CTL5		0x03004001
+#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
+#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
+
+enum sata_rcar_type {
+	RCAR_GEN1_SATA,
+	RCAR_GEN2_SATA,
+};
+
 struct sata_rcar_priv {
 	void __iomem *base;
 	struct clk *clk;
+	enum sata_rcar_type type;
 };
 
-static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
+static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
 {
 	void __iomem *base = priv->base;
 
@@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
 	iowrite32(0, base + SATAPHYRESET_REG);
 }
 
-static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
-				int group)
+static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
+				     u32 val, int group)
 {
 	void __iomem *base = priv->base;
 	int timeout;
@@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
 	iowrite32(0, base + SATAPHYADDR_REG);
 }
 
+static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
+{
+	sata_rcar_gen1_phy_preinit(priv);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+}
+
+static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
+{
+	void __iomem *base = priv->base;
+
+	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
+		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
+}
+
 static void sata_rcar_freeze(struct ata_port *ap)
 {
 	struct sata_rcar_priv *priv = ap->host->private_data;
@@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	u32 val;
 
 	/* reset and setup phy */
-	sata_rcar_phy_initialize(priv);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+	switch (priv->type) {
+	case RCAR_GEN1_SATA:
+		sata_rcar_gen1_phy_init(priv);
+		break;
+	case RCAR_GEN2_SATA:
+		sata_rcar_gen2_phy_init(priv);
+		break;
+	default:
+		dev_warn(host->dev, "SATA phy is not initialized\n");
+		break;
+	}
 
 	/* SATA-IP reset state */
 	val = ioread32(base + ATAPI_CONTROL1_REG);
@@ -770,8 +823,34 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
 }
 
+static struct of_device_id sata_rcar_match[] = {
+	{
+		.compatible = "renesas,sata-r8a7779",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7790",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{
+		.compatible = "renesas,sata-r8a7791",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, sata_rcar_match);
+
+static const struct platform_device_id sata_rcar_id_table[] = {
+	{ "sata-r8a7779", RCAR_GEN1_SATA },
+	{ "sata-r8a7790", RCAR_GEN2_SATA },
+	{ "sata-r8a7791", RCAR_GEN2_SATA },
+	{ },
+};
+MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
+
 static int sata_rcar_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id;
 	struct ata_host *host;
 	struct sata_rcar_priv *priv;
 	struct resource *mem;
@@ -787,6 +866,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
+	of_id = of_match_device(sata_rcar_match, &pdev->dev);
+	if (of_id)
+		priv->type = (enum sata_rcar_type)of_id->data;
+	else
+		priv->type = platform_get_device_id(pdev)->driver_data;
+
 	priv->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->clk)) {
 		dev_err(&pdev->dev, "failed to get access to sata clock\n");
@@ -892,15 +977,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 };
 #endif
 
-static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,sata-r8a7779", },
-	{},
-};
-MODULE_DEVICE_TABLE(of, sata_rcar_match);
-
 static struct platform_driver sata_rcar_driver = {
 	.probe		= sata_rcar_probe,
 	.remove		= sata_rcar_remove,
+	.id_table	= sata_rcar_id_table,
 	.driver = {
 		.name		= DRV_NAME,
 		.owner		= THIS_MODULE,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
  2013-10-14 15:42   ` Valentine Barshak
@ 2013-10-14 16:13     ` Mark Rutland
  -1 siblings, 0 replies; 60+ messages in thread
From: Mark Rutland @ 2013-10-14 16:13 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On Mon, Oct 14, 2013 at 04:42:33PM +0100, Valentine Barshak wrote:
> This converts the R-Car SATA DT compatibility string to
> the <unit>-<soc> format which is the preferred one for
> all SH-Mobile devices. The DT bindings are documented.
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
>  arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
>  drivers/ata/sata_rcar.c                             |  2 +-
>  3 files changed, 18 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
> 
> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> new file mode 100644
> index 0000000..2465183
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> @@ -0,0 +1,16 @@
> +* Renesas R-Car SATA
> +
> +Required properties:
> +- compatible		: must be "renesas,sata-r8a7779"

s/must be/should include/

> +- reg			: address range of the SATA registers.

Also their size...

> +- interrupt-parent	: interrupt parent controller phandle

This isn't required as such, as the interrupt-controller can be
inherited from the parent. As it's a standard auxiliary property I don't
think it needs to be documented here.

> +- interrupts		: must consist of one interrupt specifier.

Is there only one interrupt generated by the device?

> +
> +Example:
> +
> +sata: sata@fc600000 {
> +	compatible = "renesas,sata-r8a7779";
> +	reg = <0xfc600000 0x2000>;
> +	interrupt-parent = <&gic>;
> +	interrupts = <0 100 0x4>;
> +};
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> index da61d27..b1747f5 100644
> --- a/arch/arm/boot/dts/r8a7779.dtsi
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -201,7 +201,7 @@
>  	};
>  
>  	sata: sata@fc600000 {
> -		compatible = "renesas,rcar-sata";
> +		compatible = "renesas,sata-r8a7779";
>  		reg = <0xfc600000 0x2000>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 100 0x4>;
> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> index c2d95e9..c4cd738 100644
> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>  #endif
>  
>  static struct of_device_id sata_rcar_match[] = {
> -	{ .compatible = "renesas,rcar-sata", },
> +	{ .compatible = "renesas,sata-r8a7779", },
>  	{},
>  };

Why is an existing compatible string being removed?

Please do not change existing strings, it will break any dts files that
are already in use.

While the new compatible string may be preferred, the old string should
be kept for compatibility.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
@ 2013-10-14 16:13     ` Mark Rutland
  0 siblings, 0 replies; 60+ messages in thread
From: Mark Rutland @ 2013-10-14 16:13 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On Mon, Oct 14, 2013 at 04:42:33PM +0100, Valentine Barshak wrote:
> This converts the R-Car SATA DT compatibility string to
> the <unit>-<soc> format which is the preferred one for
> all SH-Mobile devices. The DT bindings are documented.
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
>  arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
>  drivers/ata/sata_rcar.c                             |  2 +-
>  3 files changed, 18 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
> 
> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> new file mode 100644
> index 0000000..2465183
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> @@ -0,0 +1,16 @@
> +* Renesas R-Car SATA
> +
> +Required properties:
> +- compatible		: must be "renesas,sata-r8a7779"

s/must be/should include/

> +- reg			: address range of the SATA registers.

Also their size...

> +- interrupt-parent	: interrupt parent controller phandle

This isn't required as such, as the interrupt-controller can be
inherited from the parent. As it's a standard auxiliary property I don't
think it needs to be documented here.

> +- interrupts		: must consist of one interrupt specifier.

Is there only one interrupt generated by the device?

> +
> +Example:
> +
> +sata: sata@fc600000 {
> +	compatible = "renesas,sata-r8a7779";
> +	reg = <0xfc600000 0x2000>;
> +	interrupt-parent = <&gic>;
> +	interrupts = <0 100 0x4>;
> +};
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> index da61d27..b1747f5 100644
> --- a/arch/arm/boot/dts/r8a7779.dtsi
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -201,7 +201,7 @@
>  	};
>  
>  	sata: sata@fc600000 {
> -		compatible = "renesas,rcar-sata";
> +		compatible = "renesas,sata-r8a7779";
>  		reg = <0xfc600000 0x2000>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 100 0x4>;
> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> index c2d95e9..c4cd738 100644
> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>  #endif
>  
>  static struct of_device_id sata_rcar_match[] = {
> -	{ .compatible = "renesas,rcar-sata", },
> +	{ .compatible = "renesas,sata-r8a7779", },
>  	{},
>  };

Why is an existing compatible string being removed?

Please do not change existing strings, it will break any dts files that
are already in use.

While the new compatible string may be preferred, the old string should
be kept for compatibility.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
  2013-10-14 15:42   ` Valentine Barshak
@ 2013-10-14 16:26     ` Mark Rutland
  -1 siblings, 0 replies; 60+ messages in thread
From: Mark Rutland @ 2013-10-14 16:26 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> R-Car Gen2 SoCs have a different PHY which is not compatible
> with the older R-Car H1 (R8A7779) version.
> This adds OF/platform device id tables and PHY initialization
> callbacks for the following Gen2 SoCs:
>   * R-Car H2: R8A7790;
>   * R-Car M2: R8A7791.
> 
> PHY initialization method is chosen, based on the device id.
> Default PHY settings are applied for Gen2 SoCs, which should
> suit the Gen2 boards available.
> 
> The R8A7779 platform code is modified to use "sata-r8a7779"
> device id.
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>  arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>  arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>  drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
>  4 files changed, 102 insertions(+), 19 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> index 2465183..b5a41bf 100644
> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> @@ -1,7 +1,10 @@
>  * Renesas R-Car SATA
>  
>  Required properties:
> -- compatible		: must be "renesas,sata-r8a7779"
> +- compatible		: must be one of the following:

s/must be/should contain/

> +			  - "renesas,sata-r8a7779" for R-Car H1
> +			  - "renesas,sata-r8a7790" for R-Car H2
> +			  - "renesas,sata-r8a7791" for R-Car M2

How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?

>  - reg			: address range of the SATA registers.

It's a size too...

>  - interrupt-parent	: interrupt parent controller phandle

Not required.

[...]

> +static struct of_device_id sata_rcar_match[] = {
> +	{
> +		.compatible = "renesas,sata-r8a7779",
> +		.data = (void *)RCAR_GEN1_SATA,
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7790",
> +		.data = (void *)RCAR_GEN2_SATA
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7791",
> +		.data = (void *)RCAR_GEN2_SATA
> +	},
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, sata_rcar_match);

Are the renesas,sata-r8a779x variants identical?

If so, why the two strings?

Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
compatible list:

	compatible = "sata-r8a7791", "sata-r8a7790";

That way we can match on "sata-r8a7791" if we want to later, but don't
need code for it now.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
@ 2013-10-14 16:26     ` Mark Rutland
  0 siblings, 0 replies; 60+ messages in thread
From: Mark Rutland @ 2013-10-14 16:26 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> R-Car Gen2 SoCs have a different PHY which is not compatible
> with the older R-Car H1 (R8A7779) version.
> This adds OF/platform device id tables and PHY initialization
> callbacks for the following Gen2 SoCs:
>   * R-Car H2: R8A7790;
>   * R-Car M2: R8A7791.
> 
> PHY initialization method is chosen, based on the device id.
> Default PHY settings are applied for Gen2 SoCs, which should
> suit the Gen2 boards available.
> 
> The R8A7779 platform code is modified to use "sata-r8a7779"
> device id.
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>  arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>  arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>  drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
>  4 files changed, 102 insertions(+), 19 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> index 2465183..b5a41bf 100644
> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> @@ -1,7 +1,10 @@
>  * Renesas R-Car SATA
>  
>  Required properties:
> -- compatible		: must be "renesas,sata-r8a7779"
> +- compatible		: must be one of the following:

s/must be/should contain/

> +			  - "renesas,sata-r8a7779" for R-Car H1
> +			  - "renesas,sata-r8a7790" for R-Car H2
> +			  - "renesas,sata-r8a7791" for R-Car M2

How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?

>  - reg			: address range of the SATA registers.

It's a size too...

>  - interrupt-parent	: interrupt parent controller phandle

Not required.

[...]

> +static struct of_device_id sata_rcar_match[] = {
> +	{
> +		.compatible = "renesas,sata-r8a7779",
> +		.data = (void *)RCAR_GEN1_SATA,
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7790",
> +		.data = (void *)RCAR_GEN2_SATA
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7791",
> +		.data = (void *)RCAR_GEN2_SATA
> +	},
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, sata_rcar_match);

Are the renesas,sata-r8a779x variants identical?

If so, why the two strings?

Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
compatible list:

	compatible = "sata-r8a7791", "sata-r8a7790";

That way we can match on "sata-r8a7791" if we want to later, but don't
need code for it now.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
  2013-10-14 16:13     ` Mark Rutland
@ 2013-10-14 17:19       ` Valentine
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine @ 2013-10-14 17:19 UTC (permalink / raw)
  To: Mark Rutland
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

Hi Mark,
thanks for looking at this.

On 10/14/2013 08:13 PM, Mark Rutland wrote:
> On Mon, Oct 14, 2013 at 04:42:33PM +0100, Valentine Barshak wrote:
>> This converts the R-Car SATA DT compatibility string to
>> the <unit>-<soc> format which is the preferred one for
>> all SH-Mobile devices. The DT bindings are documented.
>>
>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>> ---
>>   Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
>>   arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
>>   drivers/ata/sata_rcar.c                             |  2 +-
>>   3 files changed, 18 insertions(+), 2 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
>>
>> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> new file mode 100644
>> index 0000000..2465183
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> @@ -0,0 +1,16 @@
>> +* Renesas R-Car SATA
>> +
>> +Required properties:
>> +- compatible		: must be "renesas,sata-r8a7779"
>
> s/must be/should include/
>

OK, thanks.

>> +- reg			: address range of the SATA registers.
>
> Also their size...

Do you want me to rephrase it to "base address and size of the SATA 
registers"?

Looks like a lot of other bindings examples available in 
Documentation/devicetree/bindings describe regs property
as the "address range" which implies the address and size
of the registers.

>
>> +- interrupt-parent	: interrupt parent controller phandle
>
> This isn't required as such, as the interrupt-controller can be
> inherited from the parent. As it's a standard auxiliary property I don't
> think it needs to be documented here.

OK, will drop it, thanks.

>
>> +- interrupts		: must consist of one interrupt specifier.
>
> Is there only one interrupt generated by the device?

Yes, there's just one IRQ.

>
>> +
>> +Example:
>> +
>> +sata: sata@fc600000 {
>> +	compatible = "renesas,sata-r8a7779";
>> +	reg = <0xfc600000 0x2000>;
>> +	interrupt-parent = <&gic>;
>> +	interrupts = <0 100 0x4>;
>> +};
>> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
>> index da61d27..b1747f5 100644
>> --- a/arch/arm/boot/dts/r8a7779.dtsi
>> +++ b/arch/arm/boot/dts/r8a7779.dtsi
>> @@ -201,7 +201,7 @@
>>   	};
>>
>>   	sata: sata@fc600000 {
>> -		compatible = "renesas,rcar-sata";
>> +		compatible = "renesas,sata-r8a7779";
>>   		reg = <0xfc600000 0x2000>;
>>   		interrupt-parent = <&gic>;
>>   		interrupts = <0 100 0x4>;
>> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
>> index c2d95e9..c4cd738 100644
>> --- a/drivers/ata/sata_rcar.c
>> +++ b/drivers/ata/sata_rcar.c
>> @@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>>   #endif
>>
>>   static struct of_device_id sata_rcar_match[] = {
>> -	{ .compatible = "renesas,rcar-sata", },
>> +	{ .compatible = "renesas,sata-r8a7779", },
>>   	{},
>>   };
>
> Why is an existing compatible string being removed?
>
> Please do not change existing strings, it will break any dts files that
> are already in use.

It won't break the dts files, since I'm changing the only dtsi file that 
uses the SATA node as well. It will only break binary compatibility with 
the older dtb files.

>
> While the new compatible string may be preferred, the old string should
> be kept for compatibility.

OK, I can keep the old string if it's needed.

>
> Thanks,
> Mark.
>

Thanks,
Val.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
@ 2013-10-14 17:19       ` Valentine
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine @ 2013-10-14 17:19 UTC (permalink / raw)
  To: Mark Rutland
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

Hi Mark,
thanks for looking at this.

On 10/14/2013 08:13 PM, Mark Rutland wrote:
> On Mon, Oct 14, 2013 at 04:42:33PM +0100, Valentine Barshak wrote:
>> This converts the R-Car SATA DT compatibility string to
>> the <unit>-<soc> format which is the preferred one for
>> all SH-Mobile devices. The DT bindings are documented.
>>
>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>> ---
>>   Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
>>   arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
>>   drivers/ata/sata_rcar.c                             |  2 +-
>>   3 files changed, 18 insertions(+), 2 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
>>
>> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> new file mode 100644
>> index 0000000..2465183
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> @@ -0,0 +1,16 @@
>> +* Renesas R-Car SATA
>> +
>> +Required properties:
>> +- compatible		: must be "renesas,sata-r8a7779"
>
> s/must be/should include/
>

OK, thanks.

>> +- reg			: address range of the SATA registers.
>
> Also their size...

Do you want me to rephrase it to "base address and size of the SATA 
registers"?

Looks like a lot of other bindings examples available in 
Documentation/devicetree/bindings describe regs property
as the "address range" which implies the address and size
of the registers.

>
>> +- interrupt-parent	: interrupt parent controller phandle
>
> This isn't required as such, as the interrupt-controller can be
> inherited from the parent. As it's a standard auxiliary property I don't
> think it needs to be documented here.

OK, will drop it, thanks.

>
>> +- interrupts		: must consist of one interrupt specifier.
>
> Is there only one interrupt generated by the device?

Yes, there's just one IRQ.

>
>> +
>> +Example:
>> +
>> +sata: sata@fc600000 {
>> +	compatible = "renesas,sata-r8a7779";
>> +	reg = <0xfc600000 0x2000>;
>> +	interrupt-parent = <&gic>;
>> +	interrupts = <0 100 0x4>;
>> +};
>> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
>> index da61d27..b1747f5 100644
>> --- a/arch/arm/boot/dts/r8a7779.dtsi
>> +++ b/arch/arm/boot/dts/r8a7779.dtsi
>> @@ -201,7 +201,7 @@
>>   	};
>>
>>   	sata: sata@fc600000 {
>> -		compatible = "renesas,rcar-sata";
>> +		compatible = "renesas,sata-r8a7779";
>>   		reg = <0xfc600000 0x2000>;
>>   		interrupt-parent = <&gic>;
>>   		interrupts = <0 100 0x4>;
>> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
>> index c2d95e9..c4cd738 100644
>> --- a/drivers/ata/sata_rcar.c
>> +++ b/drivers/ata/sata_rcar.c
>> @@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>>   #endif
>>
>>   static struct of_device_id sata_rcar_match[] = {
>> -	{ .compatible = "renesas,rcar-sata", },
>> +	{ .compatible = "renesas,sata-r8a7779", },
>>   	{},
>>   };
>
> Why is an existing compatible string being removed?
>
> Please do not change existing strings, it will break any dts files that
> are already in use.

It won't break the dts files, since I'm changing the only dtsi file that 
uses the SATA node as well. It will only break binary compatibility with 
the older dtb files.

>
> While the new compatible string may be preferred, the old string should
> be kept for compatibility.

OK, I can keep the old string if it's needed.

>
> Thanks,
> Mark.
>

Thanks,
Val.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
  2013-10-14 16:26     ` Mark Rutland
@ 2013-10-14 17:58       ` Valentine
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine @ 2013-10-14 17:58 UTC (permalink / raw)
  To: Mark Rutland
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On 10/14/2013 08:26 PM, Mark Rutland wrote:
> On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
>> R-Car Gen2 SoCs have a different PHY which is not compatible
>> with the older R-Car H1 (R8A7779) version.
>> This adds OF/platform device id tables and PHY initialization
>> callbacks for the following Gen2 SoCs:
>>    * R-Car H2: R8A7790;
>>    * R-Car M2: R8A7791.
>>
>> PHY initialization method is chosen, based on the device id.
>> Default PHY settings are applied for Gen2 SoCs, which should
>> suit the Gen2 boards available.
>>
>> The R8A7779 platform code is modified to use "sata-r8a7779"
>> device id.
>>
>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>> ---
>>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>   drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
>>   4 files changed, 102 insertions(+), 19 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> index 2465183..b5a41bf 100644
>> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> @@ -1,7 +1,10 @@
>>   * Renesas R-Car SATA
>>
>>   Required properties:
>> -- compatible		: must be "renesas,sata-r8a7779"
>> +- compatible		: must be one of the following:
>
> s/must be/should contain/
>
>> +			  - "renesas,sata-r8a7779" for R-Car H1
>> +			  - "renesas,sata-r8a7790" for R-Car H2
>> +			  - "renesas,sata-r8a7791" for R-Car M2
>
> How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?
>
>>   - reg			: address range of the SATA registers.
>
> It's a size too...
>
>>   - interrupt-parent	: interrupt parent controller phandle
>
> Not required.
>
> [...]
>
>> +static struct of_device_id sata_rcar_match[] = {
>> +	{
>> +		.compatible = "renesas,sata-r8a7779",
>> +		.data = (void *)RCAR_GEN1_SATA,
>> +	},
>> +	{
>> +		.compatible = "renesas,sata-r8a7790",
>> +		.data = (void *)RCAR_GEN2_SATA
>> +	},
>> +	{
>> +		.compatible = "renesas,sata-r8a7791",
>> +		.data = (void *)RCAR_GEN2_SATA
>> +	},
>> +	{},
>> +};
>> +MODULE_DEVICE_TABLE(of, sata_rcar_match);
>
> Are the renesas,sata-r8a779x variants identical?
>

Yes.

> If so, why the two strings?

Just thought the driver should support "renesas,sata-r8a7791" 
compatibility as well since it should support both SoCs.
Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.

>
> Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
> compatible list:
>
> 	compatible = "sata-r8a7791", "sata-r8a7790";
>
> That way we can match on "sata-r8a7791" if we want to later, but don't
> need code for it now.

We could. In this case having compatible = "renesas,sata-r8a7791" would 
not be enough, though it looks like a valid compatible list to me.

>
> Thanks,
> Mark.
>

Thanks,
Val.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
@ 2013-10-14 17:58       ` Valentine
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine @ 2013-10-14 17:58 UTC (permalink / raw)
  To: Mark Rutland
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On 10/14/2013 08:26 PM, Mark Rutland wrote:
> On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
>> R-Car Gen2 SoCs have a different PHY which is not compatible
>> with the older R-Car H1 (R8A7779) version.
>> This adds OF/platform device id tables and PHY initialization
>> callbacks for the following Gen2 SoCs:
>>    * R-Car H2: R8A7790;
>>    * R-Car M2: R8A7791.
>>
>> PHY initialization method is chosen, based on the device id.
>> Default PHY settings are applied for Gen2 SoCs, which should
>> suit the Gen2 boards available.
>>
>> The R8A7779 platform code is modified to use "sata-r8a7779"
>> device id.
>>
>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>> ---
>>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>   drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
>>   4 files changed, 102 insertions(+), 19 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> index 2465183..b5a41bf 100644
>> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> @@ -1,7 +1,10 @@
>>   * Renesas R-Car SATA
>>
>>   Required properties:
>> -- compatible		: must be "renesas,sata-r8a7779"
>> +- compatible		: must be one of the following:
>
> s/must be/should contain/
>
>> +			  - "renesas,sata-r8a7779" for R-Car H1
>> +			  - "renesas,sata-r8a7790" for R-Car H2
>> +			  - "renesas,sata-r8a7791" for R-Car M2
>
> How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?
>
>>   - reg			: address range of the SATA registers.
>
> It's a size too...
>
>>   - interrupt-parent	: interrupt parent controller phandle
>
> Not required.
>
> [...]
>
>> +static struct of_device_id sata_rcar_match[] = {
>> +	{
>> +		.compatible = "renesas,sata-r8a7779",
>> +		.data = (void *)RCAR_GEN1_SATA,
>> +	},
>> +	{
>> +		.compatible = "renesas,sata-r8a7790",
>> +		.data = (void *)RCAR_GEN2_SATA
>> +	},
>> +	{
>> +		.compatible = "renesas,sata-r8a7791",
>> +		.data = (void *)RCAR_GEN2_SATA
>> +	},
>> +	{},
>> +};
>> +MODULE_DEVICE_TABLE(of, sata_rcar_match);
>
> Are the renesas,sata-r8a779x variants identical?
>

Yes.

> If so, why the two strings?

Just thought the driver should support "renesas,sata-r8a7791" 
compatibility as well since it should support both SoCs.
Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.

>
> Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
> compatible list:
>
> 	compatible = "sata-r8a7791", "sata-r8a7790";
>
> That way we can match on "sata-r8a7791" if we want to later, but don't
> need code for it now.

We could. In this case having compatible = "renesas,sata-r8a7791" would 
not be enough, though it looks like a valid compatible list to me.

>
> Thanks,
> Mark.
>

Thanks,
Val.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
  2013-10-14 17:58       ` Valentine
@ 2013-10-14 18:15         ` Laurent Pinchart
  -1 siblings, 0 replies; 60+ messages in thread
From: Laurent Pinchart @ 2013-10-14 18:15 UTC (permalink / raw)
  To: Valentine
  Cc: Mark Rutland, linux-sh, linux-ide, devicetree, Simon Horman,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

Hi Valentine,

On Monday 14 October 2013 21:58:50 Valentine wrote:
> On 10/14/2013 08:26 PM, Mark Rutland wrote:
> > On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> >> R-Car Gen2 SoCs have a different PHY which is not compatible
> >> with the older R-Car H1 (R8A7779) version.
> >> This adds OF/platform device id tables and PHY initialization
> >> 
> >> callbacks for the following Gen2 SoCs:
> >>    * R-Car H2: R8A7790;
> >>    * R-Car M2: R8A7791.
> >> 
> >> PHY initialization method is chosen, based on the device id.
> >> Default PHY settings are applied for Gen2 SoCs, which should
> >> suit the Gen2 boards available.
> >> 
> >> The R8A7779 platform code is modified to use "sata-r8a7779"
> >> device id.
> >> 
> >> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >> ---
> >> 
> >>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >>   drivers/ata/sata_rcar.c                            | 112 +++++++++++---
> >>   4 files changed, 102 insertions(+), 19 deletions(-)
> >> 
> >> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
> >> 2465183..b5a41bf 100644
> >> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> @@ -1,7 +1,10 @@
> >> 
> >>   * Renesas R-Car SATA
> >> 
> >>   Required properties:
> >> -- compatible		: must be "renesas,sata-r8a7779"
> > 
> >> +- compatible		: must be one of the following:
> > s/must be/should contain/
> > 
> >> +			  - "renesas,sata-r8a7779" for R-Car H1
> >> +			  - "renesas,sata-r8a7790" for R-Car H2
> >> +			  - "renesas,sata-r8a7791" for R-Car M2
> > 
> > How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?
> > 
> >>   - reg			: address range of the SATA registers.
> > 
> > It's a size too...
> > 
> >>   - interrupt-parent	: interrupt parent controller phandle
> > 
> > Not required.
> > 
> > [...]
> > 
> >> +static struct of_device_id sata_rcar_match[] = {
> >> +	{
> >> +		.compatible = "renesas,sata-r8a7779",
> >> +		.data = (void *)RCAR_GEN1_SATA,
> >> +	},
> >> +	{
> >> +		.compatible = "renesas,sata-r8a7790",
> >> +		.data = (void *)RCAR_GEN2_SATA
> >> +	},
> >> +	{
> >> +		.compatible = "renesas,sata-r8a7791",
> >> +		.data = (void *)RCAR_GEN2_SATA
> >> +	},
> >> +	{},
> >> +};
> >> +MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > 
> > Are the renesas,sata-r8a779x variants identical?
> 
> Yes.
> 
> > If so, why the two strings?
> 
> Just thought the driver should support "renesas,sata-r8a7791"
> compatibility as well since it should support both SoCs.
> Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.

One reason for two compatibility strings is not to be stuck if we later find 
out the the 7791 SATA controller differs from the 7790.

> > Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
> > 
> > compatible list:
> > 	compatible = "sata-r8a7791", "sata-r8a7790";
> > 
> > That way we can match on "sata-r8a7791" if we want to later, but don't
> > need code for it now.
> 
> We could. In this case having compatible = "renesas,sata-r8a7791" would not
> be enough, though it looks like a valid compatible list to me.

I'm fine with both solution, as long as the "sata-r8a7791" compatibility 
string is present and has precedence over "sata-r8a7790".

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
@ 2013-10-14 18:15         ` Laurent Pinchart
  0 siblings, 0 replies; 60+ messages in thread
From: Laurent Pinchart @ 2013-10-14 18:15 UTC (permalink / raw)
  To: Valentine
  Cc: Mark Rutland, linux-sh, linux-ide, devicetree, Simon Horman,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

Hi Valentine,

On Monday 14 October 2013 21:58:50 Valentine wrote:
> On 10/14/2013 08:26 PM, Mark Rutland wrote:
> > On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> >> R-Car Gen2 SoCs have a different PHY which is not compatible
> >> with the older R-Car H1 (R8A7779) version.
> >> This adds OF/platform device id tables and PHY initialization
> >> 
> >> callbacks for the following Gen2 SoCs:
> >>    * R-Car H2: R8A7790;
> >>    * R-Car M2: R8A7791.
> >> 
> >> PHY initialization method is chosen, based on the device id.
> >> Default PHY settings are applied for Gen2 SoCs, which should
> >> suit the Gen2 boards available.
> >> 
> >> The R8A7779 platform code is modified to use "sata-r8a7779"
> >> device id.
> >> 
> >> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >> ---
> >> 
> >>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >>   drivers/ata/sata_rcar.c                            | 112 +++++++++++---
> >>   4 files changed, 102 insertions(+), 19 deletions(-)
> >> 
> >> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
> >> 2465183..b5a41bf 100644
> >> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> @@ -1,7 +1,10 @@
> >> 
> >>   * Renesas R-Car SATA
> >> 
> >>   Required properties:
> >> -- compatible		: must be "renesas,sata-r8a7779"
> > 
> >> +- compatible		: must be one of the following:
> > s/must be/should contain/
> > 
> >> +			  - "renesas,sata-r8a7779" for R-Car H1
> >> +			  - "renesas,sata-r8a7790" for R-Car H2
> >> +			  - "renesas,sata-r8a7791" for R-Car M2
> > 
> > How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?
> > 
> >>   - reg			: address range of the SATA registers.
> > 
> > It's a size too...
> > 
> >>   - interrupt-parent	: interrupt parent controller phandle
> > 
> > Not required.
> > 
> > [...]
> > 
> >> +static struct of_device_id sata_rcar_match[] = {
> >> +	{
> >> +		.compatible = "renesas,sata-r8a7779",
> >> +		.data = (void *)RCAR_GEN1_SATA,
> >> +	},
> >> +	{
> >> +		.compatible = "renesas,sata-r8a7790",
> >> +		.data = (void *)RCAR_GEN2_SATA
> >> +	},
> >> +	{
> >> +		.compatible = "renesas,sata-r8a7791",
> >> +		.data = (void *)RCAR_GEN2_SATA
> >> +	},
> >> +	{},
> >> +};
> >> +MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > 
> > Are the renesas,sata-r8a779x variants identical?
> 
> Yes.
> 
> > If so, why the two strings?
> 
> Just thought the driver should support "renesas,sata-r8a7791"
> compatibility as well since it should support both SoCs.
> Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.

One reason for two compatibility strings is not to be stuck if we later find 
out the the 7791 SATA controller differs from the 7790.

> > Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
> > 
> > compatible list:
> > 	compatible = "sata-r8a7791", "sata-r8a7790";
> > 
> > That way we can match on "sata-r8a7791" if we want to later, but don't
> > need code for it now.
> 
> We could. In this case having compatible = "renesas,sata-r8a7791" would not
> be enough, though it looks like a valid compatible list to me.

I'm fine with both solution, as long as the "sata-r8a7791" compatibility 
string is present and has precedence over "sata-r8a7790".

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
  2013-10-14 18:15         ` Laurent Pinchart
@ 2013-10-14 21:22           ` Valentine
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine @ 2013-10-14 21:22 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Mark Rutland, linux-sh, linux-ide, devicetree, Simon Horman,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

On 10/14/2013 10:15 PM, Laurent Pinchart wrote:
> Hi Valentine,
>

Hi Laurent,

> On Monday 14 October 2013 21:58:50 Valentine wrote:
>> On 10/14/2013 08:26 PM, Mark Rutland wrote:
>>> On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
>>>> R-Car Gen2 SoCs have a different PHY which is not compatible
>>>> with the older R-Car H1 (R8A7779) version.
>>>> This adds OF/platform device id tables and PHY initialization
>>>>
>>>> callbacks for the following Gen2 SoCs:
>>>>     * R-Car H2: R8A7790;
>>>>     * R-Car M2: R8A7791.
>>>>
>>>> PHY initialization method is chosen, based on the device id.
>>>> Default PHY settings are applied for Gen2 SoCs, which should
>>>> suit the Gen2 boards available.
>>>>
>>>> The R8A7779 platform code is modified to use "sata-r8a7779"
>>>> device id.
>>>>
>>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>>>> ---
>>>>
>>>>    .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>>>    arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>>>    arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>>>    drivers/ata/sata_rcar.c                            | 112 +++++++++++---
>>>>    4 files changed, 102 insertions(+), 19 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
>>>> b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
>>>> 2465183..b5a41bf 100644
>>>> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
>>>> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>>>> @@ -1,7 +1,10 @@
>>>>
>>>>    * Renesas R-Car SATA
>>>>
>>>>    Required properties:
>>>> -- compatible		: must be "renesas,sata-r8a7779"
>>>
>>>> +- compatible		: must be one of the following:
>>> s/must be/should contain/
>>>
>>>> +			  - "renesas,sata-r8a7779" for R-Car H1
>>>> +			  - "renesas,sata-r8a7790" for R-Car H2
>>>> +			  - "renesas,sata-r8a7791" for R-Car M2
>>>
>>> How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?
>>>
>>>>    - reg			: address range of the SATA registers.
>>>
>>> It's a size too...
>>>
>>>>    - interrupt-parent	: interrupt parent controller phandle
>>>
>>> Not required.
>>>
>>> [...]
>>>
>>>> +static struct of_device_id sata_rcar_match[] = {
>>>> +	{
>>>> +		.compatible = "renesas,sata-r8a7779",
>>>> +		.data = (void *)RCAR_GEN1_SATA,
>>>> +	},
>>>> +	{
>>>> +		.compatible = "renesas,sata-r8a7790",
>>>> +		.data = (void *)RCAR_GEN2_SATA
>>>> +	},
>>>> +	{
>>>> +		.compatible = "renesas,sata-r8a7791",
>>>> +		.data = (void *)RCAR_GEN2_SATA
>>>> +	},
>>>> +	{},
>>>> +};
>>>> +MODULE_DEVICE_TABLE(of, sata_rcar_match);
>>>
>>> Are the renesas,sata-r8a779x variants identical?
>>
>> Yes.
>>
>>> If so, why the two strings?
>>
>> Just thought the driver should support "renesas,sata-r8a7791"
>> compatibility as well since it should support both SoCs.
>> Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.
>
> One reason for two compatibility strings is not to be stuck if we later find
> out the the 7791 SATA controller differs from the 7790.
>

Thanks!
Yeah, anyways, I'd prefer to keep both strings in the device id table.

>>> Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
>>>
>>> compatible list:
>>> 	compatible = "sata-r8a7791", "sata-r8a7790";
>>>
>>> That way we can match on "sata-r8a7791" if we want to later, but don't
>>> need code for it now.
>>
>> We could. In this case having compatible = "renesas,sata-r8a7791" would not
>> be enough, though it looks like a valid compatible list to me.
>
> I'm fine with both solution, as long as the "sata-r8a7791" compatibility
> string is present and has precedence over "sata-r8a7790".
>

Thanks,
Val.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
@ 2013-10-14 21:22           ` Valentine
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine @ 2013-10-14 21:22 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Mark Rutland, linux-sh, linux-ide, devicetree, Simon Horman,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

On 10/14/2013 10:15 PM, Laurent Pinchart wrote:
> Hi Valentine,
>

Hi Laurent,

> On Monday 14 October 2013 21:58:50 Valentine wrote:
>> On 10/14/2013 08:26 PM, Mark Rutland wrote:
>>> On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
>>>> R-Car Gen2 SoCs have a different PHY which is not compatible
>>>> with the older R-Car H1 (R8A7779) version.
>>>> This adds OF/platform device id tables and PHY initialization
>>>>
>>>> callbacks for the following Gen2 SoCs:
>>>>     * R-Car H2: R8A7790;
>>>>     * R-Car M2: R8A7791.
>>>>
>>>> PHY initialization method is chosen, based on the device id.
>>>> Default PHY settings are applied for Gen2 SoCs, which should
>>>> suit the Gen2 boards available.
>>>>
>>>> The R8A7779 platform code is modified to use "sata-r8a7779"
>>>> device id.
>>>>
>>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>>>> ---
>>>>
>>>>    .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>>>    arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>>>    arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>>>    drivers/ata/sata_rcar.c                            | 112 +++++++++++---
>>>>    4 files changed, 102 insertions(+), 19 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
>>>> b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
>>>> 2465183..b5a41bf 100644
>>>> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
>>>> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>>>> @@ -1,7 +1,10 @@
>>>>
>>>>    * Renesas R-Car SATA
>>>>
>>>>    Required properties:
>>>> -- compatible		: must be "renesas,sata-r8a7779"
>>>
>>>> +- compatible		: must be one of the following:
>>> s/must be/should contain/
>>>
>>>> +			  - "renesas,sata-r8a7779" for R-Car H1
>>>> +			  - "renesas,sata-r8a7790" for R-Car H2
>>>> +			  - "renesas,sata-r8a7791" for R-Car M2
>>>
>>> How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?
>>>
>>>>    - reg			: address range of the SATA registers.
>>>
>>> It's a size too...
>>>
>>>>    - interrupt-parent	: interrupt parent controller phandle
>>>
>>> Not required.
>>>
>>> [...]
>>>
>>>> +static struct of_device_id sata_rcar_match[] = {
>>>> +	{
>>>> +		.compatible = "renesas,sata-r8a7779",
>>>> +		.data = (void *)RCAR_GEN1_SATA,
>>>> +	},
>>>> +	{
>>>> +		.compatible = "renesas,sata-r8a7790",
>>>> +		.data = (void *)RCAR_GEN2_SATA
>>>> +	},
>>>> +	{
>>>> +		.compatible = "renesas,sata-r8a7791",
>>>> +		.data = (void *)RCAR_GEN2_SATA
>>>> +	},
>>>> +	{},
>>>> +};
>>>> +MODULE_DEVICE_TABLE(of, sata_rcar_match);
>>>
>>> Are the renesas,sata-r8a779x variants identical?
>>
>> Yes.
>>
>>> If so, why the two strings?
>>
>> Just thought the driver should support "renesas,sata-r8a7791"
>> compatibility as well since it should support both SoCs.
>> Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.
>
> One reason for two compatibility strings is not to be stuck if we later find
> out the the 7791 SATA controller differs from the 7790.
>

Thanks!
Yeah, anyways, I'd prefer to keep both strings in the device id table.

>>> Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
>>>
>>> compatible list:
>>> 	compatible = "sata-r8a7791", "sata-r8a7790";
>>>
>>> That way we can match on "sata-r8a7791" if we want to later, but don't
>>> need code for it now.
>>
>> We could. In this case having compatible = "renesas,sata-r8a7791" would not
>> be enough, though it looks like a valid compatible list to me.
>
> I'm fine with both solution, as long as the "sata-r8a7791" compatibility
> string is present and has precedence over "sata-r8a7790".
>

Thanks,
Val.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
  2013-10-14 21:22           ` Valentine
@ 2013-10-15  0:23             ` Simon Horman
  -1 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-15  0:23 UTC (permalink / raw)
  To: Valentine
  Cc: Laurent Pinchart, Mark Rutland, linux-sh, linux-ide, devicetree,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

On Tue, Oct 15, 2013 at 01:22:23AM +0400, Valentine wrote:
> On 10/14/2013 10:15 PM, Laurent Pinchart wrote:
> >Hi Valentine,
> >
> 
> Hi Laurent,
> 
> >On Monday 14 October 2013 21:58:50 Valentine wrote:
> >>On 10/14/2013 08:26 PM, Mark Rutland wrote:
> >>>On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> >>>>R-Car Gen2 SoCs have a different PHY which is not compatible
> >>>>with the older R-Car H1 (R8A7779) version.
> >>>>This adds OF/platform device id tables and PHY initialization
> >>>>
> >>>>callbacks for the following Gen2 SoCs:
> >>>>    * R-Car H2: R8A7790;
> >>>>    * R-Car M2: R8A7791.
> >>>>
> >>>>PHY initialization method is chosen, based on the device id.
> >>>>Default PHY settings are applied for Gen2 SoCs, which should
> >>>>suit the Gen2 boards available.
> >>>>
> >>>>The R8A7779 platform code is modified to use "sata-r8a7779"
> >>>>device id.
> >>>>
> >>>>Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >>>>---
> >>>>
> >>>>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >>>>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >>>>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >>>>   drivers/ata/sata_rcar.c                            | 112 +++++++++++---
> >>>>   4 files changed, 102 insertions(+), 19 deletions(-)
> >>>>
> >>>>diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>>>b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
> >>>>2465183..b5a41bf 100644
> >>>>--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>>>+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>>>@@ -1,7 +1,10 @@
> >>>>
> >>>>   * Renesas R-Car SATA
> >>>>
> >>>>   Required properties:
> >>>>-- compatible		: must be "renesas,sata-r8a7779"
> >>>
> >>>>+- compatible		: must be one of the following:
> >>>s/must be/should contain/
> >>>
> >>>>+			  - "renesas,sata-r8a7779" for R-Car H1
> >>>>+			  - "renesas,sata-r8a7790" for R-Car H2
> >>>>+			  - "renesas,sata-r8a7791" for R-Car M2
> >>>
> >>>How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?
> >>>
> >>>>   - reg			: address range of the SATA registers.
> >>>
> >>>It's a size too...
> >>>
> >>>>   - interrupt-parent	: interrupt parent controller phandle
> >>>
> >>>Not required.
> >>>
> >>>[...]
> >>>
> >>>>+static struct of_device_id sata_rcar_match[] = {
> >>>>+	{
> >>>>+		.compatible = "renesas,sata-r8a7779",
> >>>>+		.data = (void *)RCAR_GEN1_SATA,
> >>>>+	},
> >>>>+	{
> >>>>+		.compatible = "renesas,sata-r8a7790",
> >>>>+		.data = (void *)RCAR_GEN2_SATA
> >>>>+	},
> >>>>+	{
> >>>>+		.compatible = "renesas,sata-r8a7791",
> >>>>+		.data = (void *)RCAR_GEN2_SATA
> >>>>+	},
> >>>>+	{},
> >>>>+};
> >>>>+MODULE_DEVICE_TABLE(of, sata_rcar_match);
> >>>
> >>>Are the renesas,sata-r8a779x variants identical?
> >>
> >>Yes.
> >>
> >>>If so, why the two strings?
> >>
> >>Just thought the driver should support "renesas,sata-r8a7791"
> >>compatibility as well since it should support both SoCs.
> >>Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.
> >
> >One reason for two compatibility strings is not to be stuck if we later find
> >out the the 7791 SATA controller differs from the 7790.
> >
> 
> Thanks!
> Yeah, anyways, I'd prefer to keep both strings in the device id table.

Yes, I do too, mostly for the reason that Laurent gave.
But also because this is consistent with compatibility strings
for other Renesas IP.

> >>>Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
> >>>
> >>>compatible list:
> >>>	compatible = "sata-r8a7791", "sata-r8a7790";
> >>>
> >>>That way we can match on "sata-r8a7791" if we want to later, but don't
> >>>need code for it now.
> >>
> >>We could. In this case having compatible = "renesas,sata-r8a7791" would not
> >>be enough, though it looks like a valid compatible list to me.
> >
> >I'm fine with both solution, as long as the "sata-r8a7791" compatibility
> >string is present and has precedence over "sata-r8a7790".
> >
> 
> Thanks,
> Val.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
@ 2013-10-15  0:23             ` Simon Horman
  0 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-15  0:23 UTC (permalink / raw)
  To: Valentine
  Cc: Laurent Pinchart, Mark Rutland, linux-sh, linux-ide, devicetree,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

On Tue, Oct 15, 2013 at 01:22:23AM +0400, Valentine wrote:
> On 10/14/2013 10:15 PM, Laurent Pinchart wrote:
> >Hi Valentine,
> >
> 
> Hi Laurent,
> 
> >On Monday 14 October 2013 21:58:50 Valentine wrote:
> >>On 10/14/2013 08:26 PM, Mark Rutland wrote:
> >>>On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> >>>>R-Car Gen2 SoCs have a different PHY which is not compatible
> >>>>with the older R-Car H1 (R8A7779) version.
> >>>>This adds OF/platform device id tables and PHY initialization
> >>>>
> >>>>callbacks for the following Gen2 SoCs:
> >>>>    * R-Car H2: R8A7790;
> >>>>    * R-Car M2: R8A7791.
> >>>>
> >>>>PHY initialization method is chosen, based on the device id.
> >>>>Default PHY settings are applied for Gen2 SoCs, which should
> >>>>suit the Gen2 boards available.
> >>>>
> >>>>The R8A7779 platform code is modified to use "sata-r8a7779"
> >>>>device id.
> >>>>
> >>>>Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >>>>---
> >>>>
> >>>>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >>>>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >>>>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >>>>   drivers/ata/sata_rcar.c                            | 112 +++++++++++---
> >>>>   4 files changed, 102 insertions(+), 19 deletions(-)
> >>>>
> >>>>diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>>>b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
> >>>>2465183..b5a41bf 100644
> >>>>--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>>>+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>>>@@ -1,7 +1,10 @@
> >>>>
> >>>>   * Renesas R-Car SATA
> >>>>
> >>>>   Required properties:
> >>>>-- compatible		: must be "renesas,sata-r8a7779"
> >>>
> >>>>+- compatible		: must be one of the following:
> >>>s/must be/should contain/
> >>>
> >>>>+			  - "renesas,sata-r8a7779" for R-Car H1
> >>>>+			  - "renesas,sata-r8a7790" for R-Car H2
> >>>>+			  - "renesas,sata-r8a7791" for R-Car M2
> >>>
> >>>How do renesas,sata-r8a7790 and renesas,sata-r8a7791 differ?
> >>>
> >>>>   - reg			: address range of the SATA registers.
> >>>
> >>>It's a size too...
> >>>
> >>>>   - interrupt-parent	: interrupt parent controller phandle
> >>>
> >>>Not required.
> >>>
> >>>[...]
> >>>
> >>>>+static struct of_device_id sata_rcar_match[] = {
> >>>>+	{
> >>>>+		.compatible = "renesas,sata-r8a7779",
> >>>>+		.data = (void *)RCAR_GEN1_SATA,
> >>>>+	},
> >>>>+	{
> >>>>+		.compatible = "renesas,sata-r8a7790",
> >>>>+		.data = (void *)RCAR_GEN2_SATA
> >>>>+	},
> >>>>+	{
> >>>>+		.compatible = "renesas,sata-r8a7791",
> >>>>+		.data = (void *)RCAR_GEN2_SATA
> >>>>+	},
> >>>>+	{},
> >>>>+};
> >>>>+MODULE_DEVICE_TABLE(of, sata_rcar_match);
> >>>
> >>>Are the renesas,sata-r8a779x variants identical?
> >>
> >>Yes.
> >>
> >>>If so, why the two strings?
> >>
> >>Just thought the driver should support "renesas,sata-r8a7791"
> >>compatibility as well since it should support both SoCs.
> >>Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.
> >
> >One reason for two compatibility strings is not to be stuck if we later find
> >out the the 7791 SATA controller differs from the 7790.
> >
> 
> Thanks!
> Yeah, anyways, I'd prefer to keep both strings in the device id table.

Yes, I do too, mostly for the reason that Laurent gave.
But also because this is consistent with compatibility strings
for other Renesas IP.

> >>>Could we not require sata-r8a7791 devices to have "sata-r8a7790" in the
> >>>
> >>>compatible list:
> >>>	compatible = "sata-r8a7791", "sata-r8a7790";
> >>>
> >>>That way we can match on "sata-r8a7791" if we want to later, but don't
> >>>need code for it now.
> >>
> >>We could. In this case having compatible = "renesas,sata-r8a7791" would not
> >>be enough, though it looks like a valid compatible list to me.
> >
> >I'm fine with both solution, as long as the "sata-r8a7791" compatibility
> >string is present and has precedence over "sata-r8a7790".
> >
> 
> Thanks,
> Val.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
  2013-10-14 17:19       ` Valentine
@ 2013-10-15  0:25         ` Simon Horman
  -1 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-15  0:25 UTC (permalink / raw)
  To: Valentine
  Cc: Mark Rutland, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On Mon, Oct 14, 2013 at 09:19:37PM +0400, Valentine wrote:
> Hi Mark,
> thanks for looking at this.
> 
> On 10/14/2013 08:13 PM, Mark Rutland wrote:
> >On Mon, Oct 14, 2013 at 04:42:33PM +0100, Valentine Barshak wrote:
> >>This converts the R-Car SATA DT compatibility string to
> >>the <unit>-<soc> format which is the preferred one for
> >>all SH-Mobile devices. The DT bindings are documented.
> >>
> >>Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >>---
> >>  Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
> >>  arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
> >>  drivers/ata/sata_rcar.c                             |  2 +-
> >>  3 files changed, 18 insertions(+), 2 deletions(-)
> >>  create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>
> >>diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>new file mode 100644
> >>index 0000000..2465183
> >>--- /dev/null
> >>+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>@@ -0,0 +1,16 @@
> >>+* Renesas R-Car SATA
> >>+
> >>+Required properties:
> >>+- compatible		: must be "renesas,sata-r8a7779"
> >
> >s/must be/should include/
> >
> 
> OK, thanks.
> 
> >>+- reg			: address range of the SATA registers.
> >
> >Also their size...
> 
> Do you want me to rephrase it to "base address and size of the SATA
> registers"?
> 
> Looks like a lot of other bindings examples available in
> Documentation/devicetree/bindings describe regs property
> as the "address range" which implies the address and size
> of the registers.
> 
> >
> >>+- interrupt-parent	: interrupt parent controller phandle
> >
> >This isn't required as such, as the interrupt-controller can be
> >inherited from the parent. As it's a standard auxiliary property I don't
> >think it needs to be documented here.
> 
> OK, will drop it, thanks.
> 
> >
> >>+- interrupts		: must consist of one interrupt specifier.
> >
> >Is there only one interrupt generated by the device?
> 
> Yes, there's just one IRQ.
> 
> >
> >>+
> >>+Example:
> >>+
> >>+sata: sata@fc600000 {
> >>+	compatible = "renesas,sata-r8a7779";
> >>+	reg = <0xfc600000 0x2000>;
> >>+	interrupt-parent = <&gic>;
> >>+	interrupts = <0 100 0x4>;
> >>+};
> >>diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> >>index da61d27..b1747f5 100644
> >>--- a/arch/arm/boot/dts/r8a7779.dtsi
> >>+++ b/arch/arm/boot/dts/r8a7779.dtsi
> >>@@ -201,7 +201,7 @@
> >>  	};
> >>
> >>  	sata: sata@fc600000 {
> >>-		compatible = "renesas,rcar-sata";
> >>+		compatible = "renesas,sata-r8a7779";
> >>  		reg = <0xfc600000 0x2000>;
> >>  		interrupt-parent = <&gic>;
> >>  		interrupts = <0 100 0x4>;
> >>diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> >>index c2d95e9..c4cd738 100644
> >>--- a/drivers/ata/sata_rcar.c
> >>+++ b/drivers/ata/sata_rcar.c
> >>@@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
> >>  #endif
> >>
> >>  static struct of_device_id sata_rcar_match[] = {
> >>-	{ .compatible = "renesas,rcar-sata", },
> >>+	{ .compatible = "renesas,sata-r8a7779", },
> >>  	{},
> >>  };
> >
> >Why is an existing compatible string being removed?
> >
> >Please do not change existing strings, it will break any dts files that
> >are already in use.
> 
> It won't break the dts files, since I'm changing the only dtsi file
> that uses the SATA node as well. It will only break binary
> compatibility with the older dtb files.

I believe that compatibility with older dtb files is the key issue.

> >While the new compatible string may be preferred, the old string should
> >be kept for compatibility.
> 
> OK, I can keep the old string if it's needed.

FWIW I am doubtful that it is much of an issue in practice.
However, just to be safe, I think it would be bes tto leave
renesas,rcar-sata.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
@ 2013-10-15  0:25         ` Simon Horman
  0 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-15  0:25 UTC (permalink / raw)
  To: Valentine
  Cc: Mark Rutland, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On Mon, Oct 14, 2013 at 09:19:37PM +0400, Valentine wrote:
> Hi Mark,
> thanks for looking at this.
> 
> On 10/14/2013 08:13 PM, Mark Rutland wrote:
> >On Mon, Oct 14, 2013 at 04:42:33PM +0100, Valentine Barshak wrote:
> >>This converts the R-Car SATA DT compatibility string to
> >>the <unit>-<soc> format which is the preferred one for
> >>all SH-Mobile devices. The DT bindings are documented.
> >>
> >>Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >>---
> >>  Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
> >>  arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
> >>  drivers/ata/sata_rcar.c                             |  2 +-
> >>  3 files changed, 18 insertions(+), 2 deletions(-)
> >>  create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>
> >>diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>new file mode 100644
> >>index 0000000..2465183
> >>--- /dev/null
> >>+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>@@ -0,0 +1,16 @@
> >>+* Renesas R-Car SATA
> >>+
> >>+Required properties:
> >>+- compatible		: must be "renesas,sata-r8a7779"
> >
> >s/must be/should include/
> >
> 
> OK, thanks.
> 
> >>+- reg			: address range of the SATA registers.
> >
> >Also their size...
> 
> Do you want me to rephrase it to "base address and size of the SATA
> registers"?
> 
> Looks like a lot of other bindings examples available in
> Documentation/devicetree/bindings describe regs property
> as the "address range" which implies the address and size
> of the registers.
> 
> >
> >>+- interrupt-parent	: interrupt parent controller phandle
> >
> >This isn't required as such, as the interrupt-controller can be
> >inherited from the parent. As it's a standard auxiliary property I don't
> >think it needs to be documented here.
> 
> OK, will drop it, thanks.
> 
> >
> >>+- interrupts		: must consist of one interrupt specifier.
> >
> >Is there only one interrupt generated by the device?
> 
> Yes, there's just one IRQ.
> 
> >
> >>+
> >>+Example:
> >>+
> >>+sata: sata@fc600000 {
> >>+	compatible = "renesas,sata-r8a7779";
> >>+	reg = <0xfc600000 0x2000>;
> >>+	interrupt-parent = <&gic>;
> >>+	interrupts = <0 100 0x4>;
> >>+};
> >>diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> >>index da61d27..b1747f5 100644
> >>--- a/arch/arm/boot/dts/r8a7779.dtsi
> >>+++ b/arch/arm/boot/dts/r8a7779.dtsi
> >>@@ -201,7 +201,7 @@
> >>  	};
> >>
> >>  	sata: sata@fc600000 {
> >>-		compatible = "renesas,rcar-sata";
> >>+		compatible = "renesas,sata-r8a7779";
> >>  		reg = <0xfc600000 0x2000>;
> >>  		interrupt-parent = <&gic>;
> >>  		interrupts = <0 100 0x4>;
> >>diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> >>index c2d95e9..c4cd738 100644
> >>--- a/drivers/ata/sata_rcar.c
> >>+++ b/drivers/ata/sata_rcar.c
> >>@@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
> >>  #endif
> >>
> >>  static struct of_device_id sata_rcar_match[] = {
> >>-	{ .compatible = "renesas,rcar-sata", },
> >>+	{ .compatible = "renesas,sata-r8a7779", },
> >>  	{},
> >>  };
> >
> >Why is an existing compatible string being removed?
> >
> >Please do not change existing strings, it will break any dts files that
> >are already in use.
> 
> It won't break the dts files, since I'm changing the only dtsi file
> that uses the SATA node as well. It will only break binary
> compatibility with the older dtb files.

I believe that compatibility with older dtb files is the key issue.

> >While the new compatible string may be preferred, the old string should
> >be kept for compatibility.
> 
> OK, I can keep the old string if it's needed.

FWIW I am doubtful that it is much of an issue in practice.
However, just to be safe, I think it would be bes tto leave
renesas,rcar-sata.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
  2013-10-15  0:23             ` Simon Horman
@ 2013-10-15  0:32               ` Laurent Pinchart
  -1 siblings, 0 replies; 60+ messages in thread
From: Laurent Pinchart @ 2013-10-15  0:32 UTC (permalink / raw)
  To: Simon Horman
  Cc: Valentine, Mark Rutland, linux-sh, linux-ide, devicetree,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

Hi Simon,

On Tuesday 15 October 2013 09:23:19 Simon Horman wrote:
> On Tue, Oct 15, 2013 at 01:22:23AM +0400, Valentine wrote:
> > On 10/14/2013 10:15 PM, Laurent Pinchart wrote:
> > >On Monday 14 October 2013 21:58:50 Valentine wrote:
> > >>On 10/14/2013 08:26 PM, Mark Rutland wrote:
> > >>>On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> > >>>>R-Car Gen2 SoCs have a different PHY which is not compatible
> > >>>>with the older R-Car H1 (R8A7779) version.
> > >>>>This adds OF/platform device id tables and PHY initialization
> > >>>>
> > >>>>callbacks for the following Gen2 SoCs:
> > >>>>    * R-Car H2: R8A7790;
> > >>>>    * R-Car M2: R8A7791.
> > >>>>
> > >>>>PHY initialization method is chosen, based on the device id.
> > >>>>Default PHY settings are applied for Gen2 SoCs, which should
> > >>>>suit the Gen2 boards available.
> > >>>>
> > >>>>The R8A7779 platform code is modified to use "sata-r8a7779"
> > >>>>device id.
> > >>>>
> > >>>>Signed-off-by: Valentine Barshak
> > >>>><valentine.barshak@cogentembedded.com>
> > >>>>---
> > >>>>
> > >>>>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> > >>>>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> > >>>>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> > >>>>   drivers/ata/sata_rcar.c                            | 112
> > >>>>   +++++++++++---
> > >>>>   4 files changed, 102 insertions(+), 19 deletions(-)
> > >>>>
> > >>>>diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > >>>>b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
> > >>>>2465183..b5a41bf 100644
> > >>>>--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > >>>>+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt

[snip]

> > >>>>+static struct of_device_id sata_rcar_match[] = {
> > >>>>+	{
> > >>>>+		.compatible = "renesas,sata-r8a7779",
> > >>>>+		.data = (void *)RCAR_GEN1_SATA,
> > >>>>+	},
> > >>>>+	{
> > >>>>+		.compatible = "renesas,sata-r8a7790",
> > >>>>+		.data = (void *)RCAR_GEN2_SATA
> > >>>>+	},
> > >>>>+	{
> > >>>>+		.compatible = "renesas,sata-r8a7791",
> > >>>>+		.data = (void *)RCAR_GEN2_SATA
> > >>>>+	},
> > >>>>+	{},
> > >>>>+};
> > >>>>+MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > >>>
> > >>>Are the renesas,sata-r8a779x variants identical?
> > >>
> > >>Yes.
> > >>
> > >>>If so, why the two strings?
> > >>
> > >>Just thought the driver should support "renesas,sata-r8a7791"
> > >>compatibility as well since it should support both SoCs.
> > >>Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.
> > >
> > >One reason for two compatibility strings is not to be stuck if we later
> > >find out the the 7791 SATA controller differs from the 7790.
> > 
> > Thanks!
> > Yeah, anyways, I'd prefer to keep both strings in the device id table.
> 
> Yes, I do too, mostly for the reason that Laurent gave.
> But also because this is consistent with compatibility strings
> for other Renesas IP.

We need to use the 7791 compatibility string in DT, but if we specify both, 
the driver could have a single entry for both SoCs in its device ID table. As 
stated before, I have no strong preference, both would work.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
@ 2013-10-15  0:32               ` Laurent Pinchart
  0 siblings, 0 replies; 60+ messages in thread
From: Laurent Pinchart @ 2013-10-15  0:32 UTC (permalink / raw)
  To: Simon Horman
  Cc: Valentine, Mark Rutland, linux-sh, linux-ide, devicetree,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

Hi Simon,

On Tuesday 15 October 2013 09:23:19 Simon Horman wrote:
> On Tue, Oct 15, 2013 at 01:22:23AM +0400, Valentine wrote:
> > On 10/14/2013 10:15 PM, Laurent Pinchart wrote:
> > >On Monday 14 October 2013 21:58:50 Valentine wrote:
> > >>On 10/14/2013 08:26 PM, Mark Rutland wrote:
> > >>>On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> > >>>>R-Car Gen2 SoCs have a different PHY which is not compatible
> > >>>>with the older R-Car H1 (R8A7779) version.
> > >>>>This adds OF/platform device id tables and PHY initialization
> > >>>>
> > >>>>callbacks for the following Gen2 SoCs:
> > >>>>    * R-Car H2: R8A7790;
> > >>>>    * R-Car M2: R8A7791.
> > >>>>
> > >>>>PHY initialization method is chosen, based on the device id.
> > >>>>Default PHY settings are applied for Gen2 SoCs, which should
> > >>>>suit the Gen2 boards available.
> > >>>>
> > >>>>The R8A7779 platform code is modified to use "sata-r8a7779"
> > >>>>device id.
> > >>>>
> > >>>>Signed-off-by: Valentine Barshak
> > >>>><valentine.barshak@cogentembedded.com>
> > >>>>---
> > >>>>
> > >>>>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> > >>>>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> > >>>>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> > >>>>   drivers/ata/sata_rcar.c                            | 112
> > >>>>   +++++++++++---
> > >>>>   4 files changed, 102 insertions(+), 19 deletions(-)
> > >>>>
> > >>>>diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > >>>>b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
> > >>>>2465183..b5a41bf 100644
> > >>>>--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > >>>>+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt

[snip]

> > >>>>+static struct of_device_id sata_rcar_match[] = {
> > >>>>+	{
> > >>>>+		.compatible = "renesas,sata-r8a7779",
> > >>>>+		.data = (void *)RCAR_GEN1_SATA,
> > >>>>+	},
> > >>>>+	{
> > >>>>+		.compatible = "renesas,sata-r8a7790",
> > >>>>+		.data = (void *)RCAR_GEN2_SATA
> > >>>>+	},
> > >>>>+	{
> > >>>>+		.compatible = "renesas,sata-r8a7791",
> > >>>>+		.data = (void *)RCAR_GEN2_SATA
> > >>>>+	},
> > >>>>+	{},
> > >>>>+};
> > >>>>+MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > >>>
> > >>>Are the renesas,sata-r8a779x variants identical?
> > >>
> > >>Yes.
> > >>
> > >>>If so, why the two strings?
> > >>
> > >>Just thought the driver should support "renesas,sata-r8a7791"
> > >>compatibility as well since it should support both SoCs.
> > >>Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.
> > >
> > >One reason for two compatibility strings is not to be stuck if we later
> > >find out the the 7791 SATA controller differs from the 7790.
> > 
> > Thanks!
> > Yeah, anyways, I'd prefer to keep both strings in the device id table.
> 
> Yes, I do too, mostly for the reason that Laurent gave.
> But also because this is consistent with compatibility strings
> for other Renesas IP.

We need to use the 7791 compatibility string in DT, but if we specify both, 
the driver could have a single entry for both SoCs in its device ID table. As 
stated before, I have no strong preference, both would work.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
  2013-10-14 17:19       ` Valentine
@ 2013-10-15  8:15         ` Mark Rutland
  -1 siblings, 0 replies; 60+ messages in thread
From: Mark Rutland @ 2013-10-15  8:15 UTC (permalink / raw)
  To: Valentine
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On Mon, Oct 14, 2013 at 06:19:37PM +0100, Valentine wrote:
> Hi Mark,
> thanks for looking at this.
> 
> On 10/14/2013 08:13 PM, Mark Rutland wrote:
> > On Mon, Oct 14, 2013 at 04:42:33PM +0100, Valentine Barshak wrote:
> >> This converts the R-Car SATA DT compatibility string to
> >> the <unit>-<soc> format which is the preferred one for
> >> all SH-Mobile devices. The DT bindings are documented.
> >>
> >> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >> ---
> >>   Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
> >>   arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
> >>   drivers/ata/sata_rcar.c                             |  2 +-
> >>   3 files changed, 18 insertions(+), 2 deletions(-)
> >>   create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> new file mode 100644
> >> index 0000000..2465183
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> @@ -0,0 +1,16 @@
> >> +* Renesas R-Car SATA
> >> +
> >> +Required properties:
> >> +- compatible		: must be "renesas,sata-r8a7779"
> >
> > s/must be/should include/
> >
> 
> OK, thanks.

Cheers.

> 
> >> +- reg			: address range of the SATA registers.
> >
> > Also their size...
> 
> Do you want me to rephrase it to "base address and size of the SATA 
> registers"?
> 
> Looks like a lot of other bindings examples available in 
> Documentation/devicetree/bindings describe regs property
> as the "address range" which implies the address and size
> of the registers.

This is unfortunately one area where there isn't any general consensus
on the terminology. I think "base address and size ..." is sufficient --
it maps well to the set of address-cells and size-cells. For reg values
describing MMIO register blocks, ePAPR says "the offsets and lengths of
the memory-mapped IO register blocks", and there's similar wording in
other bindings.

> 
> >
> >> +- interrupt-parent	: interrupt parent controller phandle
> >
> > This isn't required as such, as the interrupt-controller can be
> > inherited from the parent. As it's a standard auxiliary property I don't
> > think it needs to be documented here.
> 
> OK, will drop it, thanks.

Ok.

> 
> >
> >> +- interrupts		: must consist of one interrupt specifier.
> >
> > Is there only one interrupt generated by the device?
> 
> Yes, there's just one IRQ.

Ok.

> 
> >
> >> +
> >> +Example:
> >> +
> >> +sata: sata@fc600000 {
> >> +	compatible = "renesas,sata-r8a7779";
> >> +	reg = <0xfc600000 0x2000>;
> >> +	interrupt-parent = <&gic>;
> >> +	interrupts = <0 100 0x4>;
> >> +};
> >> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> >> index da61d27..b1747f5 100644
> >> --- a/arch/arm/boot/dts/r8a7779.dtsi
> >> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> >> @@ -201,7 +201,7 @@
> >>   	};
> >>
> >>   	sata: sata@fc600000 {
> >> -		compatible = "renesas,rcar-sata";
> >> +		compatible = "renesas,sata-r8a7779";
> >>   		reg = <0xfc600000 0x2000>;
> >>   		interrupt-parent = <&gic>;
> >>   		interrupts = <0 100 0x4>;
> >> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> >> index c2d95e9..c4cd738 100644
> >> --- a/drivers/ata/sata_rcar.c
> >> +++ b/drivers/ata/sata_rcar.c
> >> @@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
> >>   #endif
> >>
> >>   static struct of_device_id sata_rcar_match[] = {
> >> -	{ .compatible = "renesas,rcar-sata", },
> >> +	{ .compatible = "renesas,sata-r8a7779", },
> >>   	{},
> >>   };
> >
> > Why is an existing compatible string being removed?
> >
> > Please do not change existing strings, it will break any dts files that
> > are already in use.
> 
> It won't break the dts files, since I'm changing the only dtsi file that 
> uses the SATA node as well. It will only break binary compatibility with 
> the older dtb files.

Why should an existing dtb suddenly stop working?

What if someone has an out-of-tree dts?

> 
> >
> > While the new compatible string may be preferred, the old string should
> > be kept for compatibility.
> 
> OK, I can keep the old string if it's needed.

Please do.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
@ 2013-10-15  8:15         ` Mark Rutland
  0 siblings, 0 replies; 60+ messages in thread
From: Mark Rutland @ 2013-10-15  8:15 UTC (permalink / raw)
  To: Valentine
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo

On Mon, Oct 14, 2013 at 06:19:37PM +0100, Valentine wrote:
> Hi Mark,
> thanks for looking at this.
> 
> On 10/14/2013 08:13 PM, Mark Rutland wrote:
> > On Mon, Oct 14, 2013 at 04:42:33PM +0100, Valentine Barshak wrote:
> >> This converts the R-Car SATA DT compatibility string to
> >> the <unit>-<soc> format which is the preferred one for
> >> all SH-Mobile devices. The DT bindings are documented.
> >>
> >> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >> ---
> >>   Documentation/devicetree/bindings/ata/sata_rcar.txt | 16 ++++++++++++++++
> >>   arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
> >>   drivers/ata/sata_rcar.c                             |  2 +-
> >>   3 files changed, 18 insertions(+), 2 deletions(-)
> >>   create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> new file mode 100644
> >> index 0000000..2465183
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> @@ -0,0 +1,16 @@
> >> +* Renesas R-Car SATA
> >> +
> >> +Required properties:
> >> +- compatible		: must be "renesas,sata-r8a7779"
> >
> > s/must be/should include/
> >
> 
> OK, thanks.

Cheers.

> 
> >> +- reg			: address range of the SATA registers.
> >
> > Also their size...
> 
> Do you want me to rephrase it to "base address and size of the SATA 
> registers"?
> 
> Looks like a lot of other bindings examples available in 
> Documentation/devicetree/bindings describe regs property
> as the "address range" which implies the address and size
> of the registers.

This is unfortunately one area where there isn't any general consensus
on the terminology. I think "base address and size ..." is sufficient --
it maps well to the set of address-cells and size-cells. For reg values
describing MMIO register blocks, ePAPR says "the offsets and lengths of
the memory-mapped IO register blocks", and there's similar wording in
other bindings.

> 
> >
> >> +- interrupt-parent	: interrupt parent controller phandle
> >
> > This isn't required as such, as the interrupt-controller can be
> > inherited from the parent. As it's a standard auxiliary property I don't
> > think it needs to be documented here.
> 
> OK, will drop it, thanks.

Ok.

> 
> >
> >> +- interrupts		: must consist of one interrupt specifier.
> >
> > Is there only one interrupt generated by the device?
> 
> Yes, there's just one IRQ.

Ok.

> 
> >
> >> +
> >> +Example:
> >> +
> >> +sata: sata@fc600000 {
> >> +	compatible = "renesas,sata-r8a7779";
> >> +	reg = <0xfc600000 0x2000>;
> >> +	interrupt-parent = <&gic>;
> >> +	interrupts = <0 100 0x4>;
> >> +};
> >> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> >> index da61d27..b1747f5 100644
> >> --- a/arch/arm/boot/dts/r8a7779.dtsi
> >> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> >> @@ -201,7 +201,7 @@
> >>   	};
> >>
> >>   	sata: sata@fc600000 {
> >> -		compatible = "renesas,rcar-sata";
> >> +		compatible = "renesas,sata-r8a7779";
> >>   		reg = <0xfc600000 0x2000>;
> >>   		interrupt-parent = <&gic>;
> >>   		interrupts = <0 100 0x4>;
> >> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> >> index c2d95e9..c4cd738 100644
> >> --- a/drivers/ata/sata_rcar.c
> >> +++ b/drivers/ata/sata_rcar.c
> >> @@ -893,7 +893,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
> >>   #endif
> >>
> >>   static struct of_device_id sata_rcar_match[] = {
> >> -	{ .compatible = "renesas,rcar-sata", },
> >> +	{ .compatible = "renesas,sata-r8a7779", },
> >>   	{},
> >>   };
> >
> > Why is an existing compatible string being removed?
> >
> > Please do not change existing strings, it will break any dts files that
> > are already in use.
> 
> It won't break the dts files, since I'm changing the only dtsi file that 
> uses the SATA node as well. It will only break binary compatibility with 
> the older dtb files.

Why should an existing dtb suddenly stop working?

What if someone has an out-of-tree dts?

> 
> >
> > While the new compatible string may be preferred, the old string should
> > be kept for compatibility.
> 
> OK, I can keep the old string if it's needed.

Please do.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support (take 2)
@ 2013-10-15 10:20   ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-15 10:20 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This modifies and documents R-Car SATA device tree (DT) bindings.
The "sata-<SoC>" format is now used for the "compatible" property.
Also, a platform device id table is introduced for non-DT support.
The device id naming is consistent with the "compatible" DT
property format.

R-Car Gen2 SATA PHY support is added. PHY initialization method
is chosen, based on the device id.

Changes from the previous version:
* Kept old DT bindings for compatibility
* Amended DT bindings documentation

Valentine Barshak (2):
  sata_rcar: Adjust and document device tree bindings
  sata_rcar: Add R-Car Gen2 SATA support

 .../devicetree/bindings/ata/sata_rcar.txt          |  19 ++++
 arch/arm/boot/dts/r8a7779.dtsi                     |   2 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
 5 files changed, 118 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support (take 2)
@ 2013-10-15 10:20   ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-15 10:20 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This modifies and documents R-Car SATA device tree (DT) bindings.
The "sata-<SoC>" format is now used for the "compatible" property.
Also, a platform device id table is introduced for non-DT support.
The device id naming is consistent with the "compatible" DT
property format.

R-Car Gen2 SATA PHY support is added. PHY initialization method
is chosen, based on the device id.

Changes from the previous version:
* Kept old DT bindings for compatibility
* Amended DT bindings documentation

Valentine Barshak (2):
  sata_rcar: Adjust and document device tree bindings
  sata_rcar: Add R-Car Gen2 SATA support

 .../devicetree/bindings/ata/sata_rcar.txt          |  19 ++++
 arch/arm/boot/dts/r8a7779.dtsi                     |   2 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
 5 files changed, 118 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
  2013-10-15 10:20   ` Valentine Barshak
@ 2013-10-15 10:20     ` Valentine Barshak
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-15 10:20 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This deprecates the "rcar-sata" compatibility string
and adds the "sata-r8a7779" which complies to the
preferred <unit>-<soc> format for SH-Mobile devices.
The DT bindings are documented.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 Documentation/devicetree/bindings/ata/sata_rcar.txt | 15 +++++++++++++++
 arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
 drivers/ata/sata_rcar.c                             |  3 ++-
 3 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
new file mode 100644
index 0000000..0719115
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -0,0 +1,15 @@
+* Renesas R-Car SATA
+
+Required properties:
+- compatible		: should contain "renesas,sata-r8a7779";
+- reg			: offset and length of the SATA registers;
+- interrupts		: must consist of one interrupt specifier.
+
+Example:
+
+sata: sata@fc600000 {
+	compatible = "renesas,sata-r8a7779";
+	reg = <0xfc600000 0x2000>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 100 0x4>;
+};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index da61d27..b1747f5 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -201,7 +201,7 @@
 	};
 
 	sata: sata@fc600000 {
-		compatible = "renesas,rcar-sata";
+		compatible = "renesas,sata-r8a7779";
 		reg = <0xfc600000 0x2000>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 100 0x4>;
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index c2d95e9..a625cc5 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -893,7 +893,8 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 #endif
 
 static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },
+	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
+	{ .compatible = "renesas,sata-r8a7779", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sata_rcar_match);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
@ 2013-10-15 10:20     ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-15 10:20 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This deprecates the "rcar-sata" compatibility string
and adds the "sata-r8a7779" which complies to the
preferred <unit>-<soc> format for SH-Mobile devices.
The DT bindings are documented.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 Documentation/devicetree/bindings/ata/sata_rcar.txt | 15 +++++++++++++++
 arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
 drivers/ata/sata_rcar.c                             |  3 ++-
 3 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
new file mode 100644
index 0000000..0719115
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -0,0 +1,15 @@
+* Renesas R-Car SATA
+
+Required properties:
+- compatible		: should contain "renesas,sata-r8a7779";
+- reg			: offset and length of the SATA registers;
+- interrupts		: must consist of one interrupt specifier.
+
+Example:
+
+sata: sata@fc600000 {
+	compatible = "renesas,sata-r8a7779";
+	reg = <0xfc600000 0x2000>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 100 0x4>;
+};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index da61d27..b1747f5 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -201,7 +201,7 @@
 	};
 
 	sata: sata@fc600000 {
-		compatible = "renesas,rcar-sata";
+		compatible = "renesas,sata-r8a7779";
 		reg = <0xfc600000 0x2000>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 100 0x4>;
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index c2d95e9..a625cc5 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -893,7 +893,8 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 #endif
 
 static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },
+	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
+	{ .compatible = "renesas,sata-r8a7779", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sata_rcar_match);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-15 10:20   ` Valentine Barshak
@ 2013-10-15 10:20     ` Valentine Barshak
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-15 10:20 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

R-Car Gen2 SoCs have a different PHY which is not compatible
with the older R-Car H1 (R8A7779) version.
This adds OF/platform device id tables and PHY initialization
callbacks for the following Gen2 SoCs:
  * R-Car H2: R8A7790;
  * R-Car M2: R8A7791.

PHY initialization method is chosen based on the device id.
Default PHY settings are applied for Gen2 SoCs, which should
suit the Gen2 boards available.

The R8A7779 platform code is modified to use "sata-r8a7779"
device name.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
 4 files changed, 107 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
index 0719115..d6b20a6 100644
--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -1,7 +1,10 @@
 * Renesas R-Car SATA
 
 Required properties:
-- compatible		: should contain "renesas,sata-r8a7779";
+- compatible		: should contain one of the following:
+			  - "renesas,sata-r8a7779" for R-Car H1
+			  - "renesas,sata-r8a7790" for R-Car H2
+			  - "renesas,sata-r8a7791" for R-Car M2
 - reg			: offset and length of the SATA registers;
 - interrupts		: must consist of one interrupt specifier.
 
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index badb8b7..6593237 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
 	/* MSTP32 clocks */
 	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
 	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
-	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
+	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
 	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
 	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
 	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 13049e9..6aac99e 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
 };
 
 static struct platform_device sata_device = {
-	.name		= "sata_rcar",
+	.name		= "sata-r8a7779",
 	.id		= -1,
 	.resource	= sata_resources,
 	.num_resources	= ARRAY_SIZE(sata_resources),
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index a625cc5..068d5b4 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/ata.h>
 #include <linux/libata.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
@@ -123,12 +124,37 @@
 
 #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
 
+/* Gen2 Physical Layer Control Registers */
+#define RCAR_GEN2_PHY_CTL1_REG		0x1704
+#define RCAR_GEN2_PHY_CTL1		0x34180002
+#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
+
+#define RCAR_GEN2_PHY_CTL2_REG		0x170C
+#define RCAR_GEN2_PHY_CTL2		0x00002303
+
+#define RCAR_GEN2_PHY_CTL3_REG		0x171C
+#define RCAR_GEN2_PHY_CTL3		0x000B0194
+
+#define RCAR_GEN2_PHY_CTL4_REG		0x1724
+#define RCAR_GEN2_PHY_CTL4		0x00030994
+
+#define RCAR_GEN2_PHY_CTL5_REG		0x1740
+#define RCAR_GEN2_PHY_CTL5		0x03004001
+#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
+#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
+
+enum sata_rcar_type {
+	RCAR_GEN1_SATA,
+	RCAR_GEN2_SATA,
+};
+
 struct sata_rcar_priv {
 	void __iomem *base;
 	struct clk *clk;
+	enum sata_rcar_type type;
 };
 
-static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
+static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
 {
 	void __iomem *base = priv->base;
 
@@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
 	iowrite32(0, base + SATAPHYRESET_REG);
 }
 
-static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
-				int group)
+static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
+				     u32 val, int group)
 {
 	void __iomem *base = priv->base;
 	int timeout;
@@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
 	iowrite32(0, base + SATAPHYADDR_REG);
 }
 
+static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
+{
+	sata_rcar_gen1_phy_preinit(priv);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+}
+
+static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
+{
+	void __iomem *base = priv->base;
+
+	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
+		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
+}
+
 static void sata_rcar_freeze(struct ata_port *ap)
 {
 	struct sata_rcar_priv *priv = ap->host->private_data;
@@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	u32 val;
 
 	/* reset and setup phy */
-	sata_rcar_phy_initialize(priv);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+	switch (priv->type) {
+	case RCAR_GEN1_SATA:
+		sata_rcar_gen1_phy_init(priv);
+		break;
+	case RCAR_GEN2_SATA:
+		sata_rcar_gen2_phy_init(priv);
+		break;
+	default:
+		dev_warn(host->dev, "SATA phy is not initialized\n");
+		break;
+	}
 
 	/* SATA-IP reset state */
 	val = ioread32(base + ATAPI_CONTROL1_REG);
@@ -770,8 +823,39 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
 }
 
+static struct of_device_id sata_rcar_match[] = {
+	/* Deprecated, "renesas,sata-r8a7779" should be used instead. */
+	{
+		.compatible = "renesas,rcar-sata",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7779",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7790",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{
+		.compatible = "renesas,sata-r8a7791",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, sata_rcar_match);
+
+static const struct platform_device_id sata_rcar_id_table[] = {
+	{ "sata-r8a7779", RCAR_GEN1_SATA },
+	{ "sata-r8a7790", RCAR_GEN2_SATA },
+	{ "sata-r8a7791", RCAR_GEN2_SATA },
+	{ },
+};
+MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
+
 static int sata_rcar_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id;
 	struct ata_host *host;
 	struct sata_rcar_priv *priv;
 	struct resource *mem;
@@ -787,6 +871,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
+	of_id = of_match_device(sata_rcar_match, &pdev->dev);
+	if (of_id)
+		priv->type = (enum sata_rcar_type)of_id->data;
+	else
+		priv->type = platform_get_device_id(pdev)->driver_data;
+
 	priv->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->clk)) {
 		dev_err(&pdev->dev, "failed to get access to sata clock\n");
@@ -892,16 +982,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 };
 #endif
 
-static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
-	{ .compatible = "renesas,sata-r8a7779", },
-	{},
-};
-MODULE_DEVICE_TABLE(of, sata_rcar_match);
-
 static struct platform_driver sata_rcar_driver = {
 	.probe		= sata_rcar_probe,
 	.remove		= sata_rcar_remove,
+	.id_table	= sata_rcar_id_table,
 	.driver = {
 		.name		= DRV_NAME,
 		.owner		= THIS_MODULE,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-15 10:20     ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-15 10:20 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

R-Car Gen2 SoCs have a different PHY which is not compatible
with the older R-Car H1 (R8A7779) version.
This adds OF/platform device id tables and PHY initialization
callbacks for the following Gen2 SoCs:
  * R-Car H2: R8A7790;
  * R-Car M2: R8A7791.

PHY initialization method is chosen based on the device id.
Default PHY settings are applied for Gen2 SoCs, which should
suit the Gen2 boards available.

The R8A7779 platform code is modified to use "sata-r8a7779"
device name.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
 4 files changed, 107 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
index 0719115..d6b20a6 100644
--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -1,7 +1,10 @@
 * Renesas R-Car SATA
 
 Required properties:
-- compatible		: should contain "renesas,sata-r8a7779";
+- compatible		: should contain one of the following:
+			  - "renesas,sata-r8a7779" for R-Car H1
+			  - "renesas,sata-r8a7790" for R-Car H2
+			  - "renesas,sata-r8a7791" for R-Car M2
 - reg			: offset and length of the SATA registers;
 - interrupts		: must consist of one interrupt specifier.
 
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index badb8b7..6593237 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
 	/* MSTP32 clocks */
 	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
 	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
-	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
+	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
 	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
 	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
 	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 13049e9..6aac99e 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
 };
 
 static struct platform_device sata_device = {
-	.name		= "sata_rcar",
+	.name		= "sata-r8a7779",
 	.id		= -1,
 	.resource	= sata_resources,
 	.num_resources	= ARRAY_SIZE(sata_resources),
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index a625cc5..068d5b4 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/ata.h>
 #include <linux/libata.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
@@ -123,12 +124,37 @@
 
 #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
 
+/* Gen2 Physical Layer Control Registers */
+#define RCAR_GEN2_PHY_CTL1_REG		0x1704
+#define RCAR_GEN2_PHY_CTL1		0x34180002
+#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
+
+#define RCAR_GEN2_PHY_CTL2_REG		0x170C
+#define RCAR_GEN2_PHY_CTL2		0x00002303
+
+#define RCAR_GEN2_PHY_CTL3_REG		0x171C
+#define RCAR_GEN2_PHY_CTL3		0x000B0194
+
+#define RCAR_GEN2_PHY_CTL4_REG		0x1724
+#define RCAR_GEN2_PHY_CTL4		0x00030994
+
+#define RCAR_GEN2_PHY_CTL5_REG		0x1740
+#define RCAR_GEN2_PHY_CTL5		0x03004001
+#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
+#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
+
+enum sata_rcar_type {
+	RCAR_GEN1_SATA,
+	RCAR_GEN2_SATA,
+};
+
 struct sata_rcar_priv {
 	void __iomem *base;
 	struct clk *clk;
+	enum sata_rcar_type type;
 };
 
-static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
+static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
 {
 	void __iomem *base = priv->base;
 
@@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
 	iowrite32(0, base + SATAPHYRESET_REG);
 }
 
-static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
-				int group)
+static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
+				     u32 val, int group)
 {
 	void __iomem *base = priv->base;
 	int timeout;
@@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
 	iowrite32(0, base + SATAPHYADDR_REG);
 }
 
+static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
+{
+	sata_rcar_gen1_phy_preinit(priv);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+}
+
+static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
+{
+	void __iomem *base = priv->base;
+
+	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
+		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
+}
+
 static void sata_rcar_freeze(struct ata_port *ap)
 {
 	struct sata_rcar_priv *priv = ap->host->private_data;
@@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	u32 val;
 
 	/* reset and setup phy */
-	sata_rcar_phy_initialize(priv);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+	switch (priv->type) {
+	case RCAR_GEN1_SATA:
+		sata_rcar_gen1_phy_init(priv);
+		break;
+	case RCAR_GEN2_SATA:
+		sata_rcar_gen2_phy_init(priv);
+		break;
+	default:
+		dev_warn(host->dev, "SATA phy is not initialized\n");
+		break;
+	}
 
 	/* SATA-IP reset state */
 	val = ioread32(base + ATAPI_CONTROL1_REG);
@@ -770,8 +823,39 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
 }
 
+static struct of_device_id sata_rcar_match[] = {
+	/* Deprecated, "renesas,sata-r8a7779" should be used instead. */
+	{
+		.compatible = "renesas,rcar-sata",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7779",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7790",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{
+		.compatible = "renesas,sata-r8a7791",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, sata_rcar_match);
+
+static const struct platform_device_id sata_rcar_id_table[] = {
+	{ "sata-r8a7779", RCAR_GEN1_SATA },
+	{ "sata-r8a7790", RCAR_GEN2_SATA },
+	{ "sata-r8a7791", RCAR_GEN2_SATA },
+	{ },
+};
+MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
+
 static int sata_rcar_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id;
 	struct ata_host *host;
 	struct sata_rcar_priv *priv;
 	struct resource *mem;
@@ -787,6 +871,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
+	of_id = of_match_device(sata_rcar_match, &pdev->dev);
+	if (of_id)
+		priv->type = (enum sata_rcar_type)of_id->data;
+	else
+		priv->type = platform_get_device_id(pdev)->driver_data;
+
 	priv->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->clk)) {
 		dev_err(&pdev->dev, "failed to get access to sata clock\n");
@@ -892,16 +982,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 };
 #endif
 
-static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
-	{ .compatible = "renesas,sata-r8a7779", },
-	{},
-};
-MODULE_DEVICE_TABLE(of, sata_rcar_match);
-
 static struct platform_driver sata_rcar_driver = {
 	.probe		= sata_rcar_probe,
 	.remove		= sata_rcar_remove,
+	.id_table	= sata_rcar_id_table,
 	.driver = {
 		.name		= DRV_NAME,
 		.owner		= THIS_MODULE,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* Re: [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support (take 2)
  2013-10-15 10:20   ` Valentine Barshak
@ 2013-10-15 12:40     ` Tejun Heo
  -1 siblings, 0 replies; 60+ messages in thread
From: Tejun Heo @ 2013-10-15 12:40 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Mark Rutland

On Tue, Oct 15, 2013 at 02:20:05PM +0400, Valentine Barshak wrote:
> This modifies and documents R-Car SATA device tree (DT) bindings.
> The "sata-<SoC>" format is now used for the "compatible" property.
> Also, a platform device id table is introduced for non-DT support.
> The device id naming is consistent with the "compatible" DT
> property format.
> 
> R-Car Gen2 SATA PHY support is added. PHY initialization method
> is chosen, based on the device id.
> 
> Changes from the previous version:
> * Kept old DT bindings for compatibility
> * Amended DT bindings documentation
> 
> Valentine Barshak (2):
>   sata_rcar: Adjust and document device tree bindings
>   sata_rcar: Add R-Car Gen2 SATA support

Is this about ready yet?  I'll wait for acks before applying these
patches.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support (take 2)
@ 2013-10-15 12:40     ` Tejun Heo
  0 siblings, 0 replies; 60+ messages in thread
From: Tejun Heo @ 2013-10-15 12:40 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Simon Horman, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Mark Rutland

On Tue, Oct 15, 2013 at 02:20:05PM +0400, Valentine Barshak wrote:
> This modifies and documents R-Car SATA device tree (DT) bindings.
> The "sata-<SoC>" format is now used for the "compatible" property.
> Also, a platform device id table is introduced for non-DT support.
> The device id naming is consistent with the "compatible" DT
> property format.
> 
> R-Car Gen2 SATA PHY support is added. PHY initialization method
> is chosen, based on the device id.
> 
> Changes from the previous version:
> * Kept old DT bindings for compatibility
> * Amended DT bindings documentation
> 
> Valentine Barshak (2):
>   sata_rcar: Adjust and document device tree bindings
>   sata_rcar: Add R-Car Gen2 SATA support

Is this about ready yet?  I'll wait for acks before applying these
patches.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
  2013-10-15 10:20     ` Valentine Barshak
@ 2013-10-16  0:42       ` Simon Horman
  -1 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-16  0:42 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Magnus Damm, Vladimir Barinov,
	Sergei Shtylyov, Kuninori Morimoto, Laurent Pinchart,
	Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Tue, Oct 15, 2013 at 02:20:06PM +0400, Valentine Barshak wrote:
> This deprecates the "rcar-sata" compatibility string
> and adds the "sata-r8a7779" which complies to the
> preferred <unit>-<soc> format for SH-Mobile devices.
> The DT bindings are documented.
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  Documentation/devicetree/bindings/ata/sata_rcar.txt | 15 +++++++++++++++
>  arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
>  drivers/ata/sata_rcar.c                             |  3 ++-
>  3 files changed, 18 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
> 
> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> new file mode 100644
> index 0000000..0719115
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> @@ -0,0 +1,15 @@
> +* Renesas R-Car SATA
> +
> +Required properties:
> +- compatible		: should contain "renesas,sata-r8a7779";
> +- reg			: offset and length of the SATA registers;
> +- interrupts		: must consist of one interrupt specifier.
> +
> +Example:
> +
> +sata: sata@fc600000 {
> +	compatible = "renesas,sata-r8a7779";
> +	reg = <0xfc600000 0x2000>;
> +	interrupt-parent = <&gic>;
> +	interrupts = <0 100 0x4>;
> +};
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> index da61d27..b1747f5 100644
> --- a/arch/arm/boot/dts/r8a7779.dtsi
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -201,7 +201,7 @@
>  	};
>  
>  	sata: sata@fc600000 {
> -		compatible = "renesas,rcar-sata";
> +		compatible = "renesas,sata-r8a7779";
>  		reg = <0xfc600000 0x2000>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 100 0x4>;

I think that I would prefer it if the above hunk was submitted
as a patch after the rest of the series has been merged.
After all, renesas,rcar-sata will remain usable exactly for
the purpose of backwards-compatibility. So there is no need
for an atomic change across different subsystems.

> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> index c2d95e9..a625cc5 100644
> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -893,7 +893,8 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>  #endif
>  
>  static struct of_device_id sata_rcar_match[] = {
> -	{ .compatible = "renesas,rcar-sata", },
> +	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
> +	{ .compatible = "renesas,sata-r8a7779", },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, sata_rcar_match);
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
@ 2013-10-16  0:42       ` Simon Horman
  0 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-16  0:42 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Magnus Damm, Vladimir Barinov,
	Sergei Shtylyov, Kuninori Morimoto, Laurent Pinchart,
	Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Tue, Oct 15, 2013 at 02:20:06PM +0400, Valentine Barshak wrote:
> This deprecates the "rcar-sata" compatibility string
> and adds the "sata-r8a7779" which complies to the
> preferred <unit>-<soc> format for SH-Mobile devices.
> The DT bindings are documented.
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  Documentation/devicetree/bindings/ata/sata_rcar.txt | 15 +++++++++++++++
>  arch/arm/boot/dts/r8a7779.dtsi                      |  2 +-
>  drivers/ata/sata_rcar.c                             |  3 ++-
>  3 files changed, 18 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt
> 
> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> new file mode 100644
> index 0000000..0719115
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> @@ -0,0 +1,15 @@
> +* Renesas R-Car SATA
> +
> +Required properties:
> +- compatible		: should contain "renesas,sata-r8a7779";
> +- reg			: offset and length of the SATA registers;
> +- interrupts		: must consist of one interrupt specifier.
> +
> +Example:
> +
> +sata: sata@fc600000 {
> +	compatible = "renesas,sata-r8a7779";
> +	reg = <0xfc600000 0x2000>;
> +	interrupt-parent = <&gic>;
> +	interrupts = <0 100 0x4>;
> +};
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> index da61d27..b1747f5 100644
> --- a/arch/arm/boot/dts/r8a7779.dtsi
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -201,7 +201,7 @@
>  	};
>  
>  	sata: sata@fc600000 {
> -		compatible = "renesas,rcar-sata";
> +		compatible = "renesas,sata-r8a7779";
>  		reg = <0xfc600000 0x2000>;
>  		interrupt-parent = <&gic>;
>  		interrupts = <0 100 0x4>;

I think that I would prefer it if the above hunk was submitted
as a patch after the rest of the series has been merged.
After all, renesas,rcar-sata will remain usable exactly for
the purpose of backwards-compatibility. So there is no need
for an atomic change across different subsystems.

> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> index c2d95e9..a625cc5 100644
> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -893,7 +893,8 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>  #endif
>  
>  static struct of_device_id sata_rcar_match[] = {
> -	{ .compatible = "renesas,rcar-sata", },
> +	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
> +	{ .compatible = "renesas,sata-r8a7779", },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, sata_rcar_match);
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
  2013-10-15  0:32               ` Laurent Pinchart
@ 2013-10-16  6:10                 ` Simon Horman
  -1 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-16  6:10 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Valentine, Mark Rutland, linux-sh, linux-ide, devicetree,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

On Tue, Oct 15, 2013 at 02:32:28AM +0200, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Tuesday 15 October 2013 09:23:19 Simon Horman wrote:
> > On Tue, Oct 15, 2013 at 01:22:23AM +0400, Valentine wrote:
> > > On 10/14/2013 10:15 PM, Laurent Pinchart wrote:
> > > >On Monday 14 October 2013 21:58:50 Valentine wrote:
> > > >>On 10/14/2013 08:26 PM, Mark Rutland wrote:
> > > >>>On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> > > >>>>R-Car Gen2 SoCs have a different PHY which is not compatible
> > > >>>>with the older R-Car H1 (R8A7779) version.
> > > >>>>This adds OF/platform device id tables and PHY initialization
> > > >>>>
> > > >>>>callbacks for the following Gen2 SoCs:
> > > >>>>    * R-Car H2: R8A7790;
> > > >>>>    * R-Car M2: R8A7791.
> > > >>>>
> > > >>>>PHY initialization method is chosen, based on the device id.
> > > >>>>Default PHY settings are applied for Gen2 SoCs, which should
> > > >>>>suit the Gen2 boards available.
> > > >>>>
> > > >>>>The R8A7779 platform code is modified to use "sata-r8a7779"
> > > >>>>device id.
> > > >>>>
> > > >>>>Signed-off-by: Valentine Barshak
> > > >>>><valentine.barshak@cogentembedded.com>
> > > >>>>---
> > > >>>>
> > > >>>>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> > > >>>>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> > > >>>>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> > > >>>>   drivers/ata/sata_rcar.c                            | 112
> > > >>>>   +++++++++++---
> > > >>>>   4 files changed, 102 insertions(+), 19 deletions(-)
> > > >>>>
> > > >>>>diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > > >>>>b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
> > > >>>>2465183..b5a41bf 100644
> > > >>>>--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > > >>>>+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> 
> [snip]
> 
> > > >>>>+static struct of_device_id sata_rcar_match[] = {
> > > >>>>+	{
> > > >>>>+		.compatible = "renesas,sata-r8a7779",
> > > >>>>+		.data = (void *)RCAR_GEN1_SATA,
> > > >>>>+	},
> > > >>>>+	{
> > > >>>>+		.compatible = "renesas,sata-r8a7790",
> > > >>>>+		.data = (void *)RCAR_GEN2_SATA
> > > >>>>+	},
> > > >>>>+	{
> > > >>>>+		.compatible = "renesas,sata-r8a7791",
> > > >>>>+		.data = (void *)RCAR_GEN2_SATA
> > > >>>>+	},
> > > >>>>+	{},
> > > >>>>+};
> > > >>>>+MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > > >>>
> > > >>>Are the renesas,sata-r8a779x variants identical?
> > > >>
> > > >>Yes.
> > > >>
> > > >>>If so, why the two strings?
> > > >>
> > > >>Just thought the driver should support "renesas,sata-r8a7791"
> > > >>compatibility as well since it should support both SoCs.
> > > >>Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.
> > > >
> > > >One reason for two compatibility strings is not to be stuck if we later
> > > >find out the the 7791 SATA controller differs from the 7790.
> > > 
> > > Thanks!
> > > Yeah, anyways, I'd prefer to keep both strings in the device id table.
> > 
> > Yes, I do too, mostly for the reason that Laurent gave.
> > But also because this is consistent with compatibility strings
> > for other Renesas IP.
> 
> We need to use the 7791 compatibility string in DT, but if we specify both, 
> the driver could have a single entry for both SoCs in its device ID table. As 
> stated before, I have no strong preference, both would work.

Thanks, I understand.

At this stage I don't have a strong preference either.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support
@ 2013-10-16  6:10                 ` Simon Horman
  0 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-16  6:10 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Valentine, Mark Rutland, linux-sh, linux-ide, devicetree,
	Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Guennadi Liakhovetski, Tejun Heo

On Tue, Oct 15, 2013 at 02:32:28AM +0200, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Tuesday 15 October 2013 09:23:19 Simon Horman wrote:
> > On Tue, Oct 15, 2013 at 01:22:23AM +0400, Valentine wrote:
> > > On 10/14/2013 10:15 PM, Laurent Pinchart wrote:
> > > >On Monday 14 October 2013 21:58:50 Valentine wrote:
> > > >>On 10/14/2013 08:26 PM, Mark Rutland wrote:
> > > >>>On Mon, Oct 14, 2013 at 04:42:34PM +0100, Valentine Barshak wrote:
> > > >>>>R-Car Gen2 SoCs have a different PHY which is not compatible
> > > >>>>with the older R-Car H1 (R8A7779) version.
> > > >>>>This adds OF/platform device id tables and PHY initialization
> > > >>>>
> > > >>>>callbacks for the following Gen2 SoCs:
> > > >>>>    * R-Car H2: R8A7790;
> > > >>>>    * R-Car M2: R8A7791.
> > > >>>>
> > > >>>>PHY initialization method is chosen, based on the device id.
> > > >>>>Default PHY settings are applied for Gen2 SoCs, which should
> > > >>>>suit the Gen2 boards available.
> > > >>>>
> > > >>>>The R8A7779 platform code is modified to use "sata-r8a7779"
> > > >>>>device id.
> > > >>>>
> > > >>>>Signed-off-by: Valentine Barshak
> > > >>>><valentine.barshak@cogentembedded.com>
> > > >>>>---
> > > >>>>
> > > >>>>   .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> > > >>>>   arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> > > >>>>   arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> > > >>>>   drivers/ata/sata_rcar.c                            | 112
> > > >>>>   +++++++++++---
> > > >>>>   4 files changed, 102 insertions(+), 19 deletions(-)
> > > >>>>
> > > >>>>diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > > >>>>b/Documentation/devicetree/bindings/ata/sata_rcar.txt index
> > > >>>>2465183..b5a41bf 100644
> > > >>>>--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > > >>>>+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> 
> [snip]
> 
> > > >>>>+static struct of_device_id sata_rcar_match[] = {
> > > >>>>+	{
> > > >>>>+		.compatible = "renesas,sata-r8a7779",
> > > >>>>+		.data = (void *)RCAR_GEN1_SATA,
> > > >>>>+	},
> > > >>>>+	{
> > > >>>>+		.compatible = "renesas,sata-r8a7790",
> > > >>>>+		.data = (void *)RCAR_GEN2_SATA
> > > >>>>+	},
> > > >>>>+	{
> > > >>>>+		.compatible = "renesas,sata-r8a7791",
> > > >>>>+		.data = (void *)RCAR_GEN2_SATA
> > > >>>>+	},
> > > >>>>+	{},
> > > >>>>+};
> > > >>>>+MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > > >>>
> > > >>>Are the renesas,sata-r8a779x variants identical?
> > > >>
> > > >>Yes.
> > > >>
> > > >>>If so, why the two strings?
> > > >>
> > > >>Just thought the driver should support "renesas,sata-r8a7791"
> > > >>compatibility as well since it should support both SoCs.
> > > >>Didn't want to force sata-r8a7790 compatibility for the r8a7791 SoC DTS.
> > > >
> > > >One reason for two compatibility strings is not to be stuck if we later
> > > >find out the the 7791 SATA controller differs from the 7790.
> > > 
> > > Thanks!
> > > Yeah, anyways, I'd prefer to keep both strings in the device id table.
> > 
> > Yes, I do too, mostly for the reason that Laurent gave.
> > But also because this is consistent with compatibility strings
> > for other Renesas IP.
> 
> We need to use the 7791 compatibility string in DT, but if we specify both, 
> the driver could have a single entry for both SoCs in its device ID table. As 
> stated before, I have no strong preference, both would work.

Thanks, I understand.

At this stage I don't have a strong preference either.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support (take 3)
@ 2013-10-16 12:05   ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-16 12:05 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This modifies and documents R-Car SATA device tree (DT) bindings.
The "sata-<SoC>" format is now used for the "compatible" property.
Also, a platform device id table is introduced for non-DT support.
The device id naming is consistent with the "compatible" DT
property format.

R-Car Gen2 SATA PHY support is added. PHY initialization method
is chosen, based on the device id.

Changes from version 1:
* Kept old DT bindings for compatibility
* Amended DT bindings documentation
Changes from version 2:
* Dropped r8a7779.dtsi changes

Valentine Barshak (2):
  sata_rcar: Adjust and document device tree bindings
  sata_rcar: Add R-Car Gen2 SATA support

 .../devicetree/bindings/ata/sata_rcar.txt          |  19 ++++
 arch/arm/boot/dts/r8a7779.dtsi                     |   2 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
 5 files changed, 118 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support (take 3)
@ 2013-10-16 12:05   ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-16 12:05 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This modifies and documents R-Car SATA device tree (DT) bindings.
The "sata-<SoC>" format is now used for the "compatible" property.
Also, a platform device id table is introduced for non-DT support.
The device id naming is consistent with the "compatible" DT
property format.

R-Car Gen2 SATA PHY support is added. PHY initialization method
is chosen, based on the device id.

Changes from version 1:
* Kept old DT bindings for compatibility
* Amended DT bindings documentation
Changes from version 2:
* Dropped r8a7779.dtsi changes

Valentine Barshak (2):
  sata_rcar: Adjust and document device tree bindings
  sata_rcar: Add R-Car Gen2 SATA support

 .../devicetree/bindings/ata/sata_rcar.txt          |  19 ++++
 arch/arm/boot/dts/r8a7779.dtsi                     |   2 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 112 ++++++++++++++++++---
 5 files changed, 118 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
  2013-10-16 12:05   ` Valentine Barshak
@ 2013-10-16 12:06     ` Valentine Barshak
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-16 12:06 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This deprecates the "rcar-sata" compatibility string
and adds the "sata-r8a7779" which complies to the
preferred <unit>-<soc> format for SH-Mobile devices.
The DT bindings are documented.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 Documentation/devicetree/bindings/ata/sata_rcar.txt | 15 +++++++++++++++
 drivers/ata/sata_rcar.c                             |  3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
new file mode 100644
index 0000000..0719115
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -0,0 +1,15 @@
+* Renesas R-Car SATA
+
+Required properties:
+- compatible		: should contain "renesas,sata-r8a7779";
+- reg			: offset and length of the SATA registers;
+- interrupts		: must consist of one interrupt specifier.
+
+Example:
+
+sata: sata@fc600000 {
+	compatible = "renesas,sata-r8a7779";
+	reg = <0xfc600000 0x2000>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 100 0x4>;
+};
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index c2d95e9..a625cc5 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -893,7 +893,8 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 #endif
 
 static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },
+	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
+	{ .compatible = "renesas,sata-r8a7779", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sata_rcar_match);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH 1/2] sata_rcar: Adjust and document device tree bindings
@ 2013-10-16 12:06     ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-16 12:06 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

This deprecates the "rcar-sata" compatibility string
and adds the "sata-r8a7779" which complies to the
preferred <unit>-<soc> format for SH-Mobile devices.
The DT bindings are documented.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 Documentation/devicetree/bindings/ata/sata_rcar.txt | 15 +++++++++++++++
 drivers/ata/sata_rcar.c                             |  3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/ata/sata_rcar.txt

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
new file mode 100644
index 0000000..0719115
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -0,0 +1,15 @@
+* Renesas R-Car SATA
+
+Required properties:
+- compatible		: should contain "renesas,sata-r8a7779";
+- reg			: offset and length of the SATA registers;
+- interrupts		: must consist of one interrupt specifier.
+
+Example:
+
+sata: sata@fc600000 {
+	compatible = "renesas,sata-r8a7779";
+	reg = <0xfc600000 0x2000>;
+	interrupt-parent = <&gic>;
+	interrupts = <0 100 0x4>;
+};
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index c2d95e9..a625cc5 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -893,7 +893,8 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 #endif
 
 static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },
+	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
+	{ .compatible = "renesas,sata-r8a7779", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sata_rcar_match);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-16 12:05   ` Valentine Barshak
@ 2013-10-16 12:06     ` Valentine Barshak
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-16 12:06 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

R-Car Gen2 SoCs have a different PHY which is not compatible
with the older R-Car H1 (R8A7779) version.
This adds OF/platform device id tables and PHY initialization
callbacks for the following Gen2 SoCs:
  * R-Car H2: R8A7790;
  * R-Car M2: R8A7791.

PHY initialization method is chosen based on the device id.
Default PHY settings are applied for Gen2 SoCs, which should
suit the Gen2 boards available.

The R8A7779 platform code is modified to use "sata-r8a7779"
device name.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
 4 files changed, 107 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
index 0719115..d6b20a6 100644
--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -1,7 +1,10 @@
 * Renesas R-Car SATA
 
 Required properties:
-- compatible		: should contain "renesas,sata-r8a7779";
+- compatible		: should contain one of the following:
+			  - "renesas,sata-r8a7779" for R-Car H1
+			  - "renesas,sata-r8a7790" for R-Car H2
+			  - "renesas,sata-r8a7791" for R-Car M2
 - reg			: offset and length of the SATA registers;
 - interrupts		: must consist of one interrupt specifier.
 
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 5c83259..b2f8417 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
 	/* MSTP32 clocks */
 	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
 	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
-	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
+	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
 	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
 	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
 	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 51a43c5..9d49090 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
 };
 
 static struct platform_device sata_device = {
-	.name		= "sata_rcar",
+	.name		= "sata-r8a7779",
 	.id		= -1,
 	.resource	= sata_resources,
 	.num_resources	= ARRAY_SIZE(sata_resources),
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index a625cc5..068d5b4 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/ata.h>
 #include <linux/libata.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
@@ -123,12 +124,37 @@
 
 #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
 
+/* Gen2 Physical Layer Control Registers */
+#define RCAR_GEN2_PHY_CTL1_REG		0x1704
+#define RCAR_GEN2_PHY_CTL1		0x34180002
+#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
+
+#define RCAR_GEN2_PHY_CTL2_REG		0x170C
+#define RCAR_GEN2_PHY_CTL2		0x00002303
+
+#define RCAR_GEN2_PHY_CTL3_REG		0x171C
+#define RCAR_GEN2_PHY_CTL3		0x000B0194
+
+#define RCAR_GEN2_PHY_CTL4_REG		0x1724
+#define RCAR_GEN2_PHY_CTL4		0x00030994
+
+#define RCAR_GEN2_PHY_CTL5_REG		0x1740
+#define RCAR_GEN2_PHY_CTL5		0x03004001
+#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
+#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
+
+enum sata_rcar_type {
+	RCAR_GEN1_SATA,
+	RCAR_GEN2_SATA,
+};
+
 struct sata_rcar_priv {
 	void __iomem *base;
 	struct clk *clk;
+	enum sata_rcar_type type;
 };
 
-static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
+static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
 {
 	void __iomem *base = priv->base;
 
@@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
 	iowrite32(0, base + SATAPHYRESET_REG);
 }
 
-static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
-				int group)
+static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
+				     u32 val, int group)
 {
 	void __iomem *base = priv->base;
 	int timeout;
@@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
 	iowrite32(0, base + SATAPHYADDR_REG);
 }
 
+static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
+{
+	sata_rcar_gen1_phy_preinit(priv);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+}
+
+static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
+{
+	void __iomem *base = priv->base;
+
+	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
+		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
+}
+
 static void sata_rcar_freeze(struct ata_port *ap)
 {
 	struct sata_rcar_priv *priv = ap->host->private_data;
@@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	u32 val;
 
 	/* reset and setup phy */
-	sata_rcar_phy_initialize(priv);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+	switch (priv->type) {
+	case RCAR_GEN1_SATA:
+		sata_rcar_gen1_phy_init(priv);
+		break;
+	case RCAR_GEN2_SATA:
+		sata_rcar_gen2_phy_init(priv);
+		break;
+	default:
+		dev_warn(host->dev, "SATA phy is not initialized\n");
+		break;
+	}
 
 	/* SATA-IP reset state */
 	val = ioread32(base + ATAPI_CONTROL1_REG);
@@ -770,8 +823,39 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
 }
 
+static struct of_device_id sata_rcar_match[] = {
+	/* Deprecated, "renesas,sata-r8a7779" should be used instead. */
+	{
+		.compatible = "renesas,rcar-sata",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7779",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7790",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{
+		.compatible = "renesas,sata-r8a7791",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, sata_rcar_match);
+
+static const struct platform_device_id sata_rcar_id_table[] = {
+	{ "sata-r8a7779", RCAR_GEN1_SATA },
+	{ "sata-r8a7790", RCAR_GEN2_SATA },
+	{ "sata-r8a7791", RCAR_GEN2_SATA },
+	{ },
+};
+MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
+
 static int sata_rcar_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id;
 	struct ata_host *host;
 	struct sata_rcar_priv *priv;
 	struct resource *mem;
@@ -787,6 +871,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
+	of_id = of_match_device(sata_rcar_match, &pdev->dev);
+	if (of_id)
+		priv->type = (enum sata_rcar_type)of_id->data;
+	else
+		priv->type = platform_get_device_id(pdev)->driver_data;
+
 	priv->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->clk)) {
 		dev_err(&pdev->dev, "failed to get access to sata clock\n");
@@ -892,16 +982,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 };
 #endif
 
-static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
-	{ .compatible = "renesas,sata-r8a7779", },
-	{},
-};
-MODULE_DEVICE_TABLE(of, sata_rcar_match);
-
 static struct platform_driver sata_rcar_driver = {
 	.probe		= sata_rcar_probe,
 	.remove		= sata_rcar_remove,
+	.id_table	= sata_rcar_id_table,
 	.driver = {
 		.name		= DRV_NAME,
 		.owner		= THIS_MODULE,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-16 12:06     ` Valentine Barshak
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine Barshak @ 2013-10-16 12:06 UTC (permalink / raw)
  To: linux-sh, linux-ide, devicetree
  Cc: Simon Horman, Magnus Damm, Vladimir Barinov, Sergei Shtylyov,
	Kuninori Morimoto, Laurent Pinchart, Guennadi Liakhovetski,
	Tejun Heo, Mark Rutland

R-Car Gen2 SoCs have a different PHY which is not compatible
with the older R-Car H1 (R8A7779) version.
This adds OF/platform device id tables and PHY initialization
callbacks for the following Gen2 SoCs:
  * R-Car H2: R8A7790;
  * R-Car M2: R8A7791.

PHY initialization method is chosen based on the device id.
Default PHY settings are applied for Gen2 SoCs, which should
suit the Gen2 boards available.

The R8A7779 platform code is modified to use "sata-r8a7779"
device name.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
 arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
 drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
 4 files changed, 107 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
index 0719115..d6b20a6 100644
--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -1,7 +1,10 @@
 * Renesas R-Car SATA
 
 Required properties:
-- compatible		: should contain "renesas,sata-r8a7779";
+- compatible		: should contain one of the following:
+			  - "renesas,sata-r8a7779" for R-Car H1
+			  - "renesas,sata-r8a7790" for R-Car H2
+			  - "renesas,sata-r8a7791" for R-Car M2
 - reg			: offset and length of the SATA registers;
 - interrupts		: must consist of one interrupt specifier.
 
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 5c83259..b2f8417 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
 	/* MSTP32 clocks */
 	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
 	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
-	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
+	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
 	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
 	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
 	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 51a43c5..9d49090 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
 };
 
 static struct platform_device sata_device = {
-	.name		= "sata_rcar",
+	.name		= "sata-r8a7779",
 	.id		= -1,
 	.resource	= sata_resources,
 	.num_resources	= ARRAY_SIZE(sata_resources),
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index a625cc5..068d5b4 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/ata.h>
 #include <linux/libata.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
@@ -123,12 +124,37 @@
 
 #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
 
+/* Gen2 Physical Layer Control Registers */
+#define RCAR_GEN2_PHY_CTL1_REG		0x1704
+#define RCAR_GEN2_PHY_CTL1		0x34180002
+#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
+
+#define RCAR_GEN2_PHY_CTL2_REG		0x170C
+#define RCAR_GEN2_PHY_CTL2		0x00002303
+
+#define RCAR_GEN2_PHY_CTL3_REG		0x171C
+#define RCAR_GEN2_PHY_CTL3		0x000B0194
+
+#define RCAR_GEN2_PHY_CTL4_REG		0x1724
+#define RCAR_GEN2_PHY_CTL4		0x00030994
+
+#define RCAR_GEN2_PHY_CTL5_REG		0x1740
+#define RCAR_GEN2_PHY_CTL5		0x03004001
+#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
+#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
+
+enum sata_rcar_type {
+	RCAR_GEN1_SATA,
+	RCAR_GEN2_SATA,
+};
+
 struct sata_rcar_priv {
 	void __iomem *base;
 	struct clk *clk;
+	enum sata_rcar_type type;
 };
 
-static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
+static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
 {
 	void __iomem *base = priv->base;
 
@@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
 	iowrite32(0, base + SATAPHYRESET_REG);
 }
 
-static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
-				int group)
+static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
+				     u32 val, int group)
 {
 	void __iomem *base = priv->base;
 	int timeout;
@@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
 	iowrite32(0, base + SATAPHYADDR_REG);
 }
 
+static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
+{
+	sata_rcar_gen1_phy_preinit(priv);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
+	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+}
+
+static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
+{
+	void __iomem *base = priv->base;
+
+	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
+	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
+		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
+}
+
 static void sata_rcar_freeze(struct ata_port *ap)
 {
 	struct sata_rcar_priv *priv = ap->host->private_data;
@@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	u32 val;
 
 	/* reset and setup phy */
-	sata_rcar_phy_initialize(priv);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
-	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
-	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
+	switch (priv->type) {
+	case RCAR_GEN1_SATA:
+		sata_rcar_gen1_phy_init(priv);
+		break;
+	case RCAR_GEN2_SATA:
+		sata_rcar_gen2_phy_init(priv);
+		break;
+	default:
+		dev_warn(host->dev, "SATA phy is not initialized\n");
+		break;
+	}
 
 	/* SATA-IP reset state */
 	val = ioread32(base + ATAPI_CONTROL1_REG);
@@ -770,8 +823,39 @@ static void sata_rcar_init_controller(struct ata_host *host)
 	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
 }
 
+static struct of_device_id sata_rcar_match[] = {
+	/* Deprecated, "renesas,sata-r8a7779" should be used instead. */
+	{
+		.compatible = "renesas,rcar-sata",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7779",
+		.data = (void *)RCAR_GEN1_SATA,
+	},
+	{
+		.compatible = "renesas,sata-r8a7790",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{
+		.compatible = "renesas,sata-r8a7791",
+		.data = (void *)RCAR_GEN2_SATA
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, sata_rcar_match);
+
+static const struct platform_device_id sata_rcar_id_table[] = {
+	{ "sata-r8a7779", RCAR_GEN1_SATA },
+	{ "sata-r8a7790", RCAR_GEN2_SATA },
+	{ "sata-r8a7791", RCAR_GEN2_SATA },
+	{ },
+};
+MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
+
 static int sata_rcar_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id;
 	struct ata_host *host;
 	struct sata_rcar_priv *priv;
 	struct resource *mem;
@@ -787,6 +871,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
+	of_id = of_match_device(sata_rcar_match, &pdev->dev);
+	if (of_id)
+		priv->type = (enum sata_rcar_type)of_id->data;
+	else
+		priv->type = platform_get_device_id(pdev)->driver_data;
+
 	priv->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->clk)) {
 		dev_err(&pdev->dev, "failed to get access to sata clock\n");
@@ -892,16 +982,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
 };
 #endif
 
-static struct of_device_id sata_rcar_match[] = {
-	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
-	{ .compatible = "renesas,sata-r8a7779", },
-	{},
-};
-MODULE_DEVICE_TABLE(of, sata_rcar_match);
-
 static struct platform_driver sata_rcar_driver = {
 	.probe		= sata_rcar_probe,
 	.remove		= sata_rcar_remove,
+	.id_table	= sata_rcar_id_table,
 	.driver = {
 		.name		= DRV_NAME,
 		.owner		= THIS_MODULE,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-16 12:06     ` Valentine Barshak
@ 2013-10-29  4:59       ` Simon Horman
  -1 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-29  4:59 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Magnus Damm, Vladimir Barinov,
	Sergei Shtylyov, Kuninori Morimoto, Laurent Pinchart,
	Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
> R-Car Gen2 SoCs have a different PHY which is not compatible
> with the older R-Car H1 (R8A7779) version.
> This adds OF/platform device id tables and PHY initialization
> callbacks for the following Gen2 SoCs:
>   * R-Car H2: R8A7790;
>   * R-Car M2: R8A7791.
> 
> PHY initialization method is chosen based on the device id.
> Default PHY settings are applied for Gen2 SoCs, which should
> suit the Gen2 boards available.
> 
> The R8A7779 platform code is modified to use "sata-r8a7779"
> device name.
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>  arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>  arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>  drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---

Hi Mark, Hi Device-Tree Folks,

I'm wondering if you have had a chance to look over the bindings
aspect of this and the other patch in the series. I believe that
this series addresses all previous review in that regards.

Hi Valentine,

I would like to request that the arch/arm/mach-shmobile/ portion
of this patch be split out into a separate patch. The reason is
that in general it is nicer to apply driver changes separately
to platform changes: for starters they have different maintainers.
And in this case there seems to be no reason not to split the change.

Also, I would like to this chance to pass on part of a discussion
at the ARM Linux Kernel summit which is that when posting a series of
patches please only CC devicetree@vger.kernel.org on the patches in
the series that relate to device tree. This would not include
to the new patch with only the arch/arm/mach-shmobile/ portions
of this patch. Feel free to post that patch as a separate series
noting its dependencies below '---' accordingly.

>  4 files changed, 107 insertions(+), 20 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> index 0719115..d6b20a6 100644
> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> @@ -1,7 +1,10 @@
>  * Renesas R-Car SATA
>  
>  Required properties:
> -- compatible		: should contain "renesas,sata-r8a7779";
> +- compatible		: should contain one of the following:
> +			  - "renesas,sata-r8a7779" for R-Car H1
> +			  - "renesas,sata-r8a7790" for R-Car H2
> +			  - "renesas,sata-r8a7791" for R-Car M2
>  - reg			: offset and length of the SATA registers;
>  - interrupts		: must consist of one interrupt specifier.
>  
> diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
> index 5c83259..b2f8417 100644
> --- a/arch/arm/mach-shmobile/clock-r8a7779.c
> +++ b/arch/arm/mach-shmobile/clock-r8a7779.c
> @@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
>  	/* MSTP32 clocks */
>  	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
>  	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
> -	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
> +	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
>  	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
>  	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
>  	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
> diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
> index 51a43c5..9d49090 100644
> --- a/arch/arm/mach-shmobile/setup-r8a7779.c
> +++ b/arch/arm/mach-shmobile/setup-r8a7779.c
> @@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
>  };
>  
>  static struct platform_device sata_device = {
> -	.name		= "sata_rcar",
> +	.name		= "sata-r8a7779",
>  	.id		= -1,
>  	.resource	= sata_resources,
>  	.num_resources	= ARRAY_SIZE(sata_resources),
> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> index a625cc5..068d5b4 100644
> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -15,6 +15,7 @@
>  #include <linux/module.h>
>  #include <linux/ata.h>
>  #include <linux/libata.h>
> +#include <linux/of_device.h>
>  #include <linux/platform_device.h>
>  #include <linux/clk.h>
>  #include <linux/err.h>
> @@ -123,12 +124,37 @@
>  
>  #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
>  
> +/* Gen2 Physical Layer Control Registers */
> +#define RCAR_GEN2_PHY_CTL1_REG		0x1704
> +#define RCAR_GEN2_PHY_CTL1		0x34180002
> +#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
> +
> +#define RCAR_GEN2_PHY_CTL2_REG		0x170C
> +#define RCAR_GEN2_PHY_CTL2		0x00002303
> +
> +#define RCAR_GEN2_PHY_CTL3_REG		0x171C
> +#define RCAR_GEN2_PHY_CTL3		0x000B0194
> +
> +#define RCAR_GEN2_PHY_CTL4_REG		0x1724
> +#define RCAR_GEN2_PHY_CTL4		0x00030994
> +
> +#define RCAR_GEN2_PHY_CTL5_REG		0x1740
> +#define RCAR_GEN2_PHY_CTL5		0x03004001
> +#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
> +#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
> +
> +enum sata_rcar_type {
> +	RCAR_GEN1_SATA,
> +	RCAR_GEN2_SATA,
> +};
> +
>  struct sata_rcar_priv {
>  	void __iomem *base;
>  	struct clk *clk;
> +	enum sata_rcar_type type;
>  };
>  
> -static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
> +static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
>  {
>  	void __iomem *base = priv->base;
>  
> @@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
>  	iowrite32(0, base + SATAPHYRESET_REG);
>  }
>  
> -static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
> -				int group)
> +static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
> +				     u32 val, int group)
>  {
>  	void __iomem *base = priv->base;
>  	int timeout;
> @@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
>  	iowrite32(0, base + SATAPHYADDR_REG);
>  }
>  
> +static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
> +{
> +	sata_rcar_gen1_phy_preinit(priv);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
> +}
> +
> +static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
> +{
> +	void __iomem *base = priv->base;
> +
> +	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
> +	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
> +	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
> +	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
> +	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
> +		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
> +}
> +
>  static void sata_rcar_freeze(struct ata_port *ap)
>  {
>  	struct sata_rcar_priv *priv = ap->host->private_data;
> @@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
>  	u32 val;
>  
>  	/* reset and setup phy */
> -	sata_rcar_phy_initialize(priv);
> -	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
> -	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
> -	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
> -	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
> -	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
> -	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
> +	switch (priv->type) {
> +	case RCAR_GEN1_SATA:
> +		sata_rcar_gen1_phy_init(priv);
> +		break;
> +	case RCAR_GEN2_SATA:
> +		sata_rcar_gen2_phy_init(priv);
> +		break;
> +	default:
> +		dev_warn(host->dev, "SATA phy is not initialized\n");
> +		break;
> +	}
>  
>  	/* SATA-IP reset state */
>  	val = ioread32(base + ATAPI_CONTROL1_REG);
> @@ -770,8 +823,39 @@ static void sata_rcar_init_controller(struct ata_host *host)
>  	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
>  }
>  
> +static struct of_device_id sata_rcar_match[] = {
> +	/* Deprecated, "renesas,sata-r8a7779" should be used instead. */
> +	{
> +		.compatible = "renesas,rcar-sata",
> +		.data = (void *)RCAR_GEN1_SATA,
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7779",
> +		.data = (void *)RCAR_GEN1_SATA,
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7790",
> +		.data = (void *)RCAR_GEN2_SATA
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7791",
> +		.data = (void *)RCAR_GEN2_SATA
> +	},
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, sata_rcar_match);
> +
> +static const struct platform_device_id sata_rcar_id_table[] = {
> +	{ "sata-r8a7779", RCAR_GEN1_SATA },
> +	{ "sata-r8a7790", RCAR_GEN2_SATA },
> +	{ "sata-r8a7791", RCAR_GEN2_SATA },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
> +
>  static int sata_rcar_probe(struct platform_device *pdev)
>  {
> +	const struct of_device_id *of_id;
>  	struct ata_host *host;
>  	struct sata_rcar_priv *priv;
>  	struct resource *mem;
> @@ -787,6 +871,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
>  	if (!priv)
>  		return -ENOMEM;
>  
> +	of_id = of_match_device(sata_rcar_match, &pdev->dev);
> +	if (of_id)
> +		priv->type = (enum sata_rcar_type)of_id->data;
> +	else
> +		priv->type = platform_get_device_id(pdev)->driver_data;
> +
>  	priv->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(priv->clk)) {
>  		dev_err(&pdev->dev, "failed to get access to sata clock\n");
> @@ -892,16 +982,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>  };
>  #endif
>  
> -static struct of_device_id sata_rcar_match[] = {
> -	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
> -	{ .compatible = "renesas,sata-r8a7779", },
> -	{},
> -};
> -MODULE_DEVICE_TABLE(of, sata_rcar_match);
> -
>  static struct platform_driver sata_rcar_driver = {
>  	.probe		= sata_rcar_probe,
>  	.remove		= sata_rcar_remove,
> +	.id_table	= sata_rcar_id_table,
>  	.driver = {
>  		.name		= DRV_NAME,
>  		.owner		= THIS_MODULE,
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-29  4:59       ` Simon Horman
  0 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-29  4:59 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Magnus Damm, Vladimir Barinov,
	Sergei Shtylyov, Kuninori Morimoto, Laurent Pinchart,
	Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
> R-Car Gen2 SoCs have a different PHY which is not compatible
> with the older R-Car H1 (R8A7779) version.
> This adds OF/platform device id tables and PHY initialization
> callbacks for the following Gen2 SoCs:
>   * R-Car H2: R8A7790;
>   * R-Car M2: R8A7791.
> 
> PHY initialization method is chosen based on the device id.
> Default PHY settings are applied for Gen2 SoCs, which should
> suit the Gen2 boards available.
> 
> The R8A7779 platform code is modified to use "sata-r8a7779"
> device name.
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>  arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>  arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>  drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---

Hi Mark, Hi Device-Tree Folks,

I'm wondering if you have had a chance to look over the bindings
aspect of this and the other patch in the series. I believe that
this series addresses all previous review in that regards.

Hi Valentine,

I would like to request that the arch/arm/mach-shmobile/ portion
of this patch be split out into a separate patch. The reason is
that in general it is nicer to apply driver changes separately
to platform changes: for starters they have different maintainers.
And in this case there seems to be no reason not to split the change.

Also, I would like to this chance to pass on part of a discussion
at the ARM Linux Kernel summit which is that when posting a series of
patches please only CC devicetree@vger.kernel.org on the patches in
the series that relate to device tree. This would not include
to the new patch with only the arch/arm/mach-shmobile/ portions
of this patch. Feel free to post that patch as a separate series
noting its dependencies below '---' accordingly.

>  4 files changed, 107 insertions(+), 20 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> index 0719115..d6b20a6 100644
> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> @@ -1,7 +1,10 @@
>  * Renesas R-Car SATA
>  
>  Required properties:
> -- compatible		: should contain "renesas,sata-r8a7779";
> +- compatible		: should contain one of the following:
> +			  - "renesas,sata-r8a7779" for R-Car H1
> +			  - "renesas,sata-r8a7790" for R-Car H2
> +			  - "renesas,sata-r8a7791" for R-Car M2
>  - reg			: offset and length of the SATA registers;
>  - interrupts		: must consist of one interrupt specifier.
>  
> diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
> index 5c83259..b2f8417 100644
> --- a/arch/arm/mach-shmobile/clock-r8a7779.c
> +++ b/arch/arm/mach-shmobile/clock-r8a7779.c
> @@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
>  	/* MSTP32 clocks */
>  	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
>  	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
> -	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
> +	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
>  	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
>  	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
>  	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
> diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
> index 51a43c5..9d49090 100644
> --- a/arch/arm/mach-shmobile/setup-r8a7779.c
> +++ b/arch/arm/mach-shmobile/setup-r8a7779.c
> @@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
>  };
>  
>  static struct platform_device sata_device = {
> -	.name		= "sata_rcar",
> +	.name		= "sata-r8a7779",
>  	.id		= -1,
>  	.resource	= sata_resources,
>  	.num_resources	= ARRAY_SIZE(sata_resources),
> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> index a625cc5..068d5b4 100644
> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -15,6 +15,7 @@
>  #include <linux/module.h>
>  #include <linux/ata.h>
>  #include <linux/libata.h>
> +#include <linux/of_device.h>
>  #include <linux/platform_device.h>
>  #include <linux/clk.h>
>  #include <linux/err.h>
> @@ -123,12 +124,37 @@
>  
>  #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
>  
> +/* Gen2 Physical Layer Control Registers */
> +#define RCAR_GEN2_PHY_CTL1_REG		0x1704
> +#define RCAR_GEN2_PHY_CTL1		0x34180002
> +#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
> +
> +#define RCAR_GEN2_PHY_CTL2_REG		0x170C
> +#define RCAR_GEN2_PHY_CTL2		0x00002303
> +
> +#define RCAR_GEN2_PHY_CTL3_REG		0x171C
> +#define RCAR_GEN2_PHY_CTL3		0x000B0194
> +
> +#define RCAR_GEN2_PHY_CTL4_REG		0x1724
> +#define RCAR_GEN2_PHY_CTL4		0x00030994
> +
> +#define RCAR_GEN2_PHY_CTL5_REG		0x1740
> +#define RCAR_GEN2_PHY_CTL5		0x03004001
> +#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
> +#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
> +
> +enum sata_rcar_type {
> +	RCAR_GEN1_SATA,
> +	RCAR_GEN2_SATA,
> +};
> +
>  struct sata_rcar_priv {
>  	void __iomem *base;
>  	struct clk *clk;
> +	enum sata_rcar_type type;
>  };
>  
> -static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
> +static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
>  {
>  	void __iomem *base = priv->base;
>  
> @@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
>  	iowrite32(0, base + SATAPHYRESET_REG);
>  }
>  
> -static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
> -				int group)
> +static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
> +				     u32 val, int group)
>  {
>  	void __iomem *base = priv->base;
>  	int timeout;
> @@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
>  	iowrite32(0, base + SATAPHYADDR_REG);
>  }
>  
> +static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
> +{
> +	sata_rcar_gen1_phy_preinit(priv);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
> +	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
> +}
> +
> +static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
> +{
> +	void __iomem *base = priv->base;
> +
> +	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
> +	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
> +	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
> +	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
> +	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
> +		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
> +}
> +
>  static void sata_rcar_freeze(struct ata_port *ap)
>  {
>  	struct sata_rcar_priv *priv = ap->host->private_data;
> @@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
>  	u32 val;
>  
>  	/* reset and setup phy */
> -	sata_rcar_phy_initialize(priv);
> -	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
> -	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
> -	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
> -	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
> -	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
> -	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
> +	switch (priv->type) {
> +	case RCAR_GEN1_SATA:
> +		sata_rcar_gen1_phy_init(priv);
> +		break;
> +	case RCAR_GEN2_SATA:
> +		sata_rcar_gen2_phy_init(priv);
> +		break;
> +	default:
> +		dev_warn(host->dev, "SATA phy is not initialized\n");
> +		break;
> +	}
>  
>  	/* SATA-IP reset state */
>  	val = ioread32(base + ATAPI_CONTROL1_REG);
> @@ -770,8 +823,39 @@ static void sata_rcar_init_controller(struct ata_host *host)
>  	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
>  }
>  
> +static struct of_device_id sata_rcar_match[] = {
> +	/* Deprecated, "renesas,sata-r8a7779" should be used instead. */
> +	{
> +		.compatible = "renesas,rcar-sata",
> +		.data = (void *)RCAR_GEN1_SATA,
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7779",
> +		.data = (void *)RCAR_GEN1_SATA,
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7790",
> +		.data = (void *)RCAR_GEN2_SATA
> +	},
> +	{
> +		.compatible = "renesas,sata-r8a7791",
> +		.data = (void *)RCAR_GEN2_SATA
> +	},
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, sata_rcar_match);
> +
> +static const struct platform_device_id sata_rcar_id_table[] = {
> +	{ "sata-r8a7779", RCAR_GEN1_SATA },
> +	{ "sata-r8a7790", RCAR_GEN2_SATA },
> +	{ "sata-r8a7791", RCAR_GEN2_SATA },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
> +
>  static int sata_rcar_probe(struct platform_device *pdev)
>  {
> +	const struct of_device_id *of_id;
>  	struct ata_host *host;
>  	struct sata_rcar_priv *priv;
>  	struct resource *mem;
> @@ -787,6 +871,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
>  	if (!priv)
>  		return -ENOMEM;
>  
> +	of_id = of_match_device(sata_rcar_match, &pdev->dev);
> +	if (of_id)
> +		priv->type = (enum sata_rcar_type)of_id->data;
> +	else
> +		priv->type = platform_get_device_id(pdev)->driver_data;
> +
>  	priv->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(priv->clk)) {
>  		dev_err(&pdev->dev, "failed to get access to sata clock\n");
> @@ -892,16 +982,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
>  };
>  #endif
>  
> -static struct of_device_id sata_rcar_match[] = {
> -	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
> -	{ .compatible = "renesas,sata-r8a7779", },
> -	{},
> -};
> -MODULE_DEVICE_TABLE(of, sata_rcar_match);
> -
>  static struct platform_driver sata_rcar_driver = {
>  	.probe		= sata_rcar_probe,
>  	.remove		= sata_rcar_remove,
> +	.id_table	= sata_rcar_id_table,
>  	.driver = {
>  		.name		= DRV_NAME,
>  		.owner		= THIS_MODULE,
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-29  4:59       ` Simon Horman
@ 2013-10-29  8:24         ` Kumar Gala
  -1 siblings, 0 replies; 60+ messages in thread
From: Kumar Gala @ 2013-10-29  8:24 UTC (permalink / raw)
  To: Simon Horman
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland


On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:

> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
>> R-Car Gen2 SoCs have a different PHY which is not compatible
>> with the older R-Car H1 (R8A7779) version.
>> This adds OF/platform device id tables and PHY initialization
>> callbacks for the following Gen2 SoCs:
>>  * R-Car H2: R8A7790;
>>  * R-Car M2: R8A7791.
>> 
>> PHY initialization method is chosen based on the device id.
>> Default PHY settings are applied for Gen2 SoCs, which should
>> suit the Gen2 boards available.
>> 
>> The R8A7779 platform code is modified to use "sata-r8a7779"
>> device name.
>> 
>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>> ---
>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
> 
> Hi Mark, Hi Device-Tree Folks,
> 
> I'm wondering if you have had a chance to look over the bindings
> aspect of this and the other patch in the series. I believe that
> this series addresses all previous review in that regards.

What tree is this binding in?

> 
> Hi Valentine,
> 
> I would like to request that the arch/arm/mach-shmobile/ portion
> of this patch be split out into a separate patch. The reason is
> that in general it is nicer to apply driver changes separately
> to platform changes: for starters they have different maintainers.
> And in this case there seems to be no reason not to split the change.
> 
> Also, I would like to this chance to pass on part of a discussion
> at the ARM Linux Kernel summit which is that when posting a series of
> patches please only CC devicetree@vger.kernel.org on the patches in
> the series that relate to device tree. This would not include
> to the new patch with only the arch/arm/mach-shmobile/ portions
> of this patch. Feel free to post that patch as a separate series
> noting its dependencies below '---' accordingly.
> 
>> 4 files changed, 107 insertions(+), 20 deletions(-)
>> 
>> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> index 0719115..d6b20a6 100644
>> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> @@ -1,7 +1,10 @@
>> * Renesas R-Car SATA
>> 
>> Required properties:
>> -- compatible		: should contain "renesas,sata-r8a7779";
>> +- compatible		: should contain one of the following:
>> +			  - "renesas,sata-r8a7779" for R-Car H1
>> +			  - "renesas,sata-r8a7790" for R-Car H2
>> +			  - "renesas,sata-r8a7791" for R-Car M2
>> - reg			: offset and length of the SATA registers;
>> - interrupts		: must consist of one interrupt specifier.

We normally have an example (not sure if there is one, and just not seeing it because of diff or not).

- k

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


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-29  8:24         ` Kumar Gala
  0 siblings, 0 replies; 60+ messages in thread
From: Kumar Gala @ 2013-10-29  8:24 UTC (permalink / raw)
  To: Simon Horman
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland


On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:

> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
>> R-Car Gen2 SoCs have a different PHY which is not compatible
>> with the older R-Car H1 (R8A7779) version.
>> This adds OF/platform device id tables and PHY initialization
>> callbacks for the following Gen2 SoCs:
>>  * R-Car H2: R8A7790;
>>  * R-Car M2: R8A7791.
>> 
>> PHY initialization method is chosen based on the device id.
>> Default PHY settings are applied for Gen2 SoCs, which should
>> suit the Gen2 boards available.
>> 
>> The R8A7779 platform code is modified to use "sata-r8a7779"
>> device name.
>> 
>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>> ---
>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
> 
> Hi Mark, Hi Device-Tree Folks,
> 
> I'm wondering if you have had a chance to look over the bindings
> aspect of this and the other patch in the series. I believe that
> this series addresses all previous review in that regards.

What tree is this binding in?

> 
> Hi Valentine,
> 
> I would like to request that the arch/arm/mach-shmobile/ portion
> of this patch be split out into a separate patch. The reason is
> that in general it is nicer to apply driver changes separately
> to platform changes: for starters they have different maintainers.
> And in this case there seems to be no reason not to split the change.
> 
> Also, I would like to this chance to pass on part of a discussion
> at the ARM Linux Kernel summit which is that when posting a series of
> patches please only CC devicetree@vger.kernel.org on the patches in
> the series that relate to device tree. This would not include
> to the new patch with only the arch/arm/mach-shmobile/ portions
> of this patch. Feel free to post that patch as a separate series
> noting its dependencies below '---' accordingly.
> 
>> 4 files changed, 107 insertions(+), 20 deletions(-)
>> 
>> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> index 0719115..d6b20a6 100644
>> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
>> @@ -1,7 +1,10 @@
>> * Renesas R-Car SATA
>> 
>> Required properties:
>> -- compatible		: should contain "renesas,sata-r8a7779";
>> +- compatible		: should contain one of the following:
>> +			  - "renesas,sata-r8a7779" for R-Car H1
>> +			  - "renesas,sata-r8a7790" for R-Car H2
>> +			  - "renesas,sata-r8a7791" for R-Car M2
>> - reg			: offset and length of the SATA registers;
>> - interrupts		: must consist of one interrupt specifier.

We normally have an example (not sure if there is one, and just not seeing it because of diff or not).

- k

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


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-29  8:24         ` Kumar Gala
@ 2013-10-29  8:44           ` Simon Horman
  -1 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-29  8:44 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
> 
> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
> 
> > On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
> >> R-Car Gen2 SoCs have a different PHY which is not compatible
> >> with the older R-Car H1 (R8A7779) version.
> >> This adds OF/platform device id tables and PHY initialization
> >> callbacks for the following Gen2 SoCs:
> >>  * R-Car H2: R8A7790;
> >>  * R-Car M2: R8A7791.
> >> 
> >> PHY initialization method is chosen based on the device id.
> >> Default PHY settings are applied for Gen2 SoCs, which should
> >> suit the Gen2 boards available.
> >> 
> >> The R8A7779 platform code is modified to use "sata-r8a7779"
> >> device name.
> >> 
> >> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >> ---
> >> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
> > 
> > Hi Mark, Hi Device-Tree Folks,
> > 
> > I'm wondering if you have had a chance to look over the bindings
> > aspect of this and the other patch in the series. I believe that
> > this series addresses all previous review in that regards.
> 
> What tree is this binding in?

sata_car.txt is added by the previous patch in this series
"[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"

> > Hi Valentine,
> > 
> > I would like to request that the arch/arm/mach-shmobile/ portion
> > of this patch be split out into a separate patch. The reason is
> > that in general it is nicer to apply driver changes separately
> > to platform changes: for starters they have different maintainers.
> > And in this case there seems to be no reason not to split the change.
> > 
> > Also, I would like to this chance to pass on part of a discussion
> > at the ARM Linux Kernel summit which is that when posting a series of
> > patches please only CC devicetree@vger.kernel.org on the patches in
> > the series that relate to device tree. This would not include
> > to the new patch with only the arch/arm/mach-shmobile/ portions
> > of this patch. Feel free to post that patch as a separate series
> > noting its dependencies below '---' accordingly.
> > 
> >> 4 files changed, 107 insertions(+), 20 deletions(-)
> >> 
> >> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> index 0719115..d6b20a6 100644
> >> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> @@ -1,7 +1,10 @@
> >> * Renesas R-Car SATA
> >> 
> >> Required properties:
> >> -- compatible		: should contain "renesas,sata-r8a7779";
> >> +- compatible		: should contain one of the following:
> >> +			  - "renesas,sata-r8a7779" for R-Car H1
> >> +			  - "renesas,sata-r8a7790" for R-Car H2
> >> +			  - "renesas,sata-r8a7791" for R-Car M2
> >> - reg			: offset and length of the SATA registers;
> >> - interrupts		: must consist of one interrupt specifier.
> 
> We normally have an example (not sure if there is one, and just not seeing it because of diff or not).

An example is present.

I have included the text of sata_rcar.txt below to aid review:

---- begin sata_rcar.txt ----
* Renesas R-Car SATA

Required properties:
- compatible           : should contain "renesas,sata-r8a7779";
- reg                  : offset and length of the SATA registers;
- interrupts           : must consist of one interrupt specifier.

Example:

sata: sata@fc600000 {
	compatible = "renesas,sata-r8a7779";
	reg = <0xfc600000 0x2000>;
	interrupt-parent = <&gic>;
	interrupts = <0 100 0x4>;
};

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-29  8:44           ` Simon Horman
  0 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-29  8:44 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
> 
> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
> 
> > On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
> >> R-Car Gen2 SoCs have a different PHY which is not compatible
> >> with the older R-Car H1 (R8A7779) version.
> >> This adds OF/platform device id tables and PHY initialization
> >> callbacks for the following Gen2 SoCs:
> >>  * R-Car H2: R8A7790;
> >>  * R-Car M2: R8A7791.
> >> 
> >> PHY initialization method is chosen based on the device id.
> >> Default PHY settings are applied for Gen2 SoCs, which should
> >> suit the Gen2 boards available.
> >> 
> >> The R8A7779 platform code is modified to use "sata-r8a7779"
> >> device name.
> >> 
> >> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >> ---
> >> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
> > 
> > Hi Mark, Hi Device-Tree Folks,
> > 
> > I'm wondering if you have had a chance to look over the bindings
> > aspect of this and the other patch in the series. I believe that
> > this series addresses all previous review in that regards.
> 
> What tree is this binding in?

sata_car.txt is added by the previous patch in this series
"[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"

> > Hi Valentine,
> > 
> > I would like to request that the arch/arm/mach-shmobile/ portion
> > of this patch be split out into a separate patch. The reason is
> > that in general it is nicer to apply driver changes separately
> > to platform changes: for starters they have different maintainers.
> > And in this case there seems to be no reason not to split the change.
> > 
> > Also, I would like to this chance to pass on part of a discussion
> > at the ARM Linux Kernel summit which is that when posting a series of
> > patches please only CC devicetree@vger.kernel.org on the patches in
> > the series that relate to device tree. This would not include
> > to the new patch with only the arch/arm/mach-shmobile/ portions
> > of this patch. Feel free to post that patch as a separate series
> > noting its dependencies below '---' accordingly.
> > 
> >> 4 files changed, 107 insertions(+), 20 deletions(-)
> >> 
> >> diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> index 0719115..d6b20a6 100644
> >> --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> >> @@ -1,7 +1,10 @@
> >> * Renesas R-Car SATA
> >> 
> >> Required properties:
> >> -- compatible		: should contain "renesas,sata-r8a7779";
> >> +- compatible		: should contain one of the following:
> >> +			  - "renesas,sata-r8a7779" for R-Car H1
> >> +			  - "renesas,sata-r8a7790" for R-Car H2
> >> +			  - "renesas,sata-r8a7791" for R-Car M2
> >> - reg			: offset and length of the SATA registers;
> >> - interrupts		: must consist of one interrupt specifier.
> 
> We normally have an example (not sure if there is one, and just not seeing it because of diff or not).

An example is present.

I have included the text of sata_rcar.txt below to aid review:

---- begin sata_rcar.txt ----
* Renesas R-Car SATA

Required properties:
- compatible           : should contain "renesas,sata-r8a7779";
- reg                  : offset and length of the SATA registers;
- interrupts           : must consist of one interrupt specifier.

Example:

sata: sata@fc600000 {
	compatible = "renesas,sata-r8a7779";
	reg = <0xfc600000 0x2000>;
	interrupt-parent = <&gic>;
	interrupts = <0 100 0x4>;
};

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-29  4:59       ` Simon Horman
@ 2013-10-29  8:46         ` Simon Horman
  -1 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-29  8:46 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Magnus Damm, Vladimir Barinov,
	Sergei Shtylyov, Kuninori Morimoto, Laurent Pinchart,
	Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Tue, Oct 29, 2013 at 01:59:43PM +0900, Simon Horman wrote:
> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
> > R-Car Gen2 SoCs have a different PHY which is not compatible
> > with the older R-Car H1 (R8A7779) version.
> > This adds OF/platform device id tables and PHY initialization
> > callbacks for the following Gen2 SoCs:
> >   * R-Car H2: R8A7790;
> >   * R-Car M2: R8A7791.
> > 
> > PHY initialization method is chosen based on the device id.
> > Default PHY settings are applied for Gen2 SoCs, which should
> > suit the Gen2 boards available.
> > 
> > The R8A7779 platform code is modified to use "sata-r8a7779"
> > device name.
> > 
> > Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> > ---
> >  .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >  arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >  arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >  drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
> 
> Hi Mark, Hi Device-Tree Folks,
> 
> I'm wondering if you have had a chance to look over the bindings
> aspect of this and the other patch in the series. I believe that
> this series addresses all previous review in that regards.
> 
> Hi Valentine,
> 
> I would like to request that the arch/arm/mach-shmobile/ portion
> of this patch be split out into a separate patch. The reason is
> that in general it is nicer to apply driver changes separately
> to platform changes: for starters they have different maintainers.
> And in this case there seems to be no reason not to split the change.

I now realise that my assertion is false and in its current
form the changes in this patch need to be done atomically.

I'm unsure what the motivation for this is.

> 
> Also, I would like to this chance to pass on part of a discussion
> at the ARM Linux Kernel summit which is that when posting a series of
> patches please only CC devicetree@vger.kernel.org on the patches in
> the series that relate to device tree. This would not include
> to the new patch with only the arch/arm/mach-shmobile/ portions
> of this patch. Feel free to post that patch as a separate series
> noting its dependencies below '---' accordingly.
> 
> >  4 files changed, 107 insertions(+), 20 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > index 0719115..d6b20a6 100644
> > --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > @@ -1,7 +1,10 @@
> >  * Renesas R-Car SATA
> >  
> >  Required properties:
> > -- compatible		: should contain "renesas,sata-r8a7779";
> > +- compatible		: should contain one of the following:
> > +			  - "renesas,sata-r8a7779" for R-Car H1
> > +			  - "renesas,sata-r8a7790" for R-Car H2
> > +			  - "renesas,sata-r8a7791" for R-Car M2
> >  - reg			: offset and length of the SATA registers;
> >  - interrupts		: must consist of one interrupt specifier.
> >  
> > diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
> > index 5c83259..b2f8417 100644
> > --- a/arch/arm/mach-shmobile/clock-r8a7779.c
> > +++ b/arch/arm/mach-shmobile/clock-r8a7779.c
> > @@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
> >  	/* MSTP32 clocks */
> >  	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
> >  	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
> > -	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
> > +	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
> >  	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
> >  	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
> >  	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
> > diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
> > index 51a43c5..9d49090 100644
> > --- a/arch/arm/mach-shmobile/setup-r8a7779.c
> > +++ b/arch/arm/mach-shmobile/setup-r8a7779.c
> > @@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
> >  };
> >  
> >  static struct platform_device sata_device = {
> > -	.name		= "sata_rcar",
> > +	.name		= "sata-r8a7779",
> >  	.id		= -1,
> >  	.resource	= sata_resources,
> >  	.num_resources	= ARRAY_SIZE(sata_resources),
> > diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> > index a625cc5..068d5b4 100644
> > --- a/drivers/ata/sata_rcar.c
> > +++ b/drivers/ata/sata_rcar.c
> > @@ -15,6 +15,7 @@
> >  #include <linux/module.h>
> >  #include <linux/ata.h>
> >  #include <linux/libata.h>
> > +#include <linux/of_device.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/clk.h>
> >  #include <linux/err.h>
> > @@ -123,12 +124,37 @@
> >  
> >  #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
> >  
> > +/* Gen2 Physical Layer Control Registers */
> > +#define RCAR_GEN2_PHY_CTL1_REG		0x1704
> > +#define RCAR_GEN2_PHY_CTL1		0x34180002
> > +#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
> > +
> > +#define RCAR_GEN2_PHY_CTL2_REG		0x170C
> > +#define RCAR_GEN2_PHY_CTL2		0x00002303
> > +
> > +#define RCAR_GEN2_PHY_CTL3_REG		0x171C
> > +#define RCAR_GEN2_PHY_CTL3		0x000B0194
> > +
> > +#define RCAR_GEN2_PHY_CTL4_REG		0x1724
> > +#define RCAR_GEN2_PHY_CTL4		0x00030994
> > +
> > +#define RCAR_GEN2_PHY_CTL5_REG		0x1740
> > +#define RCAR_GEN2_PHY_CTL5		0x03004001
> > +#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
> > +#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
> > +
> > +enum sata_rcar_type {
> > +	RCAR_GEN1_SATA,
> > +	RCAR_GEN2_SATA,
> > +};
> > +
> >  struct sata_rcar_priv {
> >  	void __iomem *base;
> >  	struct clk *clk;
> > +	enum sata_rcar_type type;
> >  };
> >  
> > -static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
> > +static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
> >  {
> >  	void __iomem *base = priv->base;
> >  
> > @@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
> >  	iowrite32(0, base + SATAPHYRESET_REG);
> >  }
> >  
> > -static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
> > -				int group)
> > +static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
> > +				     u32 val, int group)
> >  {
> >  	void __iomem *base = priv->base;
> >  	int timeout;
> > @@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
> >  	iowrite32(0, base + SATAPHYADDR_REG);
> >  }
> >  
> > +static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
> > +{
> > +	sata_rcar_gen1_phy_preinit(priv);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
> > +}
> > +
> > +static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
> > +{
> > +	void __iomem *base = priv->base;
> > +
> > +	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
> > +	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
> > +	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
> > +	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
> > +	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
> > +		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
> > +}
> > +
> >  static void sata_rcar_freeze(struct ata_port *ap)
> >  {
> >  	struct sata_rcar_priv *priv = ap->host->private_data;
> > @@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
> >  	u32 val;
> >  
> >  	/* reset and setup phy */
> > -	sata_rcar_phy_initialize(priv);
> > -	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
> > -	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
> > -	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
> > -	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
> > -	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
> > -	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
> > +	switch (priv->type) {
> > +	case RCAR_GEN1_SATA:
> > +		sata_rcar_gen1_phy_init(priv);
> > +		break;
> > +	case RCAR_GEN2_SATA:
> > +		sata_rcar_gen2_phy_init(priv);
> > +		break;
> > +	default:
> > +		dev_warn(host->dev, "SATA phy is not initialized\n");
> > +		break;
> > +	}
> >  
> >  	/* SATA-IP reset state */
> >  	val = ioread32(base + ATAPI_CONTROL1_REG);
> > @@ -770,8 +823,39 @@ static void sata_rcar_init_controller(struct ata_host *host)
> >  	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
> >  }
> >  
> > +static struct of_device_id sata_rcar_match[] = {
> > +	/* Deprecated, "renesas,sata-r8a7779" should be used instead. */
> > +	{
> > +		.compatible = "renesas,rcar-sata",
> > +		.data = (void *)RCAR_GEN1_SATA,
> > +	},
> > +	{
> > +		.compatible = "renesas,sata-r8a7779",
> > +		.data = (void *)RCAR_GEN1_SATA,
> > +	},
> > +	{
> > +		.compatible = "renesas,sata-r8a7790",
> > +		.data = (void *)RCAR_GEN2_SATA
> > +	},
> > +	{
> > +		.compatible = "renesas,sata-r8a7791",
> > +		.data = (void *)RCAR_GEN2_SATA
> > +	},
> > +	{},
> > +};
> > +MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > +
> > +static const struct platform_device_id sata_rcar_id_table[] = {
> > +	{ "sata-r8a7779", RCAR_GEN1_SATA },
> > +	{ "sata-r8a7790", RCAR_GEN2_SATA },
> > +	{ "sata-r8a7791", RCAR_GEN2_SATA },
> > +	{ },
> > +};
> > +MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
> > +
> >  static int sata_rcar_probe(struct platform_device *pdev)
> >  {
> > +	const struct of_device_id *of_id;
> >  	struct ata_host *host;
> >  	struct sata_rcar_priv *priv;
> >  	struct resource *mem;
> > @@ -787,6 +871,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
> >  	if (!priv)
> >  		return -ENOMEM;
> >  
> > +	of_id = of_match_device(sata_rcar_match, &pdev->dev);
> > +	if (of_id)
> > +		priv->type = (enum sata_rcar_type)of_id->data;
> > +	else
> > +		priv->type = platform_get_device_id(pdev)->driver_data;
> > +
> >  	priv->clk = devm_clk_get(&pdev->dev, NULL);
> >  	if (IS_ERR(priv->clk)) {
> >  		dev_err(&pdev->dev, "failed to get access to sata clock\n");
> > @@ -892,16 +982,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
> >  };
> >  #endif
> >  
> > -static struct of_device_id sata_rcar_match[] = {
> > -	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
> > -	{ .compatible = "renesas,sata-r8a7779", },
> > -	{},
> > -};
> > -MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > -
> >  static struct platform_driver sata_rcar_driver = {
> >  	.probe		= sata_rcar_probe,
> >  	.remove		= sata_rcar_remove,
> > +	.id_table	= sata_rcar_id_table,
> >  	.driver = {
> >  		.name		= DRV_NAME,
> >  		.owner		= THIS_MODULE,
> > -- 
> > 1.8.3.1
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-29  8:46         ` Simon Horman
  0 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-29  8:46 UTC (permalink / raw)
  To: Valentine Barshak
  Cc: linux-sh, linux-ide, devicetree, Magnus Damm, Vladimir Barinov,
	Sergei Shtylyov, Kuninori Morimoto, Laurent Pinchart,
	Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Tue, Oct 29, 2013 at 01:59:43PM +0900, Simon Horman wrote:
> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
> > R-Car Gen2 SoCs have a different PHY which is not compatible
> > with the older R-Car H1 (R8A7779) version.
> > This adds OF/platform device id tables and PHY initialization
> > callbacks for the following Gen2 SoCs:
> >   * R-Car H2: R8A7790;
> >   * R-Car M2: R8A7791.
> > 
> > PHY initialization method is chosen based on the device id.
> > Default PHY settings are applied for Gen2 SoCs, which should
> > suit the Gen2 boards available.
> > 
> > The R8A7779 platform code is modified to use "sata-r8a7779"
> > device name.
> > 
> > Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> > ---
> >  .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >  arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >  arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >  drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
> 
> Hi Mark, Hi Device-Tree Folks,
> 
> I'm wondering if you have had a chance to look over the bindings
> aspect of this and the other patch in the series. I believe that
> this series addresses all previous review in that regards.
> 
> Hi Valentine,
> 
> I would like to request that the arch/arm/mach-shmobile/ portion
> of this patch be split out into a separate patch. The reason is
> that in general it is nicer to apply driver changes separately
> to platform changes: for starters they have different maintainers.
> And in this case there seems to be no reason not to split the change.

I now realise that my assertion is false and in its current
form the changes in this patch need to be done atomically.

I'm unsure what the motivation for this is.

> 
> Also, I would like to this chance to pass on part of a discussion
> at the ARM Linux Kernel summit which is that when posting a series of
> patches please only CC devicetree@vger.kernel.org on the patches in
> the series that relate to device tree. This would not include
> to the new patch with only the arch/arm/mach-shmobile/ portions
> of this patch. Feel free to post that patch as a separate series
> noting its dependencies below '---' accordingly.
> 
> >  4 files changed, 107 insertions(+), 20 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > index 0719115..d6b20a6 100644
> > --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
> > @@ -1,7 +1,10 @@
> >  * Renesas R-Car SATA
> >  
> >  Required properties:
> > -- compatible		: should contain "renesas,sata-r8a7779";
> > +- compatible		: should contain one of the following:
> > +			  - "renesas,sata-r8a7779" for R-Car H1
> > +			  - "renesas,sata-r8a7790" for R-Car H2
> > +			  - "renesas,sata-r8a7791" for R-Car M2
> >  - reg			: offset and length of the SATA registers;
> >  - interrupts		: must consist of one interrupt specifier.
> >  
> > diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
> > index 5c83259..b2f8417 100644
> > --- a/arch/arm/mach-shmobile/clock-r8a7779.c
> > +++ b/arch/arm/mach-shmobile/clock-r8a7779.c
> > @@ -170,7 +170,7 @@ static struct clk_lookup lookups[] = {
> >  	/* MSTP32 clocks */
> >  	CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
> >  	CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
> > -	CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
> > +	CLKDEV_DEV_ID("sata-r8a7779", &mstp_clks[MSTP115]), /* SATA */
> >  	CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
> >  	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
> >  	CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
> > diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
> > index 51a43c5..9d49090 100644
> > --- a/arch/arm/mach-shmobile/setup-r8a7779.c
> > +++ b/arch/arm/mach-shmobile/setup-r8a7779.c
> > @@ -438,7 +438,7 @@ static struct resource sata_resources[] = {
> >  };
> >  
> >  static struct platform_device sata_device = {
> > -	.name		= "sata_rcar",
> > +	.name		= "sata-r8a7779",
> >  	.id		= -1,
> >  	.resource	= sata_resources,
> >  	.num_resources	= ARRAY_SIZE(sata_resources),
> > diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> > index a625cc5..068d5b4 100644
> > --- a/drivers/ata/sata_rcar.c
> > +++ b/drivers/ata/sata_rcar.c
> > @@ -15,6 +15,7 @@
> >  #include <linux/module.h>
> >  #include <linux/ata.h>
> >  #include <linux/libata.h>
> > +#include <linux/of_device.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/clk.h>
> >  #include <linux/err.h>
> > @@ -123,12 +124,37 @@
> >  
> >  #define SATA_RCAR_DMA_BOUNDARY		0x1FFFFFFEUL
> >  
> > +/* Gen2 Physical Layer Control Registers */
> > +#define RCAR_GEN2_PHY_CTL1_REG		0x1704
> > +#define RCAR_GEN2_PHY_CTL1		0x34180002
> > +#define RCAR_GEN2_PHY_CTL1_SS		0xC180	/* Spread Spectrum */
> > +
> > +#define RCAR_GEN2_PHY_CTL2_REG		0x170C
> > +#define RCAR_GEN2_PHY_CTL2		0x00002303
> > +
> > +#define RCAR_GEN2_PHY_CTL3_REG		0x171C
> > +#define RCAR_GEN2_PHY_CTL3		0x000B0194
> > +
> > +#define RCAR_GEN2_PHY_CTL4_REG		0x1724
> > +#define RCAR_GEN2_PHY_CTL4		0x00030994
> > +
> > +#define RCAR_GEN2_PHY_CTL5_REG		0x1740
> > +#define RCAR_GEN2_PHY_CTL5		0x03004001
> > +#define RCAR_GEN2_PHY_CTL5_DC		BIT(1)	/* DC connection */
> > +#define RCAR_GEN2_PHY_CTL5_TR		BIT(2)	/* Termination Resistor */
> > +
> > +enum sata_rcar_type {
> > +	RCAR_GEN1_SATA,
> > +	RCAR_GEN2_SATA,
> > +};
> > +
> >  struct sata_rcar_priv {
> >  	void __iomem *base;
> >  	struct clk *clk;
> > +	enum sata_rcar_type type;
> >  };
> >  
> > -static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
> > +static void sata_rcar_gen1_phy_preinit(struct sata_rcar_priv *priv)
> >  {
> >  	void __iomem *base = priv->base;
> >  
> > @@ -141,8 +167,8 @@ static void sata_rcar_phy_initialize(struct sata_rcar_priv *priv)
> >  	iowrite32(0, base + SATAPHYRESET_REG);
> >  }
> >  
> > -static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
> > -				int group)
> > +static void sata_rcar_gen1_phy_write(struct sata_rcar_priv *priv, u16 reg,
> > +				     u32 val, int group)
> >  {
> >  	void __iomem *base = priv->base;
> >  	int timeout;
> > @@ -170,6 +196,29 @@ static void sata_rcar_phy_write(struct sata_rcar_priv *priv, u16 reg, u32 val,
> >  	iowrite32(0, base + SATAPHYADDR_REG);
> >  }
> >  
> > +static void sata_rcar_gen1_phy_init(struct sata_rcar_priv *priv)
> > +{
> > +	sata_rcar_gen1_phy_preinit(priv);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
> > +	sata_rcar_gen1_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
> > +}
> > +
> > +static void sata_rcar_gen2_phy_init(struct sata_rcar_priv *priv)
> > +{
> > +	void __iomem *base = priv->base;
> > +
> > +	iowrite32(RCAR_GEN2_PHY_CTL1, base + RCAR_GEN2_PHY_CTL1_REG);
> > +	iowrite32(RCAR_GEN2_PHY_CTL2, base + RCAR_GEN2_PHY_CTL2_REG);
> > +	iowrite32(RCAR_GEN2_PHY_CTL3, base + RCAR_GEN2_PHY_CTL3_REG);
> > +	iowrite32(RCAR_GEN2_PHY_CTL4, base + RCAR_GEN2_PHY_CTL4_REG);
> > +	iowrite32(RCAR_GEN2_PHY_CTL5 | RCAR_GEN2_PHY_CTL5_DC |
> > +		  RCAR_GEN2_PHY_CTL5_TR, base + RCAR_GEN2_PHY_CTL5_REG);
> > +}
> > +
> >  static void sata_rcar_freeze(struct ata_port *ap)
> >  {
> >  	struct sata_rcar_priv *priv = ap->host->private_data;
> > @@ -738,13 +787,17 @@ static void sata_rcar_init_controller(struct ata_host *host)
> >  	u32 val;
> >  
> >  	/* reset and setup phy */
> > -	sata_rcar_phy_initialize(priv);
> > -	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 0);
> > -	sata_rcar_phy_write(priv, SATAPCTLR1_REG, 0x00200188, 1);
> > -	sata_rcar_phy_write(priv, SATAPCTLR3_REG, 0x0000A061, 0);
> > -	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 0);
> > -	sata_rcar_phy_write(priv, SATAPCTLR2_REG, 0x20000000, 1);
> > -	sata_rcar_phy_write(priv, SATAPCTLR4_REG, 0x28E80000, 0);
> > +	switch (priv->type) {
> > +	case RCAR_GEN1_SATA:
> > +		sata_rcar_gen1_phy_init(priv);
> > +		break;
> > +	case RCAR_GEN2_SATA:
> > +		sata_rcar_gen2_phy_init(priv);
> > +		break;
> > +	default:
> > +		dev_warn(host->dev, "SATA phy is not initialized\n");
> > +		break;
> > +	}
> >  
> >  	/* SATA-IP reset state */
> >  	val = ioread32(base + ATAPI_CONTROL1_REG);
> > @@ -770,8 +823,39 @@ static void sata_rcar_init_controller(struct ata_host *host)
> >  	iowrite32(ATAPI_INT_ENABLE_SATAINT, base + ATAPI_INT_ENABLE_REG);
> >  }
> >  
> > +static struct of_device_id sata_rcar_match[] = {
> > +	/* Deprecated, "renesas,sata-r8a7779" should be used instead. */
> > +	{
> > +		.compatible = "renesas,rcar-sata",
> > +		.data = (void *)RCAR_GEN1_SATA,
> > +	},
> > +	{
> > +		.compatible = "renesas,sata-r8a7779",
> > +		.data = (void *)RCAR_GEN1_SATA,
> > +	},
> > +	{
> > +		.compatible = "renesas,sata-r8a7790",
> > +		.data = (void *)RCAR_GEN2_SATA
> > +	},
> > +	{
> > +		.compatible = "renesas,sata-r8a7791",
> > +		.data = (void *)RCAR_GEN2_SATA
> > +	},
> > +	{},
> > +};
> > +MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > +
> > +static const struct platform_device_id sata_rcar_id_table[] = {
> > +	{ "sata-r8a7779", RCAR_GEN1_SATA },
> > +	{ "sata-r8a7790", RCAR_GEN2_SATA },
> > +	{ "sata-r8a7791", RCAR_GEN2_SATA },
> > +	{ },
> > +};
> > +MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
> > +
> >  static int sata_rcar_probe(struct platform_device *pdev)
> >  {
> > +	const struct of_device_id *of_id;
> >  	struct ata_host *host;
> >  	struct sata_rcar_priv *priv;
> >  	struct resource *mem;
> > @@ -787,6 +871,12 @@ static int sata_rcar_probe(struct platform_device *pdev)
> >  	if (!priv)
> >  		return -ENOMEM;
> >  
> > +	of_id = of_match_device(sata_rcar_match, &pdev->dev);
> > +	if (of_id)
> > +		priv->type = (enum sata_rcar_type)of_id->data;
> > +	else
> > +		priv->type = platform_get_device_id(pdev)->driver_data;
> > +
> >  	priv->clk = devm_clk_get(&pdev->dev, NULL);
> >  	if (IS_ERR(priv->clk)) {
> >  		dev_err(&pdev->dev, "failed to get access to sata clock\n");
> > @@ -892,16 +982,10 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {
> >  };
> >  #endif
> >  
> > -static struct of_device_id sata_rcar_match[] = {
> > -	{ .compatible = "renesas,rcar-sata", },	/* Deprecated */
> > -	{ .compatible = "renesas,sata-r8a7779", },
> > -	{},
> > -};
> > -MODULE_DEVICE_TABLE(of, sata_rcar_match);
> > -
> >  static struct platform_driver sata_rcar_driver = {
> >  	.probe		= sata_rcar_probe,
> >  	.remove		= sata_rcar_remove,
> > +	.id_table	= sata_rcar_id_table,
> >  	.driver = {
> >  		.name		= DRV_NAME,
> >  		.owner		= THIS_MODULE,
> > -- 
> > 1.8.3.1
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-29  8:44           ` Simon Horman
@ 2013-10-29 17:19             ` Kumar Gala
  -1 siblings, 0 replies; 60+ messages in thread
From: Kumar Gala @ 2013-10-29 17:19 UTC (permalink / raw)
  To: Simon Horman
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland


On Oct 29, 2013, at 3:44 AM, Simon Horman wrote:

> On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
>> 
>> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
>> 
>>> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
>>>> R-Car Gen2 SoCs have a different PHY which is not compatible
>>>> with the older R-Car H1 (R8A7779) version.
>>>> This adds OF/platform device id tables and PHY initialization
>>>> callbacks for the following Gen2 SoCs:
>>>> * R-Car H2: R8A7790;
>>>> * R-Car M2: R8A7791.
>>>> 
>>>> PHY initialization method is chosen based on the device id.
>>>> Default PHY settings are applied for Gen2 SoCs, which should
>>>> suit the Gen2 boards available.
>>>> 
>>>> The R8A7779 platform code is modified to use "sata-r8a7779"
>>>> device name.
>>>> 
>>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>>>> ---
>>>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
>>> 
>>> Hi Mark, Hi Device-Tree Folks,
>>> 
>>> I'm wondering if you have had a chance to look over the bindings
>>> aspect of this and the other patch in the series. I believe that
>>> this series addresses all previous review in that regards.
>> 
>> What tree is this binding in?
> 
> sata_car.txt is added by the previous patch in this series
> "[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"

Why not just have all the binding in one patch.  There isn't a reason this should be split.

- k

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


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-29 17:19             ` Kumar Gala
  0 siblings, 0 replies; 60+ messages in thread
From: Kumar Gala @ 2013-10-29 17:19 UTC (permalink / raw)
  To: Simon Horman
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland


On Oct 29, 2013, at 3:44 AM, Simon Horman wrote:

> On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
>> 
>> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
>> 
>>> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
>>>> R-Car Gen2 SoCs have a different PHY which is not compatible
>>>> with the older R-Car H1 (R8A7779) version.
>>>> This adds OF/platform device id tables and PHY initialization
>>>> callbacks for the following Gen2 SoCs:
>>>> * R-Car H2: R8A7790;
>>>> * R-Car M2: R8A7791.
>>>> 
>>>> PHY initialization method is chosen based on the device id.
>>>> Default PHY settings are applied for Gen2 SoCs, which should
>>>> suit the Gen2 boards available.
>>>> 
>>>> The R8A7779 platform code is modified to use "sata-r8a7779"
>>>> device name.
>>>> 
>>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>>>> ---
>>>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
>>> 
>>> Hi Mark, Hi Device-Tree Folks,
>>> 
>>> I'm wondering if you have had a chance to look over the bindings
>>> aspect of this and the other patch in the series. I believe that
>>> this series addresses all previous review in that regards.
>> 
>> What tree is this binding in?
> 
> sata_car.txt is added by the previous patch in this series
> "[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"

Why not just have all the binding in one patch.  There isn't a reason this should be split.

- k

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


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-29 17:19             ` Kumar Gala
@ 2013-10-30  0:28               ` Simon Horman
  -1 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-30  0:28 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Tue, Oct 29, 2013 at 12:19:08PM -0500, Kumar Gala wrote:
> 
> On Oct 29, 2013, at 3:44 AM, Simon Horman wrote:
> 
> > On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
> >> 
> >> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
> >> 
> >>> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
> >>>> R-Car Gen2 SoCs have a different PHY which is not compatible
> >>>> with the older R-Car H1 (R8A7779) version.
> >>>> This adds OF/platform device id tables and PHY initialization
> >>>> callbacks for the following Gen2 SoCs:
> >>>> * R-Car H2: R8A7790;
> >>>> * R-Car M2: R8A7791.
> >>>> 
> >>>> PHY initialization method is chosen based on the device id.
> >>>> Default PHY settings are applied for Gen2 SoCs, which should
> >>>> suit the Gen2 boards available.
> >>>> 
> >>>> The R8A7779 platform code is modified to use "sata-r8a7779"
> >>>> device name.
> >>>> 
> >>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >>>> ---
> >>>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >>>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >>>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >>>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
> >>> 
> >>> Hi Mark, Hi Device-Tree Folks,
> >>> 
> >>> I'm wondering if you have had a chance to look over the bindings
> >>> aspect of this and the other patch in the series. I believe that
> >>> this series addresses all previous review in that regards.
> >> 
> >> What tree is this binding in?
> > 
> > sata_car.txt is added by the previous patch in this series
> > "[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"
> 
> Why not just have all the binding in one patch.  There isn't a reason this should be split.

I think that the motivation was that the first patch documents the
existing implementation while the second documents a change to it.
With that in mind would you still like a single patch for the binding?

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-30  0:28               ` Simon Horman
  0 siblings, 0 replies; 60+ messages in thread
From: Simon Horman @ 2013-10-30  0:28 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On Tue, Oct 29, 2013 at 12:19:08PM -0500, Kumar Gala wrote:
> 
> On Oct 29, 2013, at 3:44 AM, Simon Horman wrote:
> 
> > On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
> >> 
> >> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
> >> 
> >>> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
> >>>> R-Car Gen2 SoCs have a different PHY which is not compatible
> >>>> with the older R-Car H1 (R8A7779) version.
> >>>> This adds OF/platform device id tables and PHY initialization
> >>>> callbacks for the following Gen2 SoCs:
> >>>> * R-Car H2: R8A7790;
> >>>> * R-Car M2: R8A7791.
> >>>> 
> >>>> PHY initialization method is chosen based on the device id.
> >>>> Default PHY settings are applied for Gen2 SoCs, which should
> >>>> suit the Gen2 boards available.
> >>>> 
> >>>> The R8A7779 platform code is modified to use "sata-r8a7779"
> >>>> device name.
> >>>> 
> >>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> >>>> ---
> >>>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
> >>>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
> >>>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
> >>>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
> >>> 
> >>> Hi Mark, Hi Device-Tree Folks,
> >>> 
> >>> I'm wondering if you have had a chance to look over the bindings
> >>> aspect of this and the other patch in the series. I believe that
> >>> this series addresses all previous review in that regards.
> >> 
> >> What tree is this binding in?
> > 
> > sata_car.txt is added by the previous patch in this series
> > "[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"
> 
> Why not just have all the binding in one patch.  There isn't a reason this should be split.

I think that the motivation was that the first patch documents the
existing implementation while the second documents a change to it.
With that in mind would you still like a single patch for the binding?

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-30  0:28               ` Simon Horman
@ 2013-10-30  7:05                 ` Kumar Gala
  -1 siblings, 0 replies; 60+ messages in thread
From: Kumar Gala @ 2013-10-30  7:05 UTC (permalink / raw)
  To: Simon Horman
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland


On Oct 29, 2013, at 7:28 PM, Simon Horman wrote:

> On Tue, Oct 29, 2013 at 12:19:08PM -0500, Kumar Gala wrote:
>> 
>> On Oct 29, 2013, at 3:44 AM, Simon Horman wrote:
>> 
>>> On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
>>>> 
>>>> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
>>>> 
>>>>> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
>>>>>> R-Car Gen2 SoCs have a different PHY which is not compatible
>>>>>> with the older R-Car H1 (R8A7779) version.
>>>>>> This adds OF/platform device id tables and PHY initialization
>>>>>> callbacks for the following Gen2 SoCs:
>>>>>> * R-Car H2: R8A7790;
>>>>>> * R-Car M2: R8A7791.
>>>>>> 
>>>>>> PHY initialization method is chosen based on the device id.
>>>>>> Default PHY settings are applied for Gen2 SoCs, which should
>>>>>> suit the Gen2 boards available.
>>>>>> 
>>>>>> The R8A7779 platform code is modified to use "sata-r8a7779"
>>>>>> device name.
>>>>>> 
>>>>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>>>>>> ---
>>>>>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>>>>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>>>>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>>>>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
>>>>> 
>>>>> Hi Mark, Hi Device-Tree Folks,
>>>>> 
>>>>> I'm wondering if you have had a chance to look over the bindings
>>>>> aspect of this and the other patch in the series. I believe that
>>>>> this series addresses all previous review in that regards.
>>>> 
>>>> What tree is this binding in?
>>> 
>>> sata_car.txt is added by the previous patch in this series
>>> "[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"
>> 
>> Why not just have all the binding in one patch.  There isn't a reason this should be split.
> 
> I think that the motivation was that the first patch documents the
> existing implementation while the second documents a change to it.
> With that in mind would you still like a single patch for the binding?

Yes, I see no reason to split this up as you know both right now.

- k

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


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-30  7:05                 ` Kumar Gala
  0 siblings, 0 replies; 60+ messages in thread
From: Kumar Gala @ 2013-10-30  7:05 UTC (permalink / raw)
  To: Simon Horman
  Cc: Valentine Barshak, linux-sh, linux-ide, devicetree, Magnus Damm,
	Vladimir Barinov, Sergei Shtylyov, Kuninori Morimoto,
	Laurent Pinchart, Guennadi Liakhovetski, Tejun Heo, Mark Rutland


On Oct 29, 2013, at 7:28 PM, Simon Horman wrote:

> On Tue, Oct 29, 2013 at 12:19:08PM -0500, Kumar Gala wrote:
>> 
>> On Oct 29, 2013, at 3:44 AM, Simon Horman wrote:
>> 
>>> On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
>>>> 
>>>> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
>>>> 
>>>>> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
>>>>>> R-Car Gen2 SoCs have a different PHY which is not compatible
>>>>>> with the older R-Car H1 (R8A7779) version.
>>>>>> This adds OF/platform device id tables and PHY initialization
>>>>>> callbacks for the following Gen2 SoCs:
>>>>>> * R-Car H2: R8A7790;
>>>>>> * R-Car M2: R8A7791.
>>>>>> 
>>>>>> PHY initialization method is chosen based on the device id.
>>>>>> Default PHY settings are applied for Gen2 SoCs, which should
>>>>>> suit the Gen2 boards available.
>>>>>> 
>>>>>> The R8A7779 platform code is modified to use "sata-r8a7779"
>>>>>> device name.
>>>>>> 
>>>>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>>>>>> ---
>>>>>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>>>>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>>>>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>>>>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
>>>>> 
>>>>> Hi Mark, Hi Device-Tree Folks,
>>>>> 
>>>>> I'm wondering if you have had a chance to look over the bindings
>>>>> aspect of this and the other patch in the series. I believe that
>>>>> this series addresses all previous review in that regards.
>>>> 
>>>> What tree is this binding in?
>>> 
>>> sata_car.txt is added by the previous patch in this series
>>> "[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"
>> 
>> Why not just have all the binding in one patch.  There isn't a reason this should be split.
> 
> I think that the motivation was that the first patch documents the
> existing implementation while the second documents a change to it.
> With that in mind would you still like a single patch for the binding?

Yes, I see no reason to split this up as you know both right now.

- k

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


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
  2013-10-30  7:05                 ` Kumar Gala
@ 2013-10-30 17:07                   ` Valentine
  -1 siblings, 0 replies; 60+ messages in thread
From: Valentine @ 2013-10-30 17:07 UTC (permalink / raw)
  To: Kumar Gala, Simon Horman
  Cc: linux-sh, linux-ide, devicetree, Magnus Damm, Vladimir Barinov,
	Sergei Shtylyov, Kuninori Morimoto, Laurent Pinchart,
	Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On 10/30/2013 11:05 AM, Kumar Gala wrote:
>
> On Oct 29, 2013, at 7:28 PM, Simon Horman wrote:
>
>> On Tue, Oct 29, 2013 at 12:19:08PM -0500, Kumar Gala wrote:
>>>
>>> On Oct 29, 2013, at 3:44 AM, Simon Horman wrote:
>>>
>>>> On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
>>>>>
>>>>> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
>>>>>
>>>>>> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
>>>>>>> R-Car Gen2 SoCs have a different PHY which is not compatible
>>>>>>> with the older R-Car H1 (R8A7779) version.
>>>>>>> This adds OF/platform device id tables and PHY initialization
>>>>>>> callbacks for the following Gen2 SoCs:
>>>>>>> * R-Car H2: R8A7790;
>>>>>>> * R-Car M2: R8A7791.
>>>>>>>
>>>>>>> PHY initialization method is chosen based on the device id.
>>>>>>> Default PHY settings are applied for Gen2 SoCs, which should
>>>>>>> suit the Gen2 boards available.
>>>>>>>
>>>>>>> The R8A7779 platform code is modified to use "sata-r8a7779"
>>>>>>> device name.
>>>>>>>
>>>>>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>>>>>>> ---
>>>>>>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>>>>>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>>>>>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>>>>>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
>>>>>>
>>>>>> Hi Mark, Hi Device-Tree Folks,
>>>>>>
>>>>>> I'm wondering if you have had a chance to look over the bindings
>>>>>> aspect of this and the other patch in the series. I believe that
>>>>>> this series addresses all previous review in that regards.
>>>>>
>>>>> What tree is this binding in?
>>>>
>>>> sata_car.txt is added by the previous patch in this series
>>>> "[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"
>>>
>>> Why not just have all the binding in one patch.  There isn't a reason this should be split.
>>
>> I think that the motivation was that the first patch documents the
>> existing implementation while the second documents a change to it.
>> With that in mind would you still like a single patch for the binding?
>
> Yes, I see no reason to split this up as you know both right now.
>
> - k
>

I'll resend the sata_rcar part as a separate patch in a bit.
I'll keep the old-style compatibility string and device id table entry
for compatibility with existing Marzen (r8a7779) platform code/dts.

Once it is accepted, the bindings documentation will be sent as a separate patch.

Thanks.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support
@ 2013-10-30 17:07                   ` Valentine
  0 siblings, 0 replies; 60+ messages in thread
From: Valentine @ 2013-10-30 17:07 UTC (permalink / raw)
  To: Kumar Gala, Simon Horman
  Cc: linux-sh, linux-ide, devicetree, Magnus Damm, Vladimir Barinov,
	Sergei Shtylyov, Kuninori Morimoto, Laurent Pinchart,
	Guennadi Liakhovetski, Tejun Heo, Mark Rutland

On 10/30/2013 11:05 AM, Kumar Gala wrote:
>
> On Oct 29, 2013, at 7:28 PM, Simon Horman wrote:
>
>> On Tue, Oct 29, 2013 at 12:19:08PM -0500, Kumar Gala wrote:
>>>
>>> On Oct 29, 2013, at 3:44 AM, Simon Horman wrote:
>>>
>>>> On Tue, Oct 29, 2013 at 03:24:16AM -0500, Kumar Gala wrote:
>>>>>
>>>>> On Oct 28, 2013, at 11:59 PM, Simon Horman wrote:
>>>>>
>>>>>> On Wed, Oct 16, 2013 at 04:06:01PM +0400, Valentine Barshak wrote:
>>>>>>> R-Car Gen2 SoCs have a different PHY which is not compatible
>>>>>>> with the older R-Car H1 (R8A7779) version.
>>>>>>> This adds OF/platform device id tables and PHY initialization
>>>>>>> callbacks for the following Gen2 SoCs:
>>>>>>> * R-Car H2: R8A7790;
>>>>>>> * R-Car M2: R8A7791.
>>>>>>>
>>>>>>> PHY initialization method is chosen based on the device id.
>>>>>>> Default PHY settings are applied for Gen2 SoCs, which should
>>>>>>> suit the Gen2 boards available.
>>>>>>>
>>>>>>> The R8A7779 platform code is modified to use "sata-r8a7779"
>>>>>>> device name.
>>>>>>>
>>>>>>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>>>>>>> ---
>>>>>>> .../devicetree/bindings/ata/sata_rcar.txt          |   5 +-
>>>>>>> arch/arm/mach-shmobile/clock-r8a7779.c             |   2 +-
>>>>>>> arch/arm/mach-shmobile/setup-r8a7779.c             |   2 +-
>>>>>>> drivers/ata/sata_rcar.c                            | 118 ++++++++++++++++++---
>>>>>>
>>>>>> Hi Mark, Hi Device-Tree Folks,
>>>>>>
>>>>>> I'm wondering if you have had a chance to look over the bindings
>>>>>> aspect of this and the other patch in the series. I believe that
>>>>>> this series addresses all previous review in that regards.
>>>>>
>>>>> What tree is this binding in?
>>>>
>>>> sata_car.txt is added by the previous patch in this series
>>>> "[PATCH 1/2] sata_rcar: Adjust and document device tree bindings"
>>>
>>> Why not just have all the binding in one patch.  There isn't a reason this should be split.
>>
>> I think that the motivation was that the first patch documents the
>> existing implementation while the second documents a change to it.
>> With that in mind would you still like a single patch for the binding?
>
> Yes, I see no reason to split this up as you know both right now.
>
> - k
>

I'll resend the sata_rcar part as a separate patch in a bit.
I'll keep the old-style compatibility string and device id table entry
for compatibility with existing Marzen (r8a7779) platform code/dts.

Once it is accepted, the bindings documentation will be sent as a separate patch.

Thanks.

^ permalink raw reply	[flat|nested] 60+ messages in thread

end of thread, other threads:[~2013-10-30 17:08 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-14 15:42 [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support Valentine Barshak
2013-10-14 15:42 ` Valentine Barshak
2013-10-14 15:42 ` [PATCH 1/2] sata_rcar: Adjust and document device tree bindings Valentine Barshak
2013-10-14 15:42   ` Valentine Barshak
2013-10-14 16:13   ` Mark Rutland
2013-10-14 16:13     ` Mark Rutland
2013-10-14 17:19     ` Valentine
2013-10-14 17:19       ` Valentine
2013-10-15  0:25       ` Simon Horman
2013-10-15  0:25         ` Simon Horman
2013-10-15  8:15       ` Mark Rutland
2013-10-15  8:15         ` Mark Rutland
2013-10-14 15:42 ` [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA support Valentine Barshak
2013-10-14 15:42   ` Valentine Barshak
2013-10-14 16:26   ` Mark Rutland
2013-10-14 16:26     ` Mark Rutland
2013-10-14 17:58     ` Valentine
2013-10-14 17:58       ` Valentine
2013-10-14 18:15       ` Laurent Pinchart
2013-10-14 18:15         ` Laurent Pinchart
2013-10-14 21:22         ` Valentine
2013-10-14 21:22           ` Valentine
2013-10-15  0:23           ` Simon Horman
2013-10-15  0:23             ` Simon Horman
2013-10-15  0:32             ` Laurent Pinchart
2013-10-15  0:32               ` Laurent Pinchart
2013-10-16  6:10               ` Simon Horman
2013-10-16  6:10                 ` Simon Horman
2013-10-15 10:20 ` [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support (take 2) Valentine Barshak
2013-10-15 10:20   ` Valentine Barshak
2013-10-15 10:20   ` [PATCH 1/2] sata_rcar: Adjust and document device tree bindings Valentine Barshak
2013-10-15 10:20     ` Valentine Barshak
2013-10-16  0:42     ` Simon Horman
2013-10-16  0:42       ` Simon Horman
2013-10-15 10:20   ` [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support Valentine Barshak
2013-10-15 10:20     ` Valentine Barshak
2013-10-15 12:40   ` [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support (take 2) Tejun Heo
2013-10-15 12:40     ` Tejun Heo
2013-10-16 12:05 ` [PATCH 0/2] sata_rcar: Adjust DT bindings and add R-Car Gen2 PHY support (take 3) Valentine Barshak
2013-10-16 12:05   ` Valentine Barshak
2013-10-16 12:06   ` [PATCH 1/2] sata_rcar: Adjust and document device tree bindings Valentine Barshak
2013-10-16 12:06     ` Valentine Barshak
2013-10-16 12:06   ` [PATCH 2/2] sata_rcar: Add R-Car Gen2 SATA PHY support Valentine Barshak
2013-10-16 12:06     ` Valentine Barshak
2013-10-29  4:59     ` Simon Horman
2013-10-29  4:59       ` Simon Horman
2013-10-29  8:24       ` Kumar Gala
2013-10-29  8:24         ` Kumar Gala
2013-10-29  8:44         ` Simon Horman
2013-10-29  8:44           ` Simon Horman
2013-10-29 17:19           ` Kumar Gala
2013-10-29 17:19             ` Kumar Gala
2013-10-30  0:28             ` Simon Horman
2013-10-30  0:28               ` Simon Horman
2013-10-30  7:05               ` Kumar Gala
2013-10-30  7:05                 ` Kumar Gala
2013-10-30 17:07                 ` Valentine
2013-10-30 17:07                   ` Valentine
2013-10-29  8:46       ` Simon Horman
2013-10-29  8:46         ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.