aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalbir Singh <bsingharora@gmail.com>2017-12-15 13:59:42 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2018-02-13 01:30:11 -0600
commit4133e973b4f2bf61d387ac4528bed3acd12b13d9 (patch)
treee13954807d255e38e65228207c90e53b2fae0231
parent725d4a2c6cc7c97bb6754094567d079e70f06323 (diff)
downloadskiboot-4133e973b4f2bf61d387ac4528bed3acd12b13d9.zip
skiboot-4133e973b4f2bf61d387ac4528bed3acd12b13d9.tar.gz
skiboot-4133e973b4f2bf61d387ac4528bed3acd12b13d9.tar.bz2
hw/npu2: support creset of npu2 devices
creset calls in the hw procedure that resets the PHY, we don't take them out of reset, just put them in reset. Signed-off-by: Balbir Singh <bsingharora@gmail.com> Acked-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/npu2-hw-procedures.c2
-rw-r--r--hw/npu2.c21
-rw-r--r--include/npu2.h1
3 files changed, 22 insertions, 2 deletions
diff --git a/hw/npu2-hw-procedures.c b/hw/npu2-hw-procedures.c
index b21c399..9e4a431 100644
--- a/hw/npu2-hw-procedures.c
+++ b/hw/npu2-hw-procedures.c
@@ -233,7 +233,7 @@ static bool poll_fence_status(struct npu2_dev *ndev, uint64_t val)
}
/* Procedure 1.2.1 - Reset NPU/NDL */
-static uint32_t reset_ntl(struct npu2_dev *ndev)
+uint32_t reset_ntl(struct npu2_dev *ndev)
{
uint64_t val;
int lane;
diff --git a/hw/npu2.c b/hw/npu2.c
index 806f848..4c1545a 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -1170,6 +1170,25 @@ static int64_t npu2_freset(struct pci_slot *slot __unused)
return OPAL_SUCCESS;
}
+static int64_t npu2_creset(struct pci_slot *slot)
+{
+ struct npu2 *p;
+ int i;
+ struct npu2_dev *ndev;
+
+ p = phb_to_npu2(slot->phb);
+ NPU2INF(p, "Creset PHB state\n");
+
+ for (i = 0; i < p->total_devices; i++) {
+ ndev = &p->devices[i];
+ if (ndev) {
+ NPU2DEVINF(ndev, "Resetting device\n");
+ reset_ntl(ndev);
+ }
+ }
+ return OPAL_SUCCESS;
+}
+
static struct pci_slot *npu2_slot_create(struct phb *phb)
{
struct pci_slot *slot;
@@ -1191,7 +1210,7 @@ static struct pci_slot *npu2_slot_create(struct phb *phb)
slot->ops.poll_link = NULL;
slot->ops.hreset = npu2_hreset;
slot->ops.freset = npu2_freset;
- slot->ops.creset = NULL;
+ slot->ops.creset = npu2_creset;
return slot;
}
diff --git a/include/npu2.h b/include/npu2.h
index dae152a..c1f3961 100644
--- a/include/npu2.h
+++ b/include/npu2.h
@@ -162,5 +162,6 @@ int64_t npu2_dev_procedure(void *dev, struct pci_cfg_reg_filter *pcrf,
void npu2_dev_procedure_reset(struct npu2_dev *dev);
void npu2_set_link_flag(struct npu2_dev *ndev, uint8_t flag);
void npu2_clear_link_flag(struct npu2_dev *ndev, uint8_t flag);
+uint32_t reset_ntl(struct npu2_dev *ndev);
extern int nv_zcal_nominal;
#endif /* __NPU2_H */