static int p8_opb_write(struct opb *opb, uint32_t addr, uint32_t data) { uint64_t opb_cmd = OPB_CMD_WRITE | OPB_CMD_32BIT; int64_t rc; if (addr > 0x00ffffff) return OPB_ERR_BAD_OPB_ADDR; addr = (addr & 0xffff00) | ((addr & 0xff) << 2); opb_cmd |= addr; opb_cmd <<= 32; opb_cmd |= data; PR_DEBUG("MFSI_OPB_WRITE: Writing 0x%16" PRIx64 "\n", opb_cmd); rc = pib_write(&opb->target, PIB2OPB_REG_CMD, opb_cmd); if (rc) { PR_ERROR("XSCOM error %" PRId64 " writing OPB CMD\n", rc); return OPB_ERR_XSCOM_ERR; } return opb_poll(opb, NULL); }
static int p8_opb_read(struct opb *opb, uint32_t addr, uint32_t *data) { uint64_t opb_cmd = OPB_CMD_READ | OPB_CMD_32BIT; int64_t rc; if (addr > 0x00ffffff) return OPB_ERR_BAD_OPB_ADDR; /* Turn the address into a byte address */ addr = (addr & 0xffff00) | ((addr & 0xff) << 2); opb_cmd |= addr; opb_cmd <<= 32; PR_DEBUG("MFSI_OPB_READ: Writing 0x%16" PRIx64 "\n", opb_cmd); rc = pib_write(&opb->target, PIB2OPB_REG_CMD, opb_cmd); if (rc) { PR_ERROR("XSCOM error %" PRId64 " writing OPB CMD\n", rc); return OPB_ERR_XSCOM_ERR; } return opb_poll(opb, data); }
static int opb_write(struct target *target, uint64_t addr, uint64_t data) { uint64_t opb_cmd = OPB_CMD_WRITE | OPB_CMD_32BIT; int64_t rc; if (addr > 0x00ffffff) return OPB_ERR_BAD_OPB_ADDR; addr = (addr & 0xffff00) | ((addr & 0xff) << 2); opb_cmd |= addr; opb_cmd <<= 32; opb_cmd |= data; PR_DEBUG("MFSI_OPB_WRITE: Writing 0x%16llx to XSCOM %llx\n", opb_cmd, target->base); rc = write_next_target(target, PIB2OPB_REG_CMD, opb_cmd); if (rc) { PR_ERROR("XSCOM error %lld writing OPB CMD\n", rc); return OPB_ERR_XSCOM_ERR; } return opb_poll(target, NULL); }
static int opb_read(struct target *target, uint64_t addr, uint64_t *data) { uint64_t opb_cmd = OPB_CMD_READ | OPB_CMD_32BIT; int64_t rc; if (addr > 0x00ffffff) return OPB_ERR_BAD_OPB_ADDR; /* Turn the address into a byte address */ addr = (addr & 0xffff00) | ((addr & 0xff) << 2); opb_cmd |= addr; opb_cmd <<= 32; PR_DEBUG("MFSI_OPB_READ: Writing 0x%16llx to XSCOM %llx\n", opb_cmd, target->base); rc = write_next_target(target, PIB2OPB_REG_CMD, opb_cmd); if (rc) { PR_ERROR("XSCOM error %lld writing OPB CMD\n", rc); return OPB_ERR_XSCOM_ERR; } return opb_poll(target, data); }