diff mbox

[v6,6/7] phy: phy_brcmstb_sata: add data for phy version

Message ID 1448506595-4981-7-git-send-email-jaedon.shin@gmail.com
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Jaedon Shin Nov. 26, 2015, 2:56 a.m. UTC
Add data for phy version, and the default value of version is using the
BRCM_SATA_PHY_28NM.

Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/phy/phy-brcmstb-sata.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Comments

Sergei Shtylyov Nov. 26, 2015, 11:05 a.m. UTC | #1
Hello.

On 11/26/2015 5:56 AM, Jaedon Shin wrote:

> Add data for phy version, and the default value of version is using the
> BRCM_SATA_PHY_28NM.
>
> Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
> Tested-by: Florian Fainelli <f.fainelli@gmail.com>
> Acked-by: Brian Norris <computersforpeace@gmail.com>
> ---
>   drivers/phy/phy-brcmstb-sata.c | 23 ++++++++++++++++++++---
>   1 file changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/phy/phy-brcmstb-sata.c b/drivers/phy/phy-brcmstb-sata.c
> index 0be55dafe9ea..5de394f589c8 100644
> --- a/drivers/phy/phy-brcmstb-sata.c
> +++ b/drivers/phy/phy-brcmstb-sata.c
> @@ -30,7 +30,11 @@
>   #define MAX_PORTS					2
>
>   /* Register offset between PHYs in PCB space */
> -#define SATA_MDIO_REG_SPACE_SIZE			0x1000
> +#define SATA_MDIO_REG_28NM_SPACE_SIZE			0x1000
> +
> +enum brcm_sata_phy_version {
> +	BRCM_SATA_PHY_28NM,
> +};

    So an uninitialized .data field would mean the same?

[...]
> @@ -126,7 +135,8 @@ static const struct phy_ops phy_ops_28nm = {
>   };
>
>   static const struct of_device_id brcm_sata_phy_of_match[] = {
> -	{ .compatible	= "brcm,bcm7445-sata-phy" },
> +	{ .compatible	= "brcm,bcm7445-sata-phy",
> +	  .data = (void *)BRCM_SATA_PHY_28NM },
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, brcm_sata_phy_of_match);
> @@ -135,6 +145,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
>   	struct device_node *dn = dev->of_node, *child;
> +	const struct of_device_id *of_id;
>   	struct brcm_sata_phy *priv;
>   	struct resource *res;
>   	struct phy_provider *provider;
> @@ -154,6 +165,12 @@ static int brcm_sata_phy_probe(struct platform_device *pdev)
>   	if (IS_ERR(priv->phy_base))
>   		return PTR_ERR(priv->phy_base);
>
> +	of_id = of_match_node(brcm_sata_phy_of_match, dn);
> +	if (of_id)
> +		priv->version = (enum brcm_sata_phy_version)of_id->data;
> +	else
> +		priv->version = BRCM_SATA_PHY_28NM;
> +
>   	for_each_available_child_of_node(dn, child) {
>   		unsigned int id;
>   		struct brcm_sata_port *port;

MBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kishon Vijay Abraham I Dec. 15, 2015, 10:46 a.m. UTC | #2
Hi Shin,

On Thursday 26 November 2015 04:35 PM, Sergei Shtylyov wrote:
> Hello.
> 
> On 11/26/2015 5:56 AM, Jaedon Shin wrote:
> 
>> Add data for phy version, and the default value of version is using the
>> BRCM_SATA_PHY_28NM.
>>
>> Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
>> Tested-by: Florian Fainelli <f.fainelli@gmail.com>
>> Acked-by: Brian Norris <computersforpeace@gmail.com>
>> ---
>>   drivers/phy/phy-brcmstb-sata.c | 23 ++++++++++++++++++++---
>>   1 file changed, 20 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/phy/phy-brcmstb-sata.c b/drivers/phy/phy-brcmstb-sata.c
>> index 0be55dafe9ea..5de394f589c8 100644
>> --- a/drivers/phy/phy-brcmstb-sata.c
>> +++ b/drivers/phy/phy-brcmstb-sata.c
>> @@ -30,7 +30,11 @@
>>   #define MAX_PORTS                    2
>>
>>   /* Register offset between PHYs in PCB space */
>> -#define SATA_MDIO_REG_SPACE_SIZE            0x1000
>> +#define SATA_MDIO_REG_28NM_SPACE_SIZE            0x1000
>> +
>> +enum brcm_sata_phy_version {
>> +    BRCM_SATA_PHY_28NM,
>> +};
> 
>    So an uninitialized .data field would mean the same?

Are you planning to fix this?

Thanks
Kishon
> 
> [...]
>> @@ -126,7 +135,8 @@ static const struct phy_ops phy_ops_28nm = {
>>   };
>>
>>   static const struct of_device_id brcm_sata_phy_of_match[] = {
>> -    { .compatible    = "brcm,bcm7445-sata-phy" },
>> +    { .compatible    = "brcm,bcm7445-sata-phy",
>> +      .data = (void *)BRCM_SATA_PHY_28NM },
>>       {},
>>   };
>>   MODULE_DEVICE_TABLE(of, brcm_sata_phy_of_match);
>> @@ -135,6 +145,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev)
>>   {
>>       struct device *dev = &pdev->dev;
>>       struct device_node *dn = dev->of_node, *child;
>> +    const struct of_device_id *of_id;
>>       struct brcm_sata_phy *priv;
>>       struct resource *res;
>>       struct phy_provider *provider;
>> @@ -154,6 +165,12 @@ static int brcm_sata_phy_probe(struct platform_device
>> *pdev)
>>       if (IS_ERR(priv->phy_base))
>>           return PTR_ERR(priv->phy_base);
>>
>> +    of_id = of_match_node(brcm_sata_phy_of_match, dn);
>> +    if (of_id)
>> +        priv->version = (enum brcm_sata_phy_version)of_id->data;
>> +    else
>> +        priv->version = BRCM_SATA_PHY_28NM;
>> +
>>       for_each_available_child_of_node(dn, child) {
>>           unsigned int id;
>>           struct brcm_sata_port *port;
> 
> MBR, Sergei
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jaedon Shin Dec. 15, 2015, 11:23 a.m. UTC | #3
Hi Kishon,

On Dec 15, 2015, at 7:46 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
> Hi Shin,
> 
> On Thursday 26 November 2015 04:35 PM, Sergei Shtylyov wrote:
>> Hello.
>> 
>> On 11/26/2015 5:56 AM, Jaedon Shin wrote:
>> 
>>> Add data for phy version, and the default value of version is using the
>>> BRCM_SATA_PHY_28NM.
>>> 
>>> Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com>
>>> Tested-by: Florian Fainelli <f.fainelli@gmail.com>
>>> Acked-by: Brian Norris <computersforpeace@gmail.com>
>>> ---
>>>  drivers/phy/phy-brcmstb-sata.c | 23 ++++++++++++++++++++---
>>>  1 file changed, 20 insertions(+), 3 deletions(-)
>>> 
>>> diff --git a/drivers/phy/phy-brcmstb-sata.c b/drivers/phy/phy-brcmstb-sata.c
>>> index 0be55dafe9ea..5de394f589c8 100644
>>> --- a/drivers/phy/phy-brcmstb-sata.c
>>> +++ b/drivers/phy/phy-brcmstb-sata.c
>>> @@ -30,7 +30,11 @@
>>>  #define MAX_PORTS                    2
>>> 
>>>  /* Register offset between PHYs in PCB space */
>>> -#define SATA_MDIO_REG_SPACE_SIZE            0x1000
>>> +#define SATA_MDIO_REG_28NM_SPACE_SIZE            0x1000
>>> +
>>> +enum brcm_sata_phy_version {
>>> +    BRCM_SATA_PHY_28NM,
>>> +};
>> 
>>   So an uninitialized .data field would mean the same?
> 
> Are you planning to fix this?
> 
> Thanks
> Kishon

No, I do not have a plan in this version.

Of course, It is good that correspond to the case of NULL, but a .data field is not 
empty at any time. I'm sure it must have BRCM_SATA_PHY_28NM or BRCM_SATA_PHY_40NM.

And Sergei, thanks to your good point.

Thanks,
Jaedon

>> 
>> [...]
>>> @@ -126,7 +135,8 @@ static const struct phy_ops phy_ops_28nm = {
>>>  };
>>> 
>>>  static const struct of_device_id brcm_sata_phy_of_match[] = {
>>> -    { .compatible    = "brcm,bcm7445-sata-phy" },
>>> +    { .compatible    = "brcm,bcm7445-sata-phy",
>>> +      .data = (void *)BRCM_SATA_PHY_28NM },
>>>      {},
>>>  };
>>>  MODULE_DEVICE_TABLE(of, brcm_sata_phy_of_match);
>>> @@ -135,6 +145,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev)
>>>  {
>>>      struct device *dev = &pdev->dev;
>>>      struct device_node *dn = dev->of_node, *child;
>>> +    const struct of_device_id *of_id;
>>>      struct brcm_sata_phy *priv;
>>>      struct resource *res;
>>>      struct phy_provider *provider;
>>> @@ -154,6 +165,12 @@ static int brcm_sata_phy_probe(struct platform_device
>>> *pdev)
>>>      if (IS_ERR(priv->phy_base))
>>>          return PTR_ERR(priv->phy_base);
>>> 
>>> +    of_id = of_match_node(brcm_sata_phy_of_match, dn);
>>> +    if (of_id)
>>> +        priv->version = (enum brcm_sata_phy_version)of_id->data;
>>> +    else
>>> +        priv->version = BRCM_SATA_PHY_28NM;
>>> +
>>>      for_each_available_child_of_node(dn, child) {
>>>          unsigned int id;
>>>          struct brcm_sata_port *port;
>> 
>> MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Florian Fainelli Dec. 17, 2015, 12:46 a.m. UTC | #4
On 15/12/15 03:23, Jaedon Shin wrote:
>>>   So an uninitialized .data field would mean the same?
>>
>> Are you planning to fix this?
>>
>> Thanks
>> Kishon
> 
> No, I do not have a plan in this version.
> 
> Of course, It is good that correspond to the case of NULL, but a .data field is not 
> empty at any time. I'm sure it must have BRCM_SATA_PHY_28NM or BRCM_SATA_PHY_40NM.
> 
> And Sergei, thanks to your good point.

I really do not this as a blocker to get these patches merged, and it
seems like we will miss another merge window on nitpicking if we
continue that route. Can we get these patches merged or are there more
blocking issues to be fixed?
diff mbox

Patch

diff --git a/drivers/phy/phy-brcmstb-sata.c b/drivers/phy/phy-brcmstb-sata.c
index 0be55dafe9ea..5de394f589c8 100644
--- a/drivers/phy/phy-brcmstb-sata.c
+++ b/drivers/phy/phy-brcmstb-sata.c
@@ -30,7 +30,11 @@ 
 #define MAX_PORTS					2
 
 /* Register offset between PHYs in PCB space */
-#define SATA_MDIO_REG_SPACE_SIZE			0x1000
+#define SATA_MDIO_REG_28NM_SPACE_SIZE			0x1000
+
+enum brcm_sata_phy_version {
+	BRCM_SATA_PHY_28NM,
+};
 
 struct brcm_sata_port {
 	int portnum;
@@ -42,6 +46,7 @@  struct brcm_sata_port {
 struct brcm_sata_phy {
 	struct device *dev;
 	void __iomem *phy_base;
+	enum brcm_sata_phy_version version;
 
 	struct brcm_sata_port phys[MAX_PORTS];
 };
@@ -64,8 +69,12 @@  enum sata_mdio_phy_regs_28nm {
 static inline void __iomem *brcm_sata_phy_base(struct brcm_sata_port *port)
 {
 	struct brcm_sata_phy *priv = port->phy_priv;
+	u32 offset;
 
-	return priv->phy_base + (port->portnum * SATA_MDIO_REG_SPACE_SIZE);
+	if (priv->version == BRCM_SATA_PHY_28NM)
+		offset = SATA_MDIO_REG_28NM_SPACE_SIZE;
+
+	return priv->phy_base + (port->portnum * offset);
 }
 
 static void brcm_sata_mdio_wr(void __iomem *addr, u32 bank, u32 ofs,
@@ -126,7 +135,8 @@  static const struct phy_ops phy_ops_28nm = {
 };
 
 static const struct of_device_id brcm_sata_phy_of_match[] = {
-	{ .compatible	= "brcm,bcm7445-sata-phy" },
+	{ .compatible	= "brcm,bcm7445-sata-phy",
+	  .data = (void *)BRCM_SATA_PHY_28NM },
 	{},
 };
 MODULE_DEVICE_TABLE(of, brcm_sata_phy_of_match);
@@ -135,6 +145,7 @@  static int brcm_sata_phy_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device_node *dn = dev->of_node, *child;
+	const struct of_device_id *of_id;
 	struct brcm_sata_phy *priv;
 	struct resource *res;
 	struct phy_provider *provider;
@@ -154,6 +165,12 @@  static int brcm_sata_phy_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->phy_base))
 		return PTR_ERR(priv->phy_base);
 
+	of_id = of_match_node(brcm_sata_phy_of_match, dn);
+	if (of_id)
+		priv->version = (enum brcm_sata_phy_version)of_id->data;
+	else
+		priv->version = BRCM_SATA_PHY_28NM;
+
 	for_each_available_child_of_node(dn, child) {
 		unsigned int id;
 		struct brcm_sata_port *port;