Lines Matching refs:nn

167 	struct n3000_nios *nn = dev_get_drvdata(dev);  in nios_fw_version_show()  local
171 ret = regmap_read(nn->regmap, N3000_NIOS_FW_VERSION, &val); in nios_fw_version_show()
190 static int get_retimer_mode(struct n3000_nios *nn, unsigned int mode_stat_reg, in get_retimer_mode() argument
196 ret = regmap_read(nn->regmap, mode_stat_reg, &val); in get_retimer_mode()
211 struct n3000_nios *nn = dev_get_drvdata(dev); in retimer_A_mode_show() local
215 ret = get_retimer_mode(nn, N3000_NIOS_PKVL_A_MODE_STS, &mode); in retimer_A_mode_show()
226 struct n3000_nios *nn = dev_get_drvdata(dev); in retimer_B_mode_show() local
230 ret = get_retimer_mode(nn, N3000_NIOS_PKVL_B_MODE_STS, &mode); in retimer_B_mode_show()
242 struct n3000_nios *nn = dev_get_drvdata(dev); in fec_mode_show() local
246 ret = regmap_read(nn->regmap, N3000_NIOS_FW_VERSION, &val); in fec_mode_show()
254 ret = get_retimer_mode(nn, N3000_NIOS_PKVL_A_MODE_STS, &retimer_a_mode); in fec_mode_show()
258 ret = get_retimer_mode(nn, N3000_NIOS_PKVL_B_MODE_STS, &retimer_b_mode); in fec_mode_show()
267 ret = regmap_read(nn->regmap, N3000_NIOS_INIT, &val); in fec_mode_show()
296 static int n3000_nios_init_done_check(struct n3000_nios *nn) in n3000_nios_init_done_check() argument
299 struct device *dev = nn->dev; in n3000_nios_init_done_check()
313 ret = regmap_read(nn->regmap, N3000_NIOS_FW_VERSION, &val); in n3000_nios_init_done_check()
333 ret = regmap_read(nn->regmap, N3000_NIOS_INIT, &val); in n3000_nios_init_done_check()
359 ret = regmap_write(nn->regmap, N3000_NIOS_INIT, val); in n3000_nios_init_done_check()
366 ret = regmap_read_poll_timeout(nn->regmap, N3000_NIOS_INIT, val, in n3000_nios_init_done_check()
374 ret2 = regmap_read(nn->regmap, N3000_NIOS_PKVL_A_MODE_STS, &state_a); in n3000_nios_init_done_check()
378 ret2 = regmap_read(nn->regmap, N3000_NIOS_PKVL_B_MODE_STS, &state_b); in n3000_nios_init_done_check()
402 dev_err(nn->dev, "PKVL_A_MODE_STS 0x%x\n", state_a); in n3000_nios_init_done_check()
403 dev_err(nn->dev, "PKVL_B_MODE_STS 0x%x\n", state_b); in n3000_nios_init_done_check()
415 static int create_altera_spi_controller(struct n3000_nios *nn) in create_altera_spi_controller() argument
419 void __iomem *base = nn->base; in create_altera_spi_controller()
437 dev_dbg(nn->dev, "%s cs %u bpm 0x%x mode 0x%x\n", __func__, in create_altera_spi_controller()
443 pdevinfo.parent = nn->dev; in create_altera_spi_controller()
447 nn->altera_spi = platform_device_register_full(&pdevinfo); in create_altera_spi_controller()
448 return PTR_ERR_OR_ZERO(nn->altera_spi); in create_altera_spi_controller()
451 static void destroy_altera_spi_controller(struct n3000_nios *nn) in destroy_altera_spi_controller() argument
453 platform_device_unregister(nn->altera_spi); in destroy_altera_spi_controller()
480 struct n3000_nios *nn = context; in n3000_nios_reg_write() local
487 writeq(v, nn->base + N3000_NS_CTRL); in n3000_nios_reg_write()
489 ret = n3000_nios_poll_stat_timeout(nn->base, &v); in n3000_nios_reg_write()
491 dev_err(nn->dev, "fail to write reg 0x%x val 0x%x: %d\n", in n3000_nios_reg_write()
499 struct n3000_nios *nn = context; in n3000_nios_reg_read() local
505 writeq(v, nn->base + N3000_NS_CTRL); in n3000_nios_reg_read()
507 ret = n3000_nios_poll_stat_timeout(nn->base, &v); in n3000_nios_reg_read()
509 dev_err(nn->dev, "fail to read reg 0x%x: %d\n", reg, ret); in n3000_nios_reg_read()
529 struct n3000_nios *nn; in n3000_nios_probe() local
532 nn = devm_kzalloc(dev, sizeof(*nn), GFP_KERNEL); in n3000_nios_probe()
533 if (!nn) in n3000_nios_probe()
536 dev_set_drvdata(&ddev->dev, nn); in n3000_nios_probe()
538 nn->dev = dev; in n3000_nios_probe()
540 nn->base = devm_ioremap_resource(&ddev->dev, &ddev->mmio_res); in n3000_nios_probe()
541 if (IS_ERR(nn->base)) in n3000_nios_probe()
542 return PTR_ERR(nn->base); in n3000_nios_probe()
544 nn->regmap = devm_regmap_init(dev, NULL, nn, &n3000_nios_regbus_cfg); in n3000_nios_probe()
545 if (IS_ERR(nn->regmap)) in n3000_nios_probe()
546 return PTR_ERR(nn->regmap); in n3000_nios_probe()
548 ret = n3000_nios_init_done_check(nn); in n3000_nios_probe()
552 ret = create_altera_spi_controller(nn); in n3000_nios_probe()
561 struct n3000_nios *nn = dev_get_drvdata(&ddev->dev); in n3000_nios_remove() local
563 destroy_altera_spi_controller(nn); in n3000_nios_remove()