nemc 94 drivers/memory/jz4780-nemc.c struct jz4780_nemc *nemc = dev_get_drvdata(dev->parent); nemc 97 drivers/memory/jz4780-nemc.c nfcsr = readl(nemc->base + NEMC_NFCSR); nemc 110 drivers/memory/jz4780-nemc.c writel(nfcsr, nemc->base + NEMC_NFCSR); nemc 125 drivers/memory/jz4780-nemc.c struct jz4780_nemc *nemc = dev_get_drvdata(dev->parent); nemc 128 drivers/memory/jz4780-nemc.c nfcsr = readl(nemc->base + NEMC_NFCSR); nemc 135 drivers/memory/jz4780-nemc.c writel(nfcsr, nemc->base + NEMC_NFCSR); nemc 139 drivers/memory/jz4780-nemc.c static uint32_t jz4780_nemc_clk_period(struct jz4780_nemc *nemc) nemc 143 drivers/memory/jz4780-nemc.c rate = clk_get_rate(nemc->clk); nemc 151 drivers/memory/jz4780-nemc.c static uint32_t jz4780_nemc_ns_to_cycles(struct jz4780_nemc *nemc, uint32_t ns) nemc 153 drivers/memory/jz4780-nemc.c return ((ns * 1000) + nemc->clk_period - 1) / nemc->clk_period; nemc 156 drivers/memory/jz4780-nemc.c static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc, nemc 185 drivers/memory/jz4780-nemc.c smcr = readl(nemc->base + NEMC_SMCRn(bank)); nemc 199 drivers/memory/jz4780-nemc.c dev_err(nemc->dev, "unsupported bus width: %u\n", val); nemc 206 drivers/memory/jz4780-nemc.c cycles = jz4780_nemc_ns_to_cycles(nemc, val); nemc 207 drivers/memory/jz4780-nemc.c if (cycles > nemc->soc_info->tas_tah_cycles_max) { nemc 208 drivers/memory/jz4780-nemc.c dev_err(nemc->dev, "tAS %u is too high (%u cycles)\n", nemc 218 drivers/memory/jz4780-nemc.c cycles = jz4780_nemc_ns_to_cycles(nemc, val); nemc 219 drivers/memory/jz4780-nemc.c if (cycles > nemc->soc_info->tas_tah_cycles_max) { nemc 220 drivers/memory/jz4780-nemc.c dev_err(nemc->dev, "tAH %u is too high (%u cycles)\n", nemc 230 drivers/memory/jz4780-nemc.c cycles = jz4780_nemc_ns_to_cycles(nemc, val); nemc 232 drivers/memory/jz4780-nemc.c dev_err(nemc->dev, "tBP %u is too high (%u cycles)\n", nemc 242 drivers/memory/jz4780-nemc.c cycles = jz4780_nemc_ns_to_cycles(nemc, val); nemc 244 drivers/memory/jz4780-nemc.c dev_err(nemc->dev, "tAW %u is too high (%u cycles)\n", nemc 254 drivers/memory/jz4780-nemc.c cycles = jz4780_nemc_ns_to_cycles(nemc, val); nemc 256 drivers/memory/jz4780-nemc.c dev_err(nemc->dev, "tSTRV %u is too high (%u cycles)\n", nemc 264 drivers/memory/jz4780-nemc.c writel(smcr, nemc->base + NEMC_SMCRn(bank)); nemc 271 drivers/memory/jz4780-nemc.c struct jz4780_nemc *nemc; nemc 279 drivers/memory/jz4780-nemc.c nemc = devm_kzalloc(dev, sizeof(*nemc), GFP_KERNEL); nemc 280 drivers/memory/jz4780-nemc.c if (!nemc) nemc 283 drivers/memory/jz4780-nemc.c nemc->soc_info = device_get_match_data(dev); nemc 284 drivers/memory/jz4780-nemc.c if (!nemc->soc_info) nemc 287 drivers/memory/jz4780-nemc.c spin_lock_init(&nemc->lock); nemc 288 drivers/memory/jz4780-nemc.c nemc->dev = dev; nemc 291 drivers/memory/jz4780-nemc.c nemc->base = devm_ioremap_resource(dev, res); nemc 292 drivers/memory/jz4780-nemc.c if (IS_ERR(nemc->base)) { nemc 294 drivers/memory/jz4780-nemc.c return PTR_ERR(nemc->base); nemc 297 drivers/memory/jz4780-nemc.c writel(0, nemc->base + NEMC_NFCSR); nemc 299 drivers/memory/jz4780-nemc.c nemc->clk = devm_clk_get(dev, NULL); nemc 300 drivers/memory/jz4780-nemc.c if (IS_ERR(nemc->clk)) { nemc 302 drivers/memory/jz4780-nemc.c return PTR_ERR(nemc->clk); nemc 305 drivers/memory/jz4780-nemc.c ret = clk_prepare_enable(nemc->clk); nemc 311 drivers/memory/jz4780-nemc.c nemc->clk_period = jz4780_nemc_clk_period(nemc); nemc 312 drivers/memory/jz4780-nemc.c if (!nemc->clk_period) { nemc 314 drivers/memory/jz4780-nemc.c clk_disable_unprepare(nemc->clk); nemc 324 drivers/memory/jz4780-nemc.c for_each_child_of_node(nemc->dev->of_node, child) { nemc 330 drivers/memory/jz4780-nemc.c dev_err(nemc->dev, nemc 343 drivers/memory/jz4780-nemc.c dev_err(nemc->dev, "%pOF has no addresses\n", nemc 346 drivers/memory/jz4780-nemc.c } else if (nemc->banks_present & referenced) { nemc 347 drivers/memory/jz4780-nemc.c dev_err(nemc->dev, "%pOF conflicts with another node\n", nemc 354 drivers/memory/jz4780-nemc.c if (!jz4780_nemc_configure_bank(nemc, bank, child)) { nemc 361 drivers/memory/jz4780-nemc.c if (of_platform_device_create(child, NULL, nemc->dev)) nemc 362 drivers/memory/jz4780-nemc.c nemc->banks_present |= referenced; nemc 366 drivers/memory/jz4780-nemc.c platform_set_drvdata(pdev, nemc); nemc 373 drivers/memory/jz4780-nemc.c struct jz4780_nemc *nemc = platform_get_drvdata(pdev); nemc 375 drivers/memory/jz4780-nemc.c clk_disable_unprepare(nemc->clk);