From: Antony Pavlov <antonynpavlov@gmail.com>
To: Lucas Stach <dev@lynxeye.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 5/5] tegra: add power management controller driver
Date: Sun, 10 Mar 2013 12:19:38 +0400 [thread overview]
Message-ID: <CAA4bVAEXyZ_NBTA7qUVqB=VdCPMihW+XxmJdCNqCkD96P7hRnQ@mail.gmail.com> (raw)
In-Reply-To: <1362652402-2985-6-git-send-email-dev@lynxeye.de>
On 7 March 2013 14:33, Lucas Stach <dev@lynxeye.de> wrote:
> Currently only implements system wide reset functionality.
Please split this patch into two patches, one for reset_cpu()-related
stuff and one for the rest.
>
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
> arch/arm/mach-tegra/Makefile | 2 +-
> arch/arm/mach-tegra/reset.c | 39 -----------------
> arch/arm/mach-tegra/tegra20-pmc.c | 89 +++++++++++++++++++++++++++++++++++++++
> arch/arm/mach-tegra/tegra20.c | 4 ++
> 4 files changed, 94 insertions(+), 40 deletions(-)
> delete mode 100644 arch/arm/mach-tegra/reset.c
> create mode 100644 arch/arm/mach-tegra/tegra20-pmc.c
>
> diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
> index 6aa219c..bcc0cd4 100644
> --- a/arch/arm/mach-tegra/Makefile
> +++ b/arch/arm/mach-tegra/Makefile
> @@ -1,4 +1,4 @@
> -obj-y += reset.o
> obj-y += tegra20.o
> obj-y += tegra20-car.o
> +obj-y += tegra20-pmc.o
> obj-y += tegra20-timer.o
> diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
> deleted file mode 100644
> index 91f9b3b..0000000
> --- a/arch/arm/mach-tegra/reset.c
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/*
> - * Copyright (C) 2011 Antony Pavlov <antonynpavlov@gmail.com>
> - *
> - * This file is part of barebox.
> - * See file CREDITS for list of people who contributed to this project.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * 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.
> - *
> - */
> -
> -/**
> - * @file
> - * @brief Resetting an malta board
> - */
> -
> -#include <common.h>
> -#include <asm/io.h>
> -#include <mach/iomap.h>
> -
> -#define PRM_RSTCTRL TEGRA_PMC_BASE
> -
> -void __noreturn reset_cpu(ulong addr)
> -{
> - int rstctrl;
> -
> - rstctrl = __raw_readl((char *)PRM_RSTCTRL);
> - rstctrl |= 0x10;
> - __raw_writel(rstctrl, (char *)PRM_RSTCTRL);
> -
> - unreachable();
> -}
> -EXPORT_SYMBOL(reset_cpu);
> diff --git a/arch/arm/mach-tegra/tegra20-pmc.c b/arch/arm/mach-tegra/tegra20-pmc.c
> new file mode 100644
> index 0000000..ed765f5
> --- /dev/null
> +++ b/arch/arm/mach-tegra/tegra20-pmc.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright (C) 2013 Lucas Stach <l.stach@pengutronix.de>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope 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.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +/**
> + * @file
> + * @brief Device driver for the Tegra 20 power management controller.
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +#include <io.h>
> +
> +/* register definitions */
> +#define PMC_CNTRL 0x00
> +#define PMC_CNTRL_FUSE_OVERRIDE (1 << 18)
> +#define PMC_CNTRL_INTR_POLARITY (1 << 17)
> +#define PMC_CNTRL_CPUPWRREQ_OE (1 << 16)
> +#define PMC_CNTRL_CPUPWRREQ_POLARITY (1 << 15)
> +#define PMC_CNTRL_SIDE_EFFECT_LP0 (1 << 14)
> +#define PMC_CNTRL_AOINIT (1 << 13)
> +#define PMC_CNTRL_PWRGATE_DIS (1 << 12)
> +#define PMC_CNTRL_SYSCLK_OE (1 << 11)
> +#define PMC_CNTRL_SYSCLK_POLARITY (1 << 10)
> +#define PMC_CNTRL_PWRREQ_OE (1 << 9)
> +#define PMC_CNTRL_PWRREQ_POLARITY (1 << 8)
> +#define PMC_CNTRL_BLINK_EN (1 << 7)
> +#define PMC_CNTRL_GLITCHDET_DIS (1 << 6)
> +#define PMC_CNTRL_LATCHWAKE_EN (1 << 5)
> +#define PMC_CNTRL_MAIN_RST (1 << 4)
> +#define PMC_CNTRL_KBC_RST (1 << 3)
> +#define PMC_CNTRL_RTC_RST (1 << 2)
> +#define PMC_CNTRL_RTC_CLK_DIS (1 << 1)
> +#define PMC_CNTRL_KBC_CLK_DIS (1 << 0)
> +
> +static void __iomem *pmc_base;
> +
> +/* main SoC reset trigger */
> +void __noreturn reset_cpu(ulong addr)
> +{
> + writel(PMC_CNTRL_MAIN_RST, pmc_base + PMC_CNTRL);
> +
> + unreachable();
> +}
> +EXPORT_SYMBOL(reset_cpu);
> +
> +static int tegra20_pmc_probe(struct device_d *dev)
> +{
> + pmc_base = dev_request_mem_region(dev, 0);
> + if (!pmc_base) {
> + dev_err(dev, "could not get memory region\n");
> + return -ENODEV;
> + }
> +
> + return 0;
> +}
> +
> +static __maybe_unused struct of_device_id tegra20_pmc_dt_ids[] = {
> + {
> + .compatible = "nvidia,tegra20-pmc",
> + }, {
> + /* sentinel */
> + }
> +};
> +
> +static struct driver_d tegra20_pmc_driver = {
> + .probe = tegra20_pmc_probe,
> + .name = "tegra20-pmc",
> + .of_compatible = DRV_OF_COMPAT(tegra20_pmc_dt_ids),
> +};
> +
> +static int tegra20_pmc_init(void)
> +{
> + return platform_driver_register(&tegra20_pmc_driver);
> +}
> +
> +coredevice_initcall(tegra20_pmc_init);
> diff --git a/arch/arm/mach-tegra/tegra20.c b/arch/arm/mach-tegra/tegra20.c
> index c1b3f78..884671a 100644
> --- a/arch/arm/mach-tegra/tegra20.c
> +++ b/arch/arm/mach-tegra/tegra20.c
> @@ -28,6 +28,10 @@ static int tegra20_init(void)
> TEGRA_TMR1_BASE, TEGRA_TMR1_SIZE,
> IORESOURCE_MEM, NULL);
>
> + add_generic_device("tegra20-pmc", DEVICE_ID_SINGLE, NULL,
> + TEGRA_PMC_BASE, TEGRA_PMC_SIZE,
> + IORESOURCE_MEM, NULL);
> +
> return 0;
> }
>
> --
> 1.8.1.2
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2013-03-10 8:19 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-01 9:22 [PATCH 0/7] Rework current Tegra support Lucas Stach
2013-03-01 9:22 ` [PATCH 1/7] tegra: move address map to tegra20-silicon.h Lucas Stach
2013-03-01 13:17 ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-02 23:25 ` Lucas Stach
2013-03-04 19:26 ` Antony Pavlov
2013-03-01 9:22 ` [PATCH 2/7] tegra: remove debug_ll Lucas Stach
2013-03-01 13:17 ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-01 17:19 ` Sascha Hauer
2013-03-01 9:22 ` [PATCH 3/7] tegra: switch to ARMv7 cpu type Lucas Stach
2013-03-01 9:22 ` [PATCH 4/7] tegra: add blank tegra20 platform init Lucas Stach
2013-03-01 13:16 ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-01 9:22 ` [PATCH 5/7] tegra: add driver for the clock and reset module Lucas Stach
2013-03-01 17:26 ` Sascha Hauer
2013-03-02 23:16 ` Lucas Stach
2013-03-01 9:22 ` [PATCH 6/7] tegra: add proper timer driver Lucas Stach
2013-03-01 13:14 ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-01 17:23 ` Sascha Hauer
2013-03-02 23:13 ` Lucas Stach
2013-03-03 7:07 ` Antony Pavlov
2013-03-04 17:09 ` Lucas Stach
2013-03-04 19:14 ` Antony Pavlov
2013-03-01 9:22 ` [PATCH 7/7] tegra: add power management controller driver Lucas Stach
2013-03-01 13:15 ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-01 17:28 ` Sascha Hauer
2013-03-01 18:00 ` Antony Pavlov
2013-03-02 23:21 ` Lucas Stach
2013-03-07 10:33 ` [PATCH v2 0/5] Rework current Tegra support Lucas Stach
2013-03-07 10:33 ` [PATCH v2 1/5] tegra: pull in iomap.h from the Linux kernel Lucas Stach
2013-03-07 10:33 ` [PATCH v2 2/5] tegra: switch to ARMv7 cpu type Lucas Stach
2013-03-08 6:03 ` Antony Pavlov
2013-03-08 13:17 ` Lucas Stach
2013-03-08 16:56 ` Antony Pavlov
2013-03-08 14:32 ` Sascha Hauer
2013-03-08 17:15 ` Antony Pavlov
2013-03-07 10:33 ` [PATCH v2 3/5] tegra: add driver for the clock and reset module Lucas Stach
2013-03-10 7:41 ` Antony Pavlov
2013-03-10 9:53 ` Sascha Hauer
2013-03-07 10:33 ` [PATCH v2 4/5] tegra: add proper timer driver Lucas Stach
2013-03-10 7:12 ` Antony Pavlov
2013-03-07 10:33 ` [PATCH v2 5/5] tegra: add power management controller driver Lucas Stach
2013-03-10 8:19 ` Antony Pavlov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAA4bVAEXyZ_NBTA7qUVqB=VdCPMihW+XxmJdCNqCkD96P7hRnQ@mail.gmail.com' \
--to=antonynpavlov@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=dev@lynxeye.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox