[Skiboot] [PATCH v2] p8/i2c: Add OPAL properties in the i2c bus nodes
Neelesh Gupta
neelegup at linux.vnet.ibm.com
Tue Feb 3 17:47:18 AEDT 2015
On 02/03/2015 11:55 AM, Neelesh Gupta wrote:
> We are getting the i2c device tree data from the hostboot and it
> shows i2cm nodes compatible to multiple chips like p8 and centaur.
> The patch further adds the OPAL properties to the i2c bus nodes
> required by the kernel.
>
> Signed-off-by: Neelesh Gupta <neelegup at linux.vnet.ibm.com>
> ---
> hw/p8-i2c.c | 263 +++++++++++++++++++++++++++++++++++------------------------
> 1 file changed, 157 insertions(+), 106 deletions(-)
>
> diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
> index 3e5334c..7042b50 100644
> --- a/hw/p8-i2c.c
> +++ b/hw/p8-i2c.c
> @@ -1105,6 +1105,50 @@ void p8_i2c_interrupt(uint32_t chip_id)
> }
> }
>
> +enum i2c_host {
> + I2C_POWER8,
> + I2C_CENTAUR,
> + MAX_I2C_HOSTS,
> +};
> +
> +static const char *compat[] = {
> + "ibm,power8-i2cm",
> + "ibm,centaur-i2cm"
> +};
> +
> +static void p8_i2c_add_bus_prop(enum i2c_host chip, struct dt_node *i2cm_port,
> + struct p8_i2c_master_port *port)
> +{
> + const struct dt_property *c, *p;
> + char name[32];
> +
> + c = dt_find_property(i2cm_port, "compatible");
> + p = dt_find_property(i2cm_port, "ibm,port-name");
i) These are OPAL properties and should actually be added by skiboot driver
*only* so I guess it is needless to check if they exist already or not. But,
at the moment, it might have been added by PLAT code or from HB (Dan
told me he is adding 'ibm,port-name' in HB to avoid crash with current
op-build pointing to..)
So, putting a check to avoid duplication of these properties.
ii) Not updating the "status" property for the i2c devices as I'm not sure
which we are reserving and which one not.
Neelesh.
> +
> + if (!c) {
> + if (chip == I2C_POWER8)
> + dt_add_property_strings(i2cm_port, "compatible",
> + "ibm,power8-i2c-port",
> + "ibm,opal-i2c");
> + else if (chip == I2C_CENTAUR)
> + dt_add_property_strings(i2cm_port, "compatible",
> + "ibm,centaur-i2c-port",
> + "ibm,opal-i2c");
> + }
> +
> + if (!p) {
> + if (chip == I2C_POWER8)
> + snprintf(name, sizeof(name), "p8_%08x_e%dp%d",
> + port->master->chip_id, port->master->engine_id,
> + port->port_num);
> + else if (chip == I2C_CENTAUR)
> + snprintf(name, sizeof(name), "cen_%08x_e%dp%d",
> + port->master->chip_id, port->master->engine_id,
> + port->port_num);
> +
> + dt_add_property_string(i2cm_port, "ibm,port-name", name);
> + }
> +}
>
More information about the Skiboot
mailing list