From patchwork Tue Jul 30 00:07:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 2835198 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5EDE29F9C8 for ; Tue, 30 Jul 2013 01:00:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6345A201CD for ; Tue, 30 Jul 2013 01:00:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC75E2018F for ; Tue, 30 Jul 2013 01:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752893Ab3G3BAk (ORCPT ); Mon, 29 Jul 2013 21:00:40 -0400 Received: from elvis.franken.de ([193.175.24.41]:41557 "EHLO elvis.franken.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752878Ab3G3BAj (ORCPT ); Mon, 29 Jul 2013 21:00:39 -0400 X-Greylist: delayed 3422 seconds by postgrey-1.27 at vger.kernel.org; Mon, 29 Jul 2013 21:00:39 EDT Received: from uucp (helo=solo.franken.de) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1V3xT4-0007if-00; Tue, 30 Jul 2013 02:07:10 +0200 Received: by solo.franken.de (Postfix, from userid 1000) id 4C0D21D232; Tue, 30 Jul 2013 02:07:02 +0200 (CEST) From: Thomas Bogendoerfer Subject: [PATCH] BMC support for PARISC machines To: openipmi-developer@lists.sourceforge.net, linux-parisc@vger.kernel.org cc: minyard@acm.org Message-Id: <20130730000702.4C0D21D232@solo.franken.de> Date: Tue, 30 Jul 2013 02:07:02 +0200 (CEST) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The last line of PARISC machines (C8000, RP34x0, etc.) have a BMC for controlling temperature, fan speed and other stuff. The BMC is connected via a special bus and listed in the firmware device tree. This change adds support for these BMCs to the IPMI driver. Signed-off-by: Thomas Bogendoerfer --- This is the second try to get this change integrated. If you see any problems with this patch, please give me hints how to improve this patch. drivers/char/ipmi/ipmi_si_intf.c | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index af4b23f..b017b8a 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -71,6 +71,11 @@ #include #include +#ifdef CONFIG_PARISC +#include /* for register_parisc_driver() stuff */ +#include +#endif + #define PFX "ipmi_si: " /* Measure times between events in the driver. */ @@ -298,6 +303,9 @@ static int pci_registered; #ifdef CONFIG_ACPI static int pnp_registered; #endif +#ifdef CONFIG_PARISC +static int parisc_registered; +#endif static unsigned int kipmid_max_busy_us[SI_MAX_PARMS]; static int num_max_busy_us; @@ -2697,6 +2705,64 @@ static struct platform_driver ipmi_driver = { .remove = ipmi_remove, }; +#ifdef CONFIG_PARISC +static int ipmi_parisc_probe(struct parisc_device *dev) +{ + struct smi_info *info; + + info = kzalloc(sizeof(*info), GFP_KERNEL); + + if (!info) { + dev_err(&dev->dev, + "could not allocate memory for PARISC probe\n"); + return -ENOMEM; + } + + info->si_type = SI_KCS; + info->addr_source = SI_DEVICETREE; + info->io_setup = mem_setup; + info->io.addr_type = IPMI_MEM_ADDR_SPACE; + info->io.addr_data = dev->hpa.start; + info->io.regsize = 1; + info->io.regspacing = 1; + info->io.regshift = 0; + info->irq = 0; /* no interrupt */ + info->irq_setup = NULL; + info->dev = &dev->dev; + + dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %d\n", + info->io.addr_data, info->io.regsize, info->io.regspacing, + info->irq); + + dev_set_drvdata(&dev->dev, info); + + if (add_smi(info)) { + kfree(info); + return -EBUSY; + } + + return 0; +} + +static int ipmi_parisc_remove(struct parisc_device *dev) +{ + cleanup_one_si(dev_get_drvdata(&dev->dev)); + return 0; +} + +static struct parisc_device_id ipmi_parisc_tbl[] = { + { HPHW_MC, HVERSION_REV_ANY_ID, 0x004, 0xC0 }, + { 0, } +}; + +static struct parisc_driver ipmi_parisc_driver = { + .name = "ipmi", + .id_table = ipmi_parisc_tbl, + .probe = ipmi_parisc_probe, + .remove = ipmi_parisc_remove, +}; +#endif /* CONFIG_PARISC */ + static int wait_for_msg_done(struct smi_info *smi_info) { enum si_sm_result smi_result; @@ -3462,6 +3528,13 @@ static int init_ipmi_si(void) spmi_find_bmc(); #endif +#ifdef CONFIG_PARISC + register_parisc_driver(&ipmi_parisc_driver); + parisc_registered = 1; + /* poking PC IO addresses will crash machine, don't do it */ + si_trydefaults = 0; +#endif + /* We prefer devices with interrupts, but in the case of a machine with multiple BMCs we assume that there will be several instances of a given type so if we succeed in registering a type then also @@ -3608,6 +3681,10 @@ static void cleanup_ipmi_si(void) if (pnp_registered) pnp_unregister_driver(&ipmi_pnp_driver); #endif +#ifdef CONFIG_PARISC + if (parisc_registered) + unregister_parisc_driver(&ipmi_parisc_driver); +#endif platform_driver_unregister(&ipmi_driver);