From patchwork Wed Feb 27 20:39:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2194581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id E0BA9DF2F2 for ; Wed, 27 Feb 2013 19:42:43 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UAmpv-0007aW-24; Wed, 27 Feb 2013 19:38:43 +0000 Received: from mail-lb0-f177.google.com ([209.85.217.177]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UAmpr-0007Zd-Cd for linux-arm-kernel@lists.infradead.org; Wed, 27 Feb 2013 19:38:40 +0000 Received: by mail-lb0-f177.google.com with SMTP id go11so769491lbb.36 for ; Wed, 27 Feb 2013 11:38:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:to:subject:from:organization:date:mime-version :content-type:content-transfer-encoding:message-id :x-gm-message-state; bh=e/Cs+rRewykXxU2fp7TUY9ulcMGDvnbPgtkKp4Fibbo=; b=L/kfQxUk8Glaya+1HkGffvQxbAEMnKCslp+RQhD1gScHD0PDieZL2w+RD+cmAD4TlJ H5JCSjn4ADrMsc4agF1eMeNgE8wioV2WMojpWhRuQXC6vr8vDTkuF1jKXvAHeQk/p80e 021k+3rypoc7GWxVyWMnKw12O01Oi0GP2IiFZReAjcOmFCOsXZQAjAYS/VRIIBteYicT phW52Y3AgvajWyPVrn9vrNQlMKeck2Ng4FdSu7EacEvnc13PMEEHiniYasy0wLBpFDTa OHm8m7PH3OLnozOSQzSE098qthVllEbbLQbG8zhnsG6BVaFXsDfEc+On9oL6JYgJmc5M KdBA== X-Received: by 10.152.148.133 with SMTP id ts5mr3168331lab.2.1361993915679; Wed, 27 Feb 2013 11:38:35 -0800 (PST) Received: from wasted.dev.rtsoft.ru (ppp91-79-66-50.pppoe.mtu-net.ru. [91.79.66.50]) by mx.google.com with ESMTPS id e11sm2114337lbd.11.2013.02.27.11.38.33 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 11:38:34 -0800 (PST) To: horms@verge.net.au, magnus.damm@gmail.com, linux@arm.linux.org.uk, linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org, vladimir.barinov@cogentembedded.com Subject: [PATCH v4 2/3] ARM: mach-shmobile: r8a7779: add SATA support From: Sergei Shtylyov Organization: Cogent Embedded Date: Wed, 27 Feb 2013 23:39:14 +0300 MIME-Version: 1.0 Message-Id: <201302272339.15402.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQlP0+ONLBWsQQBr+kBpRDrfw7Mw+MHXabWVa2pf7nhONLsspXD0I6EtbVTkE5zYiS7JSY9j X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130227_143839_550406_FE2BEE84 X-CRM114-Status: GOOD ( 15.87 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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 From: Vladimir Barinov Add SATA clock for r8a7779 SoC (for both device tree and usual cases). Register SATA controller as a "late" platform device on r8a7779 SoC. Signed-off-by: Vladimir Barinov Signed-off-by: Sergei Shtylyov --- Changes since v3: - recast to apply to the recent 'next' branch. Changes since v1: - added new clock entry for the device tree case instead of the entry in r8a7779_auxdata_lookup[]; - initialized sata_device.dev.[coherent_]dma_mask; - created r8a7779_late_devices[], add SATA device there, and register "late" devices from r8a7779_add_standard_devices(); arch/arm/mach-shmobile/clock-r8a7779.c | 4 ++++ arch/arm/mach-shmobile/setup-r8a7779.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) Index: renesas/arch/arm/mach-shmobile/clock-r8a7779.c =================================================================== --- renesas.orig/arch/arm/mach-shmobile/clock-r8a7779.c +++ renesas/arch/arm/mach-shmobile/clock-r8a7779.c @@ -87,6 +87,7 @@ static struct clk div4_clks[DIV4_NR] = { }; enum { MSTP323, MSTP322, MSTP321, MSTP320, + MSTP115, MSTP101, MSTP100, MSTP030, MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, @@ -99,6 +100,7 @@ static struct clk mstp_clks[MSTP_NR] = { [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */ [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */ [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */ + [MSTP115] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 15, 0), /* SATA */ [MSTP101] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 1, 0), /* USB2 */ [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 0, 0), /* USB0/1 */ [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */ @@ -156,6 +158,8 @@ static struct clk_lookup lookups[] = { CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]), /* MSTP32 clocks */ + CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */ + CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */ CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */ CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ Index: renesas/arch/arm/mach-shmobile/setup-r8a7779.c =================================================================== --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7779.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7779.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -322,6 +323,30 @@ static struct platform_device i2c3_devic .num_resources = ARRAY_SIZE(rcar_i2c3_res), }; +static struct resource sata_resources[] = { + [0] = { + .name = "rcar-sata", + .start = 0xfc600000, + .end = 0xfc601fff, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = gic_spi(100), + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device sata_device = { + .name = "sata_rcar", + .id = -1, + .resource = sata_resources, + .num_resources = ARRAY_SIZE(sata_resources), + .dev = { + .dma_mask = &sata_device.dev.coherent_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + }, +}; + static struct platform_device *r8a7779_devices_dt[] __initdata = { &scif0_device, &scif1_device, @@ -338,6 +363,7 @@ static struct platform_device *r8a7779_l &i2c1_device, &i2c2_device, &i2c3_device, + &sata_device, }; void __init r8a7779_add_standard_devices(void)