Lines Matching +full:uniphier +full:- +full:system +full:- +full:bus

1 // SPDX-License-Identifier: GPL-2.0-or-later
14 /* System Bus Controller registers */
43 dev_dbg(priv->dev, in uniphier_system_bus_add_bank()
47 if (bank >= ARRAY_SIZE(priv->bank)) { in uniphier_system_bus_add_bank()
48 dev_err(priv->dev, "unsupported bank number %d\n", bank); in uniphier_system_bus_add_bank()
49 return -EINVAL; in uniphier_system_bus_add_bank()
52 if (priv->bank[bank].base || priv->bank[bank].end) { in uniphier_system_bus_add_bank()
53 dev_err(priv->dev, in uniphier_system_bus_add_bank()
55 return -EINVAL; in uniphier_system_bus_add_bank()
59 dev_err(priv->dev, "base address %llx is too high\n", paddr); in uniphier_system_bus_add_bank()
60 return -EINVAL; in uniphier_system_bus_add_bank()
66 dev_err(priv->dev, in uniphier_system_bus_add_bank()
69 return -EINVAL; in uniphier_system_bus_add_bank()
71 paddr -= addr; in uniphier_system_bus_add_bank()
77 dev_err(priv->dev, "end address %08llx is too high\n", end); in uniphier_system_bus_add_bank()
78 return -EINVAL; in uniphier_system_bus_add_bank()
80 mask = paddr ^ (end - 1); in uniphier_system_bus_add_bank()
86 priv->bank[bank].base = paddr; in uniphier_system_bus_add_bank()
87 priv->bank[bank].end = end; in uniphier_system_bus_add_bank()
89 dev_dbg(priv->dev, "range added: bank = %d, addr = %08x, end = %08x\n", in uniphier_system_bus_add_bank()
90 bank, priv->bank[bank].base, priv->bank[bank].end); in uniphier_system_bus_add_bank()
100 for (i = 0; i < ARRAY_SIZE(priv->bank); i++) { in uniphier_system_bus_check_overlap()
101 for (j = i + 1; j < ARRAY_SIZE(priv->bank); j++) { in uniphier_system_bus_check_overlap()
102 if (priv->bank[i].end > priv->bank[j].base && in uniphier_system_bus_check_overlap()
103 priv->bank[i].base < priv->bank[j].end) { in uniphier_system_bus_check_overlap()
104 dev_err(priv->dev, in uniphier_system_bus_check_overlap()
107 return -EINVAL; in uniphier_system_bus_check_overlap()
118 void __iomem *base_reg = priv->membase + UNIPHIER_SBC_BASE; in uniphier_system_bus_check_boot_swap()
123 dev_dbg(priv->dev, "Boot Swap: %s\n", is_swapped ? "on" : "off"); in uniphier_system_bus_check_boot_swap()
126 * If BOOT_SWAP was asserted on power-on-reset, the CS0 and CS1 are in uniphier_system_bus_check_boot_swap()
130 swap(priv->bank[0], priv->bank[1]); in uniphier_system_bus_check_boot_swap()
136 void __iomem *base_reg = priv->membase + UNIPHIER_SBC_BASE; in uniphier_system_bus_set_reg()
140 for (i = 0; i < ARRAY_SIZE(priv->bank); i++) { in uniphier_system_bus_set_reg()
141 base = priv->bank[i].base; in uniphier_system_bus_set_reg()
142 end = priv->bank[i].end; in uniphier_system_bus_set_reg()
147 * to anywhere in the system bus space is routed to in uniphier_system_bus_set_reg()
163 mask = base ^ (end - 1); in uniphier_system_bus_set_reg()
169 dev_dbg(priv->dev, "SBC_BASE[%d] = 0x%08x\n", i, val); in uniphier_system_bus_set_reg()
177 struct device *dev = &pdev->dev; in uniphier_system_bus_probe()
185 return -ENOMEM; in uniphier_system_bus_probe()
187 priv->membase = devm_platform_ioremap_resource(pdev, 0); in uniphier_system_bus_probe()
188 if (IS_ERR(priv->membase)) in uniphier_system_bus_probe()
189 return PTR_ERR(priv->membase); in uniphier_system_bus_probe()
191 priv->dev = dev; in uniphier_system_bus_probe()
193 ret = of_range_parser_init(&parser, dev->of_node); in uniphier_system_bus_probe()
199 return -EINVAL; in uniphier_system_bus_probe()
218 /* Now, the bus is configured. Populate platform_devices below it */ in uniphier_system_bus_probe()
219 return of_platform_default_populate(dev->of_node, NULL, dev); in uniphier_system_bus_probe()
234 { .compatible = "socionext,uniphier-system-bus" },
242 .name = "uniphier-system-bus",
250 MODULE_DESCRIPTION("UniPhier System Bus driver");