Lines Matching full:aspeed
174 static u32 opb_write(struct fsi_master_aspeed *aspeed, uint32_t addr, in opb_write() argument
177 void __iomem *base = aspeed->base; in opb_write()
209 static int opb_read(struct fsi_master_aspeed *aspeed, uint32_t addr, in opb_read() argument
212 void __iomem *base = aspeed->base; in opb_read()
251 static int check_errors(struct fsi_master_aspeed *aspeed, int err) in check_errors() argument
258 opb_read(aspeed, ctrl_base + FSI_MRESP0, 4, &mresp0); in check_errors()
259 opb_read(aspeed, ctrl_base + FSI_MSTAP0, 4, &mstap0); in check_errors()
260 opb_read(aspeed, ctrl_base + FSI_MESRB0, 4, &mesrb0); in check_errors()
272 ret = opb_write(aspeed, ctrl_base + 0xd0, in check_errors()
285 int aspeed_fsi_read(struct fsi_master_aspeed *aspeed, int link, in aspeed_fsi_read() argument
291 ret = opb_read(aspeed, fsi_base + addr, size, val); in aspeed_fsi_read()
293 ret = check_errors(aspeed, ret); in aspeed_fsi_read()
300 int aspeed_fsi_write(struct fsi_master_aspeed *aspeed, int link, in aspeed_fsi_write() argument
309 ret = opb_write(aspeed, fsi_base + addr, *(uint32_t *)val, size); in aspeed_fsi_write()
311 ret = check_errors(aspeed, ret); in aspeed_fsi_write()
318 int aspeed_fsi_link_enable(struct fsi_master_aspeed *aspeed, int link) in aspeed_fsi_link_enable() argument
328 result = opb_write(aspeed, ctrl_base + FSI_MSENP0 + (4 * idx), in aspeed_fsi_link_enable()
333 ret = opb_read(aspeed, ctrl_base + FSI_MENP0 + (4 * idx), in aspeed_fsi_link_enable()
339 dev_err(aspeed->dev, "%s failed: %08x\n", __func__, result); in aspeed_fsi_link_enable()
346 int aspeed_fsi_break(struct fsi_master_aspeed *aspeed, int link) in aspeed_fsi_break() argument
355 dev_dbg(aspeed->dev, "sending break to link %d\n", link); in aspeed_fsi_break()
357 rc = aspeed_fsi_write(aspeed, link, 0, addr, &cmd, 4); in aspeed_fsi_break()
359 dev_dbg(aspeed->dev, "break done (%d)\n", rc); in aspeed_fsi_break()
364 void aspeed_fsi_status(struct fsi_master_aspeed *aspeed) in aspeed_fsi_status() argument
368 printf("%s\n", aspeed->dev->name); in aspeed_fsi_status()
370 opb_read(aspeed, ctrl_base + FSI_MMODE, 4, &mmode); in aspeed_fsi_status()
371 opb_read(aspeed, ctrl_base + FSI_MRESP0, 4, &mresp0); in aspeed_fsi_status()
372 opb_read(aspeed, ctrl_base + FSI_MSTAP0, 4, &mstap0); in aspeed_fsi_status()
373 opb_read(aspeed, ctrl_base + FSI_MESRB0, 4, &mesrb0); in aspeed_fsi_status()
381 int aspeed_fsi_divisor(struct fsi_master_aspeed *aspeed, uint16_t divisor) in aspeed_fsi_divisor() argument
387 rc = opb_read(aspeed, ctrl_base + FSI_MMODE, 4, ®); in aspeed_fsi_divisor()
402 return opb_write(aspeed, ctrl_base + FSI_MMODE, cpu_to_be32(mmode), 4); in aspeed_fsi_divisor()
416 static int aspeed_fsi_init(struct fsi_master_aspeed *aspeed) in aspeed_fsi_init() argument
422 opb_write(aspeed, ctrl_base + FSI_MRESP0, reg, 4); in aspeed_fsi_init()
427 opb_write(aspeed, ctrl_base + FSI_MRESP0, reg, 4); in aspeed_fsi_init()
430 opb_write(aspeed, ctrl_base + FSI_MECTRL, reg, 4); in aspeed_fsi_init()
436 opb_write(aspeed, ctrl_base + FSI_MMODE, reg, 4); in aspeed_fsi_init()
439 opb_write(aspeed, ctrl_base + FSI_MDLYR, reg, 4); in aspeed_fsi_init()
442 opb_write(aspeed, ctrl_base + FSI_MSENP0, reg, 4); in aspeed_fsi_init()
447 opb_write(aspeed, ctrl_base + FSI_MCENP0, reg, 4); in aspeed_fsi_init()
449 opb_read(aspeed, ctrl_base + FSI_MAEB, 4, NULL); in aspeed_fsi_init()
452 opb_write(aspeed, ctrl_base + FSI_MRESP0, reg, 4); in aspeed_fsi_init()
454 opb_read(aspeed, ctrl_base + FSI_MLEVP0, 4, NULL); in aspeed_fsi_init()
458 opb_write(aspeed, ctrl_base + FSI_MRESB0, reg, 4); in aspeed_fsi_init()
461 opb_write(aspeed, ctrl_base + FSI_MRESB0, reg, 4); in aspeed_fsi_init()
468 struct fsi_master_aspeed *aspeed = dev_get_priv(dev); in aspeed_fsi_probe() local
472 aspeed->dev = dev; in aspeed_fsi_probe()
474 aspeed->base = (void *)devfdt_get_addr(dev); in aspeed_fsi_probe()
476 ret = clk_get_by_index(dev, 0, &aspeed->clk); in aspeed_fsi_probe()
482 ret = clk_enable(&aspeed->clk); in aspeed_fsi_probe()
488 writel(0x1, aspeed->base + OPB_CLK_SYNC); in aspeed_fsi_probe()
490 aspeed->base + OPB_IRQ_MASK); in aspeed_fsi_probe()
492 writel(ctrl_base, aspeed->base + OPB_CTRL_BASE); in aspeed_fsi_probe()
493 writel(fsi_base, aspeed->base + OPB_FSI_BASE); in aspeed_fsi_probe()
496 writel(0x00030b1b, aspeed->base + OPB0_R_ENDIAN); in aspeed_fsi_probe()
499 writel(0x0011bb1b, aspeed->base + OPB0_W_ENDIAN); in aspeed_fsi_probe()
500 writel(0xffaa5500, aspeed->base + 0x50); in aspeed_fsi_probe()
507 writel(0x1, aspeed->base + OPB0_SELECT); in aspeed_fsi_probe()
509 ret = opb_read(aspeed, ctrl_base + FSI_MVER, 4, &raw); in aspeed_fsi_probe()
519 aspeed_fsi_init(aspeed); in aspeed_fsi_probe()
521 printf("FSI: probed %p\n", aspeed->base); in aspeed_fsi_probe()
526 clk_disable(&aspeed->clk); in aspeed_fsi_probe()
532 struct fsi_master_aspeed *aspeed = dev_get_priv(dev); in aspeed_fsi_remove() local
534 clk_disable(&aspeed->clk); in aspeed_fsi_remove()
540 { .compatible = "aspeed,ast2600-fsi-master" },