From patchwork Tue Apr 18 15:28:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawkins, Nick" X-Patchwork-Id: 13215856 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C525DC77B78 for ; Tue, 18 Apr 2023 15:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=h1Ison1ZgONf9EBBjGdDU38lXZbfpkpYDIhnXAyXtLY=; b=pNwe4ikC0ZAn/W JosL2DkBvd3AUQzOPEiQfP2fpFOArNNYhZlsM2mW8Nu81/wbrm6/3JvFKBUhyjKVwwy1iyJQv0d4O EOovFZtVEfnxPKfLDA++LOQO/YT4qQW3YVYHqOk7PeJte47HDuLVa1DNGm4Ci/hht9NgcfHCV55CU JeWQIh9aCOIkj1CL5uvxxAJD/HWwwpJZ5GJHHXvSussZs5xzjvZQMGHNwdig6DfHut7cu1ICgc/EU JL9FAb1ptEIyS0risNcTmKnXjYDgtn+xanjPmAlRWhW2/AN6QoAJPvlIxiQXAsS9NJnFZ45oQA2ww t+Mzm0G7Qd2vWCMOpIVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponJg-002c7N-0b; Tue, 18 Apr 2023 15:32:24 +0000 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponJH-002brr-31 for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:32:05 +0000 Received: from pps.filterd (m0134422.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33I7g3O4027489; Tue, 18 Apr 2023 15:31:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references; s=pps0720; bh=Tt4JzqIKEid4oeg7pCnXRGju7fBjcdE/E0n7Dx1eby8=; b=AyUo4KuzQy9QPt0mDcea465Y84vT2aqnvfMF+3uN0V9LWsKMBCfCE/pkeITzbmO67SXn t5Phb2KILxlbk8hu0fJ9Z5dE621MD6bx++DEHuKEIQImWc9zj5sm5OP6wxu0b1D93vmJ NePxI2LYOtf0Xnu1pmRrJ2I0Y+Lv2Pr9GM2GuteQ2lF49ZdrwAGB42J0MOjy4gaeebwB PGNV8cZz5gcdHoNYU858QQ4o4v1+jopgNkvg3ZHQyOWThxdpcG94KFS/br14tL8y0kVh z8yzezVZK16dUPcxo5yPqrM5gNZw9xaoUD39jjxj/lBqMTxd+zvzZr/AvhIA1KyxMxKN iw== Received: from p1lg14881.it.hpe.com (p1lg14881.it.hpe.com [16.230.97.202]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3q1mhrmxcx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 15:31:36 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14881.it.hpe.com (Postfix) with ESMTPS id CFA32804788; Tue, 18 Apr 2023 15:31:35 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id 2AE9681532D; Tue, 18 Apr 2023 15:31:35 +0000 (UTC) From: nick.hawkins@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jdelvare@suse.com, linux@roeck-us.net, linux@armlinux.org.uk, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 1/9] gpio: gxp: Add HPE GXP GPIO Date: Tue, 18 Apr 2023 10:28:16 -0500 Message-Id: <20230418152824.110823-2-nick.hawkins@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418152824.110823-1-nick.hawkins@hpe.com> References: <20230418152824.110823-1-nick.hawkins@hpe.com> X-Proofpoint-ORIG-GUID: 7agTXQ4YaY-0JUjdZOtoPjxiE3naG5NX X-Proofpoint-GUID: 7agTXQ4YaY-0JUjdZOtoPjxiE3naG5NX X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=999 spamscore=0 clxscore=1015 impostorscore=0 suspectscore=0 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180132 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_083159_986651_7965351A X-CRM114-Status: GOOD ( 25.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Hawkins The GXP SoC supports GPIO on multiple interfaces: Host, CPLD and Soc pins. The interface from CPLD and Host are interruptable from vic0 and vic1. This driver allows support for both of these interfaces through the use of different compatible bindings. Signed-off-by: Nick Hawkins --- drivers/gpio/Kconfig | 9 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-gxp.c | 1056 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 1066 insertions(+) create mode 100644 drivers/gpio/gpio-gxp.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 13be729710f2..47435307698c 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -1235,6 +1235,15 @@ config HTC_EGPIO several HTC phones. It provides basic support for input pins, output pins, and IRQs. +config GPIO_GXP + tristate "GXP GPIO support" + depends on ARCH_HPE_GXP + select GPIOLIB_IRQCHIP + help + Say Y here to support GXP GPIO controllers. It provides + support for the multiple GPIO interfaces available to be + available to the Host. + config GPIO_JANZ_TTL tristate "Janz VMOD-TTL Digital IO Module" depends on MFD_JANZ_CMODIO diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index c048ba003367..a7ce0ab097aa 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -63,6 +63,7 @@ obj-$(CONFIG_GPIO_FTGPIO010) += gpio-ftgpio010.o obj-$(CONFIG_GPIO_GE_FPGA) += gpio-ge.o obj-$(CONFIG_GPIO_GPIO_MM) += gpio-gpio-mm.o obj-$(CONFIG_GPIO_GRGPIO) += gpio-grgpio.o +obj-$(CONFIG_GPIO_GXP) += gpio-gxp.o obj-$(CONFIG_GPIO_GW_PLD) += gpio-gw-pld.o obj-$(CONFIG_GPIO_HISI) += gpio-hisi.o obj-$(CONFIG_GPIO_HLWD) += gpio-hlwd.o diff --git a/drivers/gpio/gpio-gxp.c b/drivers/gpio/gpio-gxp.c new file mode 100644 index 000000000000..86f69174434d --- /dev/null +++ b/drivers/gpio/gpio-gxp.c @@ -0,0 +1,1056 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright (C) 2023 Hewlett-Packard Enterprise Development Company, L.P. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GPIDATL 0x40 +#define GPIDATH 0x60 +#define GPODATL 0xb0 +#define GPODATH 0xb4 +#define GPODAT2L 0xf8 +#define GPODAT2H 0xfc +#define GPOOWNL 0x110 +#define GPOOWNH 0x114 +#define GPOOWN2L 0x118 +#define GPOOWN2H 0x11c + +#define GPIO_DIR_OUT 0 +#define GPIO_DIR_IN 1 + +#define PGOOD_MASK 1 + +#define PLREG_INT_GRP_STAT_MASK 0x8 +#define PLREG_INT_HI_PRI_EN 0xC +#define PLREG_INT_GRP5_BASE 0x31 +#define PLREG_INT_GRP6_BASE 0x35 +#define PLREG_INT_GRP5_FLAG 0x30 +#define PLREG_INT_GRP6_FLAG 0x34 +#define PLREG_INT_GRP5_PIN_BASE 59 +#define PLREG_INT_GRP6_PIN_BASE 90 + +enum pl_gpio_pn { + IOP_LED1 = 0, + IOP_LED2, + IOP_LED3, + IOP_LED4, + IOP_LED5, + IOP_LED6, + IOP_LED7, + IOP_LED8, + FAN1_INST = 8, + FAN2_INST, + FAN3_INST, + FAN4_INST, + FAN5_INST, + FAN6_INST, + FAN7_INST, + FAN8_INST, + FAN1_FAIL, + FAN2_FAIL, + FAN3_FAIL, + FAN4_FAIL, + FAN5_FAIL, + FAN6_FAIL, + FAN7_FAIL, + FAN8_FAIL, + LED_IDENTIFY = 56, + LED_HEALTH_RED, + LED_HEALTH_AMBER, + PWR_BTN_INT = 59, + UID_PRESS_INT, + SLP_INT, + ACM_FORCE_OFF = 70, + ACM_REMOVED, + ACM_REQ_N, + PSU1_INST, + PSU2_INST, + PSU3_INST, + PSU4_INST, + PSU5_INST, + PSU6_INST, + PSU7_INST, + PSU8_INST, + PSU1_AC, + PSU2_AC, + PSU3_AC, + PSU4_AC, + PSU5_AC, + PSU6_AC, + PSU7_AC, + PSU8_AC, + PSU1_DC, + PSU2_DC, + PSU3_DC, + PSU4_DC, + PSU5_DC, + PSU6_DC, + PSU7_DC, + PSU8_DC +}; + +enum plreg_gpio_pn { + RESET = 192, + NMI_OUT = 193, + VPBTN = 210, + PGOOD, + PERST, + POST_COMPLETE, +}; + +struct gxp_gpio_drvdata { + struct regmap *csm_map; + void __iomem *fn2_vbtn; + struct regmap *fn2_stat; + struct regmap *vuhc0_map; + void __iomem *vbtn; + struct regmap *pl_led; + struct regmap *pl_health; + struct regmap *pl_int; + struct gpio_chip chip; + int irq; +}; + +extern u8 get_psu_inst(void); +extern u8 get_psu_ac(void); +extern u8 get_psu_dc(void); +extern u8 get_fans_installed(void); +extern u8 get_fans_failed(void); + +static int gxp_gpio_csm_get(struct gpio_chip *chip, unsigned int offset) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + int ret = 0; + + switch (offset) { + case 0 ... 31: + regmap_read(drvdata->csm_map, GPIDATL, &ret); + ret = (ret & BIT(offset)) ? 1 : 0; + break; + case 32 ... 63: + regmap_read(drvdata->csm_map, GPIDATH, &ret); + ret = (ret & BIT(offset - 32)) ? 1 : 0; + break; + case 64 ... 95: + regmap_read(drvdata->csm_map, GPODATL, &ret); + ret = (ret & BIT(offset - 64)) ? 1 : 0; + break; + case 96 ... 127: + regmap_read(drvdata->csm_map, GPODATH, &ret); + ret = (ret & BIT(offset - 96)) ? 1 : 0; + break; + case 128 ... 159: + regmap_read(drvdata->csm_map, GPODAT2L, &ret); + ret = (ret & BIT(offset - 128)) ? 1 : 0; + break; + case 160 ... 191: + regmap_read(drvdata->csm_map, GPODAT2H, &ret); + ret = (ret & BIT(offset - 160)) ? 1 : 0; + break; + case 192: + /* SW_RESET */ + regmap_read(drvdata->csm_map, 0x5C, &ret); + ret = (ret & BIT(15)) ? 1 : 0; + break; + default: + break; + } + + return ret; +} + +static void gxp_gpio_csm_set(struct gpio_chip *chip, unsigned int offset, + int value) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + u32 tmp; + + switch (offset) { + case 64 ... 95: + /* Keep ownership setting */ + regmap_read(drvdata->csm_map, GPOOWNL, &tmp); + tmp = (tmp & BIT(offset - 64)) ? 1 : 0; + + regmap_update_bits(drvdata->csm_map, GPOOWNL, + BIT(offset - 64), BIT(offset - 64)); + regmap_update_bits(drvdata->csm_map, GPODATL, + BIT(offset - 64), value ? BIT(offset - 64) : 0); + + /* Restore ownership setting */ + regmap_update_bits(drvdata->csm_map, GPOOWNL, + BIT(offset - 64), tmp ? BIT(offset - 64) : 0); + break; + case 96 ... 127: + /* Keep ownership setting */ + regmap_read(drvdata->csm_map, GPOOWNH, &tmp); + tmp = (tmp & BIT(offset - 96)) ? 1 : 0; + + regmap_update_bits(drvdata->csm_map, GPOOWNH, + BIT(offset - 96), BIT(offset - 96)); + regmap_update_bits(drvdata->csm_map, GPODATH, + BIT(offset - 96), value ? BIT(offset - 96) : 0); + + /* Restore ownership setting */ + regmap_update_bits(drvdata->csm_map, GPOOWNH, + BIT(offset - 96), tmp ? BIT(offset - 96) : 0); + break; + case 128 ... 159: + /* Keep ownership setting */ + regmap_read(drvdata->csm_map, GPOOWN2L, &tmp); + tmp = (tmp & BIT(offset - 128)) ? 1 : 0; + + regmap_update_bits(drvdata->csm_map, GPOOWN2L, + BIT(offset - 128), BIT(offset - 128)); + regmap_update_bits(drvdata->csm_map, GPODAT2L, + BIT(offset - 128), value ? BIT(offset - 128) : 0); + + /* Restore ownership setting */ + regmap_update_bits(drvdata->csm_map, GPOOWN2L, + BIT(offset - 128), tmp ? BIT(offset - 128) : 0); + break; + case 160 ... 191: + /* Keep ownership setting */ + regmap_read(drvdata->csm_map, GPOOWN2H, &tmp); + tmp = (tmp & BIT(offset - 160)) ? 1 : 0; + + regmap_update_bits(drvdata->csm_map, GPOOWN2H, + BIT(offset - 160), BIT(offset - 160)); + regmap_update_bits(drvdata->csm_map, GPODAT2H, + BIT(offset - 160), value ? BIT(offset - 160) : 0); + + /* Restore ownership setting */ + regmap_update_bits(drvdata->csm_map, GPOOWN2H, + BIT(offset - 160), tmp ? BIT(offset - 160) : 0); + break; + case 192: + if (value) { + regmap_update_bits(drvdata->csm_map, 0x5C, + BIT(0), BIT(0)); + regmap_update_bits(drvdata->csm_map, 0x5C, + BIT(15), BIT(15)); + } else { + regmap_update_bits(drvdata->csm_map, 0x5C, + BIT(15), 0); + } + break; + default: + break; + } +} + +static int gxp_gpio_csm_get_direction(struct gpio_chip *chip, + unsigned int offset) +{ + int ret = 0; + + switch (offset) { + case 0 ... 63: + ret = GPIO_DIR_IN; + break; + case 64 ... 191: + ret = GPIO_DIR_OUT; + break; + case 192 ... 193: + ret = GPIO_DIR_OUT; + break; + case 194: + ret = GPIO_DIR_IN; + break; + default: + break; + } + + return ret; +} + +static int gxp_gpio_csm_direction_input(struct gpio_chip *chip, + unsigned int offset) +{ + int ret = -EOPNOTSUPP; + + switch (offset) { + case 0 ... 63: + ret = 0; + break; + case 194: + ret = 0; + break; + default: + break; + } + + return ret; +} + +static int gxp_gpio_csm_direction_output(struct gpio_chip *chip, + unsigned int offset, int value) +{ + int ret = -EOPNOTSUPP; + + switch (offset) { + case 64 ... 191: + case 192 ... 193: + gxp_gpio_csm_set(chip, offset, value); + ret = 0; + break; + default: + break; + } + + return ret; +} + +static int gxp_gpio_vuhc_get(struct gpio_chip *chip, unsigned int offset) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + unsigned int val; + int ret = 0; + + if (offset < 8) { + regmap_read(drvdata->vuhc0_map, 0x64 + 4 * offset, &val); + ret = (val & BIT(13)) ? 1 : 0; + } + + return ret; +} + +static void gxp_gpio_vuhc_set(struct gpio_chip *chip, unsigned int offset, + int value) +{ + switch (offset) { + default: + break; + } +} + +static int gxp_gpio_vuhc_get_direction(struct gpio_chip *chip, + unsigned int offset) +{ + int ret = 0; + + switch (offset) { + case 0: + case 1: + case 2: + ret = GPIO_DIR_IN; + break; + default: + break; + } + + return ret; +} + +static int gxp_gpio_vuhc_direction_input(struct gpio_chip *chip, + unsigned int offset) +{ + int ret = -EOPNOTSUPP; + + switch (offset) { + case 0: + case 1: + case 2: + ret = 0; + break; + default: + break; + } + + return ret; +} + +static int gxp_gpio_vuhc_direction_output(struct gpio_chip *chip, + unsigned int offset, int value) +{ + int ret = -EOPNOTSUPP; + + switch (offset) { + default: + break; + } + + return ret; +} + +static int gxp_gpio_fn2_get(struct gpio_chip *chip, unsigned int offset) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + unsigned int val; + int ret = 0; + + switch (offset) { + case PGOOD: + regmap_read(drvdata->fn2_stat, 0, &val); + ret = (val & BIT(24)) ? 1 : 0; + + break; + case PERST: + regmap_read(drvdata->fn2_stat, 0, &val); + ret = (val & BIT(25)) ? 1 : 0; + + break; + default: + break; + } + + return ret; +} + +static void gxp_gpio_fn2_set(struct gpio_chip *chip, unsigned int offset, + int value) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + + switch (offset) { + case VPBTN: + writeb(4, drvdata->vbtn); + writeb(1, drvdata->fn2_vbtn); + break; + default: + break; + } +} + +static int gxp_gpio_fn2_get_direction(struct gpio_chip *chip, + unsigned int offset) +{ + int ret = GPIO_DIR_IN; + + switch (offset) { + case VPBTN: + ret = GPIO_DIR_OUT; + break; + default: + break; + } + + return ret; +} + +static int gxp_gpio_fn2_direction_input(struct gpio_chip *chip, + unsigned int offset) +{ + int ret = -EOPNOTSUPP; + + switch (offset) { + case PGOOD: + case PERST: + case POST_COMPLETE: + ret = 0; + break; + default: + break; + } + + return ret; +} + +static int gxp_gpio_get(struct gpio_chip *chip, unsigned int offset) +{ + int ret = 0; + + if (offset < 200) + ret = gxp_gpio_csm_get(chip, offset); + else if (offset >= 250 && offset < 300) + ret = gxp_gpio_vuhc_get(chip, offset - 250); + else if (offset >= 300) + ret = gxp_gpio_fn2_get(chip, offset); + + return ret; +} + +static void gxp_gpio_set(struct gpio_chip *chip, + unsigned int offset, int value) +{ + if (offset < 200) + gxp_gpio_csm_set(chip, offset, value); + else if (offset >= 250 && offset < 300) + gxp_gpio_vuhc_set(chip, offset - 250, value); + else if (offset >= 300) + gxp_gpio_fn2_set(chip, offset, value); +} + +static int gxp_gpio_get_direction(struct gpio_chip *chip, + unsigned int offset) +{ + int ret = 0; + + if (offset < 200) + ret = gxp_gpio_csm_get_direction(chip, offset); + else if (offset >= 250 && offset < 300) + ret = gxp_gpio_vuhc_get_direction(chip, offset - 250); + else if (offset >= 300) + ret = gxp_gpio_fn2_get_direction(chip, offset); + + return ret; +} + +static int gxp_gpio_direction_input(struct gpio_chip *chip, + unsigned int offset) +{ + int ret = 0; + + if (offset < 200) + ret = gxp_gpio_csm_direction_input(chip, offset); + else if (offset >= 250 && offset < 300) + ret = gxp_gpio_vuhc_direction_input(chip, offset - 250); + else if (offset >= 300) + ret = gxp_gpio_fn2_direction_input(chip, offset); + + return ret; +} + +static int gxp_gpio_direction_output(struct gpio_chip *chip, + unsigned int offset, int value) +{ + int ret = 0; + + if (offset < 200) + ret = gxp_gpio_csm_direction_output(chip, offset, value); + else if (offset >= 250 && offset < 300) + ret = gxp_gpio_vuhc_direction_output(chip, offset - 250, value); + return ret; +} + +static struct regmap *gxp_gpio_init_regmap(struct platform_device *pdev, + char *reg_name, u8 bits) +{ + struct regmap_config regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + }; + void __iomem *base; + + if (bits == 8) { + regmap_config.reg_bits = 8; + regmap_config.reg_stride = 1; + regmap_config.val_bits = 8; + regmap_config.max_register = 0xff; + } + + base = devm_platform_ioremap_resource_byname(pdev, reg_name); + if (IS_ERR(base)) + return ERR_CAST(base); + + regmap_config.name = reg_name; + + return devm_regmap_init_mmio(&pdev->dev, base, ®map_config); +} + +static void gxp_gpio_fn2_irq_ack(struct irq_data *d) +{ + struct gpio_chip *chip = irq_data_get_irq_chip_data(d); + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + unsigned int val; + + /* Read latched interrupt */ + regmap_read(drvdata->fn2_stat, 0, &val); + /* Clear latched interrupt */ + regmap_update_bits(drvdata->fn2_stat, 0, + 0xFFFF, 0xFFFF); +} + +#define FN2_SEVMASK 4 +static void gxp_gpio_fn2_irq_set_mask(struct irq_data *d, bool set) +{ + struct gpio_chip *chip = irq_data_get_irq_chip_data(d); + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + + regmap_update_bits(drvdata->fn2_stat, FN2_SEVMASK, + BIT(0), set ? BIT(0) : 0); +} + +static void gxp_gpio_fn2_irq_mask(struct irq_data *d) +{ + gxp_gpio_fn2_irq_set_mask(d, false); +} + +static void gxp_gpio_fn2_irq_unmask(struct irq_data *d) +{ + gxp_gpio_fn2_irq_set_mask(d, true); +} + +static int gxp_gpio_fn2_set_type(struct irq_data *d, unsigned int type) +{ + if (type & IRQ_TYPE_LEVEL_MASK) + irq_set_handler_locked(d, handle_level_irq); + else + irq_set_handler_locked(d, handle_edge_irq); + + return 0; +} + +static irqreturn_t gxp_gpio_fn2_irq_handle(int irq, void *_drvdata) +{ + struct gxp_gpio_drvdata *drvdata = (struct gxp_gpio_drvdata *)_drvdata; + unsigned int val, girq; + + regmap_read(drvdata->fn2_stat, 0, &val); + + if (val & PGOOD_MASK) { + girq = irq_find_mapping(drvdata->chip.irq.domain, PGOOD); + generic_handle_irq(girq); + } + + return IRQ_HANDLED; +} + +static int gxp_gpio_pl_get(struct gpio_chip *chip, unsigned int offset) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + unsigned int val; + int ret = 0; + + switch (offset) { + case IOP_LED1 ... IOP_LED8: + regmap_read(drvdata->pl_led, 0x00, &val); + ret = (val & BIT(offset)) ? 1 : 0; + break; + case FAN1_INST ...FAN8_INST: + ret = (get_fans_installed() & BIT((offset - FAN1_INST))) ? 1 : 0; + break; + case FAN1_FAIL ... FAN8_FAIL: + ret = (get_fans_failed() & BIT((offset - FAN1_FAIL))) ? 1 : 0; + break; + case PWR_BTN_INT ... SLP_INT: + regmap_read(drvdata->pl_int, PLREG_INT_GRP5_FLAG, &val); + /* Active low */ + ret = (val & BIT((offset - PWR_BTN_INT) + 16)) ? 0 : 1; + break; + case PSU1_INST ... PSU8_INST: + ret = (get_psu_inst() & BIT((offset - PSU1_INST))) ? 1 : 0; + break; + case PSU1_AC ... PSU8_AC: + ret = (get_psu_ac() & BIT((offset - PSU1_AC))) ? 1 : 0; + break; + case PSU1_DC ... PSU8_DC: + ret = (get_psu_dc() & BIT((offset - PSU1_DC))) ? 1 : 0; + break; + default: + break; + } + + return ret; +} + +static void gxp_gpio_pl_set(struct gpio_chip *chip, + unsigned int offset, int value) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + + switch (offset) { + case IOP_LED1 ... IOP_LED8: + regmap_update_bits(drvdata->pl_led, 0x00, BIT(offset), + value == 0 ? 0 : BIT(offset)); + break; + case LED_IDENTIFY: + regmap_update_bits(drvdata->pl_led, 0x01, BIT(7) | BIT(6), + value == 0 ? BIT(7) : BIT(7) | BIT(6)); + break; + case LED_HEALTH_RED: + regmap_update_bits(drvdata->pl_health, 0x0, BIT(7), + value == 0 ? 0 : BIT(7)); + break; + case LED_HEALTH_AMBER: + regmap_update_bits(drvdata->pl_health, 0x0, BIT(6), + value == 0 ? 0 : BIT(6)); + break; + default: + break; + } +} + +static int gxp_gpio_pl_get_direction(struct gpio_chip *chip, unsigned int offset) +{ + int ret = GPIO_DIR_IN; + + switch (offset) { + case IOP_LED1 ... IOP_LED8: + case LED_IDENTIFY ... LED_HEALTH_AMBER: + case ACM_FORCE_OFF: + case ACM_REQ_N: + ret = GPIO_DIR_OUT; + break; + default: + break; + } + + return ret; +} + +static int gxp_gpio_pl_direction_input(struct gpio_chip *chip, + unsigned int offset) +{ + int ret = -EOPNOTSUPP; + + switch (offset) { + case 8 ... 55: + ret = 0; + break; + case 59 ... 65: + ret = 0; + break; + default: + break; + } + + return ret; +} + +static int gxp_gpio_pl_direction_output(struct gpio_chip *chip, + unsigned int offset, int value) +{ + int ret = -EOPNOTSUPP; + + switch (offset) { + case IOP_LED1 ... IOP_LED8: + case LED_IDENTIFY ... LED_HEALTH_AMBER: + case ACM_FORCE_OFF: + case ACM_REQ_N: + gxp_gpio_pl_set(chip, offset, value); + ret = 0; + break; + default: + break; + } + + return ret; +} + +static void gxp_gpio_pl_irq_ack(struct irq_data *d) +{ + struct gpio_chip *chip = irq_data_get_irq_chip_data(d); + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + unsigned int val; + + /* Read latched interrupt for group 5 */ + regmap_read(drvdata->pl_int, PLREG_INT_GRP5_FLAG, &val); + /* Clear latched interrupt */ + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP5_FLAG, + 0xFF, 0xFF); + + /* Read latched interrupt for group 6 */ + regmap_read(drvdata->pl_int, PLREG_INT_GRP6_FLAG, &val); + /* Clear latched interrupt */ + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP6_FLAG, + 0xFF, 0xFF); +} + +static void gxp_gpio_pl_irq_set_mask(struct irq_data *d, bool set) +{ + struct gpio_chip *chip = irq_data_get_irq_chip_data(d); + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP5_BASE, + BIT(0) | BIT(2), set ? 0 : BIT(0) | BIT(2)); + + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP6_BASE, + BIT(2), set ? 0 : BIT(2)); +} + +static void gxp_gpio_pl_irq_mask(struct irq_data *d) +{ + gxp_gpio_pl_irq_set_mask(d, false); +} + +static void gxp_gpio_pl_irq_unmask(struct irq_data *d) +{ + gxp_gpio_pl_irq_set_mask(d, true); +} + +static int gxp_gpio_irq_init_hw(struct gpio_chip *chip) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(chip->parent); + + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP5_BASE, + BIT(0) | BIT(2), 0); + + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP6_BASE, + BIT(2), 0); + + return 0; +} + +static int gxp_gpio_pl_set_type(struct irq_data *d, unsigned int type) +{ + if (type & IRQ_TYPE_LEVEL_MASK) + irq_set_handler_locked(d, handle_level_irq); + else + irq_set_handler_locked(d, handle_edge_irq); + + return 0; +} + +static irqreturn_t gxp_gpio_pl_irq_handle(int irq, void *_drvdata) +{ + struct gxp_gpio_drvdata *drvdata = (struct gxp_gpio_drvdata *)_drvdata; + unsigned int val, girq, i; + + /* Check group 5 interrupts */ + + regmap_read(drvdata->pl_int, PLREG_INT_GRP5_FLAG, &val); + + if (val) { + for_each_set_bit(i, (unsigned long *)&val, 3) { + girq = irq_find_mapping(drvdata->chip.irq.domain, + i + PLREG_INT_GRP5_PIN_BASE); + generic_handle_irq(girq); + } + + /* Clear latched interrupt */ + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP5_FLAG, + 0xFF, 0xFF); + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP5_BASE, + BIT(0) | BIT(2), 0); + } + + /* Check group 6 interrupts */ + + regmap_read(drvdata->pl_int, PLREG_INT_GRP6_FLAG, &val); + + if (val) { + for_each_set_bit(i, (unsigned long *)&val, 3) { + girq = irq_find_mapping(drvdata->chip.irq.domain, + i + PLREG_INT_GRP6_PIN_BASE); + generic_handle_irq(girq); + } + + /* Clear latched interrupt */ + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP6_FLAG, + 0xFF, 0xFF); + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP6_BASE, + BIT(2), 0); + } + + return IRQ_HANDLED; +} + +static struct irq_chip gxp_gpio_irqchip = { + .name = "gxp_fn2", + .irq_ack = gxp_gpio_fn2_irq_ack, + .irq_mask = gxp_gpio_fn2_irq_mask, + .irq_unmask = gxp_gpio_fn2_irq_unmask, + .irq_set_type = gxp_gpio_fn2_set_type, +}; + +static struct gpio_chip common_chip = { + .label = "gxp_gpio", + .owner = THIS_MODULE, + .get = gxp_gpio_get, + .set = gxp_gpio_set, + .get_direction = gxp_gpio_get_direction, + .direction_input = gxp_gpio_direction_input, + .direction_output = gxp_gpio_direction_output, + .base = 0, +}; + +static struct gpio_chip plreg_chip = { + .label = "gxp_gpio_plreg", + .owner = THIS_MODULE, + .get = gxp_gpio_pl_get, + .set = gxp_gpio_pl_set, + .get_direction = gxp_gpio_pl_get_direction, + .direction_input = gxp_gpio_pl_direction_input, + .direction_output = gxp_gpio_pl_direction_output, + .base = -1, +}; + +static struct irq_chip gxp_plreg_irqchip = { + .name = "gxp_plreg", + .irq_ack = gxp_gpio_pl_irq_ack, + .irq_mask = gxp_gpio_pl_irq_mask, + .irq_unmask = gxp_gpio_pl_irq_unmask, + .irq_set_type = gxp_gpio_pl_set_type, +}; + +static int gxp_gpio_init(struct platform_device *pdev) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(&pdev->dev); + struct gpio_irq_chip *girq; + int ret; + + drvdata->csm_map = gxp_gpio_init_regmap(pdev, "csm", 32); + if (IS_ERR(drvdata->csm_map)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->csm_map), + "failed to map csm_handle\n"); + + drvdata->fn2_vbtn = devm_platform_ioremap_resource_byname(pdev, "fn2-vbtn"); + if (IS_ERR(drvdata->fn2_vbtn)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->fn2_vbtn), + "failed to map fn2_vbtn\n"); + + drvdata->fn2_stat = gxp_gpio_init_regmap(pdev, "fn2-stat", 32); + if (IS_ERR(drvdata->fn2_stat)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->fn2_stat), + "failed to map fn2_stat\n"); + + drvdata->vuhc0_map = gxp_gpio_init_regmap(pdev, "vuhc", 32); + if (IS_ERR(drvdata->vuhc0_map)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->vuhc0_map), + "failed to map vuhc0_map\n"); + + drvdata->vbtn = devm_platform_ioremap_resource_byname(pdev, "vbtn"); + if (IS_ERR(drvdata->vbtn)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->vbtn), + "failed to map vbtn\n"); + girq = &drvdata->chip.irq; + girq->chip = &gxp_gpio_irqchip; + girq->parent_handler = NULL; + girq->num_parents = 0; + girq->parents = NULL; + girq->default_type = IRQ_TYPE_NONE; + girq->handler = handle_edge_irq; + + ret = platform_get_irq(pdev, 0); + if (ret < 0) { + dev_err(&pdev->dev, "Get irq from platform fail - %d\n", ret); + return ret; + } + drvdata->irq = ret; + + ret = devm_request_irq(&pdev->dev, drvdata->irq, gxp_gpio_fn2_irq_handle, + IRQF_SHARED, "gxp-fn2", drvdata); + if (ret < 0) { + dev_err(&pdev->dev, "IRQ handler failed - %d\n", ret); + return ret; + } + drvdata->chip = common_chip; + drvdata->chip.ngpio = 300; + + drvdata->chip.parent = &pdev->dev; + ret = devm_gpiochip_add_data(&pdev->dev, &drvdata->chip, NULL); + if (ret < 0) + dev_err(&pdev->dev, + "Could not register gpiochip for fn2, %d\n", ret); + dev_info(&pdev->dev, "HPE GXP FN2 driver loaded.\n"); + + return 0; +} + +static int gxp_gpio_pl_init(struct platform_device *pdev) +{ + struct gxp_gpio_drvdata *drvdata = dev_get_drvdata(&pdev->dev); + struct gpio_irq_chip *girq; + int ret; + unsigned int val; + + drvdata->pl_led = gxp_gpio_init_regmap(pdev, "pl-led", 8); + if (IS_ERR(drvdata->pl_led)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pl_int), + "failed to map pl_led\n"); + + drvdata->pl_health = gxp_gpio_init_regmap(pdev, "pl-health", 8); + if (IS_ERR(drvdata->pl_health)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pl_int), + "failed to map pl_health\n"); + + drvdata->pl_int = gxp_gpio_init_regmap(pdev, "pl-int", 8); + if (IS_ERR(drvdata->pl_int)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pl_int), + "failed to map pl_int\n"); + + drvdata->chip = plreg_chip; + drvdata->chip.ngpio = 100; + drvdata->chip.parent = &pdev->dev; + + girq = &drvdata->chip.irq; + girq->chip = &gxp_plreg_irqchip; + girq->parent_handler = NULL; + girq->num_parents = 0; + girq->parents = NULL; + girq->default_type = IRQ_TYPE_NONE; + girq->handler = handle_edge_irq; + + girq->init_hw = gxp_gpio_irq_init_hw; + + ret = devm_gpiochip_add_data(&pdev->dev, &drvdata->chip, drvdata); + if (ret < 0) + dev_err(&pdev->dev, "Could not register gpiochip for plreg, %d\n", + ret); + + regmap_update_bits(drvdata->pl_int, PLREG_INT_HI_PRI_EN, + BIT(4) | BIT(5), BIT(4) | BIT(5)); + regmap_update_bits(drvdata->pl_int, PLREG_INT_GRP_STAT_MASK, + BIT(4) | BIT(5), 0x00); + regmap_read(drvdata->pl_int, PLREG_INT_HI_PRI_EN, &val); + regmap_read(drvdata->pl_int, PLREG_INT_GRP_STAT_MASK, &val); + + ret = platform_get_irq(pdev, 0); + if (ret < 0) { + dev_err(&pdev->dev, "Get irq from platform fail - %d\n", ret); + return ret; + } + + drvdata->irq = ret; + + ret = devm_request_irq(&pdev->dev, drvdata->irq, gxp_gpio_pl_irq_handle, + IRQF_SHARED, "gxp-pl", drvdata); + if (ret < 0) { + dev_err(&pdev->dev, "IRQ handler failed - %d\n", ret); + return ret; + } + + return 0; +} + +static const struct of_device_id gxp_gpio_of_match[] = { + { .compatible = "hpe,gxp-gpio"}, + { .compatible = "hpe,gxp-gpio-pl"}, + {} +}; +MODULE_DEVICE_TABLE(of, gxp_gpio_of_match); + +static int gxp_gpio_probe(struct platform_device *pdev) +{ + int ret; + struct gxp_gpio_drvdata *drvdata; + struct device *dev = &pdev->dev; + struct device *parent; + const struct of_device_id *match = of_match_device(gxp_gpio_of_match, dev); + + if (!match) { + dev_err(dev, "device is not compatible"); + return -EINVAL; + } + + parent = dev->parent; + if (!parent) { + dev_err(dev, "no parent\n"); + return -ENODEV; + } + + drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gxp_gpio_drvdata), + GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + platform_set_drvdata(pdev, drvdata); + + if (strcmp(match->compatible, "hpe,gxp-gpio-pl") == 0) + ret = gxp_gpio_pl_init(pdev); + else + ret = gxp_gpio_init(pdev); + + return ret; +} + +static struct platform_driver gxp_gpio_driver = { + .driver = { + .name = "gxp-gpio", + .of_match_table = gxp_gpio_of_match, + }, + .probe = gxp_gpio_probe, +}; +module_platform_driver(gxp_gpio_driver); + +MODULE_AUTHOR("Nick Hawkins "); +MODULE_DESCRIPTION("GPIO interface for GXP"); +MODULE_LICENSE("GPL"); From patchwork Tue Apr 18 15:28:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawkins, Nick" X-Patchwork-Id: 13215853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF2A2C7EE20 for ; Tue, 18 Apr 2023 15:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r6nrEv6AUj2kB1JDNHgl02dcyLxxO/a6N7eVci+RuTc=; b=SrOixh5cjLQvMT nqjyxfm2UEL4DXOnMjdD/dgTdzQjfHcVIbLoLo3/TOkYTk+/n6TSqVck5NovZiBabXJb2cdBL+wVm vEoRrxfQRKUz0HsOq9H4A1U0aP+Z/ghu09HA/rZehBk/JvLIsWZH2/wwdsgmgHsbejfY3OxJeJfBr W4kL8mei9Op+KcUDSptF/ql/FdAlH9MpFJ0hxRBYimLG8vKmi5/TH7E5qLxID1B0zrpdOtb2JE1Yg O64hM5WrmvKdONlXM8yMwW1n4LVJo5HIcVsOvLR9jxA2QMQ8YF4BfNC/3kekaoXUjFjY29EcJyFet yKHelXg1NieE24RbVMuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponJW-002c04-2G; Tue, 18 Apr 2023 15:32:14 +0000 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponJH-002bpz-1R for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:32:02 +0000 Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33I9lVw7007157; Tue, 18 Apr 2023 15:31:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references; s=pps0720; bh=oObhR1AgXUg5CibVcUv6pkBoGTuDIv3heB6+ATUoSok=; b=j5+Ofor6tF3/RSrW/I7K7BkrWrzpAa7EPfxd1Fjw7Mloyp+eM0IBa9ISS+ZnXCS9YASA M8Y0hlMAn/AeMD39Vj7H00vKhUC03cgelTuyXlVrHq26ZvWkxBI4UTq7nyZVufFIBd0Y 7bPisyU4idRWii8DrdE3CpGeLRUT7BkMHN3eC79oAgDzGfsCuQ80k2xtRqXl+BAYttY5 X+QdItKpaoYshd559pZYrfpVzWpfFv1xhef2bibwUswEN/aLvnPfeC73oGA2CuUfcxRX OCu3TleOr6N0OgipN0blYzJfz+WtO8GjH8eYcr1RYtojAMITBUVV2J/mHyrFBqlPM9gN 5A== Received: from p1lg14880.it.hpe.com (p1lg14880.it.hpe.com [16.230.97.201]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3q1ca1045j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 15:31:37 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14880.it.hpe.com (Postfix) with ESMTPS id 7B6DC800217; Tue, 18 Apr 2023 15:31:36 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id CAE0B816D3A; Tue, 18 Apr 2023 15:31:35 +0000 (UTC) From: nick.hawkins@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jdelvare@suse.com, linux@roeck-us.net, linux@armlinux.org.uk, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 2/9] hwmon: (gxp_fan_ctrl) Give GPIO access to fan data Date: Tue, 18 Apr 2023 10:28:17 -0500 Message-Id: <20230418152824.110823-3-nick.hawkins@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418152824.110823-1-nick.hawkins@hpe.com> References: <20230418152824.110823-1-nick.hawkins@hpe.com> X-Proofpoint-GUID: IymkpW-Evmgrn-rdu4CClDYAe9CzoyTs X-Proofpoint-ORIG-GUID: IymkpW-Evmgrn-rdu4CClDYAe9CzoyTs X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 impostorscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 clxscore=1015 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180132 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_083159_784650_EC177FAB X-CRM114-Status: GOOD ( 24.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Hawkins The fan driver has access to the IO that reports fan presence. Add the ability for other drivers such as GPIO to call in to get fan information. Also remove the system power check as the GPIO driver needs it to report power state. Signed-off-by: Nick Hawkins --- drivers/hwmon/gxp-fan-ctrl.c | 58 +++++++++++++++--------------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/drivers/hwmon/gxp-fan-ctrl.c b/drivers/hwmon/gxp-fan-ctrl.c index 0014b8b0fd41..a8fcea98cc55 100644 --- a/drivers/hwmon/gxp-fan-ctrl.c +++ b/drivers/hwmon/gxp-fan-ctrl.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (C) 2022 Hewlett-Packard Enterprise Development Company, L.P. */ +/* Copyright (C) 2023 Hewlett-Packard Enterprise Development Company, L.P. */ #include #include @@ -11,15 +11,14 @@ #define OFS_FAN_INST 0 /* Is 0 because plreg base will be set at INST */ #define OFS_FAN_FAIL 2 /* Is 2 bytes after base */ -#define OFS_SEVSTAT 0 /* Is 0 because fn2 base will be set at SEVSTAT */ -#define POWER_BIT 24 struct gxp_fan_ctrl_drvdata { void __iomem *base; void __iomem *plreg; - void __iomem *fn2; }; +struct gxp_fan_ctrl_drvdata *drvdata; + static bool fan_installed(struct device *dev, int fan) { struct gxp_fan_ctrl_drvdata *drvdata = dev_get_drvdata(dev); @@ -30,6 +29,16 @@ static bool fan_installed(struct device *dev, int fan) return !!(val & BIT(fan)); } +u8 get_fans_installed(void) +{ + static u8 val; + + val = readb(drvdata->plreg + OFS_FAN_INST); + + return val; +} +EXPORT_SYMBOL(get_fans_installed); + static long fan_failed(struct device *dev, int fan) { struct gxp_fan_ctrl_drvdata *drvdata = dev_get_drvdata(dev); @@ -40,19 +49,19 @@ static long fan_failed(struct device *dev, int fan) return !!(val & BIT(fan)); } -static long fan_enabled(struct device *dev, int fan) +u8 get_fans_failed(void) { - struct gxp_fan_ctrl_drvdata *drvdata = dev_get_drvdata(dev); - u32 val; + static u8 val; - /* - * Check the power status as if the platform is off the value - * reported for the PWM will be incorrect. Report fan as - * disabled. - */ - val = readl(drvdata->fn2 + OFS_SEVSTAT); + val = readb(drvdata->plreg + OFS_FAN_FAIL); + + return val; +} +EXPORT_SYMBOL(get_fans_failed); - return !!((val & BIT(POWER_BIT)) && fan_installed(dev, fan)); +static long fan_enabled(struct device *dev, int fan) +{ + return !!(fan_installed(dev, fan)); } static int gxp_pwm_write(struct device *dev, u32 attr, int channel, long val) @@ -98,20 +107,8 @@ static int gxp_fan_read(struct device *dev, u32 attr, int channel, long *val) static int gxp_pwm_read(struct device *dev, u32 attr, int channel, long *val) { struct gxp_fan_ctrl_drvdata *drvdata = dev_get_drvdata(dev); - u32 reg; - - /* - * Check the power status of the platform. If the platform is off - * the value reported for the PWM will be incorrect. In this case - * report a PWM of zero. - */ - reg = readl(drvdata->fn2 + OFS_SEVSTAT); - - if (reg & BIT(POWER_BIT)) - *val = fan_installed(dev, channel) ? readb(drvdata->base + channel) : 0; - else - *val = 0; + *val = fan_installed(dev, channel) ? readb(drvdata->base + channel) : 0; return 0; } @@ -198,7 +195,6 @@ static const struct hwmon_chip_info gxp_fan_ctrl_chip_info = { static int gxp_fan_ctrl_probe(struct platform_device *pdev) { - struct gxp_fan_ctrl_drvdata *drvdata; struct device *dev = &pdev->dev; struct device *hwmon_dev; @@ -218,12 +214,6 @@ static int gxp_fan_ctrl_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(drvdata->plreg), "failed to map plreg\n"); - drvdata->fn2 = devm_platform_ioremap_resource_byname(pdev, - "fn2"); - if (IS_ERR(drvdata->fn2)) - return dev_err_probe(dev, PTR_ERR(drvdata->fn2), - "failed to map fn2\n"); - hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, "hpe_gxp_fan_ctrl", drvdata, From patchwork Tue Apr 18 15:28:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawkins, Nick" X-Patchwork-Id: 13215855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE0B6C77B75 for ; Tue, 18 Apr 2023 15:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Mhys8ujMT600oBJBH4YumcdJCImA8RjsHvQqqp2cntc=; b=k92GIaF9O3Pd0Y UR2UrGTvGdGwcHHO6PF0r2Hhx21wzZ9es7f1s0nHKd4WpNnyDlpVVZPfdLFhy7m8k8Sk24pn+qaDP 0X4q/pg259byAM+6Lw1UrC/shAhKFUpxLy6Isj2f/v9QhfIdCfX/m34tXF2D3TYi2ArTg9URg4ZHG R5YaiFVzb44IhTARWSF/r6gUq339G7Rhve0a81pV4r79mfwZY3dXVxbI6bqgQLsrMItH3LAnYfZvU Qxx9bpYy6XfKemou/DluaQuLTSrVyO7M+fV/+yAkNsSo2LnDird9hEfRwVZmSKdu542lDlz4Y5He2 jqOkyLOe6Nk8QRNMUAZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponJe-002c5s-0x; Tue, 18 Apr 2023 15:32:22 +0000 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponJH-002bqg-1b for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:32:05 +0000 Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33IEutOL000767; Tue, 18 Apr 2023 15:31:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references; s=pps0720; bh=Gkats5dbf8WnZT7mgL+e/Kl1YGcTI9hrVc/iSuuyick=; b=VdC1e+3co4/H4atM6L5OK8B5z/ab0tCVn2gpy/jHNe/7BsHRIPBCZSxrbeFrIYoQVf+Y 1Q5ZVRp1LfWDm9NXI+pTBa+l6PCsK5iqBzA0vvjDHmLcjWySmPqQuUaZ/XV9E2V9W04X FKHQXJAKFn+P7TVYcy88C7MhMoodUr+G5cRJAqeq4qr5xu161Argsv2wc/GU1P3ikgK4 fxijPccXLiStcsBEh853kLlL6f/Pr6DS6kcA93Jluw92jPMOfR903mDQFWfClkwGw/G7 Gzv2e/oacO7F5ov32eYztKnEAMCHzhP/qQ2TMiYf/uZJCVt6cgaRCJ4r2+K0tQMWsnrU fQ== Received: from p1lg14881.it.hpe.com (p1lg14881.it.hpe.com [16.230.97.202]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3q1wdw0b8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 15:31:37 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14881.it.hpe.com (Postfix) with ESMTPS id 2FD4E806B40; Tue, 18 Apr 2023 15:31:37 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id 7671781532D; Tue, 18 Apr 2023 15:31:36 +0000 (UTC) From: nick.hawkins@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jdelvare@suse.com, linux@roeck-us.net, linux@armlinux.org.uk, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 3/9] hwmon: (gxp-psu) Add driver to read HPE PSUs Date: Tue, 18 Apr 2023 10:28:18 -0500 Message-Id: <20230418152824.110823-4-nick.hawkins@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418152824.110823-1-nick.hawkins@hpe.com> References: <20230418152824.110823-1-nick.hawkins@hpe.com> X-Proofpoint-ORIG-GUID: Fn671cNE7gO5dLU5ieyZxcCyaATF0vl- X-Proofpoint-GUID: Fn671cNE7gO5dLU5ieyZxcCyaATF0vl- X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180132 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_083159_784189_CAA359A1 X-CRM114-Status: GOOD ( 28.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Hawkins The GXP SoC can support up to 8 power supplies that it can communicate with via i2c. The GXP PSU driver will provide a method for the GPIO driver with info it reads to be available to the host. Signed-off-by: Nick Hawkins --- drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/gxp-psu.c | 773 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 784 insertions(+) create mode 100644 drivers/hwmon/gxp-psu.c diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 5b3b76477b0e..3b56690ea089 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -723,6 +723,16 @@ config SENSORS_GXP_FAN_CTRL The GXP controls fan function via the CPLD through the use of PWM registers. This driver reports status and pwm setting of the fans. +config SENSORS_GXP_PSU + tristate "HPE GXP PSU driver" + depends on ARCH_HPE_GXP || COMPILE_TEST + depends on I2C + help + If you say yes you will get support for GXP psu driver support. The GXP + gets PSU presence and state information from the CPLD. The GXP gets PSU + data via i2c. It provides a method for other drivers to call into get + PSU presence information. + config SENSORS_HIH6130 tristate "Honeywell Humidicon HIH-6130 humidity/temperature sensor" depends on I2C diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 88712b5031c8..6c84cd52d0d3 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -84,6 +84,7 @@ obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o obj-$(CONFIG_SENSORS_GSC) += gsc-hwmon.o obj-$(CONFIG_SENSORS_GPIO_FAN) += gpio-fan.o obj-$(CONFIG_SENSORS_GXP_FAN_CTRL) += gxp-fan-ctrl.o +obj-$(CONFIG_SENSORS_GXP_PSU) += gxp-psu.o obj-$(CONFIG_SENSORS_HIH6130) += hih6130.o obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o obj-$(CONFIG_SENSORS_I5500) += i5500_temp.o diff --git a/drivers/hwmon/gxp-psu.c b/drivers/hwmon/gxp-psu.c new file mode 100644 index 000000000000..e4217200c34b --- /dev/null +++ b/drivers/hwmon/gxp-psu.c @@ -0,0 +1,773 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright (C) 2023 Hewlett-Packard Enterpise Development Company, L.P. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define READ_REG_CMD 0x00 +#define READ_FRU_CMD 0x22 +#define REG_IN_VOL 0x10 +#define REG_IN_CUR 0x11 +#define REG_IN_PWR 0x12 +#define REG_OUT_VOL 0x20 +#define REG_OUT_CUR 0x21 +#define REG_OUT_PWR 0x22 +#define REG_FAN_SPEED 0x40 +#define REG_INLET_TEMP 0x42 +#define MAX_PSU 0x08 +#define INPUT_CHAN 0 + +#define L_IN_POWER "pin1" +#define L_OUT_POWER "pout1" +#define L_IN_IN "vin" +#define L_OUT_IN "vout1" +#define L_FAN "fan1" +#define L_IN_CURR "iin" +#define L_OUT_CURR "iout1" +#define L_TEMP "temp1" + +static void __iomem *pl_psu; + +struct gxp_psu_drvdata { + struct i2c_client *client; + u16 input_power; + u16 input_voltage; + u16 input_current; + u16 output_power; + u16 output_voltage; + u16 output_current; + s16 inlet_temp; + u16 fan_speed; + u8 id; + struct dentry *debugfs; + u8 spare_part[10]; + u8 product_name[26]; + u8 serial_number[14]; + u8 product_manufacturer[3]; + bool present; /* psu can be physically removed */ + struct mutex update_lock; + struct device *hwmon_dev; +}; + +static u8 psucount; +struct gxp_psu_drvdata *psus[MAX_PSU] = { NULL }; + +u8 get_psu_inst(void) +{ + if (!pl_psu) + return 0; + + return readb(pl_psu); +} +EXPORT_SYMBOL(get_psu_inst); + +u8 get_psu_ac(void) +{ + if (!pl_psu) + return 0; + + return readb(pl_psu + 0x02); +} +EXPORT_SYMBOL(get_psu_ac); + +u8 get_psu_dc(void) +{ + if (!pl_psu) + return 0; + + return readb(pl_psu + 0x03); +} +EXPORT_SYMBOL(get_psu_dc); + +void update_presence(u8 id) +{ + unsigned int i; + unsigned long temp = (unsigned long)readb(pl_psu); + + for_each_set_bit(i, &temp, 8) { + if (i == id) + psus[id]->present = true; + } + + temp = ~temp; + for_each_set_bit(i, &temp, 8) { + if (i == id) + psus[id]->present = false; + } +} + +static unsigned char cal_checksum(unsigned char *buf, unsigned long size) +{ + unsigned char sum = 0; + + while (size > 0) { + sum += (*(buf++)); + size--; + } + return ((~sum) + 1); +} + +static unsigned char valid_checksum(unsigned char *buf, unsigned long size) +{ + unsigned char sum = 0; + + while (size > 0) { + sum += (*(buf++)); + size--; + } + return sum; +} + +static int psu_read_fru(struct gxp_psu_drvdata *drvdata, + u8 offset, u8 length, u8 *value) +{ + struct i2c_client *client = drvdata->client; + unsigned char buf_tx[4] = {(client->addr << 1), READ_FRU_CMD, offset, length}; + unsigned char tx[4] = {0}; + unsigned char chksum = cal_checksum(buf_tx, 4); + int ret = 0; + struct i2c_msg msgs[2] = {0}; + + update_presence(drvdata->id); + + value[0] = '\0'; + + if (!drvdata->present) + return -EOPNOTSUPP; + + tx[0] = READ_FRU_CMD; + tx[1] = offset; + tx[2] = length; + tx[3] = chksum; + msgs[0].addr = client->addr; + msgs[0].flags = 0; + msgs[0].buf = tx; + msgs[0].len = 4; + msgs[1].addr = client->addr; + msgs[1].flags = I2C_M_RD; + msgs[1].buf = value; + msgs[1].len = length; + + mutex_lock(&drvdata->update_lock); + ret = i2c_transfer(client->adapter, msgs, 2); + mutex_unlock(&drvdata->update_lock); + if (ret < 0) { + dev_err(&client->dev, + "gxppsu_i2c_tx_fail addr:0x%x offest:0x%x length:0x%x chk:0x%x ret:0x%x\n", + client->addr, offset, length, chksum, ret); + return ret; + } + + return ret; +} + +static int psu_read_reg_word(struct gxp_psu_drvdata *drvdata, + u8 reg, u16 *value) +{ + struct i2c_client *client = drvdata->client; + unsigned char buf_tx[3] = {(client->addr << 1), READ_REG_CMD, reg}; + unsigned char buf_rx[3] = {0}; + unsigned char tx[3] = {0}; + unsigned char rx[3] = {0}; + unsigned char chksum = cal_checksum(buf_tx, 3); + struct i2c_msg msgs[2] = {0}; + int ret = 0; + + tx[0] = 0; + tx[1] = reg; + tx[2] = chksum; + + msgs[0].addr = client->addr; + msgs[0].flags = 0; + msgs[0].buf = tx; + msgs[0].len = 3; + msgs[1].addr = client->addr; + msgs[1].flags = I2C_M_RD; + msgs[1].buf = rx; + msgs[1].len = 3; + mutex_lock(&drvdata->update_lock); + ret = i2c_transfer(client->adapter, msgs, 2); + mutex_unlock(&drvdata->update_lock); + if (ret < 0) { + dev_err(&client->dev, + "gxppsu_i2c_tx_fail addr:0x%x reg:0x%x chk:0x%x ret:0x%x\n", + client->addr, reg, chksum, ret); + return ret; + } + + buf_rx[0] = rx[0]; + buf_rx[1] = rx[1]; + buf_rx[2] = rx[2]; + if (valid_checksum(buf_rx, 3) != 0) { + dev_err(&client->dev, + "gxppsu_checksum_fail addr:0x%x reg:0x%x, data:%x %x %x\n", + client->addr, reg, rx[0], rx[1], rx[2]); + return -EAGAIN; + } + + *value = rx[0] + (rx[1] << 8); + + return ret; +} + +static int gxppsu_update_client(struct device *dev, u8 reg) +{ + struct gxp_psu_drvdata *drvdata = dev_get_drvdata(dev); + int ret = 0; + + update_presence(drvdata->id); + + if (!drvdata->present) + return -EOPNOTSUPP; + + switch (reg) { + case REG_IN_PWR: + ret = psu_read_reg_word(drvdata, REG_IN_PWR, + &drvdata->input_power); + break; + case REG_IN_VOL: + ret = psu_read_reg_word(drvdata, REG_IN_VOL, + &drvdata->input_voltage); + break; + case REG_IN_CUR: + ret = psu_read_reg_word(drvdata, REG_IN_CUR, + &drvdata->input_current); + break; + case REG_OUT_PWR: + ret = psu_read_reg_word(drvdata, REG_OUT_PWR, + &drvdata->output_power); + break; + case REG_OUT_VOL: + ret = psu_read_reg_word(drvdata, REG_OUT_VOL, + &drvdata->output_voltage); + break; + case REG_OUT_CUR: + ret = psu_read_reg_word(drvdata, REG_OUT_CUR, + &drvdata->output_current); + break; + case REG_INLET_TEMP: + ret = psu_read_reg_word(drvdata, REG_INLET_TEMP, + &drvdata->inlet_temp); + break; + case REG_FAN_SPEED: + ret = psu_read_reg_word(drvdata, REG_FAN_SPEED, + &drvdata->fan_speed); + break; + default: + dev_err(&drvdata->client->dev, "gxppsu_error_reg 0x%x\n", reg); + return -EOPNOTSUPP; + } + + return ret; +} + +static int gxp_psu_get_power_input(struct device *dev, u32 attr, int channel, + long *val) +{ + struct gxp_psu_drvdata *drvdata = dev_get_drvdata(dev); + int ret = 0; + u8 reg; + + if (channel == INPUT_CHAN) + reg = REG_IN_PWR; + else + reg = REG_OUT_PWR; + + ret = gxppsu_update_client(dev, reg); + if (ret < 0) + return ret; + + if (channel == INPUT_CHAN) + *val = drvdata->input_power; + else + *val = drvdata->output_power; + + return 0; +} + +static int gxp_psu_get_in_input(struct device *dev, u32 attr, int channel, + long *val) +{ + struct gxp_psu_drvdata *drvdata = dev_get_drvdata(dev); + int ret = 0; + u8 reg; + + if (channel == INPUT_CHAN) + reg = REG_IN_VOL; + else + reg = REG_OUT_VOL; + + ret = gxppsu_update_client(dev, reg); + if (ret < 0) + return ret; + + if (channel == INPUT_CHAN) + *val = drvdata->input_voltage; + else + *val = drvdata->output_voltage; + + return 0; +} + +static int gxp_psu_get_curr_input(struct device *dev, u32 attr, int channel, + long *val) +{ + struct gxp_psu_drvdata *drvdata = dev_get_drvdata(dev); + int ret = 0; + u8 reg; + + if (channel == INPUT_CHAN) + reg = REG_IN_CUR; + else + reg = REG_OUT_CUR; + + ret = gxppsu_update_client(dev, reg); + + if (ret < 0) + return ret; + + if (channel == INPUT_CHAN) + *val = drvdata->input_current; + else + *val = drvdata->output_current; + + return 0; +} + +static int gxp_psu_get_temp_input(struct device *dev, u32 attr, int channel, + long *val) +{ + struct gxp_psu_drvdata *drvdata = dev_get_drvdata(dev); + int ret = 0; + u8 reg = REG_INLET_TEMP; + + ret = gxppsu_update_client(dev, reg); + if (ret < 0) + return ret; + + *val = drvdata->inlet_temp; + + return 0; +}; + +static int gxp_psu_get_fan_input(struct device *dev, u32 attr, int channel, + long *val) +{ + struct gxp_psu_drvdata *drvdata = dev_get_drvdata(dev); + int ret = 0; + u8 reg = REG_FAN_SPEED; + + ret = gxppsu_update_client(dev, reg); + if (ret < 0) + return ret; + + *val = drvdata->fan_speed; + + return 0; +} + +void swapbytes(void *input, size_t len) +{ + unsigned int i; + unsigned char *in = (unsigned char *)input, tmp; + + for (i = 0; i < len / 2; i++) { + tmp = *(in + i); + *(in + i) = *(in + len - i - 1); + *(in + len - i - 1) = tmp; + } +} + +static const struct hwmon_channel_info *gxp_psu_info[] = { + HWMON_CHANNEL_INFO(power, + HWMON_P_INPUT | HWMON_P_LABEL, + HWMON_P_INPUT | HWMON_P_LABEL), + HWMON_CHANNEL_INFO(in, + HWMON_I_INPUT | HWMON_I_LABEL, + HWMON_I_INPUT | HWMON_I_LABEL), + HWMON_CHANNEL_INFO(fan, + HWMON_F_INPUT | HWMON_F_LABEL), + HWMON_CHANNEL_INFO(curr, + HWMON_C_INPUT | HWMON_C_LABEL, + HWMON_C_INPUT | HWMON_C_LABEL), + HWMON_CHANNEL_INFO(temp, + HWMON_T_INPUT | HWMON_T_LABEL), + NULL +}; + +static umode_t gxp_psu_is_visible(const void *_data, enum hwmon_sensor_types type, + u32 attr, int channel) +{ + umode_t mode = 0; + + switch (type) { + case hwmon_power: + switch (attr) { + case hwmon_power_input: + case hwmon_power_label: + mode = 0444; + break; + default: + break; + } + break; + case hwmon_in: + switch (attr) { + case hwmon_in_input: + case hwmon_in_label: + mode = 0444; + break; + default: + break; + } + break; + case hwmon_fan: + switch (attr) { + case hwmon_fan_input: + case hwmon_fan_label: + mode = 0444; + break; + default: + break; + } + break; + case hwmon_curr: + switch (attr) { + case hwmon_curr_input: + case hwmon_curr_label: + mode = 0444; + break; + default: + break; + } + break; + case hwmon_temp: + switch (attr) { + case hwmon_temp_input: + case hwmon_temp_label: + mode = 0444; + break; + default: + break; + } + break; + default: + break; + } + + return mode; +} + +static int gxp_psu_read(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long *val) +{ + switch (type) { + case hwmon_power: + switch (attr) { + case hwmon_power_input: + return gxp_psu_get_power_input(dev, attr, channel, + val); + default: + break; + } + break; + case hwmon_in: + switch (attr) { + case hwmon_in_input: + return gxp_psu_get_in_input(dev, attr, channel, + val); + default: + break; + } + break; + case hwmon_fan: + switch (attr) { + case hwmon_fan_input: + return gxp_psu_get_fan_input(dev, attr, channel, + val); + default: + break; + } + break; + case hwmon_curr: + switch (attr) { + case hwmon_curr_input: + return gxp_psu_get_curr_input(dev, attr, channel, + val); + default: + break; + } + break; + case hwmon_temp: + switch (attr) { + case hwmon_temp_input: + return gxp_psu_get_temp_input(dev, attr, channel, + val); + default: + break; + } + break; + default: + break; + } + return -EOPNOTSUPP; +} + +static int gxp_psu_read_string(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, const char **str) +{ + switch (type) { + case hwmon_power: + switch (attr) { + case hwmon_power_label: + *str = channel ? L_OUT_POWER : L_IN_POWER; + return 0; + default: + break; + } + case hwmon_in: + switch (attr) { + case hwmon_in_label: + *str = channel ? L_OUT_IN : L_IN_IN; + return 0; + default: + break; + } + case hwmon_fan: + switch (attr) { + case hwmon_fan_label: + *str = L_FAN; + return 0; + default: + break; + } + case hwmon_curr: + switch (attr) { + case hwmon_curr_label: + *str = channel ? L_OUT_CURR : L_IN_CURR; + return 0; + default: + break; + } + case hwmon_temp: + switch (attr) { + case hwmon_temp_label: + *str = L_TEMP; + return 0; + default: + break; + } + default: + break; + } + return -EOPNOTSUPP; +} + +static const struct hwmon_ops gxp_psu_ops = { + .is_visible = gxp_psu_is_visible, + .read = gxp_psu_read, + .read_string = gxp_psu_read_string, +}; + +static const struct hwmon_chip_info gxp_psu_chip_info = { + .ops = &gxp_psu_ops, + .info = gxp_psu_info, +}; + +#ifdef CONFIG_DEBUG_FS + +static int serial_number_show(struct seq_file *seqf, void *unused) +{ + struct gxp_psu_drvdata *drvdata = seqf->private; + int ret = 0; + + ret = psu_read_fru(drvdata, 91, 14, &drvdata->serial_number[0]); + if (ret < 0) { + dev_err(&drvdata->client->dev, "Unknown product serial number %d", ret); + seq_puts(seqf, "unknown\n"); + return 0; + } + + seq_printf(seqf, "%s\n", drvdata->serial_number); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(serial_number); + +static int manufacturer_show(struct seq_file *seqf, void *unused) +{ + struct gxp_psu_drvdata *drvdata = seqf->private; + int ret = 0; + + ret = psu_read_fru(drvdata, 197, 3, &drvdata->product_manufacturer[0]); + if (ret < 0) { + dev_err(&drvdata->client->dev, "Unknown product manufacturer %d", ret); + seq_puts(seqf, "unknown\n"); + return 0; + } + + swapbytes(&drvdata->product_manufacturer[0], 3); + seq_printf(seqf, "%s\n", drvdata->product_manufacturer); + return 0; +} +DEFINE_SHOW_ATTRIBUTE(manufacturer); + +static int product_name_show(struct seq_file *seqf, void *unused) +{ + struct gxp_psu_drvdata *drvdata = seqf->private; + int ret = 0; + + ret = psu_read_fru(drvdata, 50, 26, &drvdata->product_name[0]); + if (ret < 0) { + dev_err(&drvdata->client->dev, "Unknown product name %d", ret); + seq_puts(seqf, "unknown\n"); + return 0; + } + + seq_printf(seqf, "%s\n", drvdata->product_name); + return 0; +} +DEFINE_SHOW_ATTRIBUTE(product_name); + +static int spare_show(struct seq_file *seqf, void *unused) +{ + struct gxp_psu_drvdata *drvdata = seqf->private; + int ret = 0; + + ret = psu_read_fru(drvdata, 18, 10, &drvdata->spare_part[0]); + if (ret < 0) { + dev_err(&drvdata->client->dev, "Unknown product spare %d", ret); + seq_puts(seqf, "unknown\n"); + return 0; + } + + seq_printf(seqf, "%s\n", drvdata->spare_part); + return 0; +} +DEFINE_SHOW_ATTRIBUTE(spare); + +static int present_show(struct seq_file *seqf, void *unused) +{ + struct gxp_psu_drvdata *drvdata = seqf->private; + + update_presence(drvdata->id); + + if (drvdata->present) + seq_puts(seqf, "yes\n"); + else + seq_puts(seqf, "no\n"); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(present); + +static void gxp_psu_debugfs_init(struct gxp_psu_drvdata *drvdata) +{ + char name[32]; + + scnprintf(name, sizeof(name), "%s_%s-%d", dev_name(drvdata->hwmon_dev), + drvdata->client->name, drvdata->client->addr); + + drvdata->debugfs = debugfs_create_dir(name, NULL); + + debugfs_create_file("serial_number", 0444, drvdata->debugfs, drvdata, &serial_number_fops); + + debugfs_create_file("manufacturer", 0444, drvdata->debugfs, drvdata, &manufacturer_fops); + + debugfs_create_file("product_name", 0444, drvdata->debugfs, drvdata, &product_name_fops); + + debugfs_create_file("spare", 0444, drvdata->debugfs, drvdata, &spare_fops); + + debugfs_create_file("present", 0444, drvdata->debugfs, drvdata, &present_fops); + + if (!debugfs_initialized()) + dev_err(&drvdata->client->dev, "Debug FS not Init"); +} + +#else + +static void gxp_psu_debugfs_init(struct gxp_psu_drvdata *drvdata) +{ +} + +#endif + +static int gxp_psu_probe(struct i2c_client *client) +{ + struct gxp_psu_drvdata *drvdata; + struct device *hwmon_dev; + struct device_node *np; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL)) + return -EIO; + + drvdata = devm_kzalloc(&client->dev, sizeof(struct gxp_psu_drvdata), + GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + if (!pl_psu) { + np = of_parse_phandle(client->dev.of_node, "hpe,sysreg", 0); + if (!np) + return -ENODEV; + + pl_psu = of_iomap(np, 0); + if (IS_ERR(pl_psu)) + return dev_err_probe(&client->dev, IS_ERR(pl_psu), + "failed to map pl_psu"); + } + + drvdata->client = client; + i2c_set_clientdata(client, drvdata); + + mutex_init(&drvdata->update_lock); + drvdata->hwmon_dev = NULL; + hwmon_dev = devm_hwmon_device_register_with_info(&client->dev, + "hpe_gxp_psu", + drvdata, + &gxp_psu_chip_info, + NULL); + if (IS_ERR(hwmon_dev)) + return PTR_ERR(hwmon_dev); + + drvdata->hwmon_dev = hwmon_dev; + + drvdata->id = psucount; + + psus[psucount] = drvdata; + + update_presence(drvdata->id); + + psucount++; + + gxp_psu_debugfs_init(drvdata); + + return 0; +} + +static const struct of_device_id gxp_psu_of_match[] = { + { .compatible = "hpe,gxp-psu" }, + {}, +}; +MODULE_DEVICE_TABLE(of, gxp_psu_of_match); + +static struct i2c_driver gxp_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "gxp-psu", + .of_match_table = gxp_psu_of_match, + }, + .probe_new = gxp_psu_probe, +}; +module_i2c_driver(gxp_psu_driver); + +MODULE_AUTHOR("Nick Hawkins "); +MODULE_DESCRIPTION("HPE GXP PSU driver"); +MODULE_LICENSE("GPL"); From patchwork Tue Apr 18 15:28:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawkins, Nick" X-Patchwork-Id: 13215848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B7C19C77B78 for ; Tue, 18 Apr 2023 15:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rweDRz83cp/qsohoXC65GsfoLY++OraqUH3Q5tUx8jE=; b=HvFt6aHIFL3pSm ECc1qfjri2O8v9YA+oip5gAwXGpuskO/k0n+Wg9Vm0iAsBm75JgSCfTZyqMWliYijRTvE8BLpRNC7 j1SWzxwjWAHcwSFMjRXXfGP5NHRQ4piymkPIusFhxmCd9nny5gDgxLN4HiMLIMHkjnOrentuJO38Y oaDpq0LdzOjgAH8nCPiq9wKOJNxZZzDA+3/4r/wdm/Kvx2l3wgorXDDIy57nYov2ZH0pW1mfwUt5E TsGVKBQo//YzoAk5ItLlMJ0i1eWy2sPDCbvi2e68SrzOmFowxV36JgCUUeQJMbksTfb+6A56iDl42 4BgB2jYdej2dBq6LGG+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponJM-002buY-0A; Tue, 18 Apr 2023 15:32:04 +0000 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponJH-002bqR-1P for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:32:01 +0000 Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33IBHbbV014211; Tue, 18 Apr 2023 15:31:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references; s=pps0720; bh=+Tejv8VqfudpGt9W4Zi1SowtUWszSWWmt+t1g0HSDDk=; b=HReQMNJZ+tU+u+E3hwXaBLnm32mvTf9rfZ/hcsqq2brr4dreuLJk6WdLKgUKUHq2PJIC InS2vytZ6xJ4yEwbvZFhpc+YbsYnXprsTwo1IuQWtmBEWpmR5LOGzI/Zcv1cIAEuILUZ zVqm1O3bxbT4h8PgRH6hcQv0X/zWdYDOn/iUr9CTpvxUJqYoZZffgB1sODVhTAauGU/N XWlNZ1Q1DPz3EWRyMinmyvStsji66G650NXcAXyHaWfund9N5hgb3czesl8bAKKLRQfw LWLOgHf/ff0tZRDgoKRWNB1t5q4BJbq65R8LUJfBfeCnfVzHR6FZp95rIO3Tr3EfMmg9 Fw== Received: from p1lg14878.it.hpe.com (p1lg14878.it.hpe.com [16.230.97.204]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3q1t6pj41c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 15:31:38 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14878.it.hpe.com (Postfix) with ESMTPS id E06E6132CB; Tue, 18 Apr 2023 15:31:37 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id 2640C8175C0; Tue, 18 Apr 2023 15:31:37 +0000 (UTC) From: nick.hawkins@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jdelvare@suse.com, linux@roeck-us.net, linux@armlinux.org.uk, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 4/9] dt-bindings: hwmon: Modify hpe,gxp-fan-ctrl Date: Tue, 18 Apr 2023 10:28:19 -0500 Message-Id: <20230418152824.110823-5-nick.hawkins@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418152824.110823-1-nick.hawkins@hpe.com> References: <20230418152824.110823-1-nick.hawkins@hpe.com> X-Proofpoint-GUID: jwIB54FRM9lWowhdNps47Qo1GzTVKuRO X-Proofpoint-ORIG-GUID: jwIB54FRM9lWowhdNps47Qo1GzTVKuRO X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180132 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_083159_785181_7094A886 X-CRM114-Status: GOOD ( 13.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Hawkins Remove the fn2 register reference as GPIO will be using it. Signed-off-by: Nick Hawkins --- .../devicetree/bindings/hwmon/hpe,gxp-fan-ctrl.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/hwmon/hpe,gxp-fan-ctrl.yaml b/Documentation/devicetree/bindings/hwmon/hpe,gxp-fan-ctrl.yaml index 4a52aac6be72..ee70f06787f6 100644 --- a/Documentation/devicetree/bindings/hwmon/hpe,gxp-fan-ctrl.yaml +++ b/Documentation/devicetree/bindings/hwmon/hpe,gxp-fan-ctrl.yaml @@ -21,13 +21,11 @@ properties: items: - description: Fan controller PWM - description: Programmable logic - - description: Function 2 reg-names: items: - const: base - const: pl - - const: fn2 required: - compatible @@ -40,6 +38,6 @@ examples: - | fan-controller@1000c00 { compatible = "hpe,gxp-fan-ctrl"; - reg = <0x1000c00 0x200>, <0xd1000000 0xff>, <0x80200000 0x100000>; - reg-names = "base", "pl", "fn2"; + reg = <0x1000c00 0x200>, <0xd1000000 0xff>; + reg-names = "base", "pl"; }; From patchwork Tue Apr 18 15:28:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawkins, Nick" X-Patchwork-Id: 13215854 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41844C6FD18 for ; Tue, 18 Apr 2023 15:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hAVeamSTOwXck9sH6CYLpzY9t/Q8q9z73NkeZqPGou0=; b=D5oQMcH5ueeiq7 q4yqppafNvNqOudMjugMkPBlbZXDuebPm46khb9XDtL2kUgnTmhzpNaWVLogPGfiRsVhB9/B3nQJ+ XKXleNoTswLj4hG0jbTLEi70cJANJcrUf7V3Apua9aDIC0Bi3TmaGPdZQvCyolfk3kmEEZj6+E1zr NloxX3fOQ8sD0N34h7q9zKa63CXFMSFUTEJLS3UHQkZ7Gao3OmDTEJFB4TE0ns7HIHwsVl5g/NVdb cNKhTuziK3WKgQ2YygQzUxgAH9+heubSAgVVuRKRvL8VSv+G6YeJhJp65bQdAQkOaVD02qpVp0QUi xptxur0T8JofgVS4RpSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponJb-002c3Q-1S; Tue, 18 Apr 2023 15:32:19 +0000 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponJI-002bqQ-0G for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:32:04 +0000 Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33I7rAQr028406; Tue, 18 Apr 2023 15:31:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version; s=pps0720; bh=BLhWr7KA05LWTtyvACxcjFLqx/2vJ08FWT4M67w7BaQ=; b=VSMs/Kb6RtsDSJfpluG2R5QhgjO3aonnYWhkBvQgH2VT4qOhRVcxkppVjnfz0sXNpXVs jNdyQnDIcpe6GciiTNpsC/p/kJffO2fV5v5oDg7oV6ueJsQWgL3Pod+74vhXzlKYLZC4 rV2qBCpHxZF+ZsKrFghfvmIT4MHjRRapI3+8k0DIEdgoRaVkf4VRx7UYBtsd3jSMGxOs sZTQVZHiQhzw2nZ457K15IRJ2WxKCgDHEXGdwyyOuUvqs99SEDMrzI+a4o2V4gRFVNy5 h5x3JZPCb6eDPES9oRJCCL+3zP8Jj0bMPqrge7awdAUqypPbQChKCfA68148HLZKoEDx SQ== Received: from p1lg14881.it.hpe.com (p1lg14881.it.hpe.com [16.230.97.202]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3q1ca1045s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 15:31:39 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14881.it.hpe.com (Postfix) with ESMTPS id 80D9F805E92; Tue, 18 Apr 2023 15:31:38 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id D6D7481733A; Tue, 18 Apr 2023 15:31:37 +0000 (UTC) From: nick.hawkins@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jdelvare@suse.com, linux@roeck-us.net, linux@armlinux.org.uk, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 5/9] dt-bindings: gpio: Add HPE GXP GPIO Date: Tue, 18 Apr 2023 10:28:20 -0500 Message-Id: <20230418152824.110823-6-nick.hawkins@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418152824.110823-1-nick.hawkins@hpe.com> References: <20230418152824.110823-1-nick.hawkins@hpe.com> X-Proofpoint-GUID: gwlaID5TfhXmNWG6DHkXrFURaNaViBqw X-Proofpoint-ORIG-GUID: gwlaID5TfhXmNWG6DHkXrFURaNaViBqw X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 impostorscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 clxscore=1015 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180132 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_083200_139331_A72CAB7C X-CRM114-Status: GOOD ( 17.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Hawkins Provide access to the registers and interrupts for GPIO. The GPIO will have two driver instances: One for host, the other for CPLD. Signed-off-by: Nick Hawkins --- .../bindings/gpio/hpe,gxp-gpio.yaml | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/hpe,gxp-gpio.yaml diff --git a/Documentation/devicetree/bindings/gpio/hpe,gxp-gpio.yaml b/Documentation/devicetree/bindings/gpio/hpe,gxp-gpio.yaml new file mode 100644 index 000000000000..1cf4cff26d5f --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/hpe,gxp-gpio.yaml @@ -0,0 +1,137 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/hpe,gxp-gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: HPE GXP gpio controllers + +maintainers: + - Nick Hawkins + +description: + Interruptable GPIO drivers for the HPE GXP that covers multiple interfaces. + +properties: + compatible: + oneOf: + - items: + - enum: + - hpe,gxp-gpio + - hpe,gxp-gpio-pl + + reg: + minItems: 3 + maxItems: 6 + + reg-names: + minItems: 3 + maxItems: 6 + + gpio-controller: true + + '#gpio-cells': + const: 2 + + gpio-line-names: + minItems: 1 + maxItems: 300 + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - reg-names + - gpio-controller + - "#gpio-cells" + +additionalProperties: false + +allOf: + - if: + properties: + compatible: + contains: + enum: + - hpe,gxp-gpio + then: + properties: + reg: + items: + - description: CSM + - description: fn2 virtual button + - description: fn2 system status + - description: vuhc status + - description: external virtual button + reg-names: + items: + - const: csm + - const: fn2-vbtn + - const: fn2-stat + - const: vuhc + - const: vbtn + - if: + properties: + compatible: + contains: + enum: + - hpe,gxp-gpio-pl + then: + properties: + reg: + items: + - description: Programmable logic led + - description: Programmable logic health led + - description: Programmable logic interrupt interface + reg-names: + items: + - const: pl-led + - const: pl-health + - const: pl-int + +examples: + - | + gpio@0 { + compatible = "hpe,gxp-gpio"; + reg = <0x0 0x400>, <0x200046 0x1>, <0x200070 0x08>, <0x400064 0x80>, <0x5100030f 0x1>; + reg-names = "csm", "fn2-vbtn", "fn2-stat", "vuhc", "vbtn"; + gpio-controller; + #gpio-cells = <2>; + interrupt-parent = <&vic0>; + interrupts = <10>; + gpio-line-names = + "IOP_LED1", "IOP_LED2", "IOP_LED3", "IOP_LED4", "IOP_LED5", "IOP_LED6", "IOP_LED7", "IOP_LED8", + "FAN1_INST", "FAN2_INST", "FAN3_INST", "FAN4_INST", "FAN5_INST", "FAN6_INST", "FAN7_INST", + "FAN8_INST", "FAN1_FAIL", "FAN2_FAIL", "FAN3_FAIL", "FAN4_FAIL", "FAN5_FAIL", "FAN6_FAIL", + "FAN7_FAIL", "FAN8_FAIL", "FAN1_ID", "FAN2_ID", "FAN3_ID", "FAN4_ID", "FAN5_ID", "FAN6_ID", + "FAN7_ID", "FAN8_ID", "IDENTIFY", "HEALTH_RED", "HEALTH_AMBER", "POWER_BUTTON", "UID_PRESS", + "SLP", "NMI_BUTTON", "RESET_BUTTON", "SIO_S5", "SO_ON_CONTROL", "PSU1_INST", "PSU2_INST", + "PSU3_INST", "PSU4_INST", "PSU5_INST", "PSU6_INST", "PSU7_INST", "PSU8_INST", "PSU1_AC", + "PSU2_AC", "PSU3_AC", "PSU4_AC", "PSU5_AC", "PSU6_AC", "PSU7_AC", "PSU8_AC", "PSU1_DC", + "PSU2_DC", "PSU3_DC", "PSU4_DC", "PSU5_DC", "PSU6_DC", "PSU7_DC", "PSU8_DC", "", "", "", "", + "", "", "", "", "", "", "", "", "", ""; + }; + + - | + gpio@51000304 { + compatible = "hpe,gxp-gpio-pl"; + reg = <0x51000304 0x2>, <0x5100030d 0x01>, <0x51000380 0x7f>; + reg-names = "pl-led", "pl-health", "pl-int"; + gpio-controller; + #gpio-cells = <2>; + interrupt-parent = <&vic0>; + interrupts = <24>; + gpio-line-names = + "IOP_LED1", "IOP_LED2", "IOP_LED3", "IOP_LED4", "IOP_LED5", "IOP_LED6", "IOP_LED7", "IOP_LED8", + "FAN1_INST", "FAN2_INST", "FAN3_INST", "FAN4_INST", "FAN5_INST", "FAN6_INST", "FAN7_INST", + "FAN8_INST", "FAN1_FAIL", "FAN2_FAIL", "FAN3_FAIL", "FAN4_FAIL", "FAN5_FAIL", "FAN6_FAIL", + "FAN7_FAIL", "FAN8_FAIL", "FAN1_ID", "FAN2_ID", "FAN3_ID", "FAN4_ID", "FAN5_ID", "FAN6_ID", + "FAN7_ID", "FAN8_ID", "IDENTIFY", "HEALTH_RED", "HEALTH_AMBER", "POWER_BUTTON", "UID_PRESS", + "SLP", "NMI_BUTTON", "RESET_BUTTON", "SIO_S5", "SO_ON_CONTROL", "PSU1_INST", "PSU2_INST", + "PSU3_INST", "PSU4_INST", "PSU5_INST", "PSU6_INST", "PSU7_INST", "PSU8_INST", "PSU1_AC", + "PSU2_AC", "PSU3_AC", "PSU4_AC", "PSU5_AC", "PSU6_AC", "PSU7_AC", "PSU8_AC", "PSU1_DC", + "PSU2_DC", "PSU3_DC", "PSU4_DC", "PSU5_DC", "PSU6_DC", "PSU7_DC", "PSU8_DC", "", "", "", "", + "", "", "", "", "", "", "", "", "", ""; + }; From patchwork Tue Apr 18 15:28:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawkins, Nick" X-Patchwork-Id: 13215847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2047C77B75 for ; Tue, 18 Apr 2023 15:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t1cadpS/QmMsY80kJ5xg6f+cvIBVd3lLOqCfM4yzq0s=; b=1qpC5ocA9ZKYlY W23NsQVy1JB1zQrv4fjKydTr1OXg4xHUjvPMaeE2+c6VZ0scxRI4jZSxuZHUQ1NEJ0Y4DKBQQytpS SEsJVvaoidRPjqZLejMPO5d85YUHbAPidNKIREslmKTX+SzCLwFSg98dJlewOwgHb9h/EH/rNbrxQ lpUPTOLFnETLpL3QOUoCneW47iE+/fFZIetogGap8ABWD5bF6YhH0azTNISYCcNW81Y+r4B+u66N8 HFL33V8LsztCOQ0qqnZimq2ZAROO60Ju6HRLdJU1svlgnOOa4A74eVJcjSutc29UZDFA4bi1qWLSk QodM+iT+OeS2VwvRjmXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponJN-002bvJ-0q; Tue, 18 Apr 2023 15:32:05 +0000 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponJH-002bqj-1l for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:32:02 +0000 Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33IBVxHj019523; Tue, 18 Apr 2023 15:31:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version; s=pps0720; bh=mh5ckzc+JZwqQOEFdmXTbYFSjoiyihF7h8qoI41tmA0=; b=Vh3Df0Wq1qkYgkt8p2dzdwm5WxLasaljreZ5lMjHokkf9AWEhPRz0/3YZo9Y5M+KUDo8 n0ASdIzjUret7utmyP/azMTEho1ch7PAF3H6Miu7gr0p0MrkaFyymYuuYwY9sqzAsXqJ qzTzUpNcqkkzSkdbsL2sj9xu9nzlw20pMrp8HXFT4f00Y8YzuvBTbNOy+2ZJodzFJe36 kWMRCbtbbTJPObN1KbFKmeAot/G0riiFmZ2sPAW+M39ykiW58QSkAgRRzJF1k4PDZZ7a 0UC3xr03c81Fg9KXqWZ4MglKnTfFGELEvCKiPyj+t+FJut5kYrKesKzNjye6z/uLpvQD 8w== Received: from p1lg14878.it.hpe.com (p1lg14878.it.hpe.com [16.230.97.204]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3q1t6pj41n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 15:31:39 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14878.it.hpe.com (Postfix) with ESMTPS id 2AFB412E80; Tue, 18 Apr 2023 15:31:39 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id 86E9B81733B; Tue, 18 Apr 2023 15:31:38 +0000 (UTC) From: nick.hawkins@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jdelvare@suse.com, linux@roeck-us.net, linux@armlinux.org.uk, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 6/9] dt-bindings: hwmon: Add HPE GXP PSU Support Date: Tue, 18 Apr 2023 10:28:21 -0500 Message-Id: <20230418152824.110823-7-nick.hawkins@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418152824.110823-1-nick.hawkins@hpe.com> References: <20230418152824.110823-1-nick.hawkins@hpe.com> X-Proofpoint-GUID: llG_UHI9fBhjAXZ7JLrgV-1tJt87eTRh X-Proofpoint-ORIG-GUID: llG_UHI9fBhjAXZ7JLrgV-1tJt87eTRh X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180132 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_083159_798118_28D9521B X-CRM114-Status: GOOD ( 16.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Hawkins Provide i2c register information and CPLD register information to the driver. Signed-off-by: Nick Hawkins --- .../bindings/hwmon/hpe,gxp-psu.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/hpe,gxp-psu.yaml diff --git a/Documentation/devicetree/bindings/hwmon/hpe,gxp-psu.yaml b/Documentation/devicetree/bindings/hwmon/hpe,gxp-psu.yaml new file mode 100644 index 000000000000..60ca0f6ace46 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/hpe,gxp-psu.yaml @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/hpe,gxp-psu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: HPE GXP psu controller + +maintainers: + - Nicholas Hawkins + +properties: + compatible: + const: hpe,gxp-psu + interrupts: + maxItems: 1 + + reg: + maxItems: 1 + + hpe,sysreg: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle to the global status registers shared between each psu + controller instance. + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + psu@48 { + compatible = "hpe,gxp-psu"; + reg = <0x48>; + hpe,sysreg = <&sysreg_system_controller2>; + }; + }; From patchwork Tue Apr 18 15:28:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawkins, Nick" X-Patchwork-Id: 13215849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AE02C6FD18 for ; Tue, 18 Apr 2023 15:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4eVD/cJZQf2JHqknaXMbv8mkwsPkVHMWm77SnK8bG3o=; b=Mvlz/T0kpzRLwO b/jQI924at2Qy4QWParYhCtQFc+IfQuHmDdF4HHxmoG4qRgdlNv+uszgDoHKUh1BbwlXbBv+JrFDm Oj0UHy6XJeG2alAo75Q1H73gyH3Dg4rtB1Obac8X3lTZymtqzjbKRPWbuJEPHqbFKPhxNVsG8c5CX zd7286c9LhFCF4yYuDhVLrkYhuiZWRuyvR/uZhB2px3msncZht+aaYfRqwnj09c8s4GlT6CR7dXvM Z+UQ7HYx+KqVqEzwQ5h+qvbJwuf1K3O20niUYnab14A4NSGUUu87R7w4oZBVGrj8NGDpUkMwKmczq ATa138t6t3k/B0wu06Kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponJX-002c0s-2i; Tue, 18 Apr 2023 15:32:15 +0000 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponJH-002bq1-1U for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:32:02 +0000 Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33IB27OJ022227; Tue, 18 Apr 2023 15:31:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references; s=pps0720; bh=FR9/nYvdx9UuYorCT0XIOqfxpevH7D7WKcKXu1Y6aRg=; b=HMuOCwcBKvUWOu7QYxV/mItLxzoRDl80LvctxmBMQbx91MtDBlDmaWUfYesVBRMWiTLe Ol11UfcuJwP//ghGFopEk5E9BNmvaNLPyVkGmUZPTsPcf2m55ggzqZhnVrsbXgJzLfcg X7Vdl5n6xYO4FeqQUbBOXe8OjHgDxiJOTu3OgVLPH3xMNW4u4wfIVKeCIioTMZE/yQG9 XWtgbIU9tvSmnEy3X+e0Mlp/TTtFqirsfV16SyBDoapDQG8XaZMAQhNtWxEzITWwYV1S fVrKknoa5RG8h7qeom3NQdUuE8u2Uy1pQ0WWbCPklpYdQbtFv1HTS9ZP05PLkyHwxqQl bg== Received: from p1lg14880.it.hpe.com (p1lg14880.it.hpe.com [16.230.97.201]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3q1ca10469-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 15:31:40 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14880.it.hpe.com (Postfix) with ESMTPS id D417B800386; Tue, 18 Apr 2023 15:31:39 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id 2F53E81733A; Tue, 18 Apr 2023 15:31:39 +0000 (UTC) From: nick.hawkins@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jdelvare@suse.com, linux@roeck-us.net, linux@armlinux.org.uk, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 7/9] ARM: dts: gxp: add psu, i2c, gpio Date: Tue, 18 Apr 2023 10:28:22 -0500 Message-Id: <20230418152824.110823-8-nick.hawkins@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418152824.110823-1-nick.hawkins@hpe.com> References: <20230418152824.110823-1-nick.hawkins@hpe.com> X-Proofpoint-GUID: jzlnY3bNHyLJihobDT4oF8pW9MGrW95V X-Proofpoint-ORIG-GUID: jzlnY3bNHyLJihobDT4oF8pW9MGrW95V X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 impostorscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=963 phishscore=0 priorityscore=1501 clxscore=1015 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180132 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_083159_770337_FFC99D36 X-CRM114-Status: GOOD ( 15.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Hawkins Add support for the GXP I2C, PSU, and GPIO drivers. As well as adjust register ranges to be correct. Signed-off-by: Nick Hawkins --- arch/arm/boot/dts/hpe-bmc-dl360gen10.dts | 161 ++++++++++++++++++ arch/arm/boot/dts/hpe-gxp.dtsi | 197 ++++++++++++++++++++--- 2 files changed, 338 insertions(+), 20 deletions(-) diff --git a/arch/arm/boot/dts/hpe-bmc-dl360gen10.dts b/arch/arm/boot/dts/hpe-bmc-dl360gen10.dts index 3a7382ce40ef..487b6485a832 100644 --- a/arch/arm/boot/dts/hpe-bmc-dl360gen10.dts +++ b/arch/arm/boot/dts/hpe-bmc-dl360gen10.dts @@ -23,4 +23,165 @@ device_type = "memory"; reg = <0x40000000 0x20000000>; }; + + i2cmux@4 { + compatible = "i2c-mux-reg"; + i2c-parent = <&i2c4>; + reg = <0xd1000374 0x1>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@4 { + reg = <4>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; + + i2cmux@6 { + compatible = "i2c-mux-reg"; + i2c-parent = <&i2c6>; + reg = <0xd1000376 0x1>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@2 { + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@4 { + reg = <4>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c@5 { + reg = <5>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; +}; + +&i2c0 { + status = "okay"; +}; + +&i2c1 { + status = "okay"; +}; + +&i2c2 { + status = "okay"; + eeprom@50 { + compatible = "atmel,24c02"; + pagesize = <8>; + reg = <0x50>; + }; +}; + +&i2c3 { + status = "okay"; +}; + +&i2c4 { + status = "okay"; +}; + +&i2c5 { + status = "okay"; +}; + +&i2c6 { + status = "okay"; +}; + +&i2c7 { + status = "okay"; + psu@58 { + compatible = "hpe,gxp-psu"; + reg = <0x58>; + hpe,sysreg = <&sysreg_system_controller2>; + }; + + psu@59 { + compatible = "hpe,gxp-psu"; + reg = <0x59>; + hpe,sysreg = <&sysreg_system_controller2>; + }; +}; + +&i2c8 { + status = "okay"; +}; + +&i2c9 { + status = "okay"; +}; + +&gpio { + gpio-line-names = + "", "", "", "", "", "", "", "", "", "", /*0 - 9*/ + "", "", "", "", "", "", "", "", "", "", /*10 - 19*/ + "", "", "", "", "", "", "", "", "", "", /*20 - 29*/ + "", "", "", "", "", "", "", "", "", "", /*30 - 39*/ + "", "", "", "", "", "", "", "", "", "", /*40 - 49*/ + "", "", "", "", "", "", "", "", "", "", /*50 - 59*/ + "", "", "", "", "", "", "", "", "", "", /*60 - 69*/ + "", "", "", "", "", "", "", "", "", "", /*70 - 79*/ + "", "", "", "", "", "", "", "", "", "", /*80 - 89*/ + "", "", "", "", "", "", "", "", "", "", /*90 - 99*/ + "", "", "", "", "", "", "", "", "", "", /*100 - 109*/ + "", "", "", "", "", "", "", "", "", "", /*110 - 119*/ + "", "", "", "", "", "", "", "", "", "", /*120 - 129*/ + "", "", "", "", "", "", "", "", "", "", /*130 - 139*/ + "", "", "", "", "", "", "", "", "", "", /*140 - 149*/ + "", "", "", "", "", "", "", "", "", "", /*150 - 159*/ + "", "", "", "", "", "", "", "", "", "", /*160 - 169*/ + "", "", "", "", "", "", "", "", "", "", /*170 - 179*/ + "", "", "", "", "", "", "", "", "", "", /*180 - 189*/ + "", "", "RESET_OUT", "NMI_OUT", "", "", "", "", "", "", /*190 - 199*//*GPIO*/ + "", "", "", "", "", "", "", "", "", "", /*Vuhc 200-209*/ + "POWER_OUT", "PS_PWROK", "PCIERST", "POST_COMPLETE", "", "", "", "", "", ""; /*210 - 219*/ +}; + +&gpio1 { + gpio-line-names = + "IOP_LED1", "IOP_LED2", "IOP_LED3", "IOP_LED4", "IOP_LED5", "IOP_LED6", "IOP_LED7", + "IOP_LED8", "FAN1_INST", "FAN2_INST", "FAN3_INST", "FAN4_INST", "FAN5_INST", "FAN6_INST", + "FAN7_INST", "FAN8_INST", "FAN1_FAIL", "FAN2_FAIL", "FAN3_FAIL", "FAN4_FAIL", "FAN5_FAIL", + "FAN6_FAIL", "FAN7_FAIL", "FAN8_FAIL", "FAN1_ID", "FAN2_ID", "FAN3_ID", "FAN4_ID", + "FAN5_ID", "FAN6_ID", "FAN7_ID", "FAN8_ID", "IDENTIFY", "HEALTH_RED", "HEALTH_AMBER", + "POWER_BUTTON", "UID_PRESS", "SLP", "NMI_BUTTON", "RESET_BUTTON", "SIO_S5", + "SO_ON_CONTROL", "PSU1_INST", "PSU2_INST", "PSU3_INST", "PSU4_INST", "PSU5_INST", + "PSU6_INST", "PSU7_INST", "PSU8_INST", "PSU1_AC", "PSU2_AC", "PSU3_AC", "PSU4_AC", + "PSU5_AC", "PSU6_AC", "PSU7_AC", "PSU8_AC", "PSU1_DC", "PSU2_DC", "PSU3_DC", "PSU4_DC", + "PSU5_DC", "PSU6_DC", "PSU7_DC", "PSU8_DC", "", "", "", "", + "", "", "", "", "", "", "", "", "", ""; }; diff --git a/arch/arm/boot/dts/hpe-gxp.dtsi b/arch/arm/boot/dts/hpe-gxp.dtsi index cf735b3c4f35..8a8faf7fbd60 100644 --- a/arch/arm/boot/dts/hpe-gxp.dtsi +++ b/arch/arm/boot/dts/hpe-gxp.dtsi @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Device Tree file for HPE GXP + * Device Tree for HPE GXP */ /dts-v1/; @@ -52,76 +52,233 @@ cache-level = <2>; }; - ahb@c0000000 { + ahb@80000000 { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; - ranges = <0x0 0xc0000000 0x30000000>; - dma-ranges; + ranges = <0x0 0x80000000 0x20000000>, + <0x40000000 0xc0000000 0x3fff0000>; - vic0: interrupt-controller@eff0000 { + vic0: interrupt-controller@4eff0000 { compatible = "arm,pl192-vic"; - reg = <0xeff0000 0x1000>; + reg = <0x4eff0000 0x1000>; interrupt-controller; #interrupt-cells = <1>; }; - vic1: interrupt-controller@80f00000 { + vic1: interrupt-controller@f00000 { compatible = "arm,pl192-vic"; - reg = <0x80f00000 0x1000>; + reg = <0xf00000 0x1000>; interrupt-controller; #interrupt-cells = <1>; }; - uarta: serial@e0 { + uarta: serial@400000e0 { compatible = "ns16550a"; - reg = <0xe0 0x8>; + reg = <0x400000e0 0x8>; interrupts = <17>; interrupt-parent = <&vic0>; clock-frequency = <1846153>; reg-shift = <0>; }; - uartb: serial@e8 { + uartb: serial@400000e8 { compatible = "ns16550a"; - reg = <0xe8 0x8>; + reg = <0x400000e8 0x8>; interrupts = <18>; interrupt-parent = <&vic0>; clock-frequency = <1846153>; reg-shift = <0>; }; - uartc: serial@f0 { + uartc: serial@400000f0 { compatible = "ns16550a"; - reg = <0xf0 0x8>; + reg = <0x400000f0 0x8>; interrupts = <19>; interrupt-parent = <&vic0>; clock-frequency = <1846153>; reg-shift = <0>; }; - usb0: usb@efe0000 { + usb0: usb@4efe0000 { compatible = "hpe,gxp-ehci", "generic-ehci"; - reg = <0xefe0000 0x100>; + reg = <0x4efe0000 0x100>; interrupts = <7>; interrupt-parent = <&vic0>; }; - st: timer@80 { + st: timer@40000080 { compatible = "hpe,gxp-timer"; - reg = <0x80 0x16>; + reg = <0x40000080 0x16>; interrupts = <0>; interrupt-parent = <&vic0>; clocks = <&iopclk>; clock-names = "iop"; }; - usb1: usb@efe0100 { + usb1: usb@4efe0100 { compatible = "hpe,gxp-ohci", "generic-ohci"; - reg = <0xefe0100 0x110>; + reg = <0x4efe0100 0x110>; interrupts = <6>; interrupt-parent = <&vic0>; }; + + sysreg_system_controller: syscon@400000f8 { + compatible = "hpe,gxp-sysreg", "syscon"; + reg = <0x400000f8 0x8>; + }; + + sysreg_system_controller2: syscon@51000319 { + compatible = "hpe,gxp-sysreg", "syscon"; + reg = <0x51000319 0x4>; + }; + + i2c0: i2c@40002000 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002000 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + i2c1: i2c@40002100 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002100 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + i2c2: i2c@40002200 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002200 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + i2c3: i2c@40002300 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002300 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + i2c4: i2c@40002400 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002400 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + i2c5: i2c@40002500 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002500 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + i2c6: i2c@40002600 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002600 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + i2c7: i2c@40002700 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002700 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + i2c8: i2c@40002800 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002800 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + i2c9: i2c@40002900 { + compatible = "hpe,gxp-i2c"; + reg = <0x40002900 0x70>; + interrupts = <9>; + interrupt-parent = <&vic0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + hpe,sysreg = <&sysreg_system_controller>; + clock-frequency = <100000>; + }; + + fan-controller@40000c10 { /* 0xc0000c10 */ + compatible = "hpe,gxp-fan-ctrl"; + reg = <0x40000c10 0x8>, <0x51000327 0x06>; + reg-names = "base", "pl"; + }; + + gpio: gpio@0 { + compatible = "hpe,gxp-gpio"; + reg = <0x0 0x400>, <0x200046 0x1>, <0x200070 0x08>, + <0x400064 0x80>, <0x5100030f 0x1>; + reg-names = "csm", "fn2-vbtn", "fn2-stat", "vuhc", "vbtn"; + gpio-controller; + #gpio-cells = <2>; + interrupts = <0>; + interrupt-parent = <&vic1>; + }; + + gpio1: gpio@51000304 { + compatible = "hpe,gxp-gpio-pl"; + reg = <0x51000304 0x2>, <0x5100030d 0x01>, <0x51000380 0x7f>; + reg-names = "pl-led", "pl-health", "pl-int"; + gpio-controller; + #gpio-cells = <2>; + interrupts = <26>; + interrupt-parent = <&vic0>; + }; }; }; }; From patchwork Tue Apr 18 15:28:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawkins, Nick" X-Patchwork-Id: 13215850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06C89C77B75 for ; Tue, 18 Apr 2023 15:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WURCiz6d0DiHNmc4qP+i2vZbUssj3CHWxxyVrr9LFa4=; b=wzlPQRp2L80D8P 7dWtA6b9kcKxxkvtdNKYsmkN6MgEymwMRq6GMylrYJM7QlcbV6CIJPwMim5turrlauw2bswL6LqD6 PNzTjx2DV2MOVJAnElZhMHXrbCI+SEUHSY5SqXEqUTo1l6XcwmSFZaoqLhoesWcPBGrWZ9dtX1csO MGBCbhulmoGtPM+Cpvw0KBYiUfwn+b8JOZBjv+hFXuq4RASLGNsCoAk3fQwJiopbx5WZYuMwJpWIl lK0Nm206Q0z/bVBoPkhP2VPEGHUQ1OhIQg45YbSdPWKKIzbbSejSmMKqFWW5dCQ3bvo+LnxutdnMb aC3IjViyQMFGonsM6Gfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponJa-002c2b-0g; Tue, 18 Apr 2023 15:32:18 +0000 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponJI-002bqd-1j for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:32:04 +0000 Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33IEvCLv001196; Tue, 18 Apr 2023 15:31:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references; s=pps0720; bh=udJUGzMSVaHDnnkvuLdXTpjSOcpZW6ZG9k7fYYe6uL8=; b=El42DL5rzb05+LNCyhjXsrdDBepM8rdWhNDYS1o3O6sRrdIcfFSFkr7H+v3pZzUovBLj hAZ/lrIy7GTxlHbAx6RUsccZIUd5D+jKLC3eCnnE1MzBWOHXApc1ruPDvncFDa1uARSI NTuRYEVvVlBKDkV2hh9aeH1WVYD99TJgfohXvRWzBW4nDltkh1B/2Jg2CGGQ6nMghERM LAL4VxX+SuxCrP0OvRB5WJTQT6Xfb4t8FBvrRHzOput9+/I5F65gxcfGtyGUZrSb5mGY 9liC2yOfGR84Gbm2tQCaIyUIhESjPxknztNayuZraoqwpIPiLr8kmfIHD2jgR0boUmg1 dw== Received: from p1lg14881.it.hpe.com (p1lg14881.it.hpe.com [16.230.97.202]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3q1wdw0b9p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 15:31:41 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14881.it.hpe.com (Postfix) with ESMTPS id 8E6EB806B78; Tue, 18 Apr 2023 15:31:40 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id D60EE81732F; Tue, 18 Apr 2023 15:31:39 +0000 (UTC) From: nick.hawkins@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jdelvare@suse.com, linux@roeck-us.net, linux@armlinux.org.uk, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 8/9] ARM: multi_v7_defconfig: Add PSU, GPIO, and I2C Date: Tue, 18 Apr 2023 10:28:23 -0500 Message-Id: <20230418152824.110823-9-nick.hawkins@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418152824.110823-1-nick.hawkins@hpe.com> References: <20230418152824.110823-1-nick.hawkins@hpe.com> X-Proofpoint-ORIG-GUID: apShHr2eoYeqIH1XWn91XRpVUs_5Pinm X-Proofpoint-GUID: apShHr2eoYeqIH1XWn91XRpVUs_5Pinm X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 mlxlogscore=830 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180132 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_083200_599329_52C8AA3D X-CRM114-Status: GOOD ( 14.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Hawkins Add the CONFIG_I2C_GXP, CONFIG_GPIO_GXP, and CONFIG_SENSORS_GXP_PSU symbols. Make CONFIG_SENSORS_GXP_FAN_CTRL=y Signed-off-by: Nick Hawkins --- arch/arm/configs/multi_v7_defconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 084cc612ea23..fcfbcd233fb8 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -405,6 +405,7 @@ CONFIG_I2C_DAVINCI=y CONFIG_I2C_DESIGNWARE_PLATFORM=y CONFIG_I2C_DIGICOLOR=m CONFIG_I2C_EMEV2=m +CONFIG_I2C_GXP=m CONFIG_I2C_IMX=y CONFIG_I2C_MESON=y CONFIG_I2C_MV64XXX=y @@ -478,6 +479,7 @@ CONFIG_GPIO_ASPEED_SGPIO=y CONFIG_GPIO_DAVINCI=y CONFIG_GPIO_DWAPB=y CONFIG_GPIO_EM=y +CONFIG_GPIO_GXP=y CONFIG_GPIO_MPC8XXX=y CONFIG_GPIO_MXC=y CONFIG_GPIO_RCAR=y @@ -527,7 +529,8 @@ CONFIG_SENSORS_NTC_THERMISTOR=m CONFIG_SENSORS_PWM_FAN=m CONFIG_SENSORS_RASPBERRYPI_HWMON=m CONFIG_SENSORS_INA2XX=m -CONFIG_SENSORS_GXP_FAN_CTRL=m +CONFIG_SENSORS_GXP_FAN_CTRL=y +CONFIG_SENSORS_GXP_PSU=y CONFIG_CPU_THERMAL=y CONFIG_DEVFREQ_THERMAL=y CONFIG_IMX_THERMAL=y From patchwork Tue Apr 18 15:28:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hawkins, Nick" X-Patchwork-Id: 13215851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82CCFC77B78 for ; Tue, 18 Apr 2023 15:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QboL+867qo+YlKvVjWu7y71MI7LFf981vBjWQ+D075c=; b=ncx/fJHXT6ZH20 UWgCL9FjpRhstIJJ5Kk0fwykoVHOHHIKocsr6cAzPUF3WOsEF3FdtP3/TEFohiTqvDh2u1JjD2d0D hdWbknNc1SVz/U9cmDzh8+Oh26kzPUyMHLHUKSHdUgxBFbh7dcUjE12JDuG/vhU2ZYkIanfOyKB0n f0GHXGfo0o51AlzAhOHlsSIznr6Tx551WwiwilYJwWVeXcx+mhNzTnAdwrNAdnBplfRViBkACmy9Q SpYCY4LGo75h2fKg4z4Lv809ECRtvtJjlPGiMls5vKVcInB8gBdcVIqDu5ix1kIgXjYTGQEhsHbUc 8w0s3OozgS7GGI1Lm0uQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ponJc-002c4Z-2i; Tue, 18 Apr 2023 15:32:20 +0000 Received: from mx0a-002e3701.pphosted.com ([148.163.147.86]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ponJI-002bt2-30 for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:32:04 +0000 Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33IBHK90013970; Tue, 18 Apr 2023 15:31:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : subject : date : message-id : in-reply-to : references; s=pps0720; bh=dAIIzQaU+Kiqn9GnVIQkPXlXHdyWvMYyRuSKEZVxqpw=; b=eV8QatR6OZ46jcsfGDjYtnEm3WWs6/ECPhsgN9abctszN66wrieQLuMwybL+uqlUhguS sgZaT1R6YFi0+pb1kEYFt4TNZWSgh0fVHQxNK8tBUviIBksoX9caiS4xgyAsi6WOD12W nztcq9y8egggARHhODm9vj/CWxHMUNtZNw5imSiiEhE837mQXiy0r5Rdv/PyFRPne4Js JE1oBGUCz/ATP8qmEuv//LMevgTB9FHjgZ8UIWbOdWc04o6JxWw138m6MuDIZZukJdVI OJ8MIlMRiXFREPeGimH3gFmDCgdSbuXl7SDRwBu3kz9BSnW3ywAa02XtR7vt0hklzVxr zQ== Received: from p1lg14879.it.hpe.com (p1lg14879.it.hpe.com [16.230.97.200]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3q1t6pj428-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 15:31:42 +0000 Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14879.it.hpe.com (Postfix) with ESMTPS id 8726913059; Tue, 18 Apr 2023 15:31:41 +0000 (UTC) Received: from hpe.com (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id 8AD4B81532D; Tue, 18 Apr 2023 15:31:40 +0000 (UTC) From: nick.hawkins@hpe.com To: verdun@hpe.com, nick.hawkins@hpe.com, linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, jdelvare@suse.com, linux@roeck-us.net, linux@armlinux.org.uk, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 9/9] MAINTAINERS: hpe: Add GPIO, PSU Date: Tue, 18 Apr 2023 10:28:24 -0500 Message-Id: <20230418152824.110823-10-nick.hawkins@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230418152824.110823-1-nick.hawkins@hpe.com> References: <20230418152824.110823-1-nick.hawkins@hpe.com> X-Proofpoint-GUID: D-5jxxe18OTKk68YzM-A06-LVUnk68gS X-Proofpoint-ORIG-GUID: D-5jxxe18OTKk68YzM-A06-LVUnk68gS X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_11,2023-04-18_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304180132 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_083200_985548_C6313663 X-CRM114-Status: GOOD ( 14.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Hawkins List the files added for GPIO and PSU support. Signed-off-by: Nick Hawkins --- MAINTAINERS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a3b14ec33830..6df959ebf523 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2239,7 +2239,9 @@ M: Nick Hawkins S: Maintained F: Documentation/hwmon/gxp-fan-ctrl.rst F: Documentation/devicetree/bindings/arm/hpe,gxp.yaml +F: Documentation/devicetree/bindings/gpio/hpe,gxp-gpio.yaml F: Documentation/devicetree/bindings/hwmon/hpe,gxp-fan-ctrl.yaml +F: Documentation/devicetree/bindings/hwmon/hpe,gxp-psu.yaml F: Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml F: Documentation/devicetree/bindings/spi/hpe,gxp-spifi.yaml F: Documentation/devicetree/bindings/timer/hpe,gxp-timer.yaml @@ -2247,7 +2249,9 @@ F: arch/arm/boot/dts/hpe-bmc* F: arch/arm/boot/dts/hpe-gxp* F: arch/arm/mach-hpe/ F: drivers/clocksource/timer-gxp.c +F: drivers/gpio/gpio-gxp.c F: drivers/hwmon/gxp-fan-ctrl.c +F: drivers/hwmon/gxp-psu.c F: drivers/i2c/busses/i2c-gxp.c F: drivers/spi/spi-gxp.c F: drivers/watchdog/gxp-wdt.c