Commit e1c88956 authored by Jim Quinlan's avatar Jim Quinlan Committed by Krzysztof Wilczyński

PCI: brcmstb: Don't conflate the reset rescal with PHY ctrl

Add a "has_phy" field indicating that the internal PHY has SW control
that requires configuration.  Some previous chips only required the
firing of the "rescal" reset controller.

This change requires us to give the 7216 SoC its own cfg_data structure.

Link: https://lore.kernel.org/linux-pci/20240815225731.40276-10-james.quinlan@broadcom.comSigned-off-by: default avatarJim Quinlan <james.quinlan@broadcom.com>
[kwilczynski: commit log]
Signed-off-by: default avatarKrzysztof Wilczyński <kwilczynski@kernel.org>
Tested-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: default avatarStanimir Varbanov <svarbanov@suse.de>
parent 0d804603
...@@ -222,6 +222,7 @@ enum pcie_type { ...@@ -222,6 +222,7 @@ enum pcie_type {
struct pcie_cfg_data { struct pcie_cfg_data {
const int *offsets; const int *offsets;
const enum pcie_type type; const enum pcie_type type;
const bool has_phy;
void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*perst_set)(struct brcm_pcie *pcie, u32 val);
void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val);
}; };
...@@ -272,6 +273,7 @@ struct brcm_pcie { ...@@ -272,6 +273,7 @@ struct brcm_pcie {
void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val);
struct subdev_regulators *sr; struct subdev_regulators *sr;
bool ep_wakeup_capable; bool ep_wakeup_capable;
bool has_phy;
}; };
static inline bool is_bmips(const struct brcm_pcie *pcie) static inline bool is_bmips(const struct brcm_pcie *pcie)
...@@ -1313,12 +1315,12 @@ static int brcm_phy_cntl(struct brcm_pcie *pcie, const int start) ...@@ -1313,12 +1315,12 @@ static int brcm_phy_cntl(struct brcm_pcie *pcie, const int start)
static inline int brcm_phy_start(struct brcm_pcie *pcie) static inline int brcm_phy_start(struct brcm_pcie *pcie)
{ {
return pcie->rescal ? brcm_phy_cntl(pcie, 1) : 0; return pcie->has_phy ? brcm_phy_cntl(pcie, 1) : 0;
} }
static inline int brcm_phy_stop(struct brcm_pcie *pcie) static inline int brcm_phy_stop(struct brcm_pcie *pcie)
{ {
return pcie->rescal ? brcm_phy_cntl(pcie, 0) : 0; return pcie->has_phy ? brcm_phy_cntl(pcie, 0) : 0;
} }
static void brcm_pcie_turn_off(struct brcm_pcie *pcie) static void brcm_pcie_turn_off(struct brcm_pcie *pcie)
...@@ -1561,12 +1563,20 @@ static const struct pcie_cfg_data bcm2711_cfg = { ...@@ -1561,12 +1563,20 @@ static const struct pcie_cfg_data bcm2711_cfg = {
.bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic,
}; };
static const struct pcie_cfg_data bcm7216_cfg = {
.offsets = pcie_offset_bcm7278,
.type = BCM7278,
.perst_set = brcm_pcie_perst_set_7278,
.bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278,
.has_phy = true,
};
static const struct of_device_id brcm_pcie_match[] = { static const struct of_device_id brcm_pcie_match[] = {
{ .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg },
{ .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg },
{ .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg },
{ .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg }, { .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg },
{ .compatible = "brcm,bcm7216-pcie", .data = &bcm7278_cfg }, { .compatible = "brcm,bcm7216-pcie", .data = &bcm7216_cfg },
{ .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg },
{ .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg }, { .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg },
{ .compatible = "brcm,bcm7425-pcie", .data = &bcm7425_cfg }, { .compatible = "brcm,bcm7425-pcie", .data = &bcm7425_cfg },
...@@ -1614,6 +1624,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) ...@@ -1614,6 +1624,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
pcie->type = data->type; pcie->type = data->type;
pcie->perst_set = data->perst_set; pcie->perst_set = data->perst_set;
pcie->bridge_sw_init_set = data->bridge_sw_init_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set;
pcie->has_phy = data->has_phy;
pcie->base = devm_platform_ioremap_resource(pdev, 0); pcie->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pcie->base)) if (IS_ERR(pcie->base))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment