From patchwork Mon Dec 18 07:08:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Donnellan X-Patchwork-Id: 849819 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z0XGq3C9Wz9s84 for ; Mon, 18 Dec 2017 18:09:55 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3z0XGq1m0fzDsRv for ; Mon, 18 Dec 2017 18:09:55 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=au1.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=andrew.donnellan@au1.ibm.com; receiver=) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3z0XF60Z7TzDrcw for ; Mon, 18 Dec 2017 18:08:25 +1100 (AEDT) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vBI6x0jm065738 for ; Mon, 18 Dec 2017 02:08:24 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ex6eq54vc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 18 Dec 2017 02:08:23 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Dec 2017 07:08:22 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 18 Dec 2017 07:08:20 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vBI78Kkb37748832; Mon, 18 Dec 2017 07:08:20 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D479A4C044; Mon, 18 Dec 2017 07:02:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3B08B4C059; Mon, 18 Dec 2017 07:02:59 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 18 Dec 2017 07:02:59 +0000 (GMT) Received: from intelligence.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 1F032A03A3; Mon, 18 Dec 2017 18:08:16 +1100 (AEDT) From: Andrew Donnellan To: skiboot@lists.ozlabs.org Date: Mon, 18 Dec 2017 18:08:00 +1100 X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 x-cbid: 17121807-0040-0000-0000-000003FB36AA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121807-0041-0000-0000-000025FE52DE Message-Id: <1984256e1dda723c36f624667a1af535a216083f.1513579137.git-series.andrew.donnellan@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-18_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712180093 Subject: [Skiboot] [PATCH 9/9] platforms: Add OpenCAPI platform data and device tree nodes X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arbab@linux.vnet.ibm.com, alistair@popple.id.au MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Add OpenCAPI platform data for the zaius and zz platforms, as well as the generic platform that's used for BML boots. Currently, all three platforms are identical, but that won't always be the case (e.g. Witherspoon). Additionally, for Zaius, hardcode link information and the I2C bus that's required to reset OpenCAPI devices, because this currently can't be extracted from HDAT. Eventually this will go away once Hostboot adds the relevant data in HDAT. A later patch will add this for ZZ once we've done more testing. Signed-off-by: Andrew Donnellan --- core/platform.c | 13 ++++++- platforms/astbmc/zaius.c | 89 +++++++++++++++++++++++++++++++++++++++++- platforms/ibm-fsp/zz.c | 13 ++++++- 3 files changed, 115 insertions(+) diff --git a/core/platform.c b/core/platform.c index 6816fe5..8f2bf0a 100644 --- a/core/platform.c +++ b/core/platform.c @@ -168,6 +168,18 @@ static int generic_start_preload_resource(enum resource_id id, uint32_t subid, return OPAL_EMPTY; } +/* These values will work for a ZZ booted using BML */ +const struct platform_ocapi generic_ocapi = { + .i2c_voltage_18 = false, + .i2c_engine = 1, + .i2c_port = 4, + .i2c_offset = { 0x3, 0x1, 0x1 }, + .i2c_odl0_data = { 0xFD, 0xFD, 0xFF }, + .i2c_odl1_data = { 0xBF, 0xBF, 0xFF }, + .i2c_odl01_data = { 0xBD, 0xBD, 0xFF }, + .odl_phy_swap = true, +}; + static struct bmc_platform generic_bmc = { .name = "generic", }; @@ -183,6 +195,7 @@ static struct platform generic_platform = { .cec_power_down = generic_cec_power_down, .start_preload_resource = generic_start_preload_resource, .resource_loaded = generic_resource_loaded, + .ocapi = &generic_ocapi, }; const struct bmc_platform *bmc_platform = &generic_bmc; diff --git a/platforms/astbmc/zaius.c b/platforms/astbmc/zaius.c index 74c7f13..307b57d 100644 --- a/platforms/astbmc/zaius.c +++ b/platforms/astbmc/zaius.c @@ -24,6 +24,91 @@ #include "astbmc.h" +const struct platform_ocapi zaius_ocapi = { + .i2c_voltage_18 = false, + .i2c_engine = 1, + .i2c_port = 4, + .i2c_offset = { 0x3, 0x1, 0x1 }, + .i2c_odl0_data = { 0xFD, 0xFD, 0xFF }, + .i2c_odl1_data = { 0xBF, 0xBF, 0xFF }, + .i2c_odl01_data = { 0xBD, 0xBD, 0xFF }, + .odl_phy_swap = true, +}; + +#define NPU_BASE 0x5011000 +#define NPU_SIZE 0x2c +#define NPU_INDIRECT0 0x8000000009010c3f /* OB0 - no OB3 on Zaius */ + +/* OpenCAPI only */ +static void create_link(struct dt_node *npu, int group, int index) +{ + struct dt_node *link; + uint32_t lane_mask; + char namebuf[32]; + + snprintf(namebuf, sizeof(namebuf), "link@%x", index); + link = dt_new(npu, namebuf); + + dt_add_property_string(link, "compatible", "ibm,npu-link-opencapi"); + dt_add_property_cells(link, "ibm,npu-link-index", index); + + switch (index) { + case 2: + lane_mask = 0x00078f; + break; + case 3: + lane_mask = 0xf1e000; + break; + default: + assert(0); + } + + dt_add_property_u64s(link, "ibm,npu-phy", NPU_INDIRECT0); + dt_add_property_cells(link, "ibm,npu-lane-mask", lane_mask); + dt_add_property_cells(link, "ibm,npu-group-id", group); +} + +static void zaius_create_npu(void) +{ + struct dt_node *xscom, *npu; + int npu_index = 0; + int phb_index = 7; + char namebuf[32]; + prlog(PR_DEBUG, "OCAPI: Adding NPU device nodes\n"); + dt_for_each_compatible(dt_root, xscom, "ibm,xscom") { + snprintf(namebuf, sizeof(namebuf), "npu@%x", NPU_BASE); + npu = dt_new(xscom, namebuf); + dt_add_property_cells(npu, "reg", NPU_BASE, NPU_SIZE); + dt_add_property_strings(npu, "compatible", "ibm,power9-npu"); + dt_add_property_cells(npu, "ibm,npu-index", npu_index++); + dt_add_property_cells(npu, "ibm,phb-index", phb_index++); + dt_add_property_cells(npu, "ibm,npu-links", 2); + create_link(npu, 1, 2); + create_link(npu, 2, 3); + break; + } +} + +/* FIXME: Get rid of this once hostboot/MRW gives us correct i2c details */ +static void zaius_create_ocapi_i2c_bus(void) +{ + struct dt_node *xscom, *i2cm, *i2c_bus; + prlog(PR_DEBUG, "OCAPI: Adding I2C bus device node for OCAPI reset\n"); + dt_for_each_compatible(dt_root, xscom, "ibm,xscom") { + i2cm = dt_find_by_name(xscom, "i2cm@a1000"); + if (!i2cm) { + prlog(PR_ERR, "OCAPI: Failed to add I2C bus device node\n"); + continue; + } + i2c_bus = dt_new_addr(i2cm, "i2c-bus", 4); + dt_add_property_cells(i2c_bus, "reg", 4); + dt_add_property_cells(i2c_bus, "bus-frequency", 0x61a80); + dt_add_property_strings(i2c_bus, "compatible", + "ibm,opal-i2c", "ibm,power8-i2c-port", + "ibm,power9-i2c-port"); + } +} + static bool zaius_probe(void) { if (!dt_node_is_compatible(dt_root, "ingrasys,zaius")) @@ -35,6 +120,9 @@ static bool zaius_probe(void) /* Setup UART for direct use by Linux */ uart_set_console_policy(UART_CONSOLE_OS); + zaius_create_npu(); + zaius_create_ocapi_i2c_bus(); + return true; } @@ -52,4 +140,5 @@ DECLARE_PLATFORM(zaius) = { .elog_commit = ipmi_elog_commit, .exit = ipmi_wdt_final_reset, .terminate = ipmi_terminate, + .ocapi = &zaius_ocapi, }; diff --git a/platforms/ibm-fsp/zz.c b/platforms/ibm-fsp/zz.c index a8150b8..5a8a3c4 100644 --- a/platforms/ibm-fsp/zz.c +++ b/platforms/ibm-fsp/zz.c @@ -27,6 +27,18 @@ #include "ibm-fsp.h" #include "lxvpd.h" +/* We don't yet create NPU device nodes on ZZ, but these values are correct */ +const struct platform_ocapi zz_ocapi = { + .i2c_voltage_18 = false, + .i2c_engine = 1, + .i2c_port = 4, + .i2c_offset = { 0x3, 0x1, 0x1 }, + .i2c_odl0_data = { 0xFD, 0xFD, 0xFF }, + .i2c_odl1_data = { 0xBF, 0xBF, 0xFF }, + .i2c_odl01_data = { 0xBD, 0xBD, 0xFF }, + .odl_phy_swap = true, +}; + static bool zz_probe(void) { /* FIXME: make this neater when the dust settles */ @@ -71,4 +83,5 @@ DECLARE_PLATFORM(zz) = { .resource_loaded = fsp_resource_loaded, .sensor_read = ibm_fsp_sensor_read, .terminate = ibm_fsp_terminate, + .ocapi = &zz_ocapi, };