Lines Matching +full:brcmstb +full:- +full:memc +full:- +full:ddr +full:- +full:rev +full:- +full:c
1 // SPDX-License-Identifier: GPL-2.0-only
3 * DDR Self-Refresh Power Down (SRPD) support for Broadcom STB SoCs
37 static int brcmstb_memc_uses_lpddr4(struct brcmstb_memc *memc) in brcmstb_memc_uses_lpddr4() argument
39 void __iomem *config = memc->ddr_ctrl + REG_MEMC_CNTRLR_CONFIG; in brcmstb_memc_uses_lpddr4()
47 static int brcmstb_memc_srpd_config(struct brcmstb_memc *memc, in brcmstb_memc_srpd_config() argument
50 void __iomem *cfg = memc->ddr_ctrl + memc->srpd_offset; in brcmstb_memc_srpd_config()
55 return -EINVAL; in brcmstb_memc_srpd_config()
57 memc->timeout_cycles = cycles; in brcmstb_memc_srpd_config()
73 struct brcmstb_memc *memc = dev_get_drvdata(dev); in frequency_show() local
75 return sprintf(buf, "%d\n", memc->frequency); in frequency_show()
81 struct brcmstb_memc *memc = dev_get_drvdata(dev); in srpd_show() local
83 return sprintf(buf, "%d\n", memc->timeout_cycles); in srpd_show()
89 struct brcmstb_memc *memc = dev_get_drvdata(dev); in srpd_store() local
98 if (brcmstb_memc_uses_lpddr4(memc)) in srpd_store()
99 return -EOPNOTSUPP; in srpd_store()
105 ret = brcmstb_memc_srpd_config(memc, val); in srpd_store()
128 struct device *dev = &pdev->dev; in brcmstb_memc_probe()
129 struct brcmstb_memc *memc; in brcmstb_memc_probe() local
132 memc = devm_kzalloc(dev, sizeof(*memc), GFP_KERNEL); in brcmstb_memc_probe()
133 if (!memc) in brcmstb_memc_probe()
134 return -ENOMEM; in brcmstb_memc_probe()
136 dev_set_drvdata(dev, memc); in brcmstb_memc_probe()
139 memc->srpd_offset = memc_data->srpd_offset; in brcmstb_memc_probe()
141 memc->ddr_ctrl = devm_platform_ioremap_resource(pdev, 0); in brcmstb_memc_probe()
142 if (IS_ERR(memc->ddr_ctrl)) in brcmstb_memc_probe()
143 return PTR_ERR(memc->ddr_ctrl); in brcmstb_memc_probe()
145 of_property_read_u32(pdev->dev.of_node, "clock-frequency", in brcmstb_memc_probe()
146 &memc->frequency); in brcmstb_memc_probe()
148 ret = sysfs_create_group(&dev->kobj, &dev_attr_group); in brcmstb_memc_probe()
157 struct device *dev = &pdev->dev; in brcmstb_memc_remove()
159 sysfs_remove_group(&dev->kobj, &dev_attr_group); in brcmstb_memc_remove()
176 .compatible = "brcm,brcmstb-memc-ddr-rev-b.1.x",
180 .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.0",
184 .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.1",
188 .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.2",
192 .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.3",
196 .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.5",
200 .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.6",
204 .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.7",
208 .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.8",
212 .compatible = "brcm,brcmstb-memc-ddr-rev-b.3.0",
216 .compatible = "brcm,brcmstb-memc-ddr-rev-b.3.1",
220 .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.0",
224 .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.1",
228 .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.2",
232 .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.3",
236 .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.4",
241 .compatible = "brcm,brcmstb-memc-ddr",
250 struct brcmstb_memc *memc = dev_get_drvdata(dev); in brcmstb_memc_suspend() local
251 void __iomem *cfg = memc->ddr_ctrl + memc->srpd_offset; in brcmstb_memc_suspend()
254 if (memc->timeout_cycles == 0) in brcmstb_memc_suspend()
273 struct brcmstb_memc *memc = dev_get_drvdata(dev); in brcmstb_memc_resume() local
275 if (memc->timeout_cycles == 0) in brcmstb_memc_resume()
278 return brcmstb_memc_srpd_config(memc, memc->timeout_cycles); in brcmstb_memc_resume()
297 MODULE_DESCRIPTION("DDR SRPD driver for Broadcom STB chips");