From patchwork Mon Oct 26 10:44:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 55853 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9QAktOG012655 for ; Mon, 26 Oct 2009 10:49:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755517AbZJZKt3 (ORCPT ); Mon, 26 Oct 2009 06:49:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755539AbZJZKt3 (ORCPT ); Mon, 26 Oct 2009 06:49:29 -0400 Received: from mail-px0-f179.google.com ([209.85.216.179]:58753 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755517AbZJZKt2 (ORCPT ); Mon, 26 Oct 2009 06:49:28 -0400 Received: by pxi9 with SMTP id 9so1082216pxi.4 for ; Mon, 26 Oct 2009 03:49:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=ebTPweQOYmZsgUXgiLUZ9Z2YHbN7WpFYZ5We85HJnrU=; b=q1cvlkqdTOwwe//2BIwHlr60p/K0cJ1aFzdyWVResvRMhkC3D0IOCBdn8M12+66FTQ 633sGCHd47xx0nhPnFnDyJVbJw+2Si81liLC11RK/rqiare6wZUXqe+cfeeNNGrLe1C+ plBXsaKA/sJ3QcOrPZnjGnt9DqAFQ94ZCkH2g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=mobUMf1lk0uOwt244GktTR6WISaoUNC/3HDGnre+H6n3yY+e4Z5jjLVoahcHW5/YoO ra0O6lDVyrvAeRALyNeKGnW2H5BEz8Hbd6o3Y/y7Vt0Fbs/cQezZmDvxC6X9nTdD2cmi BnZl638y43FzB+cwKU5bthSyejL4C4cNFdbew= Received: by 10.114.237.24 with SMTP id k24mr22684156wah.5.1256554173084; Mon, 26 Oct 2009 03:49:33 -0700 (PDT) Received: from rxone.opensource.se (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id 20sm960510pzk.5.2009.10.26.03.49.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 26 Oct 2009 03:49:32 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Mon, 26 Oct 2009 19:44:37 +0900 Message-Id: <20091026104437.25084.57539.sendpatchset@rxone.opensource.se> Subject: [PATCH] sh: mac address through private data for sh_eth on ecovec24 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org --- 0003/arch/sh/boards/mach-ecovec24/setup.c +++ work/arch/sh/boards/mach-ecovec24/setup.c 2009-10-07 15:11:51.000000000 +0900 @@ -414,12 +414,9 @@ static u8 mac_read(struct i2c_adapter *a return buf; } -#define MAC_LEN 6 -static void __init sh_eth_init(void) +static void __init sh_eth_init(struct sh_eth_plat_data *pd) { struct i2c_adapter *a = i2c_get_adapter(1); - struct clk *eth_clk; - u8 mac[MAC_LEN]; int i; if (!a) { @@ -427,33 +424,11 @@ static void __init sh_eth_init(void) return; } - eth_clk = clk_get(NULL, "eth0"); - if (!eth_clk) { - pr_err("can not get eth0 clk\n"); - return; - } - /* read MAC address frome EEPROM */ - for (i = 0; i < MAC_LEN; i++) { - mac[i] = mac_read(a, 0x10 + i); + for (i = 0; i < sizeof(pd->mac_addr); i++) { + pd->mac_addr[i] = mac_read(a, 0x10 + i); msleep(10); } - - /* clock enable */ - clk_enable(eth_clk); - - /* reset sh-eth */ - ctrl_outl(0x1, SH_ETH_ADDR + 0x0); - - /* set MAC addr */ - ctrl_outl((mac[0] << 24) | - (mac[1] << 16) | - (mac[2] << 8) | - (mac[3] << 0), SH_ETH_MAHR); - ctrl_outl((mac[4] << 8) | - (mac[5] << 0), SH_ETH_MALR); - - clk_put(eth_clk); } #define PORT_HIZA 0xA4050158 @@ -665,7 +640,7 @@ arch_initcall(arch_setup); static int __init devices_setup(void) { - sh_eth_init(); + sh_eth_init(&sh_eth_plat); return 0; } device_initcall(devices_setup);