add support SATA for BMIPS_GENERIC
Subsystems (6)
v2 cover add support SATA for BMIPS_GENERIC
Hi all,
This patch series add support SATA for BMIPS_GENERIC.
Ralf,
I request you to drop already submitted patches for NAND deivce nodes. They are merge conflict with these.
http://patchwork.linux-mips.org/patch/10577/
http://patchwork.linux-mips.org/patch/10578/
http://patchwork.linux-mips.org/patch/10579/
http://patchwork.linux-mips.org/patch/10580/
Changes in v2:
- Adds quick for ncq
- Adds quick for phy interface control
- Remove unused definitions in ahci_brcmstb
- Combines compatible string
Jaedon Shin (10):
ata: ahci_brcmstb: add quick for broken ncq
ata: ahci_brcmstb: add support MIPS-based platforms
ata: ahci_brcmstb: add quick for broken phy
ata: ahci_brcmstb: remove unused definitions
phy: phy_brcmstb_sata: remove duplicate definitions
phy: phy_brcmstb_sata: add data for phy version
phy: phy_brcmstb_sata: add support MIPS-based platforms
MIPS: BMIPS: brcmstb: add SATA/PHY nodes for bcm7425
MIPS: BMIPS: brcmstb: add SATA/PHY nodes for bcm7346
MIPS: BMIPS: brcmstb: add SATA/PHY nodes for bcm7362
.../devicetree/bindings/ata/brcm,sata-brcmstb.txt | 8 +++- .../bindings/phy/brcm,brcmstb-sata-phy.txt | 1 + arch/mips/boot/dts/brcm/bcm7346.dtsi | 42 +++++++++++++++++ arch/mips/boot/dts/brcm/bcm7362.dtsi | 42 +++++++++++++++++ arch/mips/boot/dts/brcm/bcm7425.dtsi | 42 +++++++++++++++++ arch/mips/boot/dts/brcm/bcm97346dbsmb.dts | 8 ++++ arch/mips/boot/dts/brcm/bcm97362svmb.dts | 8 ++++ drivers/ata/Kconfig | 2 +- drivers/ata/ahci_brcmstb.c | 55 +++++++++++++++++++++- drivers/phy/Kconfig | 4 +- drivers/phy/phy-brcmstb-sata.c | 47 ++++++++++++++---- 11 files changed, 242 insertions(+), 17 deletions(-)
Signature · 1 line
2.6.2
A message that is not in the archive (sent off-list or not yet received): 1445928491-7320-1-git-send-email-jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH v2 1/10 ata: ahci_brcmstb: add quick for broken ncq
Add quick for bronken ncq. The chipsets (eg. BCM7439A0, BCM7445A0 and BCM7445B0) need a workaround disabling NCQ. and it may need the MIPS-based set-top box platforms.
--- .../devicetree/bindings/ata/brcm,sata-brcmstb.txt | 3 ++ drivers/ata/ahci_brcmstb.c | 42 ++++++++++++++++++++++ 2 files changed, 45 insertions(+)
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +3 -0
@@ -10,6 +10,9 @@ Required properties: - reg-names : "ahci" and "top-ctrl" - interrupts : interrupt mapping for SATA IRQ +Optional properties: +- brcm,broken-ncq : if present, NCQ is unusable + Also see ahci-platform.txt. Example:
drivers/ata/ahci_brcmstb.c +42 -0
65 lines not on this page · raw message
Signature · 6 lines
2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [v2 01/10] ata: ahci_brcmstb: add quick for broken ncq
Quoted 3 lines · Jaedon Shin
Add quick for bronken ncq. The chipsets (eg. BCM7439A0, BCM7445A0 and BCM7445B0) need a workaround disabling NCQ. and it may need the MIPS-based set-top box platforms.
None of these chips are production chips, so at this point, disabling NCQ should be done based on the compatible string we probed the driver with, not using a specific property.
There are more comments below
Quoted 3 lines
Signed-off-by Jaedon Shin <[email protected]>---
[snip]
Quoted 19 lines
drivers/ata/ahci_brcmstb.c +18
-0+static void brcm_sata_quick (struct platform_device *pdev, +struct brcm_ahci_priv *priv) +{ +void __iomem *ahci; +struct resource *res; +u32 reg; + + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"ahci" ); + ahci =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (ahci)) +return ; + +if (priv->quicks &BRCM_AHCI_QUICK_NONCQ ) { + reg =readl (priv->top_ctrl +SATA_TOP_CTRL_BUS_CTRL ); + reg |=OVERRIDE_HWINIT ; +writel (reg, priv->top_ctrl +SATA_TOP_CTRL_BUS_CTRL ); + +/* Clear out the NCQ bit so the AHCI driver will not issue
drivers/ata/ahci_brcmstb.c static void brcm_sata_init(struct brcm_ahci_priv *priv) · line 244
Quoted 10 lines
drivers/ata/ahci_brcmstb.c +10
-0+* FPDMA/NCQ commands. +*/ + reg =readl (ahci +HOST_CAP ); + reg &= ~HOST_CAP_NCQ ; +writel (reg, ahci +HOST_CAP ); + + reg =readl (priv->top_ctrl +SATA_TOP_CTRL_BUS_CTRL ); + reg &= ~OVERRIDE_HWINIT ; +writel (reg, priv->top_ctrl +SATA_TOP_CTRL_BUS_CTRL ); + }
In the original BSP, the NCQ disabling occurs prior to initializing the SATA controller endianess. We would want to keep doing that in the same order, and use brcm_sata_readreg() and brcm_sata_writereg() which take care of doing these accesses in the native endianess of the system.
Reference is here:
https://github.com/Broadcom/stblinux-3.3/blob/master/linux/drivers/brcmstb/bchip.c#L254
Quoted 9 lines
drivers/ata/ahci_brcmstb.c +5
-0+ +devm_iounmap (&pdev->dev, ahci); +devm_release_mem_region (&pdev->dev, res->start,resource_size (res)); +} +#ifdef CONFIG_PM_SLEEP static int brcm_ahci_suspend (struct device *dev) {
drivers/ata/ahci_brcmstb.c static int brcm_ahci_probe(struct platform_device *pdev) · line 301
Quoted 8 lines
drivers/ata/ahci_brcmstb.c +4
-0@@ -256,7 +294,11 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (IS_ERR (priv->top_ctrl))return PTR_ERR (priv->top_ctrl); +if (of_property_read_bool (dev->of_node,"brcm,broken-ncq" )) + priv->quicks |=BRCM_AHCI_QUICK_NONCQ ; +brcm_sata_init (priv); +brcm_sata_quick (pdev, priv);
Florian
PATCH v2 2/10 ata: ahci_brcmstb: add support MIPS-based platforms
In reply to a message not in the archiveThe BCM7xxx ARM-based and MIPS-based platforms share a similar hardware block for AHCI SATA3.
The BCM7425 is flagship chipset of 40nm class. Other MIPS-based 40nm chipsets has same hardware block. so the compatible string may be use brcm,bcm7425-ahci.
--- Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt | 4 ++-- drivers/ata/Kconfig | 2 +- drivers/ata/ahci_brcmstb.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +2 -2
@@ -4,8 +4,8 @@ SATA nodes are defined to describe on-chip Serial ATA controllers. Each SATA controller should have its own node. Required properties: -- compatible : compatible list, may contain "brcm,bcm7445-ahci" and/or - "brcm,sata3-ahci" +- compatible : compatible list, may contain "brcm,bcm7445-ahci" or + "brcm,bcm7425-ahci" or "brcm,sata3-ahci" - reg : register mappings for AHCI and SATA_TOP_CTRL - reg-names : "ahci" and "top-ctrl" - interrupts : interrupt mapping for SATA IRQ
drivers/ata/Kconfig +1 -1
@@ -100,7 +100,7 @@ config SATA_AHCI_PLATFORM config AHCI_BRCMSTB tristate "Broadcom STB AHCI SATA support" - depends on ARCH_BRCMSTB + depends on ARCH_BRCMSTB || BMIPS_GENERIC help This option enables support for the AHCI SATA3 controller found on STB SoC's.
drivers/ata/ahci_brcmstb.c +1 -0
@@ -343,6 +343,7 @@ static int brcm_ahci_remove(struct platform_device *pdev)static const struct of_device_id ahci_of_match[] = { {.compatible ="brcm,bcm7445-ahci" }, + {.compatible ="brcm,bcm7425-ahci" }, {}, };MODULE_DEVICE_TABLE (of, ahci_of_match);
Signature · 6 lines
2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1445928491-7320-3-git-send-email-jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [v2 02/10] ata: ahci_brcmstb: add support MIPS-based platforms
Quoted 19 lines · Jaedon Shin
The BCM7xxx ARM-based and MIPS-based platforms share a similar hardware block for AHCI SATA3.
The BCM7425 is flagship chipset of 40nm class. Other MIPS-based 40nm chipsets has same hardware block. so the compatible string may be use brcm,bcm7425-ahci.
Signed-off-by Jaedon Shin <[email protected]>--- Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt | 4 ++-- drivers/ata/Kconfig | 2 +- drivers/ata/ahci_brcmstb.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +0
-0
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt SATA nodes are defined to describe on-chip Serial ATA controllers. · line 8
Quoted 7 lines
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +2
-2@@ -4,8 +4,8 @@ SATA nodes are defined to describe on-chip Serial ATA controllers. Each SATA controller should have its own node. Required properties: -- compatible : compatible list, may contain "brcm,bcm7445-ahci" and/or - "brcm,sata3-ahci" +- compatible : compatible list, may contain "brcm,bcm7445-ahci" or + "brcm,bcm7425-ahci" or "brcm,sata3-ahci"
If you're going to spin this series anyway, you might as well turn this into a list, with one compatible string per line. That way it's easier to expand if needed.
Brian
Quoted 31 lines
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +0
-0- reg : register mappings for AHCI and SATA_TOP_CTRL - reg-names : "ahci" and "top-ctrl" - interrupts : interrupt mapping for SATA IRQdrivers/ata/Kconfig +1
-1@@ -100,7 +100,7 @@ config SATA_AHCI_PLATFORM config AHCI_BRCMSTB tristate "Broadcom STB AHCI SATA support" - depends on ARCH_BRCMSTB + depends on ARCH_BRCMSTB || BMIPS_GENERIC help This option enables support for the AHCI SATA3 controller found on STB SoC's.drivers/ata/ahci_brcmstb.c +1
-0@@ -343,6 +343,7 @@ static int brcm_ahci_remove(struct platform_device *pdev)static const struct of_device_id ahci_of_match[] = { {.compatible ="brcm,bcm7445-ahci" }, + {.compatible ="brcm,bcm7425-ahci" }, {}, };MODULE_DEVICE_TABLE (of, ahci_of_match);Signature · 1 line
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 10/10 MIPS: BMIPS: brcmstb: add SATA/PHY nodes for bcm7362
In reply to a message not in the archiveAdd AHCI and PHY device nodes to MIPS-based BCM7362 set-top box platform.
--- arch/mips/boot/dts/brcm/bcm7362.dtsi | 42 ++++++++++++++++++++++++++++++++ arch/mips/boot/dts/brcm/bcm97362svmb.dts | 8 ++++++ 2 files changed, 50 insertions(+)
arch/mips/boot/dts/brcm/bcm7362.dtsi +42 -0
@@ -189,5 +189,47 @@ interrupts = <66>; status = "disabled"; }; + + sata: sata@181000 { + compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci"; + reg-names = "ahci", "top-ctrl"; + reg = <0x181000 0xa9c>, <0x180020 0x1c>; + interrupt-parent = <&periph_intc>; + interrupts = <86>; + #address-cells = <1>; + #size-cells = <0>; + brcm,broken-ncq; + brcm,broken-phy; + status = "disabled"; + + sata0: sata-port@0 { + reg = <0>; + phys = <&sata_phy0>; + }; + + sata1: sata-port@1 { + reg = <1>; + phys = <&sata_phy1>; + }; + }; + + sata_phy: sata-phy@1800000 { + compatible = "brcm,bcm7425-sata-phy", "brcm,phy-sata3"; + reg = <0x180100 0x0eff>; + reg-names = "phy"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + sata_phy0: sata-phy@0 { + reg = <0>; + #phy-cells = <0>; + }; + + sata_phy1: sata-phy@1 { + reg = <1>; + #phy-cells = <0>; + }; + }; }; };
arch/mips/boot/dts/brcm/bcm97362svmb.dts +8 -0
@@ -40,3 +40,11 @@ &ohci0 { status = "okay"; }; + +&sata { + status = "okay"; +}; + +&sata_phy { + status = "okay"; +};
Signature · 6 lines
2.6.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 3/10 ata: ahci_brcmstb: add quick for broken phy
In reply to Jaedon ShinAdd quick for broken phy. The ARM-based 28nm chipsets have four phy interface control registers and each port has two registers. But, The MIPS-based 40nm chipsets have three. and there are no information and documentation. The legacy version of broadcom's strict-ahci based initial code did not control these registers.
--- Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt | 1 + drivers/ata/ahci_brcmstb.c | 10 ++++++++++ 2 files changed, 11 insertions(+)
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +1 -0
@@ -12,6 +12,7 @@ Required properties: Optional properties: - brcm,broken-ncq : if present, NCQ is unusable +- brcm,broken-phy : if present, to control phy interface is unusable Also see ahci-platform.txt.
drivers/ata/ahci_brcmstb.c +10 -0
@@ -71,6 +71,7 @@enum brcm_ahci_quicks {BRCM_AHCI_QUICK_NONCQ =BIT (0 ), +BRCM_AHCI_QUICK_NOPHY =BIT (1 ), };struct brcm_ahci_priv {
@@ -119,6 +120,9 @@ static void brcm_sata_phy_enable(struct brcm_ahci_priv *priv, int port)void __iomem *p;u32 reg; +if (priv->quicks &BRCM_AHCI_QUICK_NOPHY ) +return ; +/* clear PHY_DEFAULT_POWER_STATE */ p = phyctrl +SATA_TOP_CTRL_PHY_CTRL_1 ; reg =brcm_sata_readreg (p);
@@ -148,6 +152,9 @@ static void brcm_sata_phy_disable(struct brcm_ahci_priv *priv, int port)void __iomem *p;u32 reg; +if (priv->quicks &BRCM_AHCI_QUICK_NOPHY ) +return ; +/* power-off the PHY digital logic */ p = phyctrl +SATA_TOP_CTRL_PHY_CTRL_2 ; reg =brcm_sata_readreg (p);
@@ -297,6 +304,9 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (of_property_read_bool (dev->of_node,"brcm,broken-ncq" )) priv->quicks |=BRCM_AHCI_QUICK_NONCQ ; +if (of_property_read_bool (dev->of_node,"brcm,broken-phy" )) + priv->quicks |=BRCM_AHCI_QUICK_NOPHY ; +brcm_sata_init (priv);brcm_sata_quick (pdev, priv);
Signature · 1 line
2.6.2
Re: [v2 03/10] ata: ahci_brcmstb: add quick for broken phy
Quoted 1 line · Jaedon Shin
Add quick for broken phy. The ARM-based 28nm chipsets have four phy
I believe you mean "quirk".
Quoted 1 line
interface control registers and each port has two registers. But, The
registers, but the...
Quoted 1 line
MIPS-based 40nm chipsets have three. and there are no information and
s/and there/There/
Quoted 6 lines
documentation. The legacy version of broadcom's strict-ahci based initial code did not control these registers.
Signed-off-by Jaedon Shin <[email protected]>--- Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt | 1 +
Other than the commit message:
Quoted 60 lines
drivers/ata/ahci_brcmstb.c | 10 ++++++++++ 2 files changed, 11 insertions(+)Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +1
-0@@ -12,6 +12,7 @@ Required properties: Optional properties: - brcm,broken-ncq : if present, NCQ is unusable +- brcm,broken-phy : if present, to control phy interface is unusable Also see ahci-platform.txt.drivers/ata/ahci_brcmstb.c +10
-1@@ -71,6 +71,7 @@enum brcm_ahci_quicks {BRCM_AHCI_QUICK_NONCQ =BIT (0 ), +BRCM_AHCI_QUICK_NOPHY =BIT (1 ), };struct brcm_ahci_priv {@@ -119,6 +120,9 @@ static void brcm_sata_phy_enable(struct brcm_ahci_priv *priv, int port)void __iomem *p;u32 reg; +if (priv->quicks &BRCM_AHCI_QUICK_NOPHY ) +return ; +/* clear PHY_DEFAULT_POWER_STATE */ p = phyctrl +SATA_TOP_CTRL_PHY_CTRL_1 ; reg =brcm_sata_readreg (p);@@ -148,6 +152,9 @@ static void brcm_sata_phy_disable(struct brcm_ahci_priv *priv, int port)void __iomem *p;u32 reg; +if (priv->quicks &BRCM_AHCI_QUICK_NOPHY ) +return ; +/* power-off the PHY digital logic */ p = phyctrl +SATA_TOP_CTRL_PHY_CTRL_2 ; reg =brcm_sata_readreg (p);@@ -297,6 +304,9 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (of_property_read_bool (dev->of_node,"brcm,broken-ncq" )) priv->quicks |=BRCM_AHCI_QUICK_NONCQ ; +if (of_property_read_bool (dev->of_node,"brcm,broken-phy" )) + priv->quicks |=BRCM_AHCI_QUICK_NOPHY ; +brcm_sata_init (priv);brcm_sata_quick (pdev, priv); --2.6.2
Re: [v2 03/10] ata: ahci_brcmstb: add quick for broken phy
Quoted 6 lines · Rob Herring
Quoted 1 line · Jaedon Shin
Add quick for broken phy. The ARM-based 28nm chipsets have four phy
I believe you mean "quirk".
Oops! All the "quick" of patches should be changed to a "quirk".
Thanks.
Quoted 79 lines
Quoted 1 line
interface control registers and each port has two registers. But, The
registers, but the...
Quoted 1 line
MIPS-based 40nm chipsets have three. and there are no information and
s/and there/There/
Quoted 6 lines
documentation. The legacy version of broadcom's strict-ahci based initial code did not control these registers.
Signed-off-by Jaedon Shin <[email protected]>---
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt| 1 +Other than the commit message:
Acked-by Rob Herring <[email protected]>Quoted 60 lines
drivers/ata/ahci_brcmstb.c| 10 ++++++++++2 files changed, 11 insertions(+)Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +0
-0@@ -12,6 +12,7 @@ Required properties:Optional properties:
- brcm,broken-ncq : if present, NCQ is unusable
+- brcm,broken-phy : if present, to control phy interface is unusableAlso see ahci-platform.txt.
drivers/ata/ahci_brcmstb.c +10
-1@@ -71,6 +71,7 @@enum brcm_ahci_quicks {BRCM_AHCI_QUICK_NONCQ =BIT (0 ), +BRCM_AHCI_QUICK_NOPHY =BIT (1 ), };struct brcm_ahci_priv {@@ -119,6 +120,9 @@ static void brcm_sata_phy_enable(struct brcm_ahci_priv *priv, int port)void __iomem *p;u32 reg; +if (priv->quicks &BRCM_AHCI_QUICK_NOPHY ) +return ; +/* clear PHY_DEFAULT_POWER_STATE */ p = phyctrl +SATA_TOP_CTRL_PHY_CTRL_1 ; reg =brcm_sata_readreg (p);@@ -148,6 +152,9 @@ static void brcm_sata_phy_disable(struct brcm_ahci_priv *priv, int port)void __iomem *p;u32 reg; +if (priv->quicks &BRCM_AHCI_QUICK_NOPHY ) +return ; +/* power-off the PHY digital logic */ p = phyctrl +SATA_TOP_CTRL_PHY_CTRL_2 ; reg =brcm_sata_readreg (p);@@ -297,6 +304,9 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (of_property_read_bool (dev->of_node,"brcm,broken-ncq" )) priv->quicks |=BRCM_AHCI_QUICK_NONCQ ; +if (of_property_read_bool (dev->of_node,"brcm,broken-phy" )) + priv->quicks |=BRCM_AHCI_QUICK_NOPHY ; +brcm_sata_init (priv);brcm_sata_quick (pdev, priv); --2.6.2
Re: [v2 03/10] ata: ahci_brcmstb: add quick for broken phy
In reply to Jaedon ShinQuoted 5 lines · Jaedon Shin
Add quick for broken phy. The ARM-based 28nm chipsets have four phy interface control registers and each port has two registers. But, The MIPS-based 40nm chipsets have three. and there are no information and documentation. The legacy version of broadcom's strict-ahci based initial code did not control these registers.
Qualifying this of a broken PHY is a misnomer, this is more about the fact that the PHY control registers have a different layout and behavior on 40nm vs 28nm chips, but more importantly, do not require any kind of configuration.
Quoted 12 lines
Signed-off-by Jaedon Shin <[email protected]>--- Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt | 1 + drivers/ata/ahci_brcmstb.c | 10 ++++++++++ 2 files changed, 11 insertions(+)Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +0
-0
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt Required properties: · line 15
Quoted 4 lines
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +1
-0@@ -12,6 +12,7 @@ Required properties: Optional properties: - brcm,broken-ncq : if present, NCQ is unusable +- brcm,broken-phy : if present, to control phy interface is unusable
Same comment as in patch 1, this is something that can be known based on the compatible string, and the name of the property is misleading.
drivers/ata/ahci_brcmstb.c line 74
Quoted 12 lines
Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt +0
-0Also see ahci-platform.txt.drivers/ata/ahci_brcmstb.c +1
-0@@ -71,6 +71,7 @@enum brcm_ahci_quicks {BRCM_AHCI_QUICK_NONCQ =BIT (0 ), +BRCM_AHCI_QUICK_NOPHY =BIT (1 ),
I would use something like BRCM_AHCI_SKIP_PHY_ENABLE or something like that to illustrate what this really is about.
Quoted 34 lines
drivers/ata/ahci_brcmstb.c +9
-0};struct brcm_ahci_priv {@@ -119,6 +120,9 @@ static void brcm_sata_phy_enable(struct brcm_ahci_priv *priv, int port)void __iomem *p;u32 reg; +if (priv->quicks &BRCM_AHCI_QUICK_NOPHY ) +return ; +/* clear PHY_DEFAULT_POWER_STATE */ p = phyctrl +SATA_TOP_CTRL_PHY_CTRL_1 ; reg =brcm_sata_readreg (p);@@ -148,6 +152,9 @@ static void brcm_sata_phy_disable(struct brcm_ahci_priv *priv, int port)void __iomem *p;u32 reg; +if (priv->quicks &BRCM_AHCI_QUICK_NOPHY ) +return ; +/* power-off the PHY digital logic */ p = phyctrl +SATA_TOP_CTRL_PHY_CTRL_2 ; reg =brcm_sata_readreg (p);@@ -297,6 +304,9 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (of_property_read_bool (dev->of_node,"brcm,broken-ncq" )) priv->quicks |=BRCM_AHCI_QUICK_NONCQ ; +if (of_property_read_bool (dev->of_node,"brcm,broken-phy" )) + priv->quicks |=BRCM_AHCI_QUICK_NOPHY ; +brcm_sata_init (priv);brcm_sata_quick (pdev, priv);
Signature · 1 line
Florian
PATCH v2 4/10 ata: ahci_brcmstb: remove unused definitions
In reply to Jaedon ShinRemove unused definitions.
The MIPS-based 40nm chipsets has different offset. The SATA_TOP_CTRL_SATA_TP_OUT offset is 0x18 and the SATA_TOP_CTRL_CLIENT_INIT_CTRL is not exist. So, To remove do to avoid confusion.
--- drivers/ata/ahci_brcmstb.c | 2 -- 1 file changed, 2 deletions(-)
drivers/ata/ahci_brcmstb.c +0 -2
@@ -52,8 +52,6 @@#define SATA_TOP_CTRL_2_PHY_GLOBAL_RESET BIT(14)#define SATA_TOP_CTRL_PHY_OFFS 0x8#define SATA_TOP_MAX_PHYS 2 -#define SATA_TOP_CTRL_SATA_TP_OUT 0x1c -#define SATA_TOP_CTRL_CLIENT_INIT_CTRL 0x20/* On big-endian MIPS, buses are reversed to big endian, so switch them back */ #if defined(CONFIG_MIPS ) && defined(__BIG_ENDIAN)
Signature · 1 line
2.6.2
PATCH v2 5/10 phy: phy_brcmstb_sata: remove duplicate definitions
In reply to Jaedon ShinRemove duplicate definitions.
--- drivers/phy/phy-brcmstb-sata.c | 2 -- 1 file changed, 2 deletions(-)
drivers/phy/phy-brcmstb-sata.c +0 -2
@@ -26,8 +26,6 @@#define SATA_MDIO_BANK_OFFSET 0x23c#define SATA_MDIO_REG_OFFSET (ofs) ((ofs) * 4) -#define SATA_MDIO_REG_SPACE_SIZE 0x1000 -#define SATA_MDIO_REG_LENGTH 0x1f00#define MAX_PORTS 2
Signature · 1 line
2.6.2
PATCH v2 6/10 phy: phy_brcmstb_sata: add data for phy version
In reply to Jaedon ShinAdd data of device for phy version. and 28nm version is default.
--- drivers/phy/phy-brcmstb-sata.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/phy/phy-brcmstb-sata.c +20 -3
@@ -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;
Signature · 1 line
2.6.2
Re: [v2 06/10] phy: phy_brcmstb_sata: add data for phy version
Quoted 17 lines · On Tuesday 27 October 2015 15:48:07 Jaedon Shin wrote:
static const struct
of_device_idbrcm_sata_phy_of_match[] = {drivers/phy/phy-brcmstb-sata.c +3
-1- { .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;
drivers/phy/phy-brcmstb-sata.c static int brcm_sata_phy_probe(struct platform_device *pdev) · line 174
Quoted 10 lines
drivers/phy/phy-brcmstb-sata.c +6
-0@@ -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 ; +
As you don't actually use that variable except to set the 'offset' for phy_base, it would be nicer to use a structure that you can point to:
struct brcm_sata_phy_data {
unsigned long offset;
};const struct brcm_sata_phy_data brcm_sata_phy_28nm = {
.offset = SATA_MDIO_REG_28NM_SPACE_SIZE,
};
static const struct of_device_id brcm_sata_phy_of_match[] = {
{ .compatible = "brcm,bcm7445-sata-phy", .data = &brcm_sata_phy_28nm },
{},
};Arnd
PATCH v2 7/10 phy: phy_brcmstb_sata: add support MIPS-based platforms
In reply to Jaedon ShinThe BCM7xxx ARM-based and MIPS-based platforms share a similar hardware block for AHCI SATA3.
The BCM7425 is flagship chipset of 40nm class. Other MIPS-based 40nm chipsets has same hardware block. so the compatible string may be use brcm,bcm7425-sata-phy.
--- .../bindings/phy/brcm,brcmstb-sata-phy.txt | 1 + drivers/phy/Kconfig | 4 ++-- drivers/phy/phy-brcmstb-sata.c | 24 ++++++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/phy/brcm,brcmstb-sata-phy.txt +1 -0
@@ -3,6 +3,7 @@ Required properties: - compatible: should be one or more of "brcm,bcm7445-sata-phy" + "brcm,bcm7425-sata-phy" "brcm,phy-sata3" - address-cells: should be 1 - size-cells: should be 0
drivers/phy/Kconfig +2 -2
@@ -364,11 +364,11 @@ config PHY_TUSB1210 config PHY_BRCMSTB_SATA tristate "Broadcom STB SATA PHY driver" - depends on ARCH_BRCMSTB + depends on ARCH_BRCMSTB || BMIPS_GENERIC depends on OF select GENERIC_PHY help - Enable this to support the SATA3 PHY on 28nm Broadcom STB SoCs. + Enable this to support the SATA3 PHY on 28nm or 40nm Broadcom STB SoCs. Likely useful only with CONFIG_SATA_BRCMSTB enabled. endmenu
drivers/phy/phy-brcmstb-sata.c +18 -6
@@ -32,8 +32,14 @@/* Register offset between PHYs in PCB space */ #define SATA_MDIO_REG_28NM_SPACE_SIZE 0x1000 +/* The older SATA PHY registers duplicated per port registers within the map, +* rather than having a separate map per port. +*/ +#define SATA_MDIO_REG_40NM_SPACE_SIZE 0x10 +enum brcm_sata_phy_version {BRCM_SATA_PHY_28NM , +BRCM_SATA_PHY_40NM , };struct brcm_sata_port {
@@ -51,7 +57,7 @@ struct brcm_sata_phy {struct brcm_sata_port phys[MAX_PORTS ]; }; -enum sata_mdio_phy_regs_28nm { +enum sata_mdio_phy_regs {PLL_REG_BANK_0 =0x50 ,PLL_REG_BANK_0_PLLCONTROL_0 =0x81 ,
@@ -69,10 +75,14 @@ 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; +u32 offset =0 ;if (priv->version ==BRCM_SATA_PHY_28NM ) offset =SATA_MDIO_REG_28NM_SPACE_SIZE ; +else if (priv->version ==BRCM_SATA_PHY_40NM ) + offset =SATA_MDIO_REG_40NM_SPACE_SIZE ; +else +dev_err (priv->dev,"should not happen\n" );return priv->phy_base + (port->portnum * offset); }
@@ -93,7 +103,7 @@ static void brcm_sata_mdio_wr(void __iomem *addr, u32 bank, u32 ofs,#define FMAX_VAL_DEFAULT 0x3df#define FMAX_VAL_SSC 0x83 -static void brcm_sata_cfg_ssc_28nm (struct brcm_sata_port *port) +static void brcm_sata_cfg_ssc (struct brcm_sata_port *port) {void __iomem *base =brcm_sata_phy_base (port);struct brcm_sata_phy *priv = port->phy_priv;
@@ -124,12 +134,12 @@ static int brcm_sata_phy_init(struct phy *phy) {struct brcm_sata_port *port =phy_get_drvdata (phy); -brcm_sata_cfg_ssc_28nm (port); +brcm_sata_cfg_ssc (port);return 0 ; } -static const struct phy_ops phy_ops_28nm = { +static const struct phy_ops phy_ops = { .init = brcm_sata_phy_init, .owner =THIS_MODULE , };
@@ -137,6 +147,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" , .data = (void *)BRCM_SATA_PHY_28NM }, + { .compatible ="brcm,bcm7425-sata-phy" , + .data = (void *)BRCM_SATA_PHY_40NM }, {}, };MODULE_DEVICE_TABLE (of, brcm_sata_phy_of_match);
@@ -193,7 +205,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) port = &priv->phys[id]; port->portnum = id; port->phy_priv = priv; - port->phy =devm_phy_create (dev, child, &phy_ops_28nm); + port->phy =devm_phy_create (dev, child, &phy_ops); port->ssc_en =of_property_read_bool (child,"brcm,enable-ssc" );if (IS_ERR (port->phy)) {dev_err (dev,"failed to create PHY\n" );
Signature · 1 line
2.6.2
Re: [v2 07/10] phy: phy_brcmstb_sata: add support MIPS-based platforms
Quoted 8 lines · Jaedon Shin
The BCM7xxx ARM-based and MIPS-based platforms share a similar hardware block for AHCI SATA3.
The BCM7425 is flagship chipset of 40nm class. Other MIPS-based 40nm chipsets has same hardware block. so the compatible string may be use brcm,bcm7425-sata-phy.
Signed-off-by Jaedon Shin <[email protected]>
Quoted 125 lines
--- .../bindings/phy/brcm,brcmstb-sata-phy.txt | 1 + drivers/phy/Kconfig | 4 ++-- drivers/phy/phy-brcmstb-sata.c | 24 ++++++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/phy/brcm,brcmstb-sata-phy.txt +1
-0@@ -3,6 +3,7 @@ Required properties: - compatible: should be one or more of "brcm,bcm7445-sata-phy" + "brcm,bcm7425-sata-phy" "brcm,phy-sata3" - address-cells: should be 1 - size-cells: should be 0drivers/phy/Kconfig +2
-2@@ -364,11 +364,11 @@ config PHY_TUSB1210 config PHY_BRCMSTB_SATA tristate "Broadcom STB SATA PHY driver" - depends on ARCH_BRCMSTB + depends on ARCH_BRCMSTB || BMIPS_GENERIC depends on OF select GENERIC_PHY help - Enable this to support the SATA3 PHY on 28nm Broadcom STB SoCs. + Enable this to support the SATA3 PHY on 28nm or 40nm Broadcom STB SoCs. Likely useful only with CONFIG_SATA_BRCMSTB enabled. endmenudrivers/phy/phy-brcmstb-sata.c +18
-7@@ -32,8 +32,14 @@/* Register offset between PHYs in PCB space */ #define SATA_MDIO_REG_28NM_SPACE_SIZE 0x1000 +/* The older SATA PHY registers duplicated per port registers within the map, +* rather than having a separate map per port. +*/ +#define SATA_MDIO_REG_40NM_SPACE_SIZE 0x10 +enum brcm_sata_phy_version {BRCM_SATA_PHY_28NM , +BRCM_SATA_PHY_40NM , };struct brcm_sata_port {@@ -51,7 +57,7 @@ struct brcm_sata_phy {struct brcm_sata_port phys[MAX_PORTS ]; }; -enum sata_mdio_phy_regs_28nm { +enum sata_mdio_phy_regs {PLL_REG_BANK_0 =0x50 ,PLL_REG_BANK_0_PLLCONTROL_0 =0x81 ,@@ -69,10 +75,14 @@ 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; +u32 offset =0 ;if (priv->version ==BRCM_SATA_PHY_28NM ) offset =SATA_MDIO_REG_28NM_SPACE_SIZE ; +else if (priv->version ==BRCM_SATA_PHY_40NM ) + offset =SATA_MDIO_REG_40NM_SPACE_SIZE ; +else +dev_err (priv->dev,"should not happen\n" );return priv->phy_base + (port->portnum * offset); }@@ -93,7 +103,7 @@ static void brcm_sata_mdio_wr(void __iomem *addr, u32 bank, u32 ofs,#define FMAX_VAL_DEFAULT 0x3df#define FMAX_VAL_SSC 0x83 -static void brcm_sata_cfg_ssc_28nm (struct brcm_sata_port *port) +static void brcm_sata_cfg_ssc (struct brcm_sata_port *port) {void __iomem *base =brcm_sata_phy_base (port);struct brcm_sata_phy *priv = port->phy_priv;@@ -124,12 +134,12 @@ static int brcm_sata_phy_init(struct phy *phy) {struct brcm_sata_port *port =phy_get_drvdata (phy); -brcm_sata_cfg_ssc_28nm (port); +brcm_sata_cfg_ssc (port);return 0 ; } -static const struct phy_ops phy_ops_28nm = { +static const struct phy_ops phy_ops = { .init = brcm_sata_phy_init, .owner =THIS_MODULE , };@@ -137,6 +147,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" , .data = (void *)BRCM_SATA_PHY_28NM }, + { .compatible ="brcm,bcm7425-sata-phy" , + .data = (void *)BRCM_SATA_PHY_40NM }, {}, };MODULE_DEVICE_TABLE (of, brcm_sata_phy_of_match);@@ -193,7 +205,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev) port = &priv->phys[id]; port->portnum = id; port->phy_priv = priv; - port->phy =devm_phy_create (dev, child, &phy_ops_28nm); + port->phy =devm_phy_create (dev, child, &phy_ops); port->ssc_en =of_property_read_bool (child,"brcm,enable-ssc" );if (IS_ERR (port->phy)) {dev_err (dev,"failed to create PHY\n" ); --2.6.2
PATCH v2 8/10 MIPS: BMIPS: brcmstb: add SATA/PHY nodes for bcm7425
In reply to Jaedon ShinAdd AHCI and PHY device nodes to MIPS-based BCM7425 set-top box platform.
--- arch/mips/boot/dts/brcm/bcm7425.dtsi | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
arch/mips/boot/dts/brcm/bcm7425.dtsi +42 -0
@@ -221,5 +221,47 @@ interrupts = <73>; status = "disabled"; }; + + sata: sata@181000 { + compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci"; + reg-names = "ahci", "top-ctrl"; + reg = <0x181000 0xa9c>, <0x180020 0x1c>; + interrupt-parent = <&periph_intc>; + interrupts = <40>; + #address-cells = <1>; + #size-cells = <0>; + brcm,broken-ncq; + brcm,broken-phy; + status = "disabled"; + + sata0: sata-port@0 { + reg = <0>; + phys = <&sata_phy0>; + }; + + sata1: sata-port@1 { + reg = <1>; + phys = <&sata_phy1>; + }; + }; + + sata_phy: sata-phy@1800000 { + compatible = "brcm,bcm7425-sata-phy", "brcm,phy-sata3"; + reg = <0x180100 0x0eff>; + reg-names = "phy"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + sata_phy0: sata-phy@0 { + reg = <0>; + #phy-cells = <0>; + }; + + sata_phy1: sata-phy@1 { + reg = <1>; + #phy-cells = <0>; + }; + }; }; };
Signature · 1 line
2.6.2
PATCH v2 9/10 MIPS: BMIPS: brcmstb: add SATA/PHY nodes for bcm7346
In reply to Jaedon ShinAdd AHCI and PHY device nodes to MIPS-based BCM7346 set-top box platform.
--- arch/mips/boot/dts/brcm/bcm7346.dtsi | 42 +++++++++++++++++++++++++++++++ arch/mips/boot/dts/brcm/bcm97346dbsmb.dts | 8 ++++++ 2 files changed, 50 insertions(+)
arch/mips/boot/dts/brcm/bcm7346.dtsi +42 -0
@@ -246,5 +246,47 @@ interrupts = <76>; status = "disabled"; }; + + sata: sata@181000 { + compatible = "brcm,bcm7425-ahci", "brcm,sata3-ahci"; + reg-names = "ahci", "top-ctrl"; + reg = <0x181000 0xa9c>, <0x180020 0x1c>; + interrupt-parent = <&periph_intc>; + interrupts = <40>; + #address-cells = <1>; + #size-cells = <0>; + brcm,broken-ncq; + brcm,broken-phy; + status = "disabled"; + + sata0: sata-port@0 { + reg = <0>; + phys = <&sata_phy0>; + }; + + sata1: sata-port@1 { + reg = <1>; + phys = <&sata_phy1>; + }; + }; + + sata_phy: sata-phy@1800000 { + compatible = "brcm,bcm7425-sata-phy", "brcm,phy-sata3"; + reg = <0x180100 0x0eff>; + reg-names = "phy"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + sata_phy0: sata-phy@0 { + reg = <0>; + #phy-cells = <0>; + }; + + sata_phy1: sata-phy@1 { + reg = <1>; + #phy-cells = <0>; + }; + }; }; };
arch/mips/boot/dts/brcm/bcm97346dbsmb.dts +8 -0
@@ -64,3 +64,11 @@ &ohci3 { status = "okay"; }; + +&sata { + status = "okay"; +}; + +&sata_phy { + status = "okay"; +};
Signature · 1 line
2.6.2