From patchwork Thu Feb 12 02:55:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 5815791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E6E489F37F for ; Thu, 12 Feb 2015 03:02:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 404EF201ED for ; Thu, 12 Feb 2015 03:02:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 032762017E for ; Thu, 12 Feb 2015 03:02:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YLk0q-0005tS-1F; Thu, 12 Feb 2015 03:00:20 +0000 Received: from eusmtp01.atmel.com ([212.144.249.242]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YLk0b-0004W6-G8 for linux-arm-kernel@lists.infradead.org; Thu, 12 Feb 2015 03:00:09 +0000 Received: from apsmtp01.atmel.com (10.168.254.30) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.2.347.0; Thu, 12 Feb 2015 03:59:41 +0100 Received: from shaarm01.corp.atmel.com (10.168.254.13) by apsmtp01.corp.atmel.com (10.168.254.30) with Microsoft SMTP Server id 14.2.347.0; Thu, 12 Feb 2015 11:00:23 +0800 From: Wenyou Yang To: , , Subject: [PATCH 1/2] pm: at91: add the PM initialization for the sama5d3 and sama5d4 Date: Thu, 12 Feb 2015 10:55:16 +0800 Message-ID: <1423709716-8576-1-git-send-email-wenyou.yang@atmel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1423709668-8539-1-git-send-email-wenyou.yang@atmel.com> References: <1423709668-8539-1-git-send-email-wenyou.yang@atmel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150211_190005_981979_A20F69CB X-CRM114-Status: GOOD ( 12.89 ) X-Spam-Score: -0.7 (/) Cc: mark.rutland@arm.com, lorenzo.pieralisi@arm.com, sergei.shtylyov@cogentembedded.com, sylvain.rochet@finsecur.com, patrice.vilchez@atmel.com, linux-kernel@vger.kernel.org, wenyou.yang@atmel.com, alexandre.belloni@free-electrons.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To get the mpddrc peripheral id from the PM initialization, which will be used to disable mpddrc'c clock during suspending. Signed-off-by: Wenyou Yang --- arch/arm/mach-at91/generic.h | 4 ++++ arch/arm/mach-at91/include/mach/sama5d3.h | 1 + arch/arm/mach-at91/include/mach/sama5d4.h | 5 +++++ arch/arm/mach-at91/pm.c | 21 +++++++++++++++++++++ arch/arm/mach-at91/sama5.c | 10 ++++++++-- 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index a6e726a..fa70811 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h @@ -34,11 +34,15 @@ extern void __init at91rm9200_pm_init(void); extern void __init at91sam9260_pm_init(void); extern void __init at91sam9g45_pm_init(void); extern void __init at91sam9x5_pm_init(void); +extern void __init sam5d3_pm_init(void); +extern void __init sam5d4_pm_init(void); #else void __init at91rm9200_pm_init(void) { } void __init at91sam9260_pm_init(void) { } void __init at91sam9g45_pm_init(void) { } void __init at91sam9x5_pm_init(void) { } +void __init sam5d3_pm_init(void) {} +void __init sam5d4_pm_init(void) {} #endif #endif /* _AT91_GENERIC_H */ diff --git a/arch/arm/mach-at91/include/mach/sama5d3.h b/arch/arm/mach-at91/include/mach/sama5d3.h index 25613d8..5a383d8 100644 --- a/arch/arm/mach-at91/include/mach/sama5d3.h +++ b/arch/arm/mach-at91/include/mach/sama5d3.h @@ -63,6 +63,7 @@ #define SAMA5D3_ID_TDES 44 /* Triple Data Encryption Standard */ #define SAMA5D3_ID_TRNG 45 /* True Random Generator Number */ #define SAMA5D3_ID_IRQ0 47 /* Advanced Interrupt Controller (IRQ0) */ +#define SAMA5D3_ID_MPDDRC 49 /* MPDDR controller */ /* * User Peripheral physical base addresses. diff --git a/arch/arm/mach-at91/include/mach/sama5d4.h b/arch/arm/mach-at91/include/mach/sama5d4.h index f256a45..e45f1b8 100644 --- a/arch/arm/mach-at91/include/mach/sama5d4.h +++ b/arch/arm/mach-at91/include/mach/sama5d4.h @@ -14,6 +14,11 @@ #define SAMA5D4_H /* + * Peripheral identifiers/interrupts. + */ +#define SAMA5D4_ID_MPDDRC 16 /* MPDDR controller */ + +/* * User Peripheral physical base addresses. */ #define SAMA5D4_BASE_USART3 0xfc00c000 /* (USART3 non-secure) Base Address */ diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 2574bad..7acb40e 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -41,6 +41,8 @@ static struct { unsigned long uhp_udp_mask; int memctrl; + unsigned int ddrc_pid; + bool is_sama5d4; } at91_pm_data; void __iomem *at91_ramc_base[2]; @@ -360,3 +362,22 @@ void __init at91sam9x5_pm_init(void) at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; return at91_pm_init(); } + +void __init sam5d3_pm_init(void) +{ + at91_dt_ramc(); + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; + at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; + at91_pm_data.ddrc_pid = SAMA5D3_ID_MPDDRC; + return at91_pm_init(); +} + +void __init sam5d4_pm_init(void) +{ + at91_dt_ramc(); + at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; + at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; + at91_pm_data.ddrc_pid = SAMA5D4_ID_MPDDRC; + at91_pm_data.is_sama5d4 = true; + return at91_pm_init(); +} diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c index 228814a..4338d43 100644 --- a/arch/arm/mach-at91/sama5.c +++ b/arch/arm/mach-at91/sama5.c @@ -31,7 +31,7 @@ static void __init sama5_dt_device_init(void) { of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); - at91sam9x5_pm_init(); + sam5d3_pm_init(); } static const char *sama5_dt_board_compat[] __initconst = { @@ -84,10 +84,16 @@ static const char *sama5_alt_dt_board_compat[] __initconst = { NULL }; +static void __init sama5d4_dt_device_init(void) +{ + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + sam5d4_pm_init(); +} + DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5") /* Maintainer: Atmel */ .map_io = sama5_alt_map_io, - .init_machine = sama5_dt_device_init, + .init_machine = sama5d4_dt_device_init, .dt_compat = sama5_alt_dt_board_compat, .l2c_aux_mask = ~0UL, MACHINE_END