From: Anton Blanchard <anton@ozlabs.org>
To: Joel Stanley <joel@jms.id.au>
Cc: "Michael Neuling" <mikey@neuling.org>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Alistair Popple" <alistair@popple.id.au>,
"Cédric Le Goater" <clg@kaod.org>,
"Jeremy Kerr" <jk@codeconstruct.com.au>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [RFC 5/5] ipmi:bt-bmc: Add Microwatt
Date: Wed, 6 Oct 2021 14:06:54 +1100 [thread overview]
Message-ID: <20211006140654.4fb2ea0f@kryten> (raw)
In-Reply-To: <CACPK8XetfycURqsznmA1dMZ5h5=uJb6xrzg-ihsZH9Xft=phdA@mail.gmail.com>
Hi Joel,
> The series looks good.
>
> I've got a couple of patches on the ipmi list that this will conflict
> with:
>
> https://sourceforge.net/p/openipmi/mailman/message/37345391/
> https://lore.kernel.org/all/20210903015314.177987-1-joel@jms.id.au/
>
> If there's no feedback from others I suggest basing your series on top
> of those, and sending them to Corey on the ipmi list to merge.
Looks good, will do.
Thanks,
Anton
> Cheers,
>
> Joel
>
> >
> > Signed-off-by: Anton Blanchard <anton@ozlabs.org>
> > ---
> > .../devicetree/bindings/ipmi/ibt-bmc.txt | 1 +
> > drivers/char/ipmi/Kconfig | 8 ++-
> > drivers/char/ipmi/bt-bmc.c | 69
> > +++++++++++++++++++ 3 files changed, 75 insertions(+), 3
> > deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/ipmi/ibt-bmc.txt
> > b/Documentation/devicetree/bindings/ipmi/ibt-bmc.txt index
> > 78ee716a950e..1b661daf0193 100644 ---
> > a/Documentation/devicetree/bindings/ipmi/ibt-bmc.txt +++
> > b/Documentation/devicetree/bindings/ipmi/ibt-bmc.txt @@ -9,6 +9,7
> > @@ Required properties:
> > - compatible : should be one of
> > "aspeed,ast2400-ibt-bmc"
> > "aspeed,ast2500-ibt-bmc"
> > + "ibm,microwatt-ibt-bmc"
> > - reg: physical address and size of the registers
> >
> > Optional properties:
> > diff --git a/drivers/char/ipmi/Kconfig b/drivers/char/ipmi/Kconfig
> > index 8b2f0f675e5f..079302f4eef2 100644
> > --- a/drivers/char/ipmi/Kconfig
> > +++ b/drivers/char/ipmi/Kconfig
> > @@ -152,13 +152,15 @@ config IPMI_KCS_BMC_SERIO
> > called kcs_bmc_serio.
> >
> > config BT_IPMI_BMC
> > - depends on ARCH_ASPEED || COMPILE_TEST
> > + depends on ARCH_ASPEED || PPC_MICROWATT || COMPILE_TEST
> > depends on REGMAP && REGMAP_MMIO && MFD_SYSCON
> > tristate "BT IPMI bmc driver"
> > help
> > Provides a driver for the BT (Block Transfer) IPMI
> > interface
> > - found on Aspeed SOCs (AST2400 and AST2500). The driver
> > - implements the BMC side of the BT interface.
> > + found on Aspeed SOCs (AST2400 and AST2500) as well as the
> > OpenPOWER
> > + LPC peripheral macro at
> > + <https://github.com/OpenPOWERFoundation/lpcperipheral>
> > + The driver implements the BMC side of the BT interface.
> >
> > config IPMB_DEVICE_INTERFACE
> > tristate 'IPMB Interface handler'
> > diff --git a/drivers/char/ipmi/bt-bmc.c b/drivers/char/ipmi/bt-bmc.c
> > index b48e04405ac4..24327b57c60b 100644
> > --- a/drivers/char/ipmi/bt-bmc.c
> > +++ b/drivers/char/ipmi/bt-bmc.c
> > @@ -41,6 +41,11 @@
> > #define BT_CR2_IRQ_HBUSY 0x40
> > #define ASPEED_BT_CR3 0xc
> >
> > +#define MICROWATT_IRQ_MASK 0x0
> > +#define MICROWATT_IRQ_STATUS 0x4
> > +#define IRQ_HOST_TO_BMC_ATTN 0x1
> > +#define IRQ_HOST_NOT_BUSY 0x2
> > +
> > #define BT_CTRL 0x10
> > #define BT_CTRL_B_BUSY 0x80
> > #define BT_CTRL_H_BUSY 0x40
> > @@ -395,6 +400,27 @@ static irqreturn_t aspeed_bt_bmc_irq(int irq,
> > void *arg) return IRQ_HANDLED;
> > }
> >
> > +static irqreturn_t microwatt_bt_bmc_irq(int irq, void *arg)
> > +{
> > + struct bt_bmc *bt_bmc = arg;
> > + u32 reg;
> > + int rc;
> > +
> > + rc = regmap_read(bt_bmc->map, bt_bmc->offset +
> > MICROWATT_IRQ_STATUS, ®);
> > + if (rc)
> > + return IRQ_NONE;
> > +
> > + /* Interrupt wasn't something we knew about */
> > + if (!(reg & (IRQ_HOST_TO_BMC_ATTN | IRQ_HOST_NOT_BUSY)))
> > + return IRQ_NONE;
> > +
> > + /* ack all pending IRQs */
> > + regmap_write(bt_bmc->map, bt_bmc->offset +
> > MICROWATT_IRQ_STATUS, 0); +
> > + wake_up(&bt_bmc->queue);
> > + return IRQ_HANDLED;
> > +}
> > +
> > static int aspeed_bt_bmc_config_irq(struct bt_bmc *bt_bmc,
> > struct platform_device *pdev)
> > {
> > @@ -446,6 +472,48 @@ static const struct bt_bmc_ops
> > aspeed_bt_bmc_ops = { .enable_bt = aspeed_enable_bt,
> > };
> >
> > +static int microwatt_bt_bmc_config_irq(struct bt_bmc *bt_bmc,
> > + struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + int rc;
> > +
> > + bt_bmc->irq = platform_get_irq_optional(pdev, 0);
> > + if (bt_bmc->irq < 0)
> > + return bt_bmc->irq;
> > +
> > + rc = devm_request_irq(dev, bt_bmc->irq,
> > microwatt_bt_bmc_irq, IRQF_SHARED,
> > + DEVICE_NAME, bt_bmc);
> > + if (rc < 0) {
> > + dev_warn(dev, "Unable to request IRQ %d\n",
> > bt_bmc->irq);
> > + bt_bmc->irq = rc;
> > + return rc;
> > + }
> > +
> > + /*
> > + * Configure the hardware to give us an interrupt whenever
> > the H2B
> > + * bit is set or the HBUSY bit is cleared.
> > + *
> > + * H2B will be asserted when the bmc has data for us; HBUSY
> > + * will be cleared (along with B2H) when we can write the
> > next
> > + * message to the BT buffer
> > + */
> > + rc = regmap_update_bits(bt_bmc->map, bt_bmc->offset +
> > MICROWATT_IRQ_MASK,
> > + (IRQ_HOST_TO_BMC_ATTN |
> > IRQ_HOST_NOT_BUSY),
> > + (IRQ_HOST_TO_BMC_ATTN |
> > IRQ_HOST_NOT_BUSY)); +
> > + return rc;
> > +}
> > +
> > +static void microwatt_enable_bt(struct bt_bmc *bt_bmc)
> > +{
> > +}
> > +
> > +static const struct bt_bmc_ops microwatt_bt_bmc_ops = {
> > + .config_irq = microwatt_bt_bmc_config_irq,
> > + .enable_bt = microwatt_enable_bt,
> > +};
> > +
> > static int bt_bmc_probe(struct platform_device *pdev)
> > {
> > struct bt_bmc *bt_bmc;
> > @@ -530,6 +598,7 @@ static int bt_bmc_remove(struct platform_device
> > *pdev) static const struct of_device_id bt_bmc_match[] = {
> > { .compatible = "aspeed,ast2400-ibt-bmc", .data =
> > &aspeed_bt_bmc_ops }, { .compatible = "aspeed,ast2500-ibt-bmc",
> > .data = &aspeed_bt_bmc_ops },
> > + { .compatible = "ibm,microwatt-ibt-bmc", .data =
> > µwatt_bt_bmc_ops }, { },
> > };
> >
> > --
> > 2.31.1
> >
>
next prev parent reply other threads:[~2021-10-06 3:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 2:12 [RFC 1/5] ipmi:bt-bmc: Separate out ASPEED specific bits Anton Blanchard
2021-10-06 2:12 ` [RFC 2/5] ipmi:bt-bmc: Prefix ASPEED specific registers with ASPEED_ Anton Blanchard
2021-10-06 2:12 ` [RFC 3/5] ipmi:bt-bmc: Put arch specific function into bt_bmc_ops Anton Blanchard
2021-10-06 6:01 ` Cédric Le Goater
2021-10-06 2:12 ` [RFC 4/5] ipmi:bt-bmc: No longer ASPEED specific Anton Blanchard
2021-10-06 2:12 ` [RFC 5/5] ipmi:bt-bmc: Add Microwatt Anton Blanchard
2021-10-06 2:35 ` Joel Stanley
2021-10-06 3:06 ` Anton Blanchard [this message]
2021-10-06 6:00 ` Cédric Le Goater
2021-10-06 6:02 ` [RFC 1/5] ipmi:bt-bmc: Separate out ASPEED specific bits Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211006140654.4fb2ea0f@kryten \
--to=anton@ozlabs.org \
--cc=alistair@popple.id.au \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=jk@codeconstruct.com.au \
--cc=joel@jms.id.au \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.