diff for duplicates of <20100226233615.GG17041@atomide.com> diff --git a/a/1.txt b/N1/1.txt index 4cc67bd..4178046 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -8,3 +8,10 @@ Menelaus slot switching seems to be all there. Regards, Tony +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: n8x0-mmc.patch +Type: text/x-diff +Size: 11133 bytes +Desc: not available +URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100226/6756f391/attachment.bin> diff --git a/a/2.hdr b/a/2.hdr deleted file mode 100644 index 75e5ad2..0000000 --- a/a/2.hdr +++ /dev/null @@ -1,2 +0,0 @@ -Content-Type: text/x-diff; charset=us-ascii -Content-Disposition: inline; filename="n8x0-mmc.patch" diff --git a/a/2.txt b/a/2.txt deleted file mode 100644 index c561d11..0000000 --- a/a/2.txt +++ /dev/null @@ -1,496 +0,0 @@ -From: Tony Lindgren <tony@atomide.com> -Date: Fri, 26 Feb 2010 15:31:12 -0800 -Subject: [PATCH] omap2: Initialize Menelaus and MMC for N8X0 - -Initialize MMC for N8X0 - -Based on an earlier patches from Nokia released kernel -sources at: - -http://repository.maemo.org/pool/os2008/free/source/k/kernel-source-rx-34/ - -Signed-off-by: Tony Lindgren <tony@atomide.com> - -diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c -index 9de03f8..4cab052 100644 ---- a/arch/arm/mach-omap2/board-n8x0.c -+++ b/arch/arm/mach-omap2/board-n8x0.c -@@ -17,6 +17,7 @@ - #include <linux/init.h> - #include <linux/io.h> - #include <linux/stddef.h> -+#include <linux/i2c.h> - #include <linux/spi/spi.h> - #include <linux/usb/musb.h> - -@@ -25,11 +26,17 @@ - - #include <plat/board.h> - #include <plat/common.h> -+#include <plat/menelaus.h> - #include <mach/irqs.h> - #include <plat/mcspi.h> - #include <plat/onenand.h> -+#include <plat/mmc.h> - #include <plat/serial.h> - -+static int slot1_cover_open; -+static int slot2_cover_open; -+static struct device *mmc_device; -+ - static struct omap2_mcspi_device_config p54spi_mcspi_config = { - .turbo_mode = 0, - .single_channel = 1, -@@ -96,6 +103,442 @@ static void __init n8x0_onenand_init(void) {} - - #endif - -+#if defined(CONFIG_MENELAUS) && \ -+ (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)) -+ -+/* -+ * On both N800 and N810, only the first of the two MMC controllers is in use. -+ * The two MMC slots are multiplexed via Menelaus companion chip over I2C. -+ * On N800, both slots are powered via Menelaus. On N810, only one of the -+ * slots is powered via Menelaus. The N810 EMMC is powered via GPIO. -+ * -+ * VMMC slot 1 on both N800 and N810 -+ * VDCDC3_APE and VMCS2_APE slot 2 on N800 -+ * GPIO23 and GPIO9 slot 2 EMMC on N810 -+ * -+ */ -+#define N8X0_SLOT_SWITCH_GPIO 96 -+#define N810_EMMC_VSD_GPIO 23 -+#define NN810_EMMC_VIO_GPIO 9 -+ -+static int n8x0_mmc_switch_slot(struct device *dev, int slot) -+{ -+#ifdef CONFIG_MMC_DEBUG -+ dev_dbg(dev, "Choose slot %d\n", slot + 1); -+#endif -+ gpio_set_value(N8X0_SLOT_SWITCH_GPIO, slot); -+ return 0; -+} -+ -+static int n8x0_mmc_set_power_menelaus(struct device *dev, int slot, -+ int power_on, int vdd) -+{ -+ int mV; -+ -+#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) { -+ if (!power_on) -+ return menelaus_set_vmmc(0); -+ switch (1 << vdd) { -+ case MMC_VDD_33_34: -+ case MMC_VDD_32_33: -+ case MMC_VDD_31_32: -+ mV = 3100; -+ break; -+ case MMC_VDD_30_31: -+ mV = 3000; -+ break; -+ case MMC_VDD_28_29: -+ mV = 2800; -+ break; -+ case MMC_VDD_165_195: -+ mV = 1850; -+ break; -+ default: -+ BUG(); -+ } -+ return menelaus_set_vmmc(mV); -+ } else { -+ if (!power_on) -+ return menelaus_set_vdcdc(3, 0); -+ switch (1 << vdd) { -+ case MMC_VDD_33_34: -+ case MMC_VDD_32_33: -+ mV = 3300; -+ break; -+ case MMC_VDD_30_31: -+ case MMC_VDD_29_30: -+ mV = 3000; -+ break; -+ case MMC_VDD_28_29: -+ case MMC_VDD_27_28: -+ mV = 2800; -+ break; -+ case MMC_VDD_24_25: -+ case MMC_VDD_23_24: -+ mV = 2400; -+ break; -+ case MMC_VDD_22_23: -+ case MMC_VDD_21_22: -+ mV = 2200; -+ break; -+ case MMC_VDD_20_21: -+ mV = 2000; -+ break; -+ case MMC_VDD_165_195: -+ mV = 1800; -+ break; -+ default: -+ BUG(); -+ } -+ return menelaus_set_vdcdc(3, mV); -+ } -+ return 0; -+} -+ -+static void n810_set_power_emmc(struct device *dev, -+ int power_on) -+{ -+ dev_dbg(dev, "Set EMMC power %s\n", power_on ? "on" : "off"); -+ -+ if (power_on) { -+ gpio_set_value(N810_EMMC_VSD_GPIO, 1); -+ msleep(1); -+ gpio_set_value(NN810_EMMC_VIO_GPIO, 1); -+ msleep(1); -+ } else { -+ gpio_set_value(NN810_EMMC_VIO_GPIO, 0); -+ msleep(50); -+ gpio_set_value(N810_EMMC_VSD_GPIO, 0); -+ msleep(50); -+ } -+} -+ -+static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on, -+ int vdd) -+{ -+ if (machine_is_nokia_n800() || slot == 0) -+ return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd); -+ -+ n810_set_power_emmc(dev, power_on); -+ -+ return 0; -+} -+ -+static int n8x0_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode) -+{ -+ int r; -+ -+ dev_dbg(dev, "Set slot %d bus mode %s\n", slot + 1, -+ bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull"); -+ BUG_ON(slot != 0 && slot != 1); -+ slot++; -+ switch (bus_mode) { -+ case MMC_BUSMODE_OPENDRAIN: -+ r = menelaus_set_mmc_opendrain(slot, 1); -+ break; -+ case MMC_BUSMODE_PUSHPULL: -+ r = menelaus_set_mmc_opendrain(slot, 0); -+ break; -+ default: -+ BUG(); -+ } -+ if (r != 0 && printk_ratelimit()) -+ dev_err(dev, "MMC: unable to set bus mode for slot %d\n", -+ slot); -+ return r; -+} -+ -+static int n8x0_mmc_get_cover_state(struct device *dev, int slot) -+{ -+ slot++; -+ BUG_ON(slot != 1 && slot != 2); -+ if (slot == 1) -+ return slot1_cover_open; -+ else -+ return slot2_cover_open; -+} -+ -+static void n8x0_mmc_callback(void *data, u8 card_mask) -+{ -+ int bit, *openp, index; -+ -+ if (machine_is_nokia_n800()) { -+ bit = 1 << 1; -+ openp = &slot2_cover_open; -+ index = 1; -+ } else { -+ bit = 1; -+ openp = &slot1_cover_open; -+ index = 0; -+ } -+ -+ if (card_mask & bit) -+ *openp = 1; -+ else -+ *openp = 0; -+ -+ omap_mmc_notify_cover_event(mmc_device, index, *openp); -+} -+ -+void n8x0_mmc_slot1_cover_handler(void *arg, int closed_state) -+{ -+ if (mmc_device == NULL) -+ return; -+ -+ slot1_cover_open = !closed_state; -+ omap_mmc_notify_cover_event(mmc_device, 0, closed_state); -+} -+ -+static int n8x0_mmc_late_init(struct device *dev) -+{ -+ int r, bit, *openp; -+ int vs2sel; -+ -+ mmc_device = dev; -+ -+ r = menelaus_set_slot_sel(1); -+ if (r < 0) -+ return r; -+ -+ if (machine_is_nokia_n800()) -+ vs2sel = 0; -+ else -+ vs2sel = 2; -+ -+ r = menelaus_set_mmc_slot(2, 0, vs2sel, 1); -+ if (r < 0) -+ return r; -+ -+ n8x0_mmc_set_power(dev, 0, MMC_POWER_ON, 16); /* MMC_VDD_28_29 */ -+ n8x0_mmc_set_power(dev, 1, MMC_POWER_ON, 16); -+ -+ r = menelaus_set_mmc_slot(1, 1, 0, 1); -+ if (r < 0) -+ return r; -+ r = menelaus_set_mmc_slot(2, 1, vs2sel, 1); -+ if (r < 0) -+ return r; -+ -+ r = menelaus_get_slot_pin_states(); -+ if (r < 0) -+ return r; -+ -+ if (machine_is_nokia_n800()) { -+ bit = 1 << 1; -+ openp = &slot2_cover_open; -+ } else { -+ bit = 1; -+ openp = &slot1_cover_open; -+ slot2_cover_open = 0; -+ } -+ -+ /* All slot pin bits seem to be inversed until first switch change */ -+ if (r == 0xf || r == (0xf & ~bit)) -+ r = ~r; -+ -+ if (r & bit) -+ *openp = 1; -+ else -+ *openp = 0; -+ -+ r = menelaus_register_mmc_callback(n8x0_mmc_callback, NULL); -+ -+ return r; -+} -+ -+static void n8x0_mmc_shutdown(struct device *dev) -+{ -+ int vs2sel; -+ -+ if (machine_is_nokia_n800()) -+ vs2sel = 0; -+ else -+ vs2sel = 2; -+ -+ menelaus_set_mmc_slot(1, 0, 0, 0); -+ menelaus_set_mmc_slot(2, 0, vs2sel, 0); -+} -+ -+static void n8x0_mmc_cleanup(struct device *dev) -+{ -+ menelaus_unregister_mmc_callback(); -+ -+ gpio_free(N8X0_SLOT_SWITCH_GPIO); -+ -+ if (machine_is_nokia_n810()) { -+ gpio_free(N810_EMMC_VSD_GPIO); -+ gpio_free(NN810_EMMC_VIO_GPIO); -+ } -+} -+ -+/* -+ * MMC controller1 has two slots that are multiplexed via I2C. -+ * MMC controller2 is not in use. -+ */ -+static struct omap_mmc_platform_data mmc1_data = { -+ .nr_slots = 2, -+ .switch_slot = n8x0_mmc_switch_slot, -+ .init = n8x0_mmc_late_init, -+ .cleanup = n8x0_mmc_cleanup, -+ .shutdown = n8x0_mmc_shutdown, -+ .max_freq = 24000000, -+ .dma_mask = 0xffffffff, -+ .slots[0] = { -+ .wires = 4, -+ .set_power = n8x0_mmc_set_power, -+ .set_bus_mode = n8x0_mmc_set_bus_mode, -+ .get_cover_state = n8x0_mmc_get_cover_state, -+ .ocr_mask = MMC_VDD_165_195 | MMC_VDD_30_31 | -+ MMC_VDD_32_33 | MMC_VDD_33_34, -+ .name = "internal", -+ }, -+ .slots[1] = { -+ .set_power = n8x0_mmc_set_power, -+ .set_bus_mode = n8x0_mmc_set_bus_mode, -+ .get_cover_state = n8x0_mmc_get_cover_state, -+ .ocr_mask = MMC_VDD_165_195 | MMC_VDD_20_21 | -+ MMC_VDD_21_22 | MMC_VDD_22_23 | -+ MMC_VDD_23_24 | MMC_VDD_24_25 | -+ MMC_VDD_27_28 | MMC_VDD_28_29 | -+ MMC_VDD_29_30 | MMC_VDD_30_31 | -+ MMC_VDD_32_33 | MMC_VDD_33_34, -+ .name = "external", -+ }, -+}; -+ -+static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC]; -+ -+void __init n8x0_mmc_init(void) -+ -+{ -+ int err; -+ -+ if (machine_is_nokia_n810()) { -+ mmc1_data.slots[0].name = "external"; -+ -+ /* -+ * Some Samsung Movinand chips do not like open-ended -+ * multi-block reads and fall to braind-dead state -+ * while doing so. Reducing the number of blocks in -+ * the transfer or delays in clock disable do not help -+ */ -+ mmc1_data.slots[1].name = "internal"; -+ mmc1_data.slots[1].ban_openended = 1; -+ } -+ -+ err = gpio_request(N8X0_SLOT_SWITCH_GPIO, "MMC slot switch"); -+ if (err) -+ return err; -+ -+ gpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0); -+ -+ if (machine_is_nokia_n810()) { -+ err = gpio_request(N810_EMMC_VSD_GPIO, "MMC slot 2 Vddf"); -+ if (err) { -+ gpio_free(N8X0_SLOT_SWITCH_GPIO); -+ return err; -+ } -+ gpio_direction_output(N810_EMMC_VSD_GPIO, 0); -+ -+ err = gpio_request(NN810_EMMC_VIO_GPIO, "MMC slot 2 Vdd"); -+ if (err) { -+ gpio_free(N8X0_SLOT_SWITCH_GPIO); -+ gpio_free(N810_EMMC_VSD_GPIO); -+ return err; -+ } -+ gpio_direction_output(NN810_EMMC_VIO_GPIO, 0); -+ } -+ -+ mmc_data[0] = &mmc1_data; -+ omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC); -+} -+#else -+ -+void __init n8x0_mmc_init(void) -+{ -+} -+ -+void n8x0_mmc_slot1_cover_handler(void *arg, int state) -+{ -+} -+ -+#endif /* CONFIG_MMC_OMAP */ -+ -+#ifdef CONFIG_MENELAUS -+ -+static int n8x0_auto_sleep_regulators(void) -+{ -+ u32 val; -+ int ret; -+ -+ val = EN_VPLL_SLEEP | EN_VMMC_SLEEP \ -+ | EN_VAUX_SLEEP | EN_VIO_SLEEP \ -+ | EN_VMEM_SLEEP | EN_DC3_SLEEP \ -+ | EN_VC_SLEEP | EN_DC2_SLEEP; -+ -+ ret = menelaus_set_regulator_sleep(1, val); -+ if (ret < 0) { -+ printk(KERN_ERR "Could not set regulators to sleep on " -+ "menelaus: %u\n", ret); -+ return ret; -+ } -+ return 0; -+} -+ -+static int n8x0_auto_voltage_scale(void) -+{ -+ int ret; -+ -+ ret = menelaus_set_vcore_hw(1400, 1050); -+ if (ret < 0) { -+ printk(KERN_ERR "Could not set VCORE voltage on " -+ "menelaus: %u\n", ret); -+ return ret; -+ } -+ return 0; -+} -+ -+static int n8x0_menelaus_late_init(struct device *dev) -+{ -+ int ret; -+ -+ ret = n8x0_auto_voltage_scale(); -+ if (ret < 0) -+ return ret; -+ ret = n8x0_auto_sleep_regulators(); -+ if (ret < 0) -+ return ret; -+ return 0; -+} -+ -+static struct i2c_board_info __initdata n8x0_i2c_board_info_1[] = { -+ { -+ I2C_BOARD_INFO("menelaus", 0x72), -+ .irq = INT_24XX_SYS_NIRQ, -+ }, -+}; -+ -+static struct menelaus_platform_data n8x0_menelaus_platform_data = { -+ .late_init = n8x0_menelaus_late_init, -+}; -+ -+static void __init n8x0_menelaus_init(void) -+{ -+ n8x0_i2c_board_info_1[0].platform_data = &n8x0_menelaus_platform_data; -+ omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1, -+ ARRAY_SIZE(n8x0_i2c_board_info_1)); -+} -+ -+#else -+static inline void __init n8x0_menelaus_init(void) -+{ -+} -+#endif -+ - static void __init n8x0_map_io(void) - { - omap2_set_globals_242x(); -@@ -116,7 +559,9 @@ static void __init n8x0_init_machine(void) - ARRAY_SIZE(n800_spi_board_info)); - - omap_serial_init(); -+ n8x0_menelaus_init(); - n8x0_onenand_init(); -+ n8x0_mmc_init(); - } - - MACHINE_START(NOKIA_N800, "Nokia N800") diff --git a/a/content_digest b/N1/content_digest index e35104a..e247e5c 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,10 +1,9 @@ "ref\020100225230116.26233.65157.stgit@baageli.muru.com\0" - "From\0Tony Lindgren <tony@atomide.com>\0" + "From\0tony@atomide.com (Tony Lindgren)\0" "Subject\0[PATCH 7/6] omap2: Initialize Menelaus and MMC for N8X0\0" "Date\0Fri, 26 Feb 2010 15:36:15 -0800\0" "To\0linux-arm-kernel@lists.infradead.org\0" - "Cc\0linux-omap@vger.kernel.org\0" - "\01:1\0" + "\00:1\0" "b\0" "Here's one more to initialize the MMC on N8X0. That's handy\n" "for boot testing the multi-omap kernels on 24xx.\n" @@ -15,505 +14,13 @@ "\n" "Regards,\n" "\n" - Tony - "\01:2\0" - "fn\0n8x0-mmc.patch\0" - "b\0" - "From: Tony Lindgren <tony@atomide.com>\n" - "Date: Fri, 26 Feb 2010 15:31:12 -0800\n" - "Subject: [PATCH] omap2: Initialize Menelaus and MMC for N8X0\n" - "\n" - "Initialize MMC for N8X0\n" - "\n" - "Based on an earlier patches from Nokia released kernel\n" - "sources at:\n" - "\n" - "http://repository.maemo.org/pool/os2008/free/source/k/kernel-source-rx-34/\n" - "\n" - "Signed-off-by: Tony Lindgren <tony@atomide.com>\n" - "\n" - "diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c\n" - "index 9de03f8..4cab052 100644\n" - "--- a/arch/arm/mach-omap2/board-n8x0.c\n" - "+++ b/arch/arm/mach-omap2/board-n8x0.c\n" - "@@ -17,6 +17,7 @@\n" - " #include <linux/init.h>\n" - " #include <linux/io.h>\n" - " #include <linux/stddef.h>\n" - "+#include <linux/i2c.h>\n" - " #include <linux/spi/spi.h>\n" - " #include <linux/usb/musb.h>\n" - " \n" - "@@ -25,11 +26,17 @@\n" - " \n" - " #include <plat/board.h>\n" - " #include <plat/common.h>\n" - "+#include <plat/menelaus.h>\n" - " #include <mach/irqs.h>\n" - " #include <plat/mcspi.h>\n" - " #include <plat/onenand.h>\n" - "+#include <plat/mmc.h>\n" - " #include <plat/serial.h>\n" - " \n" - "+static int slot1_cover_open;\n" - "+static int slot2_cover_open;\n" - "+static struct device *mmc_device;\n" - "+\n" - " static struct omap2_mcspi_device_config p54spi_mcspi_config = {\n" - " \t.turbo_mode\t= 0,\n" - " \t.single_channel = 1,\n" - "@@ -96,6 +103,442 @@ static void __init n8x0_onenand_init(void) {}\n" - " \n" - " #endif\n" - " \n" - "+#if defined(CONFIG_MENELAUS) &&\t\t\t\t\t\t\\\n" - "+\t(defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE))\n" - "+\n" - "+/*\n" - "+ * On both N800 and N810, only the first of the two MMC controllers is in use.\n" - "+ * The two MMC slots are multiplexed via Menelaus companion chip over I2C.\n" - "+ * On N800, both slots are powered via Menelaus. On N810, only one of the\n" - "+ * slots is powered via Menelaus. The N810 EMMC is powered via GPIO.\n" - "+ *\n" - "+ * VMMC\t\t\t\tslot 1 on both N800 and N810\n" - "+ * VDCDC3_APE and VMCS2_APE\tslot 2 on N800\n" - "+ * GPIO23 and GPIO9\t\tslot 2 EMMC on N810\n" - "+ *\n" - "+ */\n" - "+#define N8X0_SLOT_SWITCH_GPIO\t96\n" - "+#define N810_EMMC_VSD_GPIO\t23\n" - "+#define NN810_EMMC_VIO_GPIO\t9\n" - "+\n" - "+static int n8x0_mmc_switch_slot(struct device *dev, int slot)\n" - "+{\n" - "+#ifdef CONFIG_MMC_DEBUG\n" - "+\tdev_dbg(dev, \"Choose slot %d\\n\", slot + 1);\n" - "+#endif\n" - "+\tgpio_set_value(N8X0_SLOT_SWITCH_GPIO, slot);\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static int n8x0_mmc_set_power_menelaus(struct device *dev, int slot,\n" - "+\t\t\t\t\tint power_on, int vdd)\n" - "+{\n" - "+\tint mV;\n" - "+\n" - "+#ifdef CONFIG_MMC_DEBUG\n" - "+\tdev_dbg(dev, \"Set slot %d power: %s (vdd %d)\\n\", slot + 1,\n" - "+\t\tpower_on ? \"on\" : \"off\", vdd);\n" - "+#endif\n" - "+\tif (slot == 0) {\n" - "+\t\tif (!power_on)\n" - "+\t\t\treturn menelaus_set_vmmc(0);\n" - "+\t\tswitch (1 << vdd) {\n" - "+\t\tcase MMC_VDD_33_34:\n" - "+\t\tcase MMC_VDD_32_33:\n" - "+\t\tcase MMC_VDD_31_32:\n" - "+\t\t\tmV = 3100;\n" - "+\t\t\tbreak;\n" - "+\t\tcase MMC_VDD_30_31:\n" - "+\t\t\tmV = 3000;\n" - "+\t\t\tbreak;\n" - "+\t\tcase MMC_VDD_28_29:\n" - "+\t\t\tmV = 2800;\n" - "+\t\t\tbreak;\n" - "+\t\tcase MMC_VDD_165_195:\n" - "+\t\t\tmV = 1850;\n" - "+\t\t\tbreak;\n" - "+\t\tdefault:\n" - "+\t\t\tBUG();\n" - "+\t\t}\n" - "+\t\treturn menelaus_set_vmmc(mV);\n" - "+\t} else {\n" - "+\t\tif (!power_on)\n" - "+\t\t\treturn menelaus_set_vdcdc(3, 0);\n" - "+\t\tswitch (1 << vdd) {\n" - "+\t\tcase MMC_VDD_33_34:\n" - "+\t\tcase MMC_VDD_32_33:\n" - "+\t\t\tmV = 3300;\n" - "+\t\t\tbreak;\n" - "+\t\tcase MMC_VDD_30_31:\n" - "+\t\tcase MMC_VDD_29_30:\n" - "+\t\t\tmV = 3000;\n" - "+\t\t\tbreak;\n" - "+\t\tcase MMC_VDD_28_29:\n" - "+\t\tcase MMC_VDD_27_28:\n" - "+\t\t\tmV = 2800;\n" - "+\t\t\tbreak;\n" - "+\t\tcase MMC_VDD_24_25:\n" - "+\t\tcase MMC_VDD_23_24:\n" - "+\t\t\tmV = 2400;\n" - "+\t\t\tbreak;\n" - "+\t\tcase MMC_VDD_22_23:\n" - "+\t\tcase MMC_VDD_21_22:\n" - "+\t\t\tmV = 2200;\n" - "+\t\t\tbreak;\n" - "+\t\tcase MMC_VDD_20_21:\n" - "+\t\t\tmV = 2000;\n" - "+\t\t\tbreak;\n" - "+\t\tcase MMC_VDD_165_195:\n" - "+\t\t\tmV = 1800;\n" - "+\t\t\tbreak;\n" - "+\t\tdefault:\n" - "+\t\t\tBUG();\n" - "+\t\t}\n" - "+\t\treturn menelaus_set_vdcdc(3, mV);\n" - "+\t}\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static void n810_set_power_emmc(struct device *dev,\n" - "+\t\t\t\t\t int power_on)\n" - "+{\n" - "+\tdev_dbg(dev, \"Set EMMC power %s\\n\", power_on ? \"on\" : \"off\");\n" - "+\n" - "+\tif (power_on) {\n" - "+\t\tgpio_set_value(N810_EMMC_VSD_GPIO, 1);\n" - "+\t\tmsleep(1);\n" - "+\t\tgpio_set_value(NN810_EMMC_VIO_GPIO, 1);\n" - "+\t\tmsleep(1);\n" - "+\t} else {\n" - "+\t\tgpio_set_value(NN810_EMMC_VIO_GPIO, 0);\n" - "+\t\tmsleep(50);\n" - "+\t\tgpio_set_value(N810_EMMC_VSD_GPIO, 0);\n" - "+\t\tmsleep(50);\n" - "+\t}\n" - "+}\n" - "+\n" - "+static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on,\n" - "+\t\t\t int vdd)\n" - "+{\n" - "+\tif (machine_is_nokia_n800() || slot == 0)\n" - "+\t\treturn n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd);\n" - "+\n" - "+\tn810_set_power_emmc(dev, power_on);\n" - "+\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static int n8x0_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)\n" - "+{\n" - "+\tint r;\n" - "+\n" - "+\tdev_dbg(dev, \"Set slot %d bus mode %s\\n\", slot + 1,\n" - "+\t\tbus_mode == MMC_BUSMODE_OPENDRAIN ? \"open-drain\" : \"push-pull\");\n" - "+\tBUG_ON(slot != 0 && slot != 1);\n" - "+\tslot++;\n" - "+\tswitch (bus_mode) {\n" - "+\tcase MMC_BUSMODE_OPENDRAIN:\n" - "+\t\tr = menelaus_set_mmc_opendrain(slot, 1);\n" - "+\t\tbreak;\n" - "+\tcase MMC_BUSMODE_PUSHPULL:\n" - "+\t\tr = menelaus_set_mmc_opendrain(slot, 0);\n" - "+\t\tbreak;\n" - "+\tdefault:\n" - "+\t\tBUG();\n" - "+\t}\n" - "+\tif (r != 0 && printk_ratelimit())\n" - "+\t\tdev_err(dev, \"MMC: unable to set bus mode for slot %d\\n\",\n" - "+\t\t\tslot);\n" - "+\treturn r;\n" - "+}\n" - "+\n" - "+static int n8x0_mmc_get_cover_state(struct device *dev, int slot)\n" - "+{\n" - "+\tslot++;\n" - "+\tBUG_ON(slot != 1 && slot != 2);\n" - "+\tif (slot == 1)\n" - "+\t\treturn slot1_cover_open;\n" - "+\telse\n" - "+\t\treturn slot2_cover_open;\n" - "+}\n" - "+\n" - "+static void n8x0_mmc_callback(void *data, u8 card_mask)\n" - "+{\n" - "+\tint bit, *openp, index;\n" - "+\n" - "+\tif (machine_is_nokia_n800()) {\n" - "+\t\tbit = 1 << 1;\n" - "+\t\topenp = &slot2_cover_open;\n" - "+\t\tindex = 1;\n" - "+\t} else {\n" - "+\t\tbit = 1;\n" - "+\t\topenp = &slot1_cover_open;\n" - "+\t\tindex = 0;\n" - "+\t}\n" - "+\n" - "+\tif (card_mask & bit)\n" - "+\t\t*openp = 1;\n" - "+\telse\n" - "+\t\t*openp = 0;\n" - "+\n" - "+\tomap_mmc_notify_cover_event(mmc_device, index, *openp);\n" - "+}\n" - "+\n" - "+void n8x0_mmc_slot1_cover_handler(void *arg, int closed_state)\n" - "+{\n" - "+\tif (mmc_device == NULL)\n" - "+\t\treturn;\n" - "+\n" - "+\tslot1_cover_open = !closed_state;\n" - "+\tomap_mmc_notify_cover_event(mmc_device, 0, closed_state);\n" - "+}\n" - "+\n" - "+static int n8x0_mmc_late_init(struct device *dev)\n" - "+{\n" - "+\tint r, bit, *openp;\n" - "+\tint vs2sel;\n" - "+\n" - "+\tmmc_device = dev;\n" - "+\n" - "+\tr = menelaus_set_slot_sel(1);\n" - "+\tif (r < 0)\n" - "+\t\treturn r;\n" - "+\n" - "+\tif (machine_is_nokia_n800())\n" - "+\t\tvs2sel = 0;\n" - "+\telse\n" - "+\t\tvs2sel = 2;\n" - "+\n" - "+\tr = menelaus_set_mmc_slot(2, 0, vs2sel, 1);\n" - "+\tif (r < 0)\n" - "+\t\treturn r;\n" - "+\n" - "+\tn8x0_mmc_set_power(dev, 0, MMC_POWER_ON, 16); /* MMC_VDD_28_29 */\n" - "+\tn8x0_mmc_set_power(dev, 1, MMC_POWER_ON, 16);\n" - "+\n" - "+\tr = menelaus_set_mmc_slot(1, 1, 0, 1);\n" - "+\tif (r < 0)\n" - "+\t\treturn r;\n" - "+\tr = menelaus_set_mmc_slot(2, 1, vs2sel, 1);\n" - "+\tif (r < 0)\n" - "+\t\treturn r;\n" - "+\n" - "+\tr = menelaus_get_slot_pin_states();\n" - "+\tif (r < 0)\n" - "+\t\treturn r;\n" - "+\n" - "+\tif (machine_is_nokia_n800()) {\n" - "+\t\tbit = 1 << 1;\n" - "+\t\topenp = &slot2_cover_open;\n" - "+\t} else {\n" - "+\t\tbit = 1;\n" - "+\t\topenp = &slot1_cover_open;\n" - "+\t\tslot2_cover_open = 0;\n" - "+\t}\n" - "+\n" - "+\t/* All slot pin bits seem to be inversed until first switch change */\n" - "+\tif (r == 0xf || r == (0xf & ~bit))\n" - "+\t\tr = ~r;\n" - "+\n" - "+\tif (r & bit)\n" - "+\t\t*openp = 1;\n" - "+\telse\n" - "+\t\t*openp = 0;\n" - "+\n" - "+\tr = menelaus_register_mmc_callback(n8x0_mmc_callback, NULL);\n" - "+\n" - "+\treturn r;\n" - "+}\n" - "+\n" - "+static void n8x0_mmc_shutdown(struct device *dev)\n" - "+{\n" - "+\tint vs2sel;\n" - "+\n" - "+\tif (machine_is_nokia_n800())\n" - "+\t\tvs2sel = 0;\n" - "+\telse\n" - "+\t\tvs2sel = 2;\n" - "+\n" - "+\tmenelaus_set_mmc_slot(1, 0, 0, 0);\n" - "+\tmenelaus_set_mmc_slot(2, 0, vs2sel, 0);\n" - "+}\n" - "+\n" - "+static void n8x0_mmc_cleanup(struct device *dev)\n" - "+{\n" - "+\tmenelaus_unregister_mmc_callback();\n" - "+\n" - "+\tgpio_free(N8X0_SLOT_SWITCH_GPIO);\n" - "+\n" - "+\tif (machine_is_nokia_n810()) {\n" - "+\t\tgpio_free(N810_EMMC_VSD_GPIO);\n" - "+\t\tgpio_free(NN810_EMMC_VIO_GPIO);\n" - "+\t}\n" - "+}\n" - "+\n" - "+/*\n" - "+ * MMC controller1 has two slots that are multiplexed via I2C.\n" - "+ * MMC controller2 is not in use.\n" - "+ */\n" - "+static struct omap_mmc_platform_data mmc1_data = {\n" - "+\t.nr_slots\t\t\t= 2,\n" - "+\t.switch_slot\t\t\t= n8x0_mmc_switch_slot,\n" - "+\t.init\t\t\t\t= n8x0_mmc_late_init,\n" - "+\t.cleanup\t\t\t= n8x0_mmc_cleanup,\n" - "+\t.shutdown\t\t\t= n8x0_mmc_shutdown,\n" - "+\t.max_freq\t\t\t= 24000000,\n" - "+\t.dma_mask\t\t\t= 0xffffffff,\n" - "+\t.slots[0] = {\n" - "+\t\t.wires\t\t\t= 4,\n" - "+\t\t.set_power\t\t= n8x0_mmc_set_power,\n" - "+\t\t.set_bus_mode\t\t= n8x0_mmc_set_bus_mode,\n" - "+\t\t.get_cover_state\t= n8x0_mmc_get_cover_state,\n" - "+\t\t.ocr_mask\t\t= MMC_VDD_165_195 | MMC_VDD_30_31 |\n" - "+\t\t\t\t\t\tMMC_VDD_32_33 | MMC_VDD_33_34,\n" - "+\t\t.name\t\t\t= \"internal\",\n" - "+\t},\n" - "+\t.slots[1] = {\n" - "+\t\t.set_power\t\t= n8x0_mmc_set_power,\n" - "+\t\t.set_bus_mode\t\t= n8x0_mmc_set_bus_mode,\n" - "+\t\t.get_cover_state\t= n8x0_mmc_get_cover_state,\n" - "+\t\t.ocr_mask\t\t= MMC_VDD_165_195 | MMC_VDD_20_21 |\n" - "+\t\t\t\t\t\tMMC_VDD_21_22 | MMC_VDD_22_23 |\n" - "+\t\t\t\t\t\tMMC_VDD_23_24 | MMC_VDD_24_25 |\n" - "+\t\t\t\t\t\tMMC_VDD_27_28 | MMC_VDD_28_29 |\n" - "+\t\t\t\t\t\tMMC_VDD_29_30 | MMC_VDD_30_31 |\n" - "+\t\t\t\t\t\tMMC_VDD_32_33 | MMC_VDD_33_34,\n" - "+\t\t.name\t\t\t= \"external\",\n" - "+\t},\n" - "+};\n" - "+\n" - "+static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];\n" - "+\n" - "+void __init n8x0_mmc_init(void)\n" - "+\n" - "+{\n" - "+\tint err;\n" - "+\n" - "+\tif (machine_is_nokia_n810()) {\n" - "+\t\tmmc1_data.slots[0].name = \"external\";\n" - "+\n" - "+\t\t/*\n" - "+\t\t * Some Samsung Movinand chips do not like open-ended\n" - "+\t\t * multi-block reads and fall to braind-dead state\n" - "+\t\t * while doing so. Reducing the number of blocks in\n" - "+\t\t * the transfer or delays in clock disable do not help\n" - "+\t\t */\n" - "+\t\tmmc1_data.slots[1].name = \"internal\";\n" - "+\t\tmmc1_data.slots[1].ban_openended = 1;\n" - "+\t}\n" - "+\n" - "+\terr = gpio_request(N8X0_SLOT_SWITCH_GPIO, \"MMC slot switch\");\n" - "+\tif (err)\n" - "+\t\treturn err;\n" - "+\n" - "+\tgpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0);\n" - "+\n" - "+\tif (machine_is_nokia_n810()) {\n" - "+\t\terr = gpio_request(N810_EMMC_VSD_GPIO, \"MMC slot 2 Vddf\");\n" - "+\t\tif (err) {\n" - "+\t\t\tgpio_free(N8X0_SLOT_SWITCH_GPIO);\n" - "+\t\t\treturn err;\n" - "+\t\t}\n" - "+\t\tgpio_direction_output(N810_EMMC_VSD_GPIO, 0);\n" - "+\n" - "+\t\terr = gpio_request(NN810_EMMC_VIO_GPIO, \"MMC slot 2 Vdd\");\n" - "+\t\tif (err) {\n" - "+\t\t\tgpio_free(N8X0_SLOT_SWITCH_GPIO);\n" - "+\t\t\tgpio_free(N810_EMMC_VSD_GPIO);\n" - "+\t\t\treturn err;\n" - "+\t\t}\n" - "+\t\tgpio_direction_output(NN810_EMMC_VIO_GPIO, 0);\n" - "+\t}\n" - "+\n" - "+\tmmc_data[0] = &mmc1_data;\n" - "+\tomap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);\n" - "+}\n" - "+#else\n" - "+\n" - "+void __init n8x0_mmc_init(void)\n" - "+{\n" - "+}\n" - "+\n" - "+void n8x0_mmc_slot1_cover_handler(void *arg, int state)\n" - "+{\n" - "+}\n" - "+\n" - "+#endif\t/* CONFIG_MMC_OMAP */\n" - "+\n" - "+#ifdef CONFIG_MENELAUS\n" - "+\n" - "+static int n8x0_auto_sleep_regulators(void)\n" - "+{\n" - "+\tu32 val;\n" - "+\tint ret;\n" - "+\n" - "+\tval = EN_VPLL_SLEEP | EN_VMMC_SLEEP \\\n" - "+\t\t| EN_VAUX_SLEEP | EN_VIO_SLEEP \\\n" - "+\t\t| EN_VMEM_SLEEP | EN_DC3_SLEEP \\\n" - "+\t\t| EN_VC_SLEEP | EN_DC2_SLEEP;\n" - "+\n" - "+\tret = menelaus_set_regulator_sleep(1, val);\n" - "+\tif (ret < 0) {\n" - "+\t\tprintk(KERN_ERR \"Could not set regulators to sleep on \"\n" - "+\t\t\t\"menelaus: %u\\n\", ret);\n" - "+\t\treturn ret;\n" - "+\t}\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static int n8x0_auto_voltage_scale(void)\n" - "+{\n" - "+\tint ret;\n" - "+\n" - "+\tret = menelaus_set_vcore_hw(1400, 1050);\n" - "+\tif (ret < 0) {\n" - "+\t\tprintk(KERN_ERR \"Could not set VCORE voltage on \"\n" - "+\t\t\t\"menelaus: %u\\n\", ret);\n" - "+\t\treturn ret;\n" - "+\t}\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static int n8x0_menelaus_late_init(struct device *dev)\n" - "+{\n" - "+\tint ret;\n" - "+\n" - "+\tret = n8x0_auto_voltage_scale();\n" - "+\tif (ret < 0)\n" - "+\t\treturn ret;\n" - "+\tret = n8x0_auto_sleep_regulators();\n" - "+\tif (ret < 0)\n" - "+\t\treturn ret;\n" - "+\treturn 0;\n" - "+}\n" - "+\n" - "+static struct i2c_board_info __initdata n8x0_i2c_board_info_1[] = {\n" - "+\t{\n" - "+\t\tI2C_BOARD_INFO(\"menelaus\", 0x72),\n" - "+\t\t.irq = INT_24XX_SYS_NIRQ,\n" - "+\t},\n" - "+};\n" - "+\n" - "+static struct menelaus_platform_data n8x0_menelaus_platform_data = {\n" - "+\t.late_init = n8x0_menelaus_late_init,\n" - "+};\n" - "+\n" - "+static void __init n8x0_menelaus_init(void)\n" - "+{\n" - "+\tn8x0_i2c_board_info_1[0].platform_data = &n8x0_menelaus_platform_data;\n" - "+\tomap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,\n" - "+\t\t\t ARRAY_SIZE(n8x0_i2c_board_info_1));\n" - "+}\n" - "+\n" - "+#else\n" - "+static inline void __init n8x0_menelaus_init(void)\n" - "+{\n" - "+}\n" - "+#endif\n" - "+\n" - " static void __init n8x0_map_io(void)\n" - " {\n" - " \tomap2_set_globals_242x();\n" - "@@ -116,7 +559,9 @@ static void __init n8x0_init_machine(void)\n" - " \t\t\t\tARRAY_SIZE(n800_spi_board_info));\n" - " \n" - " \tomap_serial_init();\n" - "+\tn8x0_menelaus_init();\n" - " \tn8x0_onenand_init();\n" - "+\tn8x0_mmc_init();\n" - " }\n" - " \n" - " MACHINE_START(NOKIA_N800, \"Nokia N800\")" + "Tony\n" + "-------------- next part --------------\n" + "A non-text attachment was scrubbed...\n" + "Name: n8x0-mmc.patch\n" + "Type: text/x-diff\n" + "Size: 11133 bytes\n" + "Desc: not available\n" + URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100226/6756f391/attachment.bin> -ac8dbde7db0895d6ddefaa88706114bff4d6e3627a5b9aab101f18431f4e921a +2383392f57449ba7903593450085f1a20d12a329ed54f6dbcc6b4dbdbdabbf76
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.