From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752768AbcENPHJ (ORCPT ); Sat, 14 May 2016 11:07:09 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:36766 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120AbcENPHH (ORCPT ); Sat, 14 May 2016 11:07:07 -0400 From: Kevin Hilman To: Neil Armstrong Cc: linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: Re: [RFC PATCH 1/3] reset: Add support for the Amlogic Meson GXBB Reset Controller Organization: BayLibre References: <1463148012-25988-1-git-send-email-narmstrong@baylibre.com> <1463148012-25988-2-git-send-email-narmstrong@baylibre.com> Date: Sat, 14 May 2016 17:07:02 +0200 In-Reply-To: <1463148012-25988-2-git-send-email-narmstrong@baylibre.com> (Neil Armstrong's message of "Fri, 13 May 2016 16:00:10 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Neil Armstrong writes: > This patch adds the platform driver for the Amlogic Meson GXBB Reset > Controller. > > Signed-off-by: Neil Armstrong [...] > +static int meson_gxbb_reset_assert(struct reset_controller_dev *rcdev, > + unsigned long id) > +{ > + struct meson_gxbb_reset *data = > + container_of(rcdev, struct meson_gxbb_reset, rcdev); > + unsigned int bank = id / BITS_PER_REG; > + unsigned int offset = id % BITS_PER_REG; > + void *reg_addr = data->reg_base + (bank << 2); > + > + if (bank >= REG_COUNT) > + return -EINVAL; > + > + writel(readl(reg_addr) | BIT(offset), reg_addr); The spec lists these registers as 16-bit registers, so probably readw/writew are more appropriate here. > + return 0; > +} > + > +static int meson_gxbb_reset_deassert(struct reset_controller_dev *rcdev, > + unsigned long id) > +{ > + struct meson_gxbb_reset *data = > + container_of(rcdev, struct meson_gxbb_reset, rcdev); > + unsigned int bank = id / BITS_PER_REG; > + unsigned int offset = id % BITS_PER_REG; > + void *reg_addr = data->reg_base + (bank << 2); > + > + if (bank >= REG_COUNT) > + return -EINVAL; > + > + writel(readl(reg_addr) & ~BIT(offset), reg_addr); and here. > + return 0; > +} Kevin