From patchwork Wed Dec 2 22:28:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 64364 X-Patchwork-Delegate: tony@atomide.com 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 nB2MT7VO024053 for ; Wed, 2 Dec 2009 22:29:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755878AbZLBW27 (ORCPT ); Wed, 2 Dec 2009 17:28:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755876AbZLBW27 (ORCPT ); Wed, 2 Dec 2009 17:28:59 -0500 Received: from smtp.nokia.com ([192.100.122.233]:63875 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755875AbZLBW25 (ORCPT ); Wed, 2 Dec 2009 17:28:57 -0500 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nB2MSt80012676; Thu, 3 Dec 2009 00:29:02 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 3 Dec 2009 00:29:01 +0200 Received: from mgw-sa01.ext.nokia.com ([147.243.1.47]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 3 Dec 2009 00:29:01 +0200 Received: from localhost.localdomain (esdhcp04340.research.nokia.com [172.21.43.40]) by mgw-sa01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nB2MSkGB011468; Thu, 3 Dec 2009 00:28:59 +0200 From: Felipe Balbi To: linux-omap@vger.kernel.org Cc: Tony Lindgren , Felipe Balbi Subject: [RFT/RFC/PATCH 10/10] cbus: add platform_data to pass gpios Date: Thu, 3 Dec 2009 00:28:32 +0200 Message-Id: <1259792912-11328-11-git-send-email-felipe.balbi@nokia.com> X-Mailer: git-send-email 1.6.6.rc0 In-Reply-To: <1259792912-11328-1-git-send-email-felipe.balbi@nokia.com> References: <1259792912-11328-1-git-send-email-felipe.balbi@nokia.com> X-OriginalArrivalTime: 02 Dec 2009 22:29:01.0563 (UTC) FILETIME=[D8F7DCB0:01CA739E] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index a8debf3..95a3a82 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c @@ -38,6 +38,7 @@ #include #include #include +#include #define ADS7846_PENDOWN_GPIO 15 @@ -97,9 +98,18 @@ static struct platform_device nokia770_kp_device = { .resource = nokia770_kp_resources, }; +static struct cbus_host_platform_data nokia770_cbus_data = { + .clk_gpio = OMAP_MPUIO(11), + .dat_gpio = OMAP_MPUIO(10), + .sel_gpio = OMAP_MPUIO(9), +}; + static struct platform_device nokia770_cbus_device = { .name = "cbus", .id = -1, + .dev = { + .platform_data = &nokia770_cbus_data, + }, }; static struct platform_device *nokia770_devices[] __initdata = { diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index 22eda61..e8198b5 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c @@ -29,6 +29,7 @@ #include #include #include +#include static struct omap2_mcspi_device_config p54spi_mcspi_config = { .turbo_mode = 0, @@ -77,9 +78,18 @@ static struct mtd_partition onenand_partitions[] = { }, }; +static struct cbus_host_platform_data n8x0_cbus_data = { + .clk_gpio = 66, + .dat_gpio = 65, + .sel_gpio = 64, +}; + static struct platform_device n8x0_cbus_device = { .name = "cbus", .id = -1, + .dev = { + .platform_data = &n8x0_cbus_data, + }, }; static struct omap_onenand_platform_data board_onenand_data = { diff --git a/arch/arm/plat-omap/include/plat/cbus.h b/arch/arm/plat-omap/include/plat/cbus.h new file mode 100644 index 0000000..d938e23 --- /dev/null +++ b/arch/arm/plat-omap/include/plat/cbus.h @@ -0,0 +1,31 @@ +/* + * cbus.h - CBUS platform_data definition + * + * Copyright (C) 2004 - 2009 Nokia Corporation + * + * Written by Felipe Balbi + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of this + * archive for more details. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __PLAT_CBUS_H +#define __PLAT_CBUS_H + +struct cbus_host_platform_data { + int dat_gpio; + int clk_gpio; + int sel_gpio; +}; + +#endif /* __PLAT_CBUS_H */ diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c index a35941e..00c3c32 100644 --- a/drivers/cbus/cbus.c +++ b/drivers/cbus/cbus.c @@ -35,6 +35,7 @@ #include #include +#include #include "cbus.h" @@ -226,6 +227,7 @@ EXPORT_SYMBOL(cbus_write_reg); static int __init cbus_bus_probe(struct platform_device *pdev) { struct cbus_host *chost; + struct cbus_host_platform_data *pdata = pdev->dev.platform_data; int ret; chost = kzalloc(sizeof (*chost), GFP_KERNEL); @@ -234,31 +236,9 @@ static int __init cbus_bus_probe(struct platform_device *pdev) spin_lock_init(&chost->lock); - /* REVISIT: Pass these from board-*.c files in platform_data */ - if (machine_is_nokia770()) { - chost->clk_gpio = OMAP_MPUIO(11); - chost->dat_gpio = OMAP_MPUIO(10); - chost->sel_gpio = OMAP_MPUIO(9); - } else if (machine_is_nokia_n800() || machine_is_nokia_n810() || - machine_is_nokia_n810_wimax()) { - chost->clk_gpio = 66; - chost->dat_gpio = 65; - chost->sel_gpio = 64; - } else { - printk(KERN_ERR "cbus: Unsupported board\n"); - ret = -ENODEV; - goto exit1; - } - -#ifdef CONFIG_ARCH_OMAP1 - if (!OMAP_GPIO_IS_MPUIO(chost->clk_gpio) || - !OMAP_GPIO_IS_MPUIO(chost->dat_gpio) || - !OMAP_GPIO_IS_MPUIO(chost->sel_gpio)) { - printk(KERN_ERR "cbus: Only MPUIO pins supported\n"); - ret = -ENODEV; - goto exit1; - } -#endif + chost->clk_gpio = pdata->clk_gpio; + chost->dat_gpio = pdata->dat_gpio; + chost->sel_gpio = pdata->sel_gpio; if ((ret = gpio_request(chost->clk_gpio, "CBUS clk")) < 0) goto exit1;