[Skiboot] [PATCH 2/2] hdat: parse processor attached i2c devices

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Apr 7 14:07:03 AEST 2017


On 04/06/2017 09:31 AM, Oliver O'Halloran wrote:
> Adds basic parsing for i2c devices that are attached to the processor
> I2C interfaces. This is mainly VPD SEEPROMs.
>
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>

.../...

> +struct i2c_dev {
> +	uint8_t i2cm_engine;
> +	uint8_t i2cm_port;
> +	__be16 i2c_bus_freq;
> +
> +	/* i2c slave info */
> +	uint8_t type;
> +	uint8_t i2c_addr;
> +	uint8_t i2c_port;
> +	uint8_t __reserved;
> +
> +	__be32 purpose;
> +	__be32 i2c_link;
> +	__be16 slca_index;
> +};

better to pack the structure.

> +
> +#define P9_I2CM_XSCOM_SIZE 0x1000
> +#define P9_I2CM_XSCOM_BASE 0xa0000
> +
> +static struct dt_node *get_i2cm_node(struct dt_node *xscom, int engine)
> +{
> +	uint64_t xscom_base = P9_I2CM_XSCOM_BASE + P9_I2CM_XSCOM_SIZE * engine;
> +	struct dt_node *i2cm;
> +
> +	i2cm = dt_find_by_name_addr(xscom, "i2cm", xscom_base);
> +	if (!i2cm) {
> +		i2cm = dt_new_addr(xscom, "i2cm", xscom_base);

assert(i2cm)?


-Vasant



More information about the Skiboot mailing list