Skip to content

Commit c1602a1

Browse files
jaedonkishon
authored andcommitted
phy: phy_brcmstb_sata: add support for MIPS-based platforms
The BCM7xxx ARM-based and MIPS-based platforms share a similar hardware block for AHCI SATA3. This new compatible string, "brcm,bcm7425-sata-phy", may be used for most MIPS-based platforms of 40nm process technology. Signed-off-by: Jaedon Shin <[email protected]> Acked-by: Rob Herring <[email protected]> Tested-by: Florian Fainelli <[email protected]> Acked-by: Brian Norris <[email protected]> Signed-off-by: Kishon Vijay Abraham I <[email protected]>
1 parent 810c6f1 commit c1602a1

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

Documentation/devicetree/bindings/phy/brcm,brcmstb-sata-phy.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Required properties:
44
- compatible: should be one or more of
5+
"brcm,bcm7425-sata-phy"
56
"brcm,bcm7445-sata-phy"
67
"brcm,phy-sata3"
78
- address-cells: should be 1

drivers/phy/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,11 @@ config PHY_TUSB1210
390390

391391
config PHY_BRCMSTB_SATA
392392
tristate "Broadcom STB SATA PHY driver"
393-
depends on ARCH_BRCMSTB
393+
depends on ARCH_BRCMSTB || BMIPS_GENERIC
394394
depends on OF
395395
select GENERIC_PHY
396396
help
397-
Enable this to support the SATA3 PHY on 28nm Broadcom STB SoCs.
397+
Enable this to support the SATA3 PHY on 28nm or 40nm Broadcom STB SoCs.
398398
Likely useful only with CONFIG_SATA_BRCMSTB enabled.
399399

400400
config PHY_CYGNUS_PCIE

drivers/phy/phy-brcmstb-sata.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@
3232
/* Register offset between PHYs in PCB space */
3333
#define SATA_MDIO_REG_28NM_SPACE_SIZE 0x1000
3434

35+
/* The older SATA PHY registers duplicated per port registers within the map,
36+
* rather than having a separate map per port.
37+
*/
38+
#define SATA_MDIO_REG_40NM_SPACE_SIZE 0x10
39+
3540
enum brcm_sata_phy_version {
3641
BRCM_SATA_PHY_28NM,
42+
BRCM_SATA_PHY_40NM,
3743
};
3844

3945
struct brcm_sata_port {
@@ -51,7 +57,7 @@ struct brcm_sata_phy {
5157
struct brcm_sata_port phys[MAX_PORTS];
5258
};
5359

54-
enum sata_mdio_phy_regs_28nm {
60+
enum sata_mdio_phy_regs {
5561
PLL_REG_BANK_0 = 0x50,
5662
PLL_REG_BANK_0_PLLCONTROL_0 = 0x81,
5763

@@ -69,10 +75,14 @@ enum sata_mdio_phy_regs_28nm {
6975
static inline void __iomem *brcm_sata_phy_base(struct brcm_sata_port *port)
7076
{
7177
struct brcm_sata_phy *priv = port->phy_priv;
72-
u32 offset;
78+
u32 offset = 0;
7379

7480
if (priv->version == BRCM_SATA_PHY_28NM)
7581
offset = SATA_MDIO_REG_28NM_SPACE_SIZE;
82+
else if (priv->version == BRCM_SATA_PHY_40NM)
83+
offset = SATA_MDIO_REG_40NM_SPACE_SIZE;
84+
else
85+
dev_err(priv->dev, "invalid phy version\n");
7686

7787
return priv->phy_base + (port->portnum * offset);
7888
}
@@ -93,7 +103,7 @@ static void brcm_sata_mdio_wr(void __iomem *addr, u32 bank, u32 ofs,
93103
#define FMAX_VAL_DEFAULT 0x3df
94104
#define FMAX_VAL_SSC 0x83
95105

96-
static void brcm_sata_cfg_ssc_28nm(struct brcm_sata_port *port)
106+
static void brcm_sata_cfg_ssc(struct brcm_sata_port *port)
97107
{
98108
void __iomem *base = brcm_sata_phy_base(port);
99109
struct brcm_sata_phy *priv = port->phy_priv;
@@ -124,19 +134,21 @@ static int brcm_sata_phy_init(struct phy *phy)
124134
{
125135
struct brcm_sata_port *port = phy_get_drvdata(phy);
126136

127-
brcm_sata_cfg_ssc_28nm(port);
137+
brcm_sata_cfg_ssc(port);
128138

129139
return 0;
130140
}
131141

132-
static const struct phy_ops phy_ops_28nm = {
142+
static const struct phy_ops phy_ops = {
133143
.init = brcm_sata_phy_init,
134144
.owner = THIS_MODULE,
135145
};
136146

137147
static const struct of_device_id brcm_sata_phy_of_match[] = {
138148
{ .compatible = "brcm,bcm7445-sata-phy",
139149
.data = (void *)BRCM_SATA_PHY_28NM },
150+
{ .compatible = "brcm,bcm7425-sata-phy",
151+
.data = (void *)BRCM_SATA_PHY_40NM },
140152
{},
141153
};
142154
MODULE_DEVICE_TABLE(of, brcm_sata_phy_of_match);
@@ -196,7 +208,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev)
196208
port = &priv->phys[id];
197209
port->portnum = id;
198210
port->phy_priv = priv;
199-
port->phy = devm_phy_create(dev, child, &phy_ops_28nm);
211+
port->phy = devm_phy_create(dev, child, &phy_ops);
200212
port->ssc_en = of_property_read_bool(child, "brcm,enable-ssc");
201213
if (IS_ERR(port->phy)) {
202214
dev_err(dev, "failed to create PHY\n");

0 commit comments

Comments
 (0)