Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1906036pxp; Mon, 21 Mar 2022 07:24:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUjMxCHndbUmwy4JBhgWm0JtjK95Z3b3SPA/ilOrfgAbJWo9zjUhlQFD5OuFtCAmqSo60b X-Received: by 2002:a17:906:2a85:b0:6ce:36bd:bcd9 with SMTP id l5-20020a1709062a8500b006ce36bdbcd9mr21159349eje.318.1647872696110; Mon, 21 Mar 2022 07:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647872696; cv=none; d=google.com; s=arc-20160816; b=BYFsGbHdT7om3vuoT5DCuv71QZXn3zMUAcO8Tc/YoCIPbHKOfmIredBEDxNDl/XZlv mRbmnKYoH8Y0OU6VTylnbMn+f5HIeAqDefD3HkamAgSNvH+RX/TS1hyXFX8ERvW0DFkX wn+VtqiB0PIPtF0WkeadPSSel5XoZzIazDg+sUSuJg8kL0xUrOZd9jDQW+W85f9NSVYi VwvwgMZHBZV8gPu4hE+aYZjVCTZBklkel9PFEMP1AuvnQ54zlstcpmUFWRHgHDCcn52V 7oqmxcc48pxaPitS38E/T8Hs8JhSLuTj7ef6qY5nvWVzUOvwWKuC6GrnOvmsahRSQoNK falg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QHs8nDZRrzCpYhZ9BA1UXjXzxl4mRfbGgiIRqb+Sb8s=; b=Ecgav6BkSFYLX/nNCf3djDoyJlQ7jh8GFFUs1i2rhV+6MCS566ryt6/Cgn8KyBoFTW WHXiRhSgY/x4vgDhYlKdMJ5i/9oLbx3aTs9cNTq8IGWPaKuDNv7HvoeYoPw7xQqAHVNc zQ9TKVNKBh1qrmdtF+8fXaalx2FrT5jIKZXns5lEZ0B2WlRwpfHIsH54qoYLWR45uRRy sqrw3u8JzL1pij5ue2F8X3XF+AnWltOqbb+TMAebxLEIe0d6XsJ0Eu6blx6XskT/toKY bm5QlYm/LIaftXvhwRq/tEIvoOCkZDp14ELBqcvjksJhO4vVcBDHk91iE+pg4O9n75fI L4Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ps2bUPVP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c28-20020a1709063f1c00b006df76385ba5si8877731ejj.69.2022.03.21.07.24.28; Mon, 21 Mar 2022 07:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ps2bUPVP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345189AbiCUIXX (ORCPT + 99 others); Mon, 21 Mar 2022 04:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239039AbiCUIXV (ORCPT ); Mon, 21 Mar 2022 04:23:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6594F13AA0E; Mon, 21 Mar 2022 01:21:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 87EC7B81141; Mon, 21 Mar 2022 08:21:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72016C340E8; Mon, 21 Mar 2022 08:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647850913; bh=W7j35n3i7ouQcxLyTwP0bCw1+grg/FGzjCKUso/dVLw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ps2bUPVPU2suvW45Df6jEflofLA9ipyAVHmyhz6mrrzwn5ZOC0u3kaXjUvM0VnV0A SJqHNeaWuu4NDAEKW+y6ax4aUHPgoepoVm3szvaigNDQw/resQ99+ghSzi/WihBjV3 lCkPE0jcCykg22Xrseo9BnbSIfoUW+hbSzC2BVds= Date: Mon, 21 Mar 2022 09:21:49 +0100 From: Greg Kroah-Hartman To: Quan Nguyen Cc: Lee Jones , Rob Herring , Krzysztof Kozlowski , Jean Delvare , Guenter Roeck , Jonathan Corbet , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Thu Nguyen , Gustavo Pimentel , open list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:HARDWARE MONITORING" , "open list:DOCUMENTATION" , OpenBMC Maillist , Open Source Submission , Phong Vo , "Thang Q . Nguyen" Subject: Re: [PATCH v7 5/9] misc: smpro-misc: Add Ampere's Altra SMpro misc driver Message-ID: References: <20220321081355.6802-1-quan@os.amperecomputing.com> <20220321081355.6802-6-quan@os.amperecomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220321081355.6802-6-quan@os.amperecomputing.com> X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 21, 2022 at 03:13:51PM +0700, Quan Nguyen wrote: > This commit adds driver support for accessing various information > reported by Ampere's SMpro co-processor such as Boot Progress and > other miscellaneous data. > > Signed-off-by: Quan Nguyen No Documentation/ABI/ entries for your sysfs file? > +static ssize_t boot_progress_show(struct device *dev, struct device_attribute *da, char *buf) > +{ > + struct smpro_misc *misc = dev_get_drvdata(dev); > + u32 boot_progress; > + u8 current_stage; > + u8 boot_status; > + u8 boot_stage; > + u32 select; > + u32 reg_lo; > + u32 reg; > + int ret; > + > + /* Read current boot stage */ > + ret = regmap_read(misc->regmap, BOOTSTAGE_CUR_STAGE, ®); > + if (ret) > + return ret; > + > + current_stage = reg & 0xff; > + > + /* Read the boot progress */ > + ret = regmap_read(misc->regmap, BOOTSTAGE_SELECT, &select); > + if (ret) > + return ret; > + > + boot_stage = (select >> 8) & 0xff; > + boot_status = select & 0xff; > + > + if (boot_stage > current_stage) > + return -EINVAL; > + > + ret = regmap_read(misc->regmap, BOOTSTAGE_STATUS_LO, ®_lo); > + if (!ret) > + ret = regmap_read(misc->regmap, BOOTSTAGE_STATUS_HI, ®); > + if (ret) > + return ret; > + > + boot_progress = swab16(reg) << 16 | swab16(reg_lo); > + > + /* Tell firmware to provide next boot stage next time */ > + if (boot_stage < current_stage) { > + ret = regmap_write(misc->regmap, BOOTSTAGE_SELECT, ((select & 0xff00) | 0x1)); > + if (ret) > + return ret; > + } > + > + return snprintf(buf, PAGE_SIZE, "0x%02x 0x%02x 0x%08x\n", > + boot_stage, boot_status, boot_progress); sysfs_emit() please. Also, this is 3 different things, put all of these in different sysfs files. thanks, greg k-h