/* reset and boot a gphy. these phys only exist on xrx200 SoC */ int xrx200_gphy_boot(struct device *dev, unsigned int id, dma_addr_t dev_addr) { struct clk *clk; if (!of_device_is_compatible(ltq_rcu_np, "lantiq,rcu-xrx200")) { dev_err(dev, "this SoC has no GPHY\n"); return -EINVAL; } clk = clk_get_sys("1f203000.rcu", "gphy"); if (IS_ERR(clk)) return PTR_ERR(clk); clk_enable(clk); if (id > 1) { dev_err(dev, "%u is an invalid gphy id\n", id); return -EINVAL; } dev_info(dev, "booting GPHY%u firmware at %X\n", id, dev_addr); ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) | xrx200_gphy[id].rd, RCU_RST_REQ); ltq_rcu_w32(dev_addr, xrx200_gphy[id].addr); ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) & ~xrx200_gphy[id].rd, RCU_RST_REQ); return 0; }
static void ltq_machine_restart(char *command) { pr_notice("System restart\n"); local_irq_disable(); ltq_rcu_w32(ltq_rcu_r32(LTQ_RCU_RST) | LTQ_RCU_RST_ALL, LTQ_RCU_RST); unreachable(); }
/* allow platform code to find out what source we booted from */ unsigned char ltq_boot_select(void) { u32 val = ltq_rcu_r32(RCU_RST_STAT); if (of_device_is_compatible(ltq_rcu_np, "lantiq,rcu-xrx200")) return RCU_BOOT_SEL_XRX200(val); return RCU_BOOT_SEL(val); }
/* This function is used by the watchdog driver */ int ltq_reset_cause(void) { u32 val = ltq_rcu_r32(LTQ_RCU_RST_STAT); return val >> LTQ_RCU_STAT_SHIFT; }
static void ltq_machine_restart(char *command) { local_irq_disable(); ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) | RCU_RD_SRST, RCU_RST_REQ); unreachable(); }
/* reset a io domain for u micro seconds */ void ltq_reset_once(unsigned int module, ulong u) { ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) | module, RCU_RST_REQ); udelay(u); ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) & ~module, RCU_RST_REQ); }