From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753444AbcEPIt2 (ORCPT ); Mon, 16 May 2016 04:49:28 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37060 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752194AbcEPIt1 (ORCPT ); Mon, 16 May 2016 04:49:27 -0400 Subject: Re: [RFC PATCH 1/3] reset: Add support for the Amlogic Meson GXBB Reset Controller To: Kevin Hilman References: <1463148012-25988-1-git-send-email-narmstrong@baylibre.com> <1463148012-25988-2-git-send-email-narmstrong@baylibre.com> Cc: linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org From: Neil Armstrong Organization: Baylibre Message-ID: <57398989.2020207@baylibre.com> Date: Mon, 16 May 2016 10:49:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/14/2016 05:07 PM, Kevin Hilman wrote: > Neil Armstrong writes: >> + 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. Looking at the datasheet, the reset controller is an APB3 module, thus 32bit would be the only data width configured. Sure, it's strange to only have 16 used bits per registers... > >> + 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 > Neil