[Skiboot] [PATCH v3 1/3] Add: add mihawk platform file
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Wed Jul 17 18:47:53 AEST 2019
On 07/17/2019 01:06 PM, joy_chu at wistron.com wrote:
> From: joy_chu <joy_chu at wistron.com>
Few minor comments.
>
> Signed-off-by: joy_chu <joy_chu at wistron.com>
> ---
.../...
> +
> +#define NPU_BASE 0x5011000
> +#define NPU_SIZE 0x2c
> +#define NPU_INDIRECT0 0x8000000009010c3fUL /* OB0 - no OB3 on Zaius */
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);
Better to check dt_new return value. Add
assert(link);
> +
> + dt_add_property_string(link, "compatible", "ibm,npu-link");
> + dt_add_property_cells(link, "ibm,npu-link-index", index);
> +
> + switch (index) {
> + case 2:
> + lane_mask = 0xf1e000; /* 0-3, 7-10 */
> + break;
> + case 3:
> + lane_mask = 0x00078f; /* 13-16, 20-23 */
> + 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);
> + dt_add_property_u64s(link, "ibm,link-speed", 25000000000ul);
> +}
> +
> +/* FIXME: Get rid of this after we get NPU information properly via HDAT/MRW */
> +static void mihawk_create_npu(void)
> +{
> + struct dt_node *xscom, *npu;
> + int npu_index = 0;
> + int phb_index = 7;
> + char namebuf[32];
> +
> + /* Abort if there's already an NPU in the device tree */
s/Abort/return/
> + if (dt_find_compatible_node(dt_root, NULL, "ibm,power9-npu"))
> + return;
> +
> + 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);
> + }
> +}
> +
> +/* FIXME: Get rid of this after we get NPU information properly via HDAT/MRW */
> +static void mihawk_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 at a1000");
> + if (!i2cm) {
> + prlog(PR_ERR, "OCAPI: Failed to add I2C bus device node\n");
s/add/get/
-Vasant
> + continue;
> + }
> +
> + if (dt_find_by_name(i2cm, "i2c-bus at 4"))
> + 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");
> + }
> +}
More information about the Skiboot
mailing list