From patchwork Sat Aug 17 22:15:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 268004 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5D4C22C00A6 for ; Sun, 18 Aug 2013 08:15:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754807Ab3HQWPb (ORCPT ); Sat, 17 Aug 2013 18:15:31 -0400 Received: from mail-la0-f51.google.com ([209.85.215.51]:39530 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754712Ab3HQWPa (ORCPT ); Sat, 17 Aug 2013 18:15:30 -0400 Received: by mail-la0-f51.google.com with SMTP id es20so2426110lab.38 for ; Sat, 17 Aug 2013 15:15:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:organization:to:subject:date:user-agent:cc :references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=RXW00OO9sBMp7eFOQKYiFL3aAgtsJx6DM501Jy8umjg=; b=OzZ9XscLqTY4hQ7hsu775U+ZHT03jFmI1Lvu61lDkZtQ2Pa8F9F12N9Whpl3Lrzli+ sWubBiwmzQ5fVkxVqnzZukauxhmtaj0c0ySFKvQT306oN95Pj6/nfBQTUTbDMjIiWLDL 3zl9pDaH5IkmNr84+8UJtd40OBzH6SnYsEWlLpTo3WTPacMM7Tu53qaxQnN73Ic4Ybtl KYndHyJiyXgT1C3U5DfaI3yfaBrroAM8V5nVtJ/zrncHNHJYaYFdnOrLMjmWX5W4bKdG Ua1fD3YAeASRBoCLcKK+wkYMFgXy4GaD+9gGZ8xj8wpbk0vaSHcyvw3lLK22K7Et+zyf Vjvg== X-Gm-Message-State: ALoCoQlDMaQGC2wG0oG4BO+ZX0DrZBJrSuQXL3/QUJLkn2Zb+vbrCd5ZnTEMvS/IiIHOGrYb5hBO X-Received: by 10.112.136.38 with SMTP id px6mr38576lbb.29.1376777728598; Sat, 17 Aug 2013 15:15:28 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-76-155-153.pppoe.mtu-net.ru. [91.76.155.153]) by mx.google.com with ESMTPSA id i9sm1674477laa.3.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 17 Aug 2013 15:15:27 -0700 (PDT) From: Sergei Shtylyov Organization: Cogent Embedded To: netdev@vger.kernel.org Subject: [PATCH 1/2] SH7619: fix Ether support Date: Sun, 18 Aug 2013 02:15:42 +0400 User-Agent: KMail/1.13.5 (Linux/2.6.32.26-175.fc12.i686.PAE; KDE/4.4.5; i686; ; ) Cc: lethal@linux-sh.org, linux-sh@vger.kernel.org, davem@davemloft.net References: <201308180213.23296.sergei.shtylyov@cogentembedded.com> In-Reply-To: <201308180213.23296.sergei.shtylyov@cogentembedded.com> MIME-Version: 1.0 Message-Id: <201308180215.43063.sergei.shtylyov@cogentembedded.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The 'sh_eth' driver's probe will crash as the platform code is hopelessly behind the platform data -- it passes PHY ID instead of 'struct sh_eth_plat_data *'. Strangely, both commit d88a3ea6fa4c (SH7619 add ethernet controler support) that added the platform code and commit 71557a37adb5 ([netdrvr] sh_eth: Add SH7619 support) were done in about the same time, yet the latter one added 'struct sh_eth_plat_data' and the platform code didn't ever get updated... Add the proper platform data and fix off-by-one memory resource end error, while at it... Signed-off-by: Sergei Shtylyov Cc: stable@vger.kernel.org --- arch/sh/kernel/cpu/sh2/setup-sh7619.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net/arch/sh/kernel/cpu/sh2/setup-sh7619.c =================================================================== --- net.orig/arch/sh/kernel/cpu/sh2/setup-sh7619.c +++ net/arch/sh/kernel/cpu/sh2/setup-sh7619.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -110,10 +111,17 @@ static struct platform_device scif2_devi }, }; +static struct sh_eth_plat_data eth_platform_data = { + .phy = 1, + .edmac_endian = EDMAC_LITTLE_ENDIAN, + .register_type = SH_ETH_REG_FAST_SH3_SH2, + .phy_interace = PHY_INTERFACE_MODE_MII, +}; + static struct resource eth_resources[] = { [0] = { .start = 0xfb000000, - .end = 0xfb0001c8, + .end = 0xfb0001c7, .flags = IORESOURCE_MEM, }, [1] = { @@ -127,7 +135,7 @@ static struct platform_device eth_device .name = "sh7619-ether", .id = -1, .dev = { - .platform_data = (void *)1, + .platform_data = ð_platform_data, }, .num_resources = ARRAY_SIZE(eth_resources), .resource = eth_resources,