From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752773AbbKANlK (ORCPT ); Sun, 1 Nov 2015 08:41:10 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35831 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752549AbbKANky (ORCPT ); Sun, 1 Nov 2015 08:40:54 -0500 Subject: Re: [PATCH v4 4/6] reset: sunxi: Add Allwinner H3 bus resets To: Arnd Bergmann , linux-arm-kernel@lists.infradead.org References: <1445964626-6484-1-git-send-email-jenskuske@gmail.com> <1445964626-6484-5-git-send-email-jenskuske@gmail.com> <13919923.o3Dj9msmoa@wuerfel> Cc: Maxime Ripard , Chen-Yu Tsai , Michael Turquette , Linus Walleij , Rob Herring , Philipp Zabel , =?UTF-8?Q?Emilio_L=c3=b3pez?= , devicetree@vger.kernel.org, Vishnu Patekar , linux-kernel@vger.kernel.org, Hans de Goede , linux-sunxi@googlegroups.com From: Jens Kuske Message-ID: <563611E5.3000206@gmail.com> Date: Sun, 1 Nov 2015 14:21:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <13919923.o3Dj9msmoa@wuerfel> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 30/10/15 09:27, Arnd Bergmann wrote: > On Tuesday 27 October 2015 17:50:24 Jens Kuske wrote: >> >> +static int sun8i_h3_bus_reset_xlate(struct reset_controller_dev *rcdev, >> + const struct of_phandle_args *reset_spec) >> +{ >> + unsigned int index = reset_spec->args[0]; >> + >> + if (index < 96) >> + return index; >> + else if (index < 128) >> + return index + 32; >> + else if (index < 160) >> + return index + 64; >> + else >> + return -EINVAL; >> +} >> + >> > > This looks like you are doing something wrong and should either > put the actual number into DT, or use a two-cell representation, > with the first cell indicating the block (0, 1 or 2), and the > second cell the index. > I tried to fix up the somewhat strange register layout here. >>From the datasheet: BUS_SOFT_RST_REG0 0x02C0 Bus Software Reset Register 0 BUS_SOFT_RST_REG1 0x02C4 Bus Software Reset Register 1 BUS_SOFT_RST_REG2 0x02C8 Bus Software Reset Register 2 BUS_SOFT_RST_REG3 0x02D0 Bus Software Reset Register 3 BUS_SOFT_RST_REG4 0x02D8 Bus Software Reset Register 4 0x2cc and 0x2d4 are unused for some reason, but the regs are named 0-4, so it lead to some confusion with the actual numbers in DT. If we shouldn't do this I would be ok with putting the actual number into DT too. Jens