From patchwork Sat May 29 05:28:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cory Maccarrone X-Patchwork-Id: 103013 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4T5SiW0012535 for ; Sat, 29 May 2010 05:28:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751288Ab0E2F2l (ORCPT ); Sat, 29 May 2010 01:28:41 -0400 Received: from mail-yw0-f198.google.com ([209.85.211.198]:40593 "EHLO mail-yw0-f198.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751271Ab0E2F2l (ORCPT ); Sat, 29 May 2010 01:28:41 -0400 Received: by ywh36 with SMTP id 36so1276700ywh.4 for ; Fri, 28 May 2010 22:28:40 -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:subject:date :message-id:x-mailer:in-reply-to:references; bh=cRRHjlj6gbH1+72xHUsDHqwqaiQceE5g/EcnS57e19k=; b=gFzYD8k8zGkFihDolpEio8YfqxHiiheH8oaclwD/vhD5TfWsnGs5Qr/3xky1SYkrE9 6IWl/817lPZauJ2L7GcASSrofsuVC6L0QHZ1PICF6RZipYxwpyNY9VCtgAVohr4i+N6Q cbMtsH5x97K2DyMsAl5iP650d/MB6j/bNYlhs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=yFi0+fzVWlWhs+P1m5oIlFha62LtIglqFRgrjs8kIku0VNzwopN/7uPfUQsxjNfGTh 6besA7m96ONTzXGnZ8DdANXDPrQhF34c1g4SBdbof9MNyXpsfmrhDZ2ZKSsG5tHiNx0P +zx78bRAqYTnoYZBqhjK0bA9TA48ifWRoYEUk= Received: by 10.231.149.145 with SMTP id t17mr1669538ibv.25.1275110919934; Fri, 28 May 2010 22:28:39 -0700 (PDT) Received: from localhost (97-126-104-191.tukw.qwest.net [97.126.104.191]) by mx.google.com with ESMTPS id a8sm14348769ibi.11.2010.05.28.22.28.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 28 May 2010 22:28:39 -0700 (PDT) From: Cory Maccarrone To: linux-omap@vger.kernel.org Cc: linwizard-devel@lists.sf.net, Cory Maccarrone Subject: [PATCH 1/4] [OMAP1] Add MMC board code common to HTC devices Date: Fri, 28 May 2010 22:28:04 -0700 Message-Id: <1275110887-2918-2-git-send-email-darkstar6262@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1275110887-2918-1-git-send-email-darkstar6262@gmail.com> References: <1275110887-2918-1-git-send-email-darkstar6262@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 29 May 2010 05:28:44 +0000 (UTC) diff --git a/arch/arm/mach-omap1/htc-mmc.c b/arch/arm/mach-omap1/htc-mmc.c new file mode 100644 index 0000000..4fa8bb4 --- /dev/null +++ b/arch/arm/mach-omap1/htc-mmc.c @@ -0,0 +1,104 @@ +/* + * linux/arch/arm/mach-omap1/htc-mmc.c + * + * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT + * Author: Felipe Balbi + * + * This code is based on linux/arch/arm/mach-omap2/board-n800-mmc.c, which is: + * Copyright (C) 2006 Nokia Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include + +#include +#include + +#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) + +#define OMAP_MMC_REG_SYSC (0xfffb7800 + 0x32) +#define OMAP_MMC_REG_SYSS (0xfffb7800 + 0x34) + +static int slot_cover_open; +static struct device *mmc_device; + +static int htc_mmc_set_power(struct device *dev, int slot, int power_on, + int vdd) +{ +#ifdef CONFIG_MMC_DEBUG + dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1, + power_on ? "on" : "off", vdd); +#endif + if (slot != 0) { + dev_err(dev, "No such slot %d\n", slot + 1); + return -ENODEV; + } + + return 0; +} + +static int htc_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode) +{ +#ifdef CONFIG_MMC_DEBUG + dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1, + bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull"); +#endif + if (slot != 0) { + dev_err(dev, "No such slot %d\n", slot + 1); + return -ENODEV; + } + + /* Treated on upper level */ + + return bus_mode; +} + +static int htc_mmc_get_cover_state(struct device *dev, int slot) +{ + BUG_ON(slot != 0); + return slot_cover_open; +} + +static int htc_mmc_late_init(struct device *dev) +{ + mmc_device = dev; + return 0; +} + +static void htc_mmc_cleanup(struct device *dev) +{ +} + +static struct omap_mmc_platform_data htc_mmc1_data = { + .nr_slots = 1, + .switch_slot = NULL, + .init = htc_mmc_late_init, + .cleanup = htc_mmc_cleanup, + .slots[0] = { + .set_power = htc_mmc_set_power, + .set_bus_mode = htc_mmc_set_bus_mode, + .get_ro = NULL, + .get_cover_state = htc_mmc_get_cover_state, + .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | + MMC_VDD_32_33 | MMC_VDD_33_34, + .name = "mmcblk", + .nomux = 1, + .wires = 4, + .switch_pin = -1, + }, +}; + +static struct omap_mmc_platform_data *htc_mmc_data[1]; + +void __init htc_mmc_init(void) +{ + /* register it */ + htc_mmc_data[0] = &htc_mmc1_data; + omap1_init_mmc(htc_mmc_data, 1); +} +#endif + diff --git a/arch/arm/mach-omap1/htc-mmc.h b/arch/arm/mach-omap1/htc-mmc.h new file mode 100644 index 0000000..480de14 --- /dev/null +++ b/arch/arm/mach-omap1/htc-mmc.h @@ -0,0 +1,26 @@ +/* + * linux/arch/arm/mach-omap1/htc-mmc.h + * + * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT + * Author: Felipe Balbi + * + * This code is based on linux/arch/arm/mach-omap2/board-n800-mmc.c, which is: + * Copyright (C) 2006 Nokia Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef __HTC_MMC_H +#define __HTC_MMC_H + +#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) +extern void htc_mmc_init(void); +#else +static inline void htc_mmc_init(void) +{ +} +#endif + +#endif /* __HTC_MMC_H */ +