Searched refs:nemc (Results 1 - 1 of 1) sorted by relevance

/linux-4.1.27/drivers/memory/
H A Djz4780-nemc.c23 #include <linux/jz4780-nemc.h>
92 struct jz4780_nemc *nemc = dev_get_drvdata(dev->parent); jz4780_nemc_set_type() local
95 nfcsr = readl(nemc->base + NEMC_NFCSR); jz4780_nemc_set_type()
108 writel(nfcsr, nemc->base + NEMC_NFCSR); jz4780_nemc_set_type()
123 struct jz4780_nemc *nemc = dev_get_drvdata(dev->parent); jz4780_nemc_assert() local
126 nfcsr = readl(nemc->base + NEMC_NFCSR); jz4780_nemc_assert()
133 writel(nfcsr, nemc->base + NEMC_NFCSR); jz4780_nemc_assert()
137 static uint32_t jz4780_nemc_clk_period(struct jz4780_nemc *nemc) jz4780_nemc_clk_period() argument
141 rate = clk_get_rate(nemc->clk); jz4780_nemc_clk_period()
149 static uint32_t jz4780_nemc_ns_to_cycles(struct jz4780_nemc *nemc, uint32_t ns) jz4780_nemc_ns_to_cycles() argument
151 return ((ns * 1000) + nemc->clk_period - 1) / nemc->clk_period; jz4780_nemc_ns_to_cycles()
154 static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc, jz4780_nemc_configure_bank() argument
183 smcr = readl(nemc->base + NEMC_SMCRn(bank)); jz4780_nemc_configure_bank()
186 if (!of_property_read_u32(node, "ingenic,nemc-bus-width", &val)) { jz4780_nemc_configure_bank()
197 dev_err(nemc->dev, "unsupported bus width: %u\n", val); jz4780_nemc_configure_bank()
202 if (of_property_read_u32(node, "ingenic,nemc-tAS", &val) == 0) { jz4780_nemc_configure_bank()
204 cycles = jz4780_nemc_ns_to_cycles(nemc, val); jz4780_nemc_configure_bank()
206 dev_err(nemc->dev, "tAS %u is too high (%u cycles)\n", jz4780_nemc_configure_bank()
214 if (of_property_read_u32(node, "ingenic,nemc-tAH", &val) == 0) { jz4780_nemc_configure_bank()
216 cycles = jz4780_nemc_ns_to_cycles(nemc, val); jz4780_nemc_configure_bank()
218 dev_err(nemc->dev, "tAH %u is too high (%u cycles)\n", jz4780_nemc_configure_bank()
226 if (of_property_read_u32(node, "ingenic,nemc-tBP", &val) == 0) { jz4780_nemc_configure_bank()
228 cycles = jz4780_nemc_ns_to_cycles(nemc, val); jz4780_nemc_configure_bank()
230 dev_err(nemc->dev, "tBP %u is too high (%u cycles)\n", jz4780_nemc_configure_bank()
238 if (of_property_read_u32(node, "ingenic,nemc-tAW", &val) == 0) { jz4780_nemc_configure_bank()
240 cycles = jz4780_nemc_ns_to_cycles(nemc, val); jz4780_nemc_configure_bank()
242 dev_err(nemc->dev, "tAW %u is too high (%u cycles)\n", jz4780_nemc_configure_bank()
250 if (of_property_read_u32(node, "ingenic,nemc-tSTRV", &val) == 0) { jz4780_nemc_configure_bank()
252 cycles = jz4780_nemc_ns_to_cycles(nemc, val); jz4780_nemc_configure_bank()
254 dev_err(nemc->dev, "tSTRV %u is too high (%u cycles)\n", jz4780_nemc_configure_bank()
262 writel(smcr, nemc->base + NEMC_SMCRn(bank)); jz4780_nemc_configure_bank()
269 struct jz4780_nemc *nemc; jz4780_nemc_probe() local
277 nemc = devm_kzalloc(dev, sizeof(*nemc), GFP_KERNEL); jz4780_nemc_probe()
278 if (!nemc) jz4780_nemc_probe()
281 spin_lock_init(&nemc->lock); jz4780_nemc_probe()
282 nemc->dev = dev; jz4780_nemc_probe()
285 nemc->base = devm_ioremap_resource(dev, res); jz4780_nemc_probe()
286 if (IS_ERR(nemc->base)) { jz4780_nemc_probe()
288 return PTR_ERR(nemc->base); jz4780_nemc_probe()
291 writel(0, nemc->base + NEMC_NFCSR); jz4780_nemc_probe()
293 nemc->clk = devm_clk_get(dev, NULL); jz4780_nemc_probe()
294 if (IS_ERR(nemc->clk)) { jz4780_nemc_probe()
296 return PTR_ERR(nemc->clk); jz4780_nemc_probe()
299 ret = clk_prepare_enable(nemc->clk); jz4780_nemc_probe()
305 nemc->clk_period = jz4780_nemc_clk_period(nemc); jz4780_nemc_probe()
306 if (!nemc->clk_period) { jz4780_nemc_probe()
308 clk_disable_unprepare(nemc->clk); jz4780_nemc_probe()
318 for_each_child_of_node(nemc->dev->of_node, child) { jz4780_nemc_probe()
324 dev_err(nemc->dev, jz4780_nemc_probe()
337 dev_err(nemc->dev, "%s has no addresses\n", jz4780_nemc_probe()
340 } else if (nemc->banks_present & referenced) { jz4780_nemc_probe()
341 dev_err(nemc->dev, "%s conflicts with another node\n", jz4780_nemc_probe()
348 if (!jz4780_nemc_configure_bank(nemc, bank, child)) { jz4780_nemc_probe()
355 if (of_platform_device_create(child, NULL, nemc->dev)) jz4780_nemc_probe()
356 nemc->banks_present |= referenced; jz4780_nemc_probe()
360 platform_set_drvdata(pdev, nemc); jz4780_nemc_probe()
367 struct jz4780_nemc *nemc = platform_get_drvdata(pdev); jz4780_nemc_remove() local
369 clk_disable_unprepare(nemc->clk); jz4780_nemc_remove()
374 { .compatible = "ingenic,jz4780-nemc" },
382 .name = "jz4780-nemc",

Completed in 60 milliseconds