From patchwork Tue May 10 09:51:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 67412 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2032908qge; Tue, 10 May 2016 02:52:07 -0700 (PDT) X-Received: by 10.98.101.199 with SMTP id z190mr57141956pfb.1.1462873922841; Tue, 10 May 2016 02:52:02 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b68si1996831pfb.21.2016.05.10.02.52.02; Tue, 10 May 2016 02:52:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752211AbcEJJv6 (ORCPT + 29 others); Tue, 10 May 2016 05:51:58 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:34613 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751162AbcEJJvv (ORCPT ); Tue, 10 May 2016 05:51:51 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id u4A9o2qI001762; Tue, 10 May 2016 18:50:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u4A9o2qI001762 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1462873829; bh=svo5azSTD3T7X2vOI597v84VxS7wdkQCUeAnS/Rq47k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qYkQcP2k4leFy380EA+japPcR8MRkp9frViRdEAHaGN74E6IZPIKy26RqSvw6cvrU 01IrhrmGM+fgyvxMQZElCS0vxdR9ACgytWKxaDMbeX0niQRc90ldoChwyr8DC+8sjV Y/nj2J5WmCL4RV4ZQPamAwwocBl0Zk90K9QQC1W7Jn8Qzv87lXrvzNyfXzg0Igx2ex LlEmvPEZLS+aLfXBYmCx8+QPptwkEHo5WaV5Aq3GO+Tj3WHwqf9z7qSrUIX4udYT1s 9g6Ho9QQkIFh7OIMVQvmG/G6Tc5kvaCtMGLrcFY5G67C0wLf60Yqd+JEPEerKo9cPE pMYUIUj9MpNjw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-clk@vger.kernel.org, Arnd Bergmann , Philipp Zabel Cc: Masahiro Yamada , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 21/21] reset: uniphier: add reset driver for Peripheral block on UniPhier SoCs Date: Tue, 10 May 2016 18:51:02 +0900 Message-Id: <1462873862-30940-22-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462873862-30940-1-git-send-email-yamada.masahiro@socionext.com> References: <1462873862-30940-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series is just for review. Please do not apply this patch. Signed-off-by: Masahiro Yamada --- drivers/reset/uniphier/Kconfig | 4 ++ drivers/reset/uniphier/Makefile | 1 + drivers/reset/uniphier/reset-uniphier-peri.c | 101 +++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 drivers/reset/uniphier/reset-uniphier-peri.c -- 1.9.1 diff --git a/drivers/reset/uniphier/Kconfig b/drivers/reset/uniphier/Kconfig index a582938..d3e629e 100644 --- a/drivers/reset/uniphier/Kconfig +++ b/drivers/reset/uniphier/Kconfig @@ -38,4 +38,8 @@ config RESET_UNIPHIER_MIO tristate "Reset driver for UniPhier Media I/O block" default y +config RESET_UNIPHIER_PERI + tristate "Reset driver for UniPhier Peripheral block" + default y + endif diff --git a/drivers/reset/uniphier/Makefile b/drivers/reset/uniphier/Makefile index e83bd14..65e9d2d 100644 --- a/drivers/reset/uniphier/Makefile +++ b/drivers/reset/uniphier/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_RESET_UNIPHIER_LD11) += reset-uniphier-ld11.o obj-$(CONFIG_RESET_UNIPHIER_LD20) += reset-uniphier-ld20.o obj-$(CONFIG_RESET_UNIPHIER_MIO) += reset-uniphier-mio.o +obj-$(CONFIG_RESET_UNIPHIER_PERI) += reset-uniphier-peri.o diff --git a/drivers/reset/uniphier/reset-uniphier-peri.c b/drivers/reset/uniphier/reset-uniphier-peri.c new file mode 100644 index 0000000..1ec1c16 --- /dev/null +++ b/drivers/reset/uniphier/reset-uniphier-peri.c @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2016 Socionext Inc. + * Author: Masahiro Yamada + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include + +#include "reset-uniphier.h" + +#define UNIPHIER_PERI_RESET_UART(ch, index) \ + { \ + .id = (index), \ + .reg = 0x114, \ + .mask = BIT(19 + ch), \ + .deassert_val = BIT(19 + ch), \ + } + +#define UNIPHIER_PERI_RESET_I2C(ch, index) \ + { \ + .id = (index), \ + .reg = 0x114, \ + .mask = BIT(5 + ch), \ + .deassert_val = BIT(5 + ch), \ + } + +#define UNIPHIER_PERI_RESET_FI2C(ch, index) \ + { \ + .id = (index), \ + .reg = 0x114, \ + .mask = BIT(24 + ch), \ + .deassert_val = BIT(24 + ch), \ + } + +static const struct uniphier_reset_data uniphier_ld4_peri_reset_data[] = { + UNIPHIER_PERI_RESET_UART(0, 0), + UNIPHIER_PERI_RESET_UART(1, 1), + UNIPHIER_PERI_RESET_UART(2, 2), + UNIPHIER_PERI_RESET_UART(3, 3), + UNIPHIER_PERI_RESET_I2C(0, 4), + UNIPHIER_PERI_RESET_I2C(1, 5), + UNIPHIER_PERI_RESET_I2C(2, 6), + UNIPHIER_PERI_RESET_I2C(3, 7), + UNIPHIER_PERI_RESET_I2C(4, 8), + { .id = UNIPHIER_RESET_ID_END } +}; + +static int uniphier_ld4_peri_reset_probe(struct platform_device *pdev) +{ + return uniphier_reset_probe(pdev, uniphier_ld4_peri_reset_data); +} + +static struct platform_driver uniphier_ld4_peri_reset_driver = { + .probe = uniphier_ld4_peri_reset_probe, + .driver = { + .name = "uniphier-ld4-peri-reset", + }, +}; +module_platform_driver(uniphier_ld4_peri_reset_driver); + +static const struct uniphier_reset_data uniphier_pro5_peri_reset_data[] = { + UNIPHIER_PERI_RESET_UART(0, 0), + UNIPHIER_PERI_RESET_UART(1, 1), + UNIPHIER_PERI_RESET_UART(2, 2), + UNIPHIER_PERI_RESET_UART(3, 3), + UNIPHIER_PERI_RESET_FI2C(0, 4), + UNIPHIER_PERI_RESET_FI2C(1, 5), + UNIPHIER_PERI_RESET_FI2C(2, 6), + UNIPHIER_PERI_RESET_FI2C(3, 7), + UNIPHIER_PERI_RESET_FI2C(4, 8), + UNIPHIER_PERI_RESET_FI2C(5, 9), + UNIPHIER_PERI_RESET_FI2C(6, 10), + { .id = UNIPHIER_RESET_ID_END } +}; + +static int uniphier_pro5_peri_reset_probe(struct platform_device *pdev) +{ + return uniphier_reset_probe(pdev, uniphier_pro5_peri_reset_data); +} + +static struct platform_driver uniphier_pro5_peri_reset_driver = { + .probe = uniphier_pro5_peri_reset_probe, + .driver = { + .name = "uniphier-pro5-peri-reset", + }, +}; +module_platform_driver(uniphier_pro5_peri_reset_driver); + +MODULE_AUTHOR("Masahiro Yamada "); +MODULE_DESCRIPTION("UniPhier Peripheral Reset Controller Driver"); +MODULE_LICENSE("GPL");