1 Merge OpenMoko kernel patches
2 git://git.openmoko.org/git/kernel.git#(no
4 lars@lars-laptop Thu May 14 18:33:23 UTC 2009
9 +++ b/arch/arm/mach-s3c2410/include/mach/mci.h
14 +struct s3c24xx_mci_pdata {
15 + unsigned int gpio_detect;
16 + unsigned int gpio_wprotect;
17 + unsigned long ocr_avail;
18 + unsigned int do_dma;
19 + void (*set_power)(unsigned char power_mode,
20 + unsigned short vdd);
23 +#endif /* _ARCH_NCI_H */
24 --- a/arch/arm/mach-s3c2410/include/mach/regs-sdi.h
25 +++ b/arch/arm/mach-s3c2410/include/mach/regs-sdi.h
27 #define S3C2410_SDIFSTA (0x38)
29 #define S3C2410_SDIDATA (0x3C)
30 +#define S3C2410_SDIDATA_BYTE (0x3C)
31 #define S3C2410_SDIIMSK (0x40)
33 #define S3C2440_SDIDATA (0x40)
36 #define S3C2440_SDICON_SDRESET (1<<8)
37 #define S3C2440_SDICON_MMCCLOCK (1<<5)
38 +#define S3C2440_SDIDATA_BYTE (0x48)
40 #define S3C2410_SDICON_BYTEORDER (1<<4)
41 #define S3C2410_SDICON_SDIOIRQ (1<<3)
42 #define S3C2410_SDICON_RWAITEN (1<<2)
43 --- a/arch/arm/mach-s3c2440/s3c2440.c
44 +++ b/arch/arm/mach-s3c2440/s3c2440.c
45 @@ -46,6 +46,9 @@ int __init s3c2440_init(void)
46 s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
47 s3c_device_wdt.resource[1].end = IRQ_S3C2440_WDT;
49 + /* make sure SD/MMC driver can distinguish 2440 from 2410 */
50 + s3c_device_sdi.name = "s3c2440-sdi";
52 /* register our system device for everything else */
54 return sysdev_register(&s3c2440_sysdev);
55 --- a/arch/arm/mach-s3c2442/s3c2442.c
56 +++ b/arch/arm/mach-s3c2442/s3c2442.c
59 #include <plat/s3c2442.h>
61 +#include <plat/devs.h>
63 static struct sys_device s3c2442_sysdev = {
64 .cls = &s3c2442_sysclass,
65 @@ -30,5 +31,8 @@ int __init s3c2442_init(void)
67 printk("S3C2442: Initialising architecture\n");
69 + /* make sure SD/MMC driver can distinguish 2440 from 2410 */
70 + s3c_device_sdi.name = "s3c2440-sdi";
72 return sysdev_register(&s3c2442_sysdev);
74 --- a/arch/arm/Makefile
75 +++ b/arch/arm/Makefile
76 @@ -55,7 +55,8 @@ ifeq ($(CONFIG_CPU_32v6),y)
77 arch-$(CONFIG_CPU_32v6K) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k)
79 arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
80 -arch-$(CONFIG_CPU_32v4T) :=-D__LINUX_ARM_ARCH__=4 -march=armv4t
81 +# We can't load armv4t modules, but still need to assemble some armv4t code to be linked in.
82 +arch-$(CONFIG_CPU_32v4T) :=-D__LINUX_ARM_ARCH__=4 -march=armv4 -Wa,-march=armv4t
83 arch-$(CONFIG_CPU_32v4) :=-D__LINUX_ARM_ARCH__=4 -march=armv4
84 arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3
87 +++ b/arch/arm/plat-s3c/include/mach/cpu.h
90 + * arch/arm/plat-s3c/include/mach/cpu.h
92 + * S3C cpu type detection
94 + * Copyright (C) 2008 Samsung Electronics
95 + * Kyungmin Park <kyungmin.park@samsung.com>
97 + * Derived from OMAP cpu.h
99 + * This program is free software; you can redistribute it and/or modify
100 + * it under the terms of the GNU General Public License as published by
101 + * the Free Software Foundation; either version 2 of the License, or
102 + * (at your option) any later version.
104 + * This program is distributed in the hope that it will be useful,
105 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
106 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107 + * GNU General Public License for more details.
109 + * You should have received a copy of the GNU General Public License
110 + * along with this program; if not, write to the Free Software
111 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
114 +#ifndef __ASM_ARCH_S3C_CPU_H
115 +#define __ASM_ARCH_S3C_CPU_H
117 +extern unsigned int system_rev;
119 +#define S3C_SYSTEM_REV_ATAG (system_rev & 0xffff)
120 +#define S3C_SYSTEM_REV_CPU (system_rev & 0xffff0000)
123 + * cpu_is_s3c24xx(): True for s3c2400, s3c2410, s3c2440 and so on
124 + * cpu_is_s3c241x(): True fro s3c2410, s3c2412
125 + * cpu_is_s3c244x(): True fro s3c2440, s3c2442, s3c2443
126 + * cpu_is_s3c64xx(): True for s3c6400, s3c6410
128 +#define GET_S3C_CLASS ((system_rev >> 24) & 0xff)
130 +#define IS_S3C_CLASS(class, id) \
131 +static inline int is_s3c ##class (void) \
133 + return (GET_S3C_CLASS == (id)) ? 1 : 0; \
136 +#define GET_S3C_SUBCLASS ((system_rev >> 20) & 0xfff)
138 +#define IS_S3C_SUBCLASS(subclass, id) \
139 +static inline int is_s3c ##subclass (void) \
141 + return (GET_S3C_SUBCLASS == (id)) ? 1 : 0; \
144 +IS_S3C_CLASS(24xx, 0x24)
145 +IS_S3C_CLASS(64xx, 0x64)
147 +IS_S3C_SUBCLASS(241x, 0x241)
148 +IS_S3C_SUBCLASS(244x, 0x244)
150 +#define cpu_is_s3c24xx() 0
151 +#define cpu_is_s3c241x() 0
152 +#define cpu_is_s3c244x() 0
153 +#define cpu_is_s3c64xx() 0
155 +#if defined(CONFIG_ARCH_S3C2410)
156 +# undef cpu_is_s3c24xx
157 +# undef cpu_is_s3c241x
158 +# undef cpu_is_s3c244x
159 +# define cpu_is_s3c24xx() is_s3c24xx()
160 +# define cpu_is_s3c241x() is_s3c241x()
161 +# define cpu_is_s3c244x() is_s3c244x()
164 +#if defined(CONFIG_ARCH_S3C64XX)
165 +# undef cpu_is_s3c64xx
166 +# define cpu_is_s3c64xx() is_s3c64xx()
170 + * Macros to detect individual cpu types.
171 + * cpu_is_s3c2410(): True for s3c2410
172 + * cpu_is_s3c2440(): True for s3c2440
173 + * cpu_is_s3c6400(): True for s3c6400
174 + * cpu_is_s3c6410(): True for s3c6410
177 + * Store Revision A to 1
178 + * s3c2410a -> s3c2411
179 + * s3c2440a -> s3c2441
182 +#define GET_S3C_TYPE ((system_rev >> 16) & 0xffff)
184 +#define IS_S3C_TYPE(type, id) \
185 +static inline int is_s3c ##type (void) \
187 + return (GET_S3C_TYPE == (id)) ? 1 : 0; \
190 +IS_S3C_TYPE(2400, 0x2400)
191 +IS_S3C_TYPE(2410, 0x2410)
192 +IS_S3C_TYPE(2410a, 0x2411)
193 +IS_S3C_TYPE(2412, 0x2412)
194 +IS_S3C_TYPE(2440, 0x2440)
195 +IS_S3C_TYPE(2440a, 0x2441)
196 +IS_S3C_TYPE(2442, 0x2442)
197 +IS_S3C_TYPE(2443, 0x2443)
198 +IS_S3C_TYPE(6400, 0x6400)
199 +IS_S3C_TYPE(6410, 0x6410)
201 +#define cpu_is_s3c2400() 0
202 +#define cpu_is_s3c2410() 0
203 +#define cpu_is_s3c2410a() 0
204 +#define cpu_is_s3c2412() 0
205 +#define cpu_is_s3c2440() 0
206 +#define cpu_is_s3c2440a() 0
207 +#define cpu_is_s3c2442() 0
208 +#define cpu_is_s3c2443() 0
209 +#define cpu_is_s3c6400() 0
210 +#define cpu_is_s3c6410() 0
212 +#if defined(CONFIG_ARCH_S3C2410)
213 +# undef cpu_is_s3c2400
214 +# define cpu_is_s3c2400() is_s3c2400()
217 +#if defined(CONFIG_CPU_S3C2410)
218 +# undef cpu_is_s3c2410
219 +# undef cpu_is_s3c2410a
220 +# define cpu_is_s3c2410() is_s3c2410()
221 +# define cpu_is_s3c2410a() is_s3c2410a()
224 +#if defined(CONFIG_CPU_S3C2412)
225 +# undef cpu_is_s3c2412
226 +# define cpu_is_s3c2412() is_s3c2412()
229 +#if defined(CONFIG_CPU_S3C2440)
230 +# undef cpu_is_s3c2440
231 +# undef cpu_is_s3c2440a
232 +# define cpu_is_s3c2440() is_s3c2440()
233 +# define cpu_is_s3c2440a() is_s3c2440a()
236 +#if defined(CONFIG_CPU_S3C2442)
237 +# undef cpu_is_s3c2442
238 +# define cpu_is_s3c2442() is_s3c2442()
241 +#if defined(CONFIG_CPU_S3C2443)
242 +# undef cpu_is_s3c2443
243 +# define cpu_is_s3c2443() is_s3c2443()
246 +#if defined(CONFIG_ARCH_S3C64XX)
247 +# undef cpu_is_s3c6400
248 +# undef cpu_is_s3c6410
249 +# define cpu_is_s3c6400() is_s3c6400()
250 +# define cpu_is_s3c6410() is_s3c6410()
254 --- a/arch/arm/plat-s3c/include/plat/devs.h
255 +++ b/arch/arm/plat-s3c/include/plat/devs.h
256 @@ -16,6 +16,10 @@ struct s3c24xx_uart_resources {
257 unsigned long nr_resources;
260 +struct s3c_plat_otg_data {
264 extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
265 extern struct s3c24xx_uart_resources s3c64xx_uart_resources[];
267 --- a/arch/arm/plat-s3c/include/plat/gpio-core.h
268 +++ b/arch/arm/plat-s3c/include/plat/gpio-core.h
273 +struct s3c_gpio_chip;
276 + * struct s3c_gpio_pm - power management (suspend/resume) information
277 + * @save: Routine to save the state of the GPIO block
278 + * @resume: Routine to resume the GPIO block.
280 +struct s3c_gpio_pm {
281 + void (*save)(struct s3c_gpio_chip *chip);
282 + void (*resume)(struct s3c_gpio_chip *chip);
289 @@ -27,6 +40,7 @@ struct s3c_gpio_cfg;
290 * @chip: The chip structure to be exported via gpiolib.
291 * @base: The base pointer to the gpio configuration registers.
292 * @config: special function and pull-resistor control information.
293 + * @pm_save: Save information for suspend/resume support.
295 * This wrapper provides the necessary information for the Samsung
296 * specific gpios being registered with gpiolib.
297 @@ -34,7 +48,11 @@ struct s3c_gpio_cfg;
298 struct s3c_gpio_chip {
299 struct gpio_chip chip;
300 struct s3c_gpio_cfg *config;
301 + struct s3c_gpio_pm *pm;
308 static inline struct s3c_gpio_chip *to_s3c_gpio(struct gpio_chip *gpc)
309 @@ -75,3 +93,16 @@ static inline struct s3c_gpio_chip *s3c_
311 static inline void s3c_gpiolib_track(struct s3c_gpio_chip *chip) { }
315 +extern struct s3c_gpio_pm s3c_gpio_pm_1bit;
316 +extern struct s3c_gpio_pm s3c_gpio_pm_2bit;
317 +extern struct s3c_gpio_pm s3c_gpio_pm_4bit;
318 +#define __gpio_pm(x) x
320 +#define s3c_gpio_pm_1bit NULL
321 +#define s3c_gpio_pm_2bit NULL
322 +#define s3c_gpio_pm_4bit NULL
323 +#define __gpio_pm(x) NULL
325 +#endif /* CONFIG_PM */
326 --- a/arch/arm/plat-s3c/include/plat/map-base.h
327 +++ b/arch/arm/plat-s3c/include/plat/map-base.h
329 #define S3C_VA_TIMER S3C_ADDR(0x00300000) /* timer block */
330 #define S3C_VA_WATCHDOG S3C_ADDR(0x00400000) /* watchdog */
331 #define S3C_VA_UART S3C_ADDR(0x01000000) /* UART */
332 +#define S3C_VA_OTG S3C_ADDR(0x03900000) /* OTG */
333 +#define S3C_VA_OTGSFR S3C_ADDR(0x03a00000) /* OTGSFR */
335 #endif /* __ASM_PLAT_MAP_H */
336 --- a/arch/arm/plat-s3c/include/plat/nand.h
337 +++ b/arch/arm/plat-s3c/include/plat/nand.h
339 * partitions = mtd partition list
342 +#define S3C2410_NAND_BBT 0x0001
344 struct s3c2410_nand_set {
345 unsigned int disable_ecc : 1;
349 + unsigned int flags;
352 struct mtd_partition *partitions;
353 @@ -44,6 +47,9 @@ struct s3c2410_platform_nand {
355 struct s3c2410_nand_set *sets;
357 + /* force software_ecc at runtime */
360 void (*select_chip)(struct s3c2410_nand_set *,
363 --- a/arch/arm/plat-s3c/include/plat/pm.h
364 +++ b/arch/arm/plat-s3c/include/plat/pm.h
366 * published by the Free Software Foundation.
369 +#include <linux/sysdev.h>
373 * called from board at initialisation time to setup the power
374 @@ -44,6 +46,8 @@ extern void (*pm_cpu_sleep)(void);
376 extern unsigned long s3c_pm_flags;
378 +extern unsigned char pm_uart_udivslot; /* true to save UART UDIVSLOT */
382 extern int s3c_cpu_save(unsigned long *saveblk);
383 @@ -88,6 +92,7 @@ struct pm_uart_save {
390 /* helper functions to save/restore lists of registers. */
391 --- a/arch/arm/plat-s3c/include/plat/sdhci.h
392 +++ b/arch/arm/plat-s3c/include/plat/sdhci.h
393 @@ -29,6 +29,7 @@ struct mmc_ios;
394 * is necessary the controllers and/or GPIO blocks require the
395 * changing of driver-strength and other controls dependant on
396 * the card and speed of operation.
397 + * sdhci_host: Pointer kept during init, allows presence change notification
399 * Initialisation data specific to either the machine or the platform
400 * for the device driver to use or call-back when configuring gpio or
401 @@ -45,8 +46,11 @@ struct s3c_sdhci_platdata {
402 void __iomem *regbase,
404 struct mmc_card *card);
405 + struct sdhci_host * sdhci_host;
408 +extern void sdhci_s3c_force_presence_change(struct platform_device *pdev);
411 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
412 * @pd: Platform data to register to device.
413 --- a/arch/arm/plat-s3c/init.c
414 +++ b/arch/arm/plat-s3c/init.c
417 static struct cpu_table *cpu;
419 +static void __init set_system_rev(unsigned int idcode)
422 + * system_rev encoding is as follows
423 + * system_rev & 0xff000000 -> S3C Class (24xx/64xx)
424 + * system_rev & 0xfff00000 -> S3C Sub Class (241x/244x)
425 + * system_rev & 0xffff0000 -> S3C Type (2410/2440/6400/6410)
427 + * Remaining[15:0] are preserved from the value set by ATAG
430 + * Store Revision A to 1 such as
431 + * s3c2410A to s3c2411
432 + * s3c2440A to s3c2441
435 + system_rev &= 0xffff;
436 + system_rev |= (idcode & 0x0ffff000) << 4;
438 + if (idcode == 0x32410002 || idcode == 0x32440001)
439 + system_rev |= (0x1 << 16);
440 + if (idcode == 0x32440aaa /* s3c2442 */
441 + || idcode == 0x32440aab) /* s3c2442b */
442 + system_rev |= (0x2 << 16);
443 + if (idcode == 0x0) /* s3c2400 */
444 + system_rev |= (0x2400 << 16);
447 static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
448 struct cpu_table *tab,
450 @@ -53,6 +81,8 @@ void __init s3c_init_cpu(unsigned long i
451 panic("Unknown S3C24XX CPU");
454 + set_system_rev(idcode);
456 printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
458 if (cpu->map_io == NULL || cpu->init == NULL) {
459 --- a/arch/arm/plat-s3c/Makefile
460 +++ b/arch/arm/plat-s3c/Makefile
461 @@ -21,6 +21,7 @@ obj-y += gpio-config.o
464 obj-$(CONFIG_PM) += pm.o
465 +obj-$(CONFIG_PM) += pm-gpio.o
466 obj-$(CONFIG_S3C2410_PM_CHECK) += pm-check.o
469 --- a/arch/arm/plat-s3c/pm.c
470 +++ b/arch/arm/plat-s3c/pm.c
473 #include <asm/cacheflush.h>
474 #include <mach/hardware.h>
475 +#include <mach/map.h>
477 #include <plat/regs-serial.h>
478 #include <mach/regs-clock.h>
479 -#include <mach/regs-gpio.h>
480 -#include <mach/regs-mem.h>
481 #include <mach/regs-irq.h>
484 @@ -70,6 +69,8 @@ static inline void s3c_pm_debug_init(voi
486 /* Save the UART configurations if we are configured for debug. */
488 +unsigned char pm_uart_udivslot;
490 #ifdef CONFIG_S3C2410_PM_DEBUG
492 struct pm_uart_save uart_save[CONFIG_SERIAL_SAMSUNG_UARTS];
493 @@ -83,6 +84,12 @@ static void s3c_pm_save_uart(unsigned in
494 save->ufcon = __raw_readl(regs + S3C2410_UFCON);
495 save->umcon = __raw_readl(regs + S3C2410_UMCON);
496 save->ubrdiv = __raw_readl(regs + S3C2410_UBRDIV);
498 + if (pm_uart_udivslot)
499 + save->udivslot = __raw_readl(regs + S3C2443_DIVSLOT);
501 + S3C_PMDBG("UART[%d]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n",
502 + uart, save->ulcon, save->ucon, save->ufcon, save->ubrdiv);
505 static void s3c_pm_save_uarts(void)
506 @@ -98,11 +105,16 @@ static void s3c_pm_restore_uart(unsigned
508 void __iomem *regs = S3C_VA_UARTx(uart);
510 + s3c_pm_arch_update_uart(regs, save);
512 __raw_writel(save->ulcon, regs + S3C2410_ULCON);
513 __raw_writel(save->ucon, regs + S3C2410_UCON);
514 __raw_writel(save->ufcon, regs + S3C2410_UFCON);
515 __raw_writel(save->umcon, regs + S3C2410_UMCON);
516 __raw_writel(save->ubrdiv, regs + S3C2410_UBRDIV);
518 + if (pm_uart_udivslot)
519 + __raw_writel(save->udivslot, regs + S3C2443_DIVSLOT);
522 static void s3c_pm_restore_uarts(void)
523 @@ -289,11 +301,14 @@ static int s3c_pm_enter(suspend_state_t
525 s3c_pm_arch_stop_clocks();
527 - /* s3c_cpu_save will also act as our return point from when
528 - * we resume as it saves its own register state and restores it
529 - * during the resume. */
531 - s3c_cpu_save(regs_save);
532 + /* s3c2410_cpu_save will also act as our return point from when
533 + * we resume as it saves its own register state, so use the return
534 + * code to differentiate return from save and return from sleep */
536 + if (s3c_cpu_save(regs_save) == 0) {
541 /* restore the cpu state using the kernel's cpu init code. */
544 +++ b/arch/arm/plat-s3c/pm-gpio.c
546 +/* linux/arch/arm/plat-s3c/pm-gpio.c
548 + * Copyright 2008 Openmoko, Inc.
549 + * Copyright 2008 Simtec Electronics
550 + * Ben Dooks <ben@simtec.co.uk>
551 + * http://armlinux.simtec.co.uk/
553 + * S3C series GPIO PM code
555 + * This program is free software; you can redistribute it and/or modify
556 + * it under the terms of the GNU General Public License version 2 as
557 + * published by the Free Software Foundation.
560 +#include <linux/kernel.h>
561 +#include <linux/init.h>
562 +#include <linux/io.h>
563 +#include <linux/gpio.h>
565 +#include <mach/gpio-core.h>
566 +#include <plat/pm.h>
568 +/* PM GPIO helpers */
570 +#define OFFS_CON (0x00)
571 +#define OFFS_DAT (0X04)
572 +#define OFFS_UP (0X08)
574 +static void s3c_gpio_pm_1bit_save(struct s3c_gpio_chip *chip)
576 + chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);
577 + chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);
580 +static void s3c_gpio_pm_1bit_resume(struct s3c_gpio_chip *chip)
582 + void __iomem *base = chip->base;
583 + u32 old_gpcon = __raw_readl(base + OFFS_CON);
584 + u32 old_gpdat = __raw_readl(base + OFFS_DAT);
585 + u32 gps_gpcon = chip->pm_save[0];
586 + u32 gps_gpdat = chip->pm_save[1];
589 + /* GPACON only has one bit per control / data and no PULLUPs.
590 + * GPACON[x] = 0 => Output, 1 => SFN */
592 + /* first set all SFN bits to SFN */
594 + gpcon = old_gpcon | gps_gpcon;
595 + __raw_writel(gpcon, base + OFFS_CON);
597 + /* now set all the other bits */
599 + __raw_writel(gps_gpdat, base + OFFS_DAT);
600 + __raw_writel(gps_gpcon, base + OFFS_CON);
602 + S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",
603 + chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
606 +struct s3c_gpio_pm s3c_gpio_pm_1bit = {
607 + .save = s3c_gpio_pm_1bit_save,
608 + .resume = s3c_gpio_pm_1bit_resume,
611 +static void s3c_gpio_pm_2bit_save(struct s3c_gpio_chip *chip)
613 + chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);
614 + chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);
615 + chip->pm_save[2] = __raw_readl(chip->base + OFFS_UP);
618 +/* Test whether the given masked+shifted bits of an GPIO configuration
619 + * are one of the SFN (special function) modes. */
621 +static inline int is_sfn(unsigned long con)
626 +/* Test if the given masked+shifted GPIO configuration is an input */
628 +static inline int is_in(unsigned long con)
633 +/* Test if the given masked+shifted GPIO configuration is an output */
635 +static inline int is_out(unsigned long con)
641 + * s3c_gpio_pm_2bit_resume() - restore the given GPIO bank
642 + * @chip: The chip information to resume.
644 + * Restore one of the GPIO banks that was saved during suspend. This is
645 + * not as simple as once thought, due to the possibility of glitches
646 + * from the order that the CON and DAT registers are set in.
648 + * The three states the pin can be are {IN,OUT,SFN} which gives us 9
649 + * combinations of changes to check. Three of these, if the pin stays
650 + * in the same configuration can be discounted. This leaves us with
653 + * { IN => OUT } Change DAT first
654 + * { IN => SFN } Change CON first
655 + * { OUT => SFN } Change CON first, so new data will not glitch
656 + * { OUT => IN } Change CON first, so new data will not glitch
657 + * { SFN => IN } Change CON first
658 + * { SFN => OUT } Change DAT first, so new data will not glitch [1]
660 + * We do not currently deal with the UP registers as these control
661 + * weak resistors, so a small delay in change should not need to bring
662 + * these into the calculations.
664 + * [1] this assumes that writing to a pin DAT whilst in SFN will set the
665 + * state for when it is next output.
667 +static void s3c_gpio_pm_2bit_resume(struct s3c_gpio_chip *chip)
669 + void __iomem *base = chip->base;
670 + u32 old_gpcon = __raw_readl(base + OFFS_CON);
671 + u32 old_gpdat = __raw_readl(base + OFFS_DAT);
672 + u32 gps_gpcon = chip->pm_save[0];
673 + u32 gps_gpdat = chip->pm_save[1];
674 + u32 gpcon, old, new, mask;
675 + u32 change_mask = 0x0;
678 + /* restore GPIO pull-up settings */
679 + __raw_writel(chip->pm_save[2], base + OFFS_UP);
681 + /* Create a change_mask of all the items that need to have
682 + * their CON value changed before their DAT value, so that
683 + * we minimise the work between the two settings.
686 + for (nr = 0, mask = 0x03; nr < 32; nr += 2, mask <<= 2) {
687 + old = (old_gpcon & mask) >> nr;
688 + new = (gps_gpcon & mask) >> nr;
690 + /* If there is no change, then skip */
695 + /* If both are special function, then skip */
697 + if (is_sfn(old) && is_sfn(new))
700 + /* Change is IN => OUT, do not change now */
702 + if (is_in(old) && is_out(new))
705 + /* Change is SFN => OUT, do not change now */
707 + if (is_sfn(old) && is_out(new))
710 + /* We should now be at the case of IN=>SFN,
711 + * OUT=>SFN, OUT=>IN, SFN=>IN. */
713 + change_mask |= mask;
717 + /* Write the new CON settings */
719 + gpcon = old_gpcon & ~change_mask;
720 + gpcon |= gps_gpcon & change_mask;
722 + __raw_writel(gpcon, base + OFFS_CON);
724 + /* Now change any items that require DAT,CON */
726 + __raw_writel(gps_gpdat, base + OFFS_DAT);
727 + __raw_writel(gps_gpcon, base + OFFS_CON);
729 + S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",
730 + chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
733 +struct s3c_gpio_pm s3c_gpio_pm_2bit = {
734 + .save = s3c_gpio_pm_2bit_save,
735 + .resume = s3c_gpio_pm_2bit_resume,
738 +#ifdef CONFIG_ARCH_S3C64XX
739 +static void s3c_gpio_pm_4bit_save(struct s3c_gpio_chip *chip)
741 + chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON);
742 + chip->pm_save[2] = __raw_readl(chip->base + OFFS_DAT);
743 + chip->pm_save[3] = __raw_readl(chip->base + OFFS_UP);
745 + if (chip->chip.ngpio > 8)
746 + chip->pm_save[0] = __raw_readl(chip->base - 4);
749 +static u32 s3c_gpio_pm_4bit_mask(u32 old_gpcon, u32 gps_gpcon)
751 + u32 old, new, mask;
752 + u32 change_mask = 0x0;
755 + for (nr = 0, mask = 0x0f; nr < 16; nr += 4, mask <<= 4) {
756 + old = (old_gpcon & mask) >> nr;
757 + new = (gps_gpcon & mask) >> nr;
759 + /* If there is no change, then skip */
764 + /* If both are special function, then skip */
766 + if (is_sfn(old) && is_sfn(new))
769 + /* Change is IN => OUT, do not change now */
771 + if (is_in(old) && is_out(new))
774 + /* Change is SFN => OUT, do not change now */
776 + if (is_sfn(old) && is_out(new))
779 + /* We should now be at the case of IN=>SFN,
780 + * OUT=>SFN, OUT=>IN, SFN=>IN. */
782 + change_mask |= mask;
785 + return change_mask;
788 +static void s3c_gpio_pm_4bit_con(struct s3c_gpio_chip *chip, int index)
790 + void __iomem *con = chip->base + (index * 4);
791 + u32 old_gpcon = __raw_readl(con);
792 + u32 gps_gpcon = chip->pm_save[index + 1];
795 + mask = s3c_gpio_pm_4bit_mask(old_gpcon, gps_gpcon);
797 + gpcon = old_gpcon & ~mask;
798 + gpcon |= gps_gpcon & mask;
800 + __raw_writel(gpcon, con);
803 +static void s3c_gpio_pm_4bit_resume(struct s3c_gpio_chip *chip)
805 + void __iomem *base = chip->base;
807 + u32 old_gpdat = __raw_readl(base + OFFS_DAT);
808 + u32 gps_gpdat = chip->pm_save[2];
810 + /* First, modify the CON settings */
813 + old_gpcon[1] = __raw_readl(base + OFFS_CON);
815 + s3c_gpio_pm_4bit_con(chip, 0);
816 + if (chip->chip.ngpio > 8) {
817 + old_gpcon[0] = __raw_readl(base - 4);
818 + s3c_gpio_pm_4bit_con(chip, -1);
821 + /* Now change the configurations that require DAT,CON */
823 + __raw_writel(chip->pm_save[2], base + OFFS_DAT);
824 + __raw_writel(chip->pm_save[1], base + OFFS_CON);
825 + if (chip->chip.ngpio > 8)
826 + __raw_writel(chip->pm_save[0], base - 4);
828 + __raw_writel(chip->pm_save[2], base + OFFS_DAT);
829 + __raw_writel(chip->pm_save[3], base + OFFS_UP);
831 + if (chip->chip.ngpio > 8) {
832 + S3C_PMDBG("%s: CON4 %08x,%08x => %08x,%08x, DAT %08x => %08x\n",
833 + chip->chip.label, old_gpcon[0], old_gpcon[1],
834 + __raw_readl(base - 4),
835 + __raw_readl(base + OFFS_CON),
836 + old_gpdat, gps_gpdat);
838 + S3C_PMDBG("%s: CON4 %08x => %08x, DAT %08x => %08x\n",
839 + chip->chip.label, old_gpcon[1],
840 + __raw_readl(base + OFFS_CON),
841 + old_gpdat, gps_gpdat);
844 +struct s3c_gpio_pm s3c_gpio_pm_4bit = {
845 + .save = s3c_gpio_pm_4bit_save,
846 + .resume = s3c_gpio_pm_4bit_resume,
848 +#endif /* CONFIG_ARCH_S3C64XX */
851 + * s3c_pm_save_gpio() - save gpio chip data for suspend
852 + * @ourchip: The chip for suspend.
854 +static void s3c_pm_save_gpio(struct s3c_gpio_chip *ourchip)
856 + struct s3c_gpio_pm *pm = ourchip->pm;
858 + if (pm == NULL || pm->save == NULL)
859 + S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);
865 + * s3c_pm_save_gpios() - Save the state of the GPIO banks.
867 + * For all the GPIO banks, save the state of each one ready for going
868 + * into a suspend mode.
870 +void s3c_pm_save_gpios(void)
872 + struct s3c_gpio_chip *ourchip;
873 + unsigned int gpio_nr;
875 + for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) {
876 + ourchip = s3c_gpiolib_getchip(gpio_nr);
880 + s3c_pm_save_gpio(ourchip);
882 + S3C_PMDBG("%s: save %08x,%08x,%08x,%08x\n",
883 + ourchip->chip.label,
884 + ourchip->pm_save[0],
885 + ourchip->pm_save[1],
886 + ourchip->pm_save[2],
887 + ourchip->pm_save[3]);
889 + gpio_nr += ourchip->chip.ngpio;
890 + gpio_nr += CONFIG_S3C_GPIO_SPACE;
895 + * s3c_pm_resume_gpio() - restore gpio chip data after suspend
896 + * @ourchip: The suspended chip.
898 +static void s3c_pm_resume_gpio(struct s3c_gpio_chip *ourchip)
900 + struct s3c_gpio_pm *pm = ourchip->pm;
902 + if (pm == NULL || pm->resume == NULL)
903 + S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);
905 + pm->resume(ourchip);
908 +void s3c_pm_restore_gpios(void)
910 + struct s3c_gpio_chip *ourchip;
911 + unsigned int gpio_nr;
913 + for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) {
914 + ourchip = s3c_gpiolib_getchip(gpio_nr);
918 + s3c_pm_resume_gpio(ourchip);
920 + gpio_nr += ourchip->chip.ngpio;
921 + gpio_nr += CONFIG_S3C_GPIO_SPACE;
924 --- a/arch/arm/plat-s3c24xx/clock-dclk.c
925 +++ b/arch/arm/plat-s3c24xx/clock-dclk.c
928 #include <mach/regs-clock.h>
929 #include <mach/regs-gpio.h>
930 +#include <mach/hardware.h>
932 #include <plat/clock.h>
933 #include <plat/cpu.h>
934 --- a/arch/arm/plat-s3c24xx/cpu.c
935 +++ b/arch/arm/plat-s3c24xx/cpu.c
936 @@ -61,6 +61,7 @@ static const char name_s3c2410[] = "S3C
937 static const char name_s3c2412[] = "S3C2412";
938 static const char name_s3c2440[] = "S3C2440";
939 static const char name_s3c2442[] = "S3C2442";
940 +static const char name_s3c2442b[] = "S3C2442B";
941 static const char name_s3c2443[] = "S3C2443";
942 static const char name_s3c2410a[] = "S3C2410A";
943 static const char name_s3c2440a[] = "S3C2440A";
944 @@ -112,6 +113,15 @@ static struct cpu_table cpu_ids[] __init
948 + .idcode = 0x32440aab,
949 + .idmask = 0xffffffff,
950 + .map_io = s3c244x_map_io,
951 + .init_clocks = s3c244x_init_clocks,
952 + .init_uarts = s3c244x_init_uarts,
953 + .init = s3c2442_init,
954 + .name = name_s3c2442b
957 .idcode = 0x32412001,
958 .idmask = 0xffffffff,
959 .map_io = s3c2412_map_io,
960 --- a/arch/arm/plat-s3c24xx/gpiolib.c
961 +++ b/arch/arm/plat-s3c24xx/gpiolib.c
963 #include <linux/io.h>
964 #include <linux/gpio.h>
966 -#include <mach/gpio-core.h>
967 +#include <plat/gpio-core.h>
968 #include <mach/hardware.h>
970 +#include <plat/pm.h>
972 #include <mach/regs-gpio.h>
974 @@ -78,6 +79,7 @@ static int s3c24xx_gpiolib_bankg_toirq(s
975 struct s3c_gpio_chip s3c24xx_gpios[] = {
977 .base = S3C24XX_GPIO_BASE(S3C2410_GPA0),
978 + .pm = __gpio_pm(&s3c_gpio_pm_1bit),
980 .base = S3C2410_GPA0,
981 .owner = THIS_MODULE,
982 @@ -89,6 +91,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
985 .base = S3C24XX_GPIO_BASE(S3C2410_GPB0),
986 + .pm = __gpio_pm(&s3c_gpio_pm_2bit),
988 .base = S3C2410_GPB0,
989 .owner = THIS_MODULE,
990 @@ -98,6 +101,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
993 .base = S3C24XX_GPIO_BASE(S3C2410_GPC0),
994 + .pm = __gpio_pm(&s3c_gpio_pm_2bit),
996 .base = S3C2410_GPC0,
997 .owner = THIS_MODULE,
998 @@ -107,6 +111,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
1001 .base = S3C24XX_GPIO_BASE(S3C2410_GPD0),
1002 + .pm = __gpio_pm(&s3c_gpio_pm_2bit),
1004 .base = S3C2410_GPD0,
1005 .owner = THIS_MODULE,
1006 @@ -116,6 +121,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
1009 .base = S3C24XX_GPIO_BASE(S3C2410_GPE0),
1010 + .pm = __gpio_pm(&s3c_gpio_pm_2bit),
1012 .base = S3C2410_GPE0,
1014 @@ -125,6 +131,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
1017 .base = S3C24XX_GPIO_BASE(S3C2410_GPF0),
1018 + .pm = __gpio_pm(&s3c_gpio_pm_2bit),
1020 .base = S3C2410_GPF0,
1021 .owner = THIS_MODULE,
1022 @@ -135,12 +142,23 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
1025 .base = S3C24XX_GPIO_BASE(S3C2410_GPG0),
1026 + .pm = __gpio_pm(&s3c_gpio_pm_2bit),
1028 .base = S3C2410_GPG0,
1029 .owner = THIS_MODULE,
1032 .to_irq = s3c24xx_gpiolib_bankg_toirq,
1037 + .base = S3C24XX_GPIO_BASE(S3C2410_GPH0),
1038 + .pm = __gpio_pm(&s3c_gpio_pm_2bit),
1040 + .base = S3C2410_GPH0,
1041 + .owner = THIS_MODULE,
1047 --- a/arch/arm/plat-s3c24xx/include/plat/pm-core.h
1048 +++ b/arch/arm/plat-s3c24xx/include/plat/pm-core.h
1049 @@ -57,3 +57,8 @@ static inline void s3c_pm_arch_show_resu
1050 s3c_pm_show_resume_irqs(IRQ_EINT4-4, __raw_readl(S3C2410_EINTPEND),
1051 s3c_irqwake_eintmask);
1054 +static inline void s3c_pm_arch_update_uart(void __iomem *regs,
1055 + struct pm_uart_save *save)
1058 --- a/arch/arm/plat-s3c24xx/irq-pm.c
1059 +++ b/arch/arm/plat-s3c24xx/irq-pm.c
1061 #include <linux/module.h>
1062 #include <linux/interrupt.h>
1063 #include <linux/sysdev.h>
1064 +#include <linux/irq.h>
1066 #include <plat/cpu.h>
1067 #include <plat/pm.h>
1068 @@ -80,7 +81,9 @@ int s3c24xx_irq_suspend(struct sys_devic
1070 int s3c24xx_irq_resume(struct sys_device *dev)
1073 + unsigned int i, irq;
1074 + unsigned long eintpnd;
1075 + struct irq_desc *desc;
1077 for (i = 0; i < ARRAY_SIZE(save_extint); i++)
1078 __raw_writel(save_extint[i], S3C24XX_EXTINT0 + (i*4));
1079 @@ -91,5 +94,25 @@ int s3c24xx_irq_resume(struct sys_device
1080 s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
1081 __raw_writel(save_eintmask, S3C24XX_EINTMASK);
1084 + * ACK those interrupts which are now masked and pending.
1085 + * Level interrupts if not ACKed here, create an interrupt storm
1086 + * because they are not handled at all.
1089 + eintpnd = __raw_readl(S3C24XX_EINTPEND);
1091 + eintpnd &= save_eintmask;
1092 + eintpnd &= ~0xff; /* ignore lower irqs */
1095 + irq = __ffs(eintpnd);
1096 + eintpnd &= ~(1 << irq);
1098 + irq += (IRQ_EINT4 - 4);
1099 + desc = irq_to_desc(irq);
1100 + desc->chip->ack(irq);
1105 --- a/arch/arm/plat-s3c24xx/pm.c
1106 +++ b/arch/arm/plat-s3c24xx/pm.c
1108 #include <mach/regs-gpio.h>
1109 #include <mach/regs-mem.h>
1110 #include <mach/regs-irq.h>
1111 +#include <mach/hardware.h>
1113 #include <asm/mach/time.h>
1115 @@ -75,43 +76,10 @@ static struct sleep_save core_save[] = {
1116 SAVE_ITEM(S3C2410_CLKSLOW),
1119 -static struct gpio_sleep {
1120 - void __iomem *base;
1121 - unsigned int gpcon;
1122 - unsigned int gpdat;
1123 - unsigned int gpup;
1126 - .base = S3C2410_GPACON,
1129 - .base = S3C2410_GPBCON,
1132 - .base = S3C2410_GPCCON,
1135 - .base = S3C2410_GPDCON,
1138 - .base = S3C2410_GPECON,
1141 - .base = S3C2410_GPFCON,
1144 - .base = S3C2410_GPGCON,
1147 - .base = S3C2410_GPHCON,
1151 static struct sleep_save misc_save[] = {
1152 SAVE_ITEM(S3C2410_DCLKCON),
1156 /* s3c_pm_check_resume_pin
1158 * check to see if the pin is configured correctly for sleep mode, and
1159 @@ -165,186 +133,6 @@ void s3c_pm_configure_extint(void)
1163 -/* offsets for CON/DAT/UP registers */
1165 -#define OFFS_CON (S3C2410_GPACON - S3C2410_GPACON)
1166 -#define OFFS_DAT (S3C2410_GPADAT - S3C2410_GPACON)
1167 -#define OFFS_UP (S3C2410_GPBUP - S3C2410_GPBCON)
1169 -/* s3c_pm_save_gpios()
1171 - * Save the state of the GPIOs
1174 -void s3c_pm_save_gpios(void)
1176 - struct gpio_sleep *gps = gpio_save;
1177 - unsigned int gpio;
1179 - for (gpio = 0; gpio < ARRAY_SIZE(gpio_save); gpio++, gps++) {
1180 - void __iomem *base = gps->base;
1182 - gps->gpcon = __raw_readl(base + OFFS_CON);
1183 - gps->gpdat = __raw_readl(base + OFFS_DAT);
1186 - gps->gpup = __raw_readl(base + OFFS_UP);
1191 -/* Test whether the given masked+shifted bits of an GPIO configuration
1192 - * are one of the SFN (special function) modes. */
1194 -static inline int is_sfn(unsigned long con)
1196 - return (con == 2 || con == 3);
1199 -/* Test if the given masked+shifted GPIO configuration is an input */
1201 -static inline int is_in(unsigned long con)
1206 -/* Test if the given masked+shifted GPIO configuration is an output */
1208 -static inline int is_out(unsigned long con)
1214 - * s3c2410_pm_restore_gpio() - restore the given GPIO bank
1215 - * @index: The number of the GPIO bank being resumed.
1216 - * @gps: The sleep confgiuration for the bank.
1218 - * Restore one of the GPIO banks that was saved during suspend. This is
1219 - * not as simple as once thought, due to the possibility of glitches
1220 - * from the order that the CON and DAT registers are set in.
1222 - * The three states the pin can be are {IN,OUT,SFN} which gives us 9
1223 - * combinations of changes to check. Three of these, if the pin stays
1224 - * in the same configuration can be discounted. This leaves us with
1227 - * { IN => OUT } Change DAT first
1228 - * { IN => SFN } Change CON first
1229 - * { OUT => SFN } Change CON first, so new data will not glitch
1230 - * { OUT => IN } Change CON first, so new data will not glitch
1231 - * { SFN => IN } Change CON first
1232 - * { SFN => OUT } Change DAT first, so new data will not glitch [1]
1234 - * We do not currently deal with the UP registers as these control
1235 - * weak resistors, so a small delay in change should not need to bring
1236 - * these into the calculations.
1238 - * [1] this assumes that writing to a pin DAT whilst in SFN will set the
1239 - * state for when it is next output.
1242 -static void s3c2410_pm_restore_gpio(int index, struct gpio_sleep *gps)
1244 - void __iomem *base = gps->base;
1245 - unsigned long gps_gpcon = gps->gpcon;
1246 - unsigned long gps_gpdat = gps->gpdat;
1247 - unsigned long old_gpcon;
1248 - unsigned long old_gpdat;
1249 - unsigned long old_gpup = 0x0;
1250 - unsigned long gpcon;
1253 - old_gpcon = __raw_readl(base + OFFS_CON);
1254 - old_gpdat = __raw_readl(base + OFFS_DAT);
1256 - if (base == S3C2410_GPACON) {
1257 - /* GPACON only has one bit per control / data and no PULLUPs.
1258 - * GPACON[x] = 0 => Output, 1 => SFN */
1260 - /* first set all SFN bits to SFN */
1262 - gpcon = old_gpcon | gps->gpcon;
1263 - __raw_writel(gpcon, base + OFFS_CON);
1265 - /* now set all the other bits */
1267 - __raw_writel(gps_gpdat, base + OFFS_DAT);
1268 - __raw_writel(gps_gpcon, base + OFFS_CON);
1270 - unsigned long old, new, mask;
1271 - unsigned long change_mask = 0x0;
1273 - old_gpup = __raw_readl(base + OFFS_UP);
1275 - /* Create a change_mask of all the items that need to have
1276 - * their CON value changed before their DAT value, so that
1277 - * we minimise the work between the two settings.
1280 - for (nr = 0, mask = 0x03; nr < 32; nr += 2, mask <<= 2) {
1281 - old = (old_gpcon & mask) >> nr;
1282 - new = (gps_gpcon & mask) >> nr;
1284 - /* If there is no change, then skip */
1289 - /* If both are special function, then skip */
1291 - if (is_sfn(old) && is_sfn(new))
1294 - /* Change is IN => OUT, do not change now */
1296 - if (is_in(old) && is_out(new))
1299 - /* Change is SFN => OUT, do not change now */
1301 - if (is_sfn(old) && is_out(new))
1304 - /* We should now be at the case of IN=>SFN,
1305 - * OUT=>SFN, OUT=>IN, SFN=>IN. */
1307 - change_mask |= mask;
1310 - /* Write the new CON settings */
1312 - gpcon = old_gpcon & ~change_mask;
1313 - gpcon |= gps_gpcon & change_mask;
1315 - __raw_writel(gpcon, base + OFFS_CON);
1317 - /* Now change any items that require DAT,CON */
1319 - __raw_writel(gps_gpdat, base + OFFS_DAT);
1320 - __raw_writel(gps_gpcon, base + OFFS_CON);
1321 - __raw_writel(gps->gpup, base + OFFS_UP);
1324 - S3C_PMDBG("GPIO[%d] CON %08lx => %08lx, DAT %08lx => %08lx\n",
1325 - index, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
1329 -/** s3c2410_pm_restore_gpios()
1331 - * Restore the state of the GPIOs
1334 -void s3c_pm_restore_gpios(void)
1336 - struct gpio_sleep *gps = gpio_save;
1339 - for (gpio = 0; gpio < ARRAY_SIZE(gpio_save); gpio++, gps++) {
1340 - s3c2410_pm_restore_gpio(gpio, gps);
1344 void s3c_pm_restore_core(void)
1346 --- a/drivers/mmc/host/Kconfig
1347 +++ b/drivers/mmc/host/Kconfig
1348 @@ -37,13 +37,6 @@ config MMC_SDHCI
1352 -config MMC_SDHCI_IO_ACCESSORS
1354 - depends on MMC_SDHCI
1356 - This is silent Kconfig symbol that is selected by the drivers that
1357 - need to overwrite SDHCI IO memory accessors.
1359 config MMC_SDHCI_PCI
1360 tristate "SDHCI support on PCI bus"
1361 depends on MMC_SDHCI && PCI
1362 @@ -55,6 +48,18 @@ config MMC_SDHCI_PCI
1366 +config MMC_SDHCI_S3C
1367 + tristate "SDHCI support on Samsung S3C SoC"
1368 + depends on MMC_SDHCI && PLAT_S3C24XX
1370 + This selects the Secure Digital Host Controller Interface (SDHCI)
1371 + often referrered to as the HSMMC block in some of the Samsung S3C
1374 + If you have a controller with this interface, say Y or M here.
1378 config MMC_RICOH_MMC
1379 tristate "Ricoh MMC Controller Disabler (EXPERIMENTAL)"
1380 depends on MMC_SDHCI_PCI
1381 @@ -72,17 +77,6 @@ config MMC_RICOH_MMC
1385 -config MMC_SDHCI_OF
1386 - tristate "SDHCI support on OpenFirmware platforms"
1387 - depends on MMC_SDHCI && PPC_OF
1388 - select MMC_SDHCI_IO_ACCESSORS
1390 - This selects the OF support for Secure Digital Host Controller
1391 - Interfaces. So far, only the Freescale eSDHC controller is known
1392 - to exist on OF platforms.
1397 tristate "TI OMAP Multimedia Card Interface support"
1398 depends on ARCH_OMAP
1399 @@ -163,16 +157,6 @@ config MMC_IMX
1404 - tristate "Freescale i.MX2/3 Multimedia Card Interface support"
1405 - depends on ARCH_MXC
1407 - This selects the Freescale i.MX2/3 Multimedia card Interface.
1408 - If you have a i.MX platform with a Multimedia Card slot,
1414 tristate "TI Flash Media MMC/SD Interface support (EXPERIMENTAL)"
1415 depends on EXPERIMENTAL && PCI
1416 --- a/drivers/mmc/host/Makefile
1417 +++ b/drivers/mmc/host/Makefile
1418 @@ -9,11 +9,10 @@ endif
1419 obj-$(CONFIG_MMC_ARMMMCI) += mmci.o
1420 obj-$(CONFIG_MMC_PXA) += pxamci.o
1421 obj-$(CONFIG_MMC_IMX) += imxmmc.o
1422 -obj-$(CONFIG_MMC_MXC) += mxcmmc.o
1423 obj-$(CONFIG_MMC_SDHCI) += sdhci.o
1424 obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o
1425 +obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o
1426 obj-$(CONFIG_MMC_RICOH_MMC) += ricoh_mmc.o
1427 -obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o
1428 obj-$(CONFIG_MMC_WBSD) += wbsd.o
1429 obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
1430 obj-$(CONFIG_MMC_OMAP) += omap.o
1431 @@ -21,7 +20,6 @@ obj-$(CONFIG_MMC_OMAP_HS) += omap_hsmmc.
1432 obj-$(CONFIG_MMC_AT91) += at91_mci.o
1433 obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o
1434 obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o
1435 -obj-$(CONFIG_MMC_MVSDIO) += mvsdio.o
1436 obj-$(CONFIG_MMC_SPI) += mmc_spi.o
1437 ifeq ($(CONFIG_OF),y)
1438 obj-$(CONFIG_MMC_SPI) += of_mmc_spi.o
1439 --- a/drivers/mmc/host/s3cmci.c
1440 +++ b/drivers/mmc/host/s3cmci.c
1442 * linux/drivers/mmc/s3cmci.h - Samsung S3C MCI driver
1444 * Copyright (C) 2004-2006 maintech GmbH, Thomas Kleffel <tk@maintech.de>
1445 + * Copyright (C) 2007 Harald Welte <laforge@gnumonks.org>
1447 * Current driver maintained by Ben Dooks and Simtec Electronics
1448 * Copyright (C) 2008 Simtec Electronics <ben-linux@fluff.org>
1451 #include <mach/regs-sdi.h>
1452 #include <mach/regs-gpio.h>
1453 +#include <mach/hardware.h>
1455 #include <plat/mci.h>
1457 +#include <asm/dma.h>
1458 +#include <asm/dma-mapping.h>
1460 +#include <asm/io.h>
1461 +#include <mach/regs-gpio.h>
1462 +#include <mach/mci.h>
1463 +#include <mach/dma.h>
1467 #define DRIVER_NAME "s3c-mci"
1468 @@ -47,6 +57,9 @@ static const int dbgmap_err = dbg_fail
1469 static const int dbgmap_info = dbg_info | dbg_conf;
1470 static const int dbgmap_debug = dbg_err | dbg_debug;
1472 +static int f_max = -1; /* override maximum frequency limit */
1473 +static int persist; /* keep interface alive across suspend/resume */
1475 #define dbg(host, channels, args...) \
1477 if (dbgmap_err & channels) \
1478 @@ -280,8 +293,11 @@ static void do_pio_read(struct s3cmci_ho
1479 * an even multiple of 4. */
1480 if (fifo >= host->pio_bytes)
1481 fifo = host->pio_bytes;
1489 host->pio_bytes -= fifo;
1490 host->pio_count += fifo;
1491 @@ -329,7 +345,7 @@ static void do_pio_write(struct s3cmci_h
1493 to_ptr = host->base + host->sdidata;
1495 - while ((fifo = fifo_free(host)) > 3) {
1496 + while ((fifo = fifo_free(host))) {
1497 if (!host->pio_bytes) {
1498 res = get_data_buffer(host, &host->pio_bytes,
1500 @@ -353,8 +369,11 @@ static void do_pio_write(struct s3cmci_h
1501 * words, so round down to an even multiple of 4. */
1502 if (fifo >= host->pio_bytes)
1503 fifo = host->pio_bytes;
1511 host->pio_bytes -= fifo;
1512 host->pio_count += fifo;
1513 @@ -373,7 +392,6 @@ static void pio_tasklet(unsigned long da
1515 struct s3cmci_host *host = (struct s3cmci_host *) data;
1518 disable_irq(host->irq);
1520 if (host->pio_active == XFER_WRITE)
1521 @@ -614,7 +632,6 @@ irq_out:
1523 spin_unlock_irqrestore(&host->complete_lock, iflags);
1529 @@ -789,11 +806,11 @@ static void s3cmci_dma_setup(struct s3cm
1531 last_source = source;
1533 - s3c2410_dma_devconfig(host->dma, source, 3,
1534 + s3c2410_dma_devconfig(host->dma, source,
1535 host->mem->start + host->sdidata);
1538 - s3c2410_dma_config(host->dma, 4, 0);
1539 + s3c2410_dma_config(host->dma, 4);
1540 s3c2410_dma_set_buffdone_fn(host->dma,
1541 s3cmci_dma_done_callback);
1542 s3c2410_dma_setflags(host->dma, S3C2410_DMAF_AUTOSTART);
1543 @@ -1026,6 +1043,7 @@ static void s3cmci_send_request(struct m
1544 dbg(host, dbg_err, "data prepare error %d\n", res);
1546 cmd->data->error = res;
1547 + cmd->data->error = -EIO;
1549 mmc_request_done(mmc, mrq);
1551 @@ -1263,10 +1281,8 @@ static int __devinit s3cmci_probe(struct
1552 host->is2440 = is2440;
1554 host->pdata = pdev->dev.platform_data;
1555 - if (!host->pdata) {
1556 - pdev->dev.platform_data = &s3cmci_def_pdata;
1558 host->pdata = &s3cmci_def_pdata;
1561 spin_lock_init(&host->complete_lock);
1562 tasklet_init(&host->pio_tasklet, pio_tasklet, (unsigned long) host);
1563 @@ -1379,6 +1395,18 @@ static int __devinit s3cmci_probe(struct
1564 mmc->f_min = host->clk_rate / (host->clk_div * 256);
1565 mmc->f_max = host->clk_rate / host->clk_div;
1568 + unsigned f = f_max;
1570 + if (f < mmc->f_min)
1572 + if (mmc->f_max > f) {
1573 + dev_info(&pdev->dev, "f_max lowered from %u to %u Hz\n",
1579 if (host->pdata->ocr_avail)
1580 mmc->ocr_avail = host->pdata->ocr_avail;
1582 @@ -1491,18 +1519,60 @@ static int __devinit s3cmci_2440_probe(s
1586 +static int save_regs(struct mmc_host *mmc)
1588 + struct s3cmci_host *host = mmc_priv(mmc);
1589 + unsigned long flags;
1591 + u32 *to = host->saved;
1593 + mmc_flush_scheduled_work();
1595 + local_irq_save(flags);
1596 + for (from = S3C2410_SDICON; from != S3C2410_SDIIMSK+4; from += 4)
1597 + if (from != host->sdidata)
1598 + *to++ = readl(host->base + from);
1599 + BUG_ON(to-host->saved != ARRAY_SIZE(host->saved));
1600 + local_irq_restore(flags);
1605 +static int restore_regs(struct mmc_host *mmc)
1607 + struct s3cmci_host *host = mmc_priv(mmc);
1608 + unsigned long flags;
1610 + u32 *from = host->saved;
1613 + * Before we begin with the necromancy, make sure we don't
1614 + * inadvertently start something we'll regret microseconds later.
1616 + from[S3C2410_SDICMDCON - S3C2410_SDICON] = 0;
1618 + local_irq_save(flags);
1619 + for (to = S3C2410_SDICON; to != S3C2410_SDIIMSK+4; to += 4)
1620 + if (to != host->sdidata)
1621 + writel(*from++, host->base + to);
1622 + BUG_ON(from-host->saved != ARRAY_SIZE(host->saved));
1623 + local_irq_restore(flags);
1628 static int s3cmci_suspend(struct platform_device *dev, pm_message_t state)
1630 struct mmc_host *mmc = platform_get_drvdata(dev);
1632 - return mmc_suspend_host(mmc, state);
1633 + return persist ? save_regs(mmc) : mmc_suspend_host(mmc, state);
1636 static int s3cmci_resume(struct platform_device *dev)
1638 struct mmc_host *mmc = platform_get_drvdata(dev);
1640 - return mmc_resume_host(mmc);
1641 + return persist ? restore_regs(mmc) : mmc_resume_host(mmc);
1644 #else /* CONFIG_PM */
1645 @@ -1560,9 +1630,13 @@ static void __exit s3cmci_exit(void)
1646 module_init(s3cmci_init);
1647 module_exit(s3cmci_exit);
1649 +module_param(f_max, int, 0644);
1650 +module_param(persist, int, 0644);
1652 MODULE_DESCRIPTION("Samsung S3C MMC/SD Card Interface driver");
1653 MODULE_LICENSE("GPL v2");
1654 MODULE_AUTHOR("Thomas Kleffel <tk@maintech.de>, Ben Dooks <ben-linux@fluff.org>");
1655 MODULE_ALIAS("platform:s3c2410-sdi");
1656 MODULE_ALIAS("platform:s3c2412-sdi");
1657 MODULE_ALIAS("platform:s3c2440-sdi");
1659 --- a/drivers/mmc/host/s3cmci.h
1660 +++ b/drivers/mmc/host/s3cmci.h
1662 * published by the Free Software Foundation.
1666 +#include <mach/regs-sdi.h>
1667 +#include <linux/regulator/consumer.h>
1669 /* FIXME: DMA Resource management ?! */
1670 #define S3CMCI_DMA 0
1672 @@ -68,7 +72,16 @@ struct s3cmci_host {
1673 unsigned int ccnt, dcnt;
1674 struct tasklet_struct pio_tasklet;
1677 + * Here's where we save the registers during suspend. Note that we skip
1678 + * SDIDATA, which is at different positions on 2410 and 2440, so
1679 + * there's no "+1" in the array size.
1681 + u32 saved[(S3C2410_SDIIMSK-S3C2410_SDICON)/4];
1683 #ifdef CONFIG_CPU_FREQ
1684 struct notifier_block freq_transition;
1687 + struct regulator *regulator;
1690 +++ b/drivers/mmc/host/sdhci-s3c.c
1692 +/* linux/drivers/mmc/host/sdhci-s3c.c
1694 + * Copyright 2008 Openmoko Inc.
1695 + * Copyright 2008 Simtec Electronics
1696 + * Ben Dooks <ben@simtec.co.uk>
1697 + * http://armlinux.simtec.co.uk/
1699 + * SDHCI (HSMMC) support for Samsung SoC
1701 + * This program is free software; you can redistribute it and/or modify
1702 + * it under the terms of the GNU General Public License version 2 as
1703 + * published by the Free Software Foundation.
1706 +#include <linux/delay.h>
1707 +#include <linux/dma-mapping.h>
1708 +#include <linux/platform_device.h>
1709 +#include <linux/clk.h>
1710 +#include <linux/io.h>
1712 +#include <linux/mmc/host.h>
1714 +#include <plat/regs-sdhci.h>
1715 +#include <plat/sdhci.h>
1719 +#define MAX_BUS_CLK (4)
1722 + struct sdhci_host *host;
1723 + struct platform_device *pdev;
1724 + struct resource *ioarea;
1725 + struct s3c_sdhci_platdata *pdata;
1726 + unsigned int cur_clk;
1728 + struct clk *clk_io; /* clock for io bus */
1729 + struct clk *clk_bus[MAX_BUS_CLK];
1732 +static inline struct sdhci_s3c *to_s3c(struct sdhci_host *host)
1734 + return sdhci_priv(host);
1737 +static u32 get_curclk(u32 ctrl2)
1739 + ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
1740 + ctrl2 >>= S3C_SDHCI_CTRL2_SELBASECLK_SHIFT;
1745 +static void sdhci_s3c_check_sclk(struct sdhci_host *host)
1747 + struct sdhci_s3c *ourhost = to_s3c(host);
1748 + u32 tmp = readl(host->ioaddr + S3C_SDHCI_CONTROL2);
1750 + if (get_curclk(tmp) != ourhost->cur_clk) {
1751 + dev_dbg(&ourhost->pdev->dev, "restored ctrl2 clock setting\n");
1753 + tmp &= ~S3C_SDHCI_CTRL2_SELBASECLK_MASK;
1754 + tmp |= ourhost->cur_clk << S3C_SDHCI_CTRL2_SELBASECLK_SHIFT;
1755 + writel(tmp, host->ioaddr + 0x80);
1759 +static unsigned int sdhci_s3c_get_max_clk(struct sdhci_host *host)
1761 + struct sdhci_s3c *ourhost = to_s3c(host);
1762 + struct clk *busclk;
1763 + unsigned int rate, max;
1766 + /* note, a reset will reset the clock source */
1768 + sdhci_s3c_check_sclk(host);
1770 + for (max = 0, clk = 0; clk < MAX_BUS_CLK; clk++) {
1771 + busclk = ourhost->clk_bus[clk];
1775 + rate = clk_get_rate(busclk);
1783 +static unsigned int sdhci_s3c_get_timeout_clk(struct sdhci_host *host)
1785 + return sdhci_s3c_get_max_clk(host) / 1000000;
1788 +static void sdhci_s3c_set_ios(struct sdhci_host *host,
1789 + struct mmc_ios *ios)
1791 + struct sdhci_s3c *ourhost = to_s3c(host);
1792 + struct s3c_sdhci_platdata *pdata = ourhost->pdata;
1795 + sdhci_s3c_check_sclk(host);
1797 + if (ios->power_mode != MMC_POWER_OFF) {
1798 + switch (ios->bus_width) {
1799 + case MMC_BUS_WIDTH_4:
1802 + case MMC_BUS_WIDTH_1:
1809 + if (pdata->cfg_gpio)
1810 + pdata->cfg_gpio(ourhost->pdev, width);
1813 + if (pdata->cfg_card)
1814 + pdata->cfg_card(ourhost->pdev, host->ioaddr,
1815 + ios, host->mmc->card);
1818 +static unsigned int sdhci_s3c_consider_clock(struct sdhci_s3c *ourhost,
1820 + unsigned int wanted)
1822 + unsigned long rate;
1823 + struct clk *clksrc = ourhost->clk_bus[src];
1829 + rate = clk_get_rate(clksrc);
1831 + for (div = 1; div < 256; div *= 2) {
1832 + if ((rate / div) <= wanted)
1836 + dev_dbg(&ourhost->pdev->dev, "clk %d: rate %ld, want %d, got %ld\n",
1837 + src, rate, wanted, rate / div);
1839 + return (wanted - (rate / div));
1842 +static void sdhci_s3c_change_clock(struct sdhci_host *host, unsigned int clock)
1844 + struct sdhci_s3c *ourhost = to_s3c(host);
1845 + unsigned int best = UINT_MAX;
1846 + unsigned int delta;
1851 + for (src = 0; src < MAX_BUS_CLK; src++) {
1852 + delta = sdhci_s3c_consider_clock(ourhost, src, clock);
1853 + if (delta < best) {
1859 + dev_dbg(&ourhost->pdev->dev,
1860 + "selected source %d, clock %d, delta %d\n",
1861 + best_src, clock, best);
1863 + /* turn clock off to card before changing clock source */
1864 + writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);
1866 + /* select the new clock source */
1868 + if (ourhost->cur_clk != best_src) {
1869 + struct clk *clk = ourhost->clk_bus[best_src];
1871 + ourhost->cur_clk = best_src;
1872 + host->max_clk = clk_get_rate(clk);
1873 + host->timeout_clk = host->max_clk / 1000000;
1875 + ctrl = readl(host->ioaddr + S3C_SDHCI_CONTROL2);
1876 + ctrl &= ~S3C_SDHCI_CTRL2_SELBASECLK_MASK;
1877 + ctrl |= best_src << S3C_SDHCI_CTRL2_SELBASECLK_SHIFT;
1878 + writel(ctrl, host->ioaddr + S3C_SDHCI_CONTROL2);
1881 + sdhci_change_clock(host, clock);
1884 +static struct sdhci_ops sdhci_s3c_ops = {
1885 + .get_max_clock = sdhci_s3c_get_max_clk,
1886 + .get_timeout_clock = sdhci_s3c_get_timeout_clk,
1887 + .change_clock = sdhci_s3c_change_clock,
1888 + .set_ios = sdhci_s3c_set_ios,
1892 + * call this when you need sd stack to recognize insertion or removal of card
1893 + * that can't be told by SDHCI regs
1896 +void sdhci_s3c_force_presence_change(struct platform_device *pdev)
1898 + struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data;
1900 + dev_info(&pdev->dev, "sdhci_s3c_force_presence_change called\n");
1901 + mmc_detect_change(pdata->sdhci_host->mmc, msecs_to_jiffies(200));
1903 +EXPORT_SYMBOL_GPL(sdhci_s3c_force_presence_change);
1906 +static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
1908 + struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data;
1909 + struct device *dev = &pdev->dev;
1910 + struct sdhci_host *host;
1911 + struct sdhci_s3c *sc;
1912 + struct resource *res;
1913 + int ret, irq, ptr, clks;
1916 + dev_err(dev, "no device data specified\n");
1920 + irq = platform_get_irq(pdev, 0);
1922 + dev_err(dev, "no irq specified\n");
1926 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1928 + dev_err(dev, "no memory specified\n");
1932 + host = sdhci_alloc_host(dev, sizeof(struct sdhci_s3c));
1933 + if (IS_ERR(host)) {
1934 + dev_err(dev, "sdhci_alloc_host() failed\n");
1935 + return PTR_ERR(host);
1938 + pdata->sdhci_host = host;
1940 + sc = sdhci_priv(host);
1944 + sc->pdata = pdata;
1946 + platform_set_drvdata(pdev, host);
1948 + sc->clk_io = clk_get(dev, "hsmmc");
1949 + if (IS_ERR(sc->clk_io)) {
1950 + dev_err(dev, "failed to get io clock\n");
1951 + ret = PTR_ERR(sc->clk_io);
1955 + /* enable the local io clock and keep it running for the moment. */
1956 + clk_enable(sc->clk_io);
1958 + for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
1960 + char *name = pdata->clocks[ptr];
1965 + clk = clk_get(dev, name);
1966 + if (IS_ERR(clk)) {
1967 + dev_err(dev, "failed to get clock %s\n", name);
1972 + sc->clk_bus[ptr] = clk;
1975 + dev_info(dev, "clock source %d: %s (%ld Hz)\n",
1976 + ptr, name, clk_get_rate(clk));
1980 + dev_err(dev, "failed to find any bus clocks\n");
1982 + goto err_no_busclks;
1985 + sc->ioarea = request_mem_region(res->start, resource_size(res),
1986 + mmc_hostname(host->mmc));
1987 + if (!sc->ioarea) {
1988 + dev_err(dev, "failed to reserve register area\n");
1990 + goto err_req_regs;
1993 + host->ioaddr = ioremap_nocache(res->start, resource_size(res));
1994 + if (!host->ioaddr) {
1995 + dev_err(dev, "failed to map registers\n");
1997 + goto err_req_regs;
2000 + /* Ensure we have minimal gpio selected CMD/CLK/Detect */
2001 + if (pdata->cfg_gpio)
2002 + pdata->cfg_gpio(pdev, 0);
2004 + sdhci_s3c_check_sclk(host);
2006 + host->hw_name = "samsung-hsmmc";
2007 + host->ops = &sdhci_s3c_ops;
2011 + /* Setup quirks for the controller */
2013 + /* Currently with ADMA enabled we are getting some length
2014 + * interrupts that are not being dealt with, do disable
2015 + * ADMA until this is sorted out. */
2016 + host->quirks |= SDHCI_QUIRK_BROKEN_ADMA;
2017 + host->quirks |= SDHCI_QUIRK_32BIT_ADMA_SIZE;
2019 + /* It seems we do not get an DATA transfer complete on non-busy
2020 + * transfers, not sure if this is a problem with this specific
2021 + * SDHCI block, or a missing configuration that needs to be set. */
2022 + host->quirks |= SDHCI_QUIRK_NO_TCIRQ_ON_NOT_BUSY;
2024 + host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR |
2025 + SDHCI_QUIRK_32BIT_DMA_SIZE);
2027 + ret = sdhci_add_host(host);
2029 + dev_err(dev, "sdhci_add_host() failed\n");
2030 + goto err_add_host;
2036 + release_resource(sc->ioarea);
2037 + kfree(sc->ioarea);
2040 + for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
2041 + clk_disable(sc->clk_bus[ptr]);
2042 + clk_put(sc->clk_bus[ptr]);
2046 + clk_disable(sc->clk_io);
2047 + clk_put(sc->clk_io);
2050 + sdhci_free_host(host);
2055 +static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
2062 +static int sdhci_s3c_suspend(struct platform_device *dev, pm_message_t pm)
2064 + struct sdhci_host *host = platform_get_drvdata(dev);
2066 + sdhci_suspend_host(host, pm);
2070 +static int sdhci_s3c_resume(struct platform_device *dev)
2072 + struct sdhci_host *host = platform_get_drvdata(dev);
2074 + sdhci_resume_host(host);
2079 +#define sdhci_s3c_suspend NULL
2080 +#define sdhci_s3c_resume NULL
2083 +static struct platform_driver sdhci_s3c_driver = {
2084 + .probe = sdhci_s3c_probe,
2085 + .remove = __devexit_p(sdhci_s3c_remove),
2086 + .suspend = sdhci_s3c_suspend,
2087 + .resume = sdhci_s3c_resume,
2089 + .owner = THIS_MODULE,
2090 + .name = "s3c-sdhci",
2094 +static int __init sdhci_s3c_init(void)
2096 + return platform_driver_register(&sdhci_s3c_driver);
2099 +static void __exit sdhci_s3c_exit(void)
2101 + platform_driver_unregister(&sdhci_s3c_driver);
2104 +module_init(sdhci_s3c_init);
2105 +module_exit(sdhci_s3c_exit);
2107 +MODULE_DESCRIPTION("Samsung SDHCI (HSMMC) glue");
2108 +MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
2109 +MODULE_LICENSE("GPL v2");
2110 +MODULE_ALIAS("platform:s3c-sdhci");
2111 --- a/drivers/mtd/nand/s3c2410.c
2112 +++ b/drivers/mtd/nand/s3c2410.c
2113 @@ -438,7 +438,7 @@ static int s3c2410_nand_correct_data(str
2114 if ((diff0 & ~(1<<fls(diff0))) == 0)
2122 @@ -530,7 +530,12 @@ static void s3c2410_nand_read_buf(struct
2123 static void s3c2440_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
2125 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
2126 + u8 *ptr = buf + (len & ~3);
2129 readsl(info->regs + S3C2440_NFDATA, buf, len / 4);
2130 + for (i = 0; i != (len & 3); i++)
2131 + ptr[i] = readb(info->regs + S3C2440_NFDATA);
2134 static void s3c2410_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
2135 @@ -645,17 +650,31 @@ static int s3c2410_nand_remove(struct pl
2138 #ifdef CONFIG_MTD_PARTITIONS
2139 +const char *part_probes[] = { "cmdlinepart", NULL };
2140 static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info,
2141 struct s3c2410_nand_mtd *mtd,
2142 struct s3c2410_nand_set *set)
2144 + struct mtd_partition *part_info;
2148 return add_mtd_device(&mtd->mtd);
2150 - if (set->nr_partitions > 0 && set->partitions != NULL) {
2151 - return add_mtd_partitions(&mtd->mtd, set->partitions, set->nr_partitions);
2152 + if (set->nr_partitions == 0) {
2153 + mtd->mtd.name = set->name;
2154 + nr_part = parse_mtd_partitions(&mtd->mtd, part_probes,
2157 + if (set->nr_partitions > 0 && set->partitions != NULL) {
2158 + nr_part = set->nr_partitions;
2159 + part_info = set->partitions;
2163 + if (nr_part > 0 && part_info)
2164 + return add_mtd_partitions(&mtd->mtd, part_info, nr_part);
2166 return add_mtd_device(&mtd->mtd);
2169 @@ -684,9 +703,13 @@ static void s3c2410_nand_init_chip(struc
2170 chip->select_chip = s3c2410_nand_select_chip;
2171 chip->chip_delay = 50;
2173 - chip->options = 0;
2174 chip->controller = &info->controller;
2176 + if (set->flags & S3C2410_NAND_BBT)
2177 + chip->options = NAND_USE_FLASH_BBT;
2179 + chip->options = 0;
2181 switch (info->cpu_type) {
2183 chip->IO_ADDR_W = regs + S3C2410_NFDATA;
2184 @@ -726,7 +749,7 @@ static void s3c2410_nand_init_chip(struc
2185 nmtd->mtd.owner = THIS_MODULE;
2188 - if (hardware_ecc) {
2189 + if (!info->platform->software_ecc && hardware_ecc) {
2190 chip->ecc.calculate = s3c2410_nand_calculate_ecc;
2191 chip->ecc.correct = s3c2410_nand_correct_data;
2192 chip->ecc.mode = NAND_ECC_HW;
2193 --- a/drivers/mmc/core/core.c
2194 +++ b/drivers/mmc/core/core.c
2195 @@ -59,10 +59,11 @@ static int mmc_schedule_delayed_work(str
2197 * Internal function. Flush all scheduled work from the MMC work queue.
2199 -static void mmc_flush_scheduled_work(void)
2200 +void mmc_flush_scheduled_work(void)
2202 flush_workqueue(workqueue);
2204 +EXPORT_SYMBOL_GPL(mmc_flush_scheduled_work);
2207 * mmc_request_done - finish processing an MMC request