Commit ebad3ccb authored by Corey Minyard's avatar Corey Minyard Committed by Greg Kroah-Hartman

ipmi: Add the i2c-addr property for SSIF interfaces

commit d7323638 upstream.

This is required for SSIF to work.

There was no way to know if the interface being added was SI
or SSIF from the platform data, but that was required so the
i2c-addr is only added for SSIF interfaces.  So add a field
for that.

Also rework the logic a bit so that ipmi-type is not set
for SSIF interfaces, as it is not necessary for that.

Fixes: 3cd83bac ("ipmi: Consolidate the adding of platform devices")
Reported-by: default avatarKamlakant Patel <kamlakantp@marvell.com>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
Cc: stable@vger.kernel.org # 5.1
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9c52c4cf
...@@ -47,9 +47,11 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, ...@@ -47,9 +47,11 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr,
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
name = "dmi-ipmi-si"; name = "dmi-ipmi-si";
p.iftype = IPMI_PLAT_IF_SI;
switch (type) { switch (type) {
case IPMI_DMI_TYPE_SSIF: case IPMI_DMI_TYPE_SSIF:
name = "dmi-ipmi-ssif"; name = "dmi-ipmi-ssif";
p.iftype = IPMI_PLAT_IF_SSIF;
p.type = SI_TYPE_INVALID; p.type = SI_TYPE_INVALID;
break; break;
case IPMI_DMI_TYPE_BT: case IPMI_DMI_TYPE_BT:
......
...@@ -12,7 +12,7 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst, ...@@ -12,7 +12,7 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst,
struct ipmi_plat_data *p) struct ipmi_plat_data *p)
{ {
struct platform_device *pdev; struct platform_device *pdev;
unsigned int num_r = 1, size, pidx = 0; unsigned int num_r = 1, size = 0, pidx = 0;
struct resource r[4]; struct resource r[4];
struct property_entry pr[6]; struct property_entry pr[6];
u32 flags; u32 flags;
...@@ -21,11 +21,10 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst, ...@@ -21,11 +21,10 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst,
memset(pr, 0, sizeof(pr)); memset(pr, 0, sizeof(pr));
memset(r, 0, sizeof(r)); memset(r, 0, sizeof(r));
if (p->iftype == IPMI_PLAT_IF_SI) {
if (p->type == SI_BT) if (p->type == SI_BT)
size = 3; size = 3;
else if (p->type == SI_TYPE_INVALID) else if (p->type != SI_TYPE_INVALID)
size = 0;
else
size = 2; size = 2;
if (p->regsize == 0) if (p->regsize == 0)
...@@ -34,6 +33,10 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst, ...@@ -34,6 +33,10 @@ struct platform_device *ipmi_platform_add(const char *name, unsigned int inst,
p->regspacing = p->regsize; p->regspacing = p->regsize;
pr[pidx++] = PROPERTY_ENTRY_U8("ipmi-type", p->type); pr[pidx++] = PROPERTY_ENTRY_U8("ipmi-type", p->type);
} else if (p->iftype == IPMI_PLAT_IF_SSIF) {
pr[pidx++] = PROPERTY_ENTRY_U16("i2c-addr", p->addr);
}
if (p->slave_addr) if (p->slave_addr)
pr[pidx++] = PROPERTY_ENTRY_U8("slave-addr", p->slave_addr); pr[pidx++] = PROPERTY_ENTRY_U8("slave-addr", p->slave_addr);
pr[pidx++] = PROPERTY_ENTRY_U8("addr-source", p->addr_source); pr[pidx++] = PROPERTY_ENTRY_U8("addr-source", p->addr_source);
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
#include <linux/ipmi.h> #include <linux/ipmi.h>
enum ipmi_plat_interface_type { IPMI_PLAT_IF_SI, IPMI_PLAT_IF_SSIF };
struct ipmi_plat_data { struct ipmi_plat_data {
enum ipmi_plat_interface_type iftype;
unsigned int type; /* si_type for si, SI_INVALID for others */ unsigned int type; /* si_type for si, SI_INVALID for others */
unsigned int space; /* addr_space for si, intf# for ssif. */ unsigned int space; /* addr_space for si, intf# for ssif. */
unsigned long addr; unsigned long addr;
......
...@@ -83,6 +83,7 @@ static void __init ipmi_hardcode_init_one(const char *si_type_str, ...@@ -83,6 +83,7 @@ static void __init ipmi_hardcode_init_one(const char *si_type_str,
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
p.iftype = IPMI_PLAT_IF_SI;
if (!si_type_str || !*si_type_str || strcmp(si_type_str, "kcs") == 0) { if (!si_type_str || !*si_type_str || strcmp(si_type_str, "kcs") == 0) {
p.type = SI_KCS; p.type = SI_KCS;
} else if (strcmp(si_type_str, "smic") == 0) { } else if (strcmp(si_type_str, "smic") == 0) {
......
...@@ -108,6 +108,7 @@ static int parse_hotmod_str(const char *curr, enum hotmod_op *op, ...@@ -108,6 +108,7 @@ static int parse_hotmod_str(const char *curr, enum hotmod_op *op,
int rv; int rv;
unsigned int ival; unsigned int ival;
h->iftype = IPMI_PLAT_IF_SI;
rv = parse_str(hotmod_ops, &ival, "operation", &curr); rv = parse_str(hotmod_ops, &ival, "operation", &curr);
if (rv) if (rv)
return rv; return rv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment