]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP1: Make omap1 use MMC multislot structures
authorFelipe Balbi <felipe.lima@indt.org.br>
Tue, 27 Nov 2007 04:01:45 +0000 (00:01 -0400)
committerTony Lindgren <tony@atomide.com>
Fri, 8 Feb 2008 18:38:01 +0000 (10:38 -0800)
Make omap1 use new MMC multislot structures. The related MMC
patches will be sent separately.

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Signed-off-by: Anderson Briglia <anderson.briglia@indt.org.br>
Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
Signed-off-by: David Cohen <david.cohen@indt.org.br>
Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/configs/omap_h2_1610_defconfig
arch/arm/mach-omap1/Makefile
arch/arm/mach-omap1/board-h2-mmc.c [new file with mode: 0644]
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3-mmc.c [new file with mode: 0644]
arch/arm/mach-omap1/board-h3.c
include/asm-arm/arch-omap/board-apollon.h
include/asm-arm/arch-omap/board-h2.h
include/asm-arm/arch-omap/board-h3.h

index b8a78ab49cdd494fb3b860af9197f3c9a2540fe4..64aa431f851485a2ab3527cd65262c9b43d26c1b 100644 (file)
@@ -74,12 +74,20 @@ CONFIG_SLAB=y
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
+
+#
+# Loadable module support
+#
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 # CONFIG_KMOD is not set
+
+#
+# Block layer
+#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
@@ -358,8 +366,20 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_INET6_TUNNEL is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
+
+#
+# DCCP Configuration (EXPERIMENTAL)
+#
 # CONFIG_IP_DCCP is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
 # CONFIG_IP_SCTP is not set
+
+#
+# TIPC Configuration (EXPERIMENTAL)
+#
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -408,6 +428,10 @@ CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
 # CONFIG_SYS_HYPERVISOR is not set
+
+#
+# Connector - unified userspace <-> kernelspace linker
+#
 # CONFIG_CONNECTOR is not set
 # CONFIG_MTD is not set
 # CONFIG_PARPORT is not set
@@ -463,7 +487,15 @@ CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_ATA is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
 # CONFIG_MD is not set
+
+#
+# Network device support
+#
 CONFIG_NETDEVICES=y
 # CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
@@ -472,6 +504,10 @@ CONFIG_NETDEVICES=y
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
 # CONFIG_PHYLIB is not set
+
+#
+# Ethernet (10 or 100Mbit)
+#
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
 # CONFIG_AX88796 is not set
@@ -480,6 +516,10 @@ CONFIG_SMC91X=y
 CONFIG_NETDEV_1000=y
 CONFIG_NETDEV_10000=y
 
+#
+# Token Ring devices
+#
+
 #
 # Wireless LAN
 #
@@ -505,6 +545,10 @@ CONFIG_SLHC=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
+
+#
+# ISDN subsystem
+#
 # CONFIG_ISDN is not set
 
 #
@@ -541,6 +585,7 @@ CONFIG_INPUT_MISC=y
 # CONFIG_INPUT_POWERMATE is not set
 # CONFIG_INPUT_YEALINK is not set
 CONFIG_INPUT_UINPUT=y
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Hardware I/O ports
@@ -575,6 +620,10 @@ CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 # CONFIG_LEGACY_PTYS is not set
+
+#
+# IPMI
+#
 # CONFIG_IPMI_HANDLER is not set
 CONFIG_WATCHDOG=y
 CONFIG_WATCHDOG_NOWAYOUT=y
@@ -588,6 +637,10 @@ CONFIG_WATCHDOG_NOWAYOUT=y
 # CONFIG_NVRAM is not set
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
+
+#
+# TPM devices
+#
 # CONFIG_TCG_TPM is not set
 # CONFIG_I2C is not set
 
@@ -771,8 +824,9 @@ CONFIG_DNOTIFY=y
 #
 CONFIG_FAT_FS=y
 CONFIG_MSDOS_FS=y
-# CONFIG_VFAT_FS is not set
+CONFIG_VFAT_FS=y
 CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # CONFIG_NTFS_FS is not set
 
 #
@@ -838,7 +892,7 @@ CONFIG_MSDOS_PARTITION=y
 #
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
+CONFIG_NLS_CODEPAGE_437=y
 # CONFIG_NLS_CODEPAGE_737 is not set
 # CONFIG_NLS_CODEPAGE_775 is not set
 # CONFIG_NLS_CODEPAGE_850 is not set
@@ -862,7 +916,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_CODEPAGE_1250 is not set
 # CONFIG_NLS_CODEPAGE_1251 is not set
 # CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_ISO8859_1 is not set
+CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
 # CONFIG_NLS_ISO8859_3 is not set
 # CONFIG_NLS_ISO8859_4 is not set
index 391b6f4827f6a82db99753003a6e4510daea3f17..416a778611b49fc74cfb487282e3ba0436ab76e3 100644 (file)
@@ -13,13 +13,13 @@ obj-$(CONFIG_PM) += pm.o sleep.o
 led-y := leds.o
 
 # Specific board support
-obj-$(CONFIG_MACH_OMAP_H2)             += board-h2.o
+obj-$(CONFIG_MACH_OMAP_H2)             += board-h2.o board-h2-mmc.o
 obj-$(CONFIG_MACH_OMAP_INNOVATOR)      += board-innovator.o
 obj-$(CONFIG_MACH_OMAP_GENERIC)                += board-generic.o
 obj-$(CONFIG_MACH_OMAP_PERSEUS2)       += board-perseus2.o
 obj-$(CONFIG_MACH_OMAP_FSAMPLE)                += board-fsample.o
 obj-$(CONFIG_MACH_OMAP_OSK)            += board-osk.o
-obj-$(CONFIG_MACH_OMAP_H3)             += board-h3.o
+obj-$(CONFIG_MACH_OMAP_H3)             += board-h3.o board-h3-mmc.o
 obj-$(CONFIG_MACH_VOICEBLUE)           += board-voiceblue.o
 obj-$(CONFIG_MACH_OMAP_PALMTE)         += board-palmte.o
 obj-$(CONFIG_MACH_OMAP_PALMZ71)                += board-palmz71.o
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
new file mode 100644 (file)
index 0000000..6fdc784
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * linux/arch/arm/mach-omap1/board-h2-mmc.c
+ *
+ * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
+ * Author: Felipe Balbi <felipe.lima@indt.org.br>
+ *
+ * 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 <asm/arch/mmc.h>
+#include <asm/arch/gpio.h>
+
+#ifdef CONFIG_MMC_OMAP
+static int slot_cover_open;
+static struct device *mmc_device;
+
+static int h2_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 h2_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;
+       }
+
+       return 0;
+}
+
+static int h2_mmc_get_cover_state(struct device *dev, int slot)
+{
+       BUG_ON(slot != 0);
+
+       return slot_cover_open;
+}
+
+void h2_mmc_slot_cover_handler(void *arg, int state)
+{
+       if (mmc_device == NULL)
+               return;
+
+       slot_cover_open = state;
+       omap_mmc_notify_cover_event(mmc_device, 0, state);
+}
+
+static int h2_mmc_late_init(struct device *dev)
+{
+       int ret = 0;
+
+       mmc_device = dev;
+
+       return ret;
+}
+
+static void h2_mmc_cleanup(struct device *dev)
+{
+}
+
+static struct omap_mmc_platform_data h2_mmc_data = {
+       .nr_slots                       = 1,
+       .switch_slot                    = NULL,
+       .init                           = h2_mmc_late_init,
+       .cleanup                        = h2_mmc_cleanup,
+       .slots[0]       = {
+               .set_power              = h2_mmc_set_power,
+               .set_bus_mode           = h2_mmc_set_bus_mode,
+               .get_ro                 = NULL,
+               .get_cover_state        = h2_mmc_get_cover_state,
+               .ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
+                                         MMC_VDD_32_33 | MMC_VDD_33_34,
+               .name                   = "mmcblk",
+       },
+};
+
+void __init h2_mmc_init(void)
+{
+       omap_set_mmc_info(1, &h2_mmc_data);
+}
+
+#else
+
+void __init h2_mmc_init(void)
+{
+}
+
+void h2_mmc_slot_cover_handler(void *arg, int state)
+{
+}
+#endif
index 18899d74d4c071253242958fd015f90451372647..ab6e68b00064fef99713684a35b045cb34977e02 100644 (file)
@@ -389,15 +389,14 @@ static struct omap_usb_config h2_usb_config __initdata = {
 };
 
 static struct omap_mmc_config h2_mmc_config __initdata = {
-       .mmc [0] = {
-               .enabled        = 1,
+       .mmc[0] = {
+               .enabled        = 1,
                .wire4          = 1,
-               .wp_pin         = OMAP_MPUIO(3),
-               .power_pin      = -1,   /* tps65010 gpio3 */
-               .switch_pin     = OMAP_MPUIO(1),
        },
 };
 
+extern struct omap_mmc_platform_data h2_mmc_data;
+
 static struct omap_uart_config h2_uart_config __initdata = {
        .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -459,6 +458,7 @@ static void __init h2_init(void)
        omap_board_config = h2_config;
        omap_board_config_size = ARRAY_SIZE(h2_config);
        omap_serial_init();
+       h2_mmc_init();
 
        /* irq for tps65010 chip */
        omap_cfg_reg(W4_GPIO58);
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
new file mode 100644 (file)
index 0000000..66ecc43
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * linux/arch/arm/mach-omap1/board-h3-mmc.c
+ *
+ * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
+ * Author: Felipe Balbi <felipe.lima@indt.org.br>
+ *
+ * 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 <asm/arch/mmc.h>
+#include <asm/arch/gpio.h>
+
+#ifdef CONFIG_MMC_OMAP
+static int slot_cover_open;
+static struct device *mmc_device;
+
+static int h3_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 h3_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)
+{
+       int ret = 0;
+
+#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 h3_mmc_get_cover_state(struct device *dev, int slot)
+{
+       BUG_ON(slot != 0);
+
+       return slot_cover_open;
+}
+
+void h3_mmc_slot_cover_handler(void *arg, int state)
+{
+       if (mmc_device == NULL)
+               return;
+
+       slot_cover_open = state;
+       omap_mmc_notify_cover_event(mmc_device, 0, state);
+}
+
+static int h3_mmc_late_init(struct device *dev)
+{
+       int ret = 0;
+
+       mmc_device = dev;
+
+       return ret;
+}
+
+static void h3_mmc_cleanup(struct device *dev)
+{
+}
+
+static struct omap_mmc_platform_data h3_mmc_data = {
+       .nr_slots                       = 1,
+       .switch_slot                    = NULL,
+       .init                           = h3_mmc_late_init,
+       .cleanup                        = h3_mmc_cleanup,
+       .slots[0]       = {
+               .set_power              = h3_mmc_set_power,
+               .set_bus_mode           = h3_mmc_set_bus_mode,
+               .get_ro                 = NULL,
+               .get_cover_state        = h3_mmc_get_cover_state,
+               .ocr_mask               = MMC_VDD_28_29 | MMC_VDD_30_31 |
+                                         MMC_VDD_32_33 | MMC_VDD_33_34,
+               .name                   = "mmcblk",
+       },
+};
+
+void __init h3_mmc_init(void)
+{
+       omap_set_mmc_info(1, &h3_mmc_data);
+}
+
+#else
+
+void __init h3_mmc_init(void)
+{
+}
+
+void h3_mmc_slot_cover_handler(void *arg, int state)
+{
+}
+#endif
index 67ae5035a7efa9c029d89f31378bf22b545be09b..f28f05d6760dfbf95c8d57267ef3241c36b934b8 100644 (file)
@@ -437,12 +437,13 @@ static struct omap_usb_config h3_usb_config __initdata = {
 
 static struct omap_mmc_config h3_mmc_config __initdata = {
        .mmc[0] = {
-               .enabled        = 1,
-               .power_pin      = -1,   /* tps65010 GPIO4 */
-               .switch_pin     = OMAP_MPUIO(1),
-       },
+               .enabled        = 1,
+               .wire4          = 1,
+       },
 };
 
+extern struct omap_mmc_platform_data h3_mmc_data;
+
 static struct omap_uart_config h3_uart_config __initdata = {
        .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -471,6 +472,18 @@ static struct i2c_board_info __initdata h3_i2c_board_info[] = {
         */
 };
 
+static struct omap_gpio_switch h3_gpio_switches[] __initdata = {
+       {
+               .name                   = "mmc_slot",
+               .gpio                   = OMAP_MPUIO(1),
+               .type                   = OMAP_GPIO_SWITCH_TYPE_COVER,
+               .debounce_rising        = 100,
+               .debounce_falling       = 0,
+               .notify                 = h3_mmc_slot_cover_handler,
+               .notify_data            = NULL,
+       },
+};
+
 #define H3_NAND_RB_GPIO_PIN    10
 
 static int nand_dev_ready(struct omap_nand_platform_data *data)
@@ -504,6 +517,7 @@ static void __init h3_init(void)
        omap_board_config = h3_config;
        omap_board_config_size = ARRAY_SIZE(h3_config);
        omap_serial_init();
+       h3_mmc_init();
 
        /* FIXME setup irq for tps65013 chip */
        i2c_register_board_info(1, h3_i2c_board_info,
index dcb587b311f18fa038b21c38ff0044861a6a9bab..547125a4695e0bbf94c503c2ad6414f64009616b 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef __ASM_ARCH_OMAP_APOLLON_H
 #define __ASM_ARCH_OMAP_APOLLON_H
 
+extern void apollon_mmc_init(void);
+
 /* Placeholder for APOLLON specific defines */
 #define APOLLON_ETHR_GPIO_IRQ          74
 
index b2888ef9e9b4ada2a72ac22ae39ef6508cf6fe56..c322796d0d26ce94d60b841f491ddfb326ab4e78 100644 (file)
@@ -34,5 +34,8 @@
 /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
 #define OMAP1610_ETHR_START            0x04000300
 
+extern void h2_mmc_init(void);
+extern void h2_mmc_slot_cover_handler(void *arg, int state);
+
 #endif /*  __ASM_ARCH_OMAP_H2_H */
 
index 761ea0a178972a961ca9e8a7ee4726bc1c30dcba..1c2b55c61ca013b1f4704511a8e04b645368fdac 100644 (file)
@@ -36,5 +36,7 @@
 
 #define NR_IRQS                                (MAXIRQNUM + 1)
 
+extern void __init h3_mmc_init(void);
+extern void h3_mmc_slot_cover_handler(void *arg, int state);
 
 #endif /*  __ASM_ARCH_OMAP_H3_H */