···5151-----------52525353 Each pin has an unique number associated with it in regs-gpio.h,5454- eg S3C2410_GPA0 or S3C2410_GPF1. These defines are used to tell5454+ eg S3C2410_GPA(0) or S3C2410_GPF(1). These defines are used to tell5555 the GPIO functions which pin is to be used.56565757···65656666 Eg:67676868- s3c2410_gpio_cfgpin(S3C2410_GPA0, S3C2410_GPA0_ADDR0);6969- s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1);6868+ s3c2410_gpio_cfgpin(S3C2410_GPA(0), S3C2410_GPA0_ADDR0);6969+ s3c2410_gpio_cfgpin(S3C2410_GPE(8), S3C2410_GPE8_SDDAT1);70707171- which would turn GPA0 into the lowest Address line A0, and set7272- GPE8 to be connected to the SDIO/MMC controller's SDDAT1 line.7171+ which would turn GPA(0) into the lowest Address line A0, and set7272+ GPE(8) to be connected to the SDIO/MMC controller's SDDAT1 line.737374747575Reading the current configuration
+7
arch/arm/common/Kconfig
···44config ARM_VIC55 bool6677+config ARM_VIC_NR88+ int99+ default 21010+ help1111+ The maximum number of VICs available in the system, for1212+ power management.1313+714config ICST525815 bool916
+214-7
arch/arm/common/vic.c
···2121#include <linux/init.h>2222#include <linux/list.h>2323#include <linux/io.h>2424+#include <linux/sysdev.h>24252526#include <asm/mach/irq.h>2627#include <asm/hardware/vic.h>···4039 writel(1 << irq, base + VIC_INT_ENABLE);4140}42414242+/**4343+ * vic_init2 - common initialisation code4444+ * @base: Base of the VIC.4545+ *4646+ * Common initialisation code for registeration4747+ * and resume.4848+*/4949+static void vic_init2(void __iomem *base)5050+{5151+ int i;5252+5353+ for (i = 0; i < 16; i++) {5454+ void __iomem *reg = base + VIC_VECT_CNTL0 + (i * 4);5555+ writel(VIC_VECT_CNTL_ENABLE | i, reg);5656+ }5757+5858+ writel(32, base + VIC_PL190_DEF_VECT_ADDR);5959+}6060+6161+#if defined(CONFIG_PM)6262+/**6363+ * struct vic_device - VIC PM device6464+ * @sysdev: The system device which is registered.6565+ * @irq: The IRQ number for the base of the VIC.6666+ * @base: The register base for the VIC.6767+ * @resume_sources: A bitmask of interrupts for resume.6868+ * @resume_irqs: The IRQs enabled for resume.6969+ * @int_select: Save for VIC_INT_SELECT.7070+ * @int_enable: Save for VIC_INT_ENABLE.7171+ * @soft_int: Save for VIC_INT_SOFT.7272+ * @protect: Save for VIC_PROTECT.7373+ */7474+struct vic_device {7575+ struct sys_device sysdev;7676+7777+ void __iomem *base;7878+ int irq;7979+ u32 resume_sources;8080+ u32 resume_irqs;8181+ u32 int_select;8282+ u32 int_enable;8383+ u32 soft_int;8484+ u32 protect;8585+};8686+8787+/* we cannot allocate memory when VICs are initially registered */8888+static struct vic_device vic_devices[CONFIG_ARM_VIC_NR];8989+9090+static inline struct vic_device *to_vic(struct sys_device *sys)9191+{9292+ return container_of(sys, struct vic_device, sysdev);9393+}9494+9595+static int vic_id;9696+9797+static int vic_class_resume(struct sys_device *dev)9898+{9999+ struct vic_device *vic = to_vic(dev);100100+ void __iomem *base = vic->base;101101+102102+ printk(KERN_DEBUG "%s: resuming vic at %p\n", __func__, base);103103+104104+ /* re-initialise static settings */105105+ vic_init2(base);106106+107107+ writel(vic->int_select, base + VIC_INT_SELECT);108108+ writel(vic->protect, base + VIC_PROTECT);109109+110110+ /* set the enabled ints and then clear the non-enabled */111111+ writel(vic->int_enable, base + VIC_INT_ENABLE);112112+ writel(~vic->int_enable, base + VIC_INT_ENABLE_CLEAR);113113+114114+ /* and the same for the soft-int register */115115+116116+ writel(vic->soft_int, base + VIC_INT_SOFT);117117+ writel(~vic->soft_int, base + VIC_INT_SOFT_CLEAR);118118+119119+ return 0;120120+}121121+122122+static int vic_class_suspend(struct sys_device *dev, pm_message_t state)123123+{124124+ struct vic_device *vic = to_vic(dev);125125+ void __iomem *base = vic->base;126126+127127+ printk(KERN_DEBUG "%s: suspending vic at %p\n", __func__, base);128128+129129+ vic->int_select = readl(base + VIC_INT_SELECT);130130+ vic->int_enable = readl(base + VIC_INT_ENABLE);131131+ vic->soft_int = readl(base + VIC_INT_SOFT);132132+ vic->protect = readl(base + VIC_PROTECT);133133+134134+ /* set the interrupts (if any) that are used for135135+ * resuming the system */136136+137137+ writel(vic->resume_irqs, base + VIC_INT_ENABLE);138138+ writel(~vic->resume_irqs, base + VIC_INT_ENABLE_CLEAR);139139+140140+ return 0;141141+}142142+143143+struct sysdev_class vic_class = {144144+ .name = "vic",145145+ .suspend = vic_class_suspend,146146+ .resume = vic_class_resume,147147+};148148+149149+/**150150+ * vic_pm_register - Register a VIC for later power management control151151+ * @base: The base address of the VIC.152152+ * @irq: The base IRQ for the VIC.153153+ * @resume_sources: bitmask of interrupts allowed for resume sources.154154+ *155155+ * Register the VIC with the system device tree so that it can be notified156156+ * of suspend and resume requests and ensure that the correct actions are157157+ * taken to re-instate the settings on resume.158158+ */159159+static void __init vic_pm_register(void __iomem *base, unsigned int irq, u32 resume_sources)160160+{161161+ struct vic_device *v;162162+163163+ if (vic_id >= ARRAY_SIZE(vic_devices))164164+ printk(KERN_ERR "%s: too few VICs, increase CONFIG_ARM_VIC_NR\n", __func__);165165+ else {166166+ v = &vic_devices[vic_id];167167+ v->base = base;168168+ v->resume_sources = resume_sources;169169+ v->irq = irq;170170+ vic_id++;171171+ }172172+}173173+174174+/**175175+ * vic_pm_init - initicall to register VIC pm176176+ *177177+ * This is called via late_initcall() to register178178+ * the resources for the VICs due to the early179179+ * nature of the VIC's registration.180180+*/181181+static int __init vic_pm_init(void)182182+{183183+ struct vic_device *dev = vic_devices;184184+ int err;185185+ int id;186186+187187+ if (vic_id == 0)188188+ return 0;189189+190190+ err = sysdev_class_register(&vic_class);191191+ if (err) {192192+ printk(KERN_ERR "%s: cannot register class\n", __func__);193193+ return err;194194+ }195195+196196+ for (id = 0; id < vic_id; id++, dev++) {197197+ dev->sysdev.id = id;198198+ dev->sysdev.cls = &vic_class;199199+200200+ err = sysdev_register(&dev->sysdev);201201+ if (err) {202202+ printk(KERN_ERR "%s: failed to register device\n",203203+ __func__);204204+ return err;205205+ }206206+ }207207+208208+ return 0;209209+}210210+211211+late_initcall(vic_pm_init);212212+213213+static struct vic_device *vic_from_irq(unsigned int irq)214214+{215215+ struct vic_device *v = vic_devices;216216+ unsigned int base_irq = irq & ~31;217217+ int id;218218+219219+ for (id = 0; id < vic_id; id++, v++) {220220+ if (v->irq == base_irq)221221+ return v;222222+ }223223+224224+ return NULL;225225+}226226+227227+static int vic_set_wake(unsigned int irq, unsigned int on)228228+{229229+ struct vic_device *v = vic_from_irq(irq);230230+ unsigned int off = irq & 31;231231+232232+ if (!v)233233+ return -EINVAL;234234+235235+ if (on)236236+ v->resume_irqs |= 1 << off;237237+ else238238+ v->resume_irqs &= ~(1 << off);239239+240240+ return 0;241241+}242242+243243+#else244244+static inline void vic_pm_register(void __iomem *base, unsigned int irq, u32 arg1) { }245245+246246+#define vic_set_wake NULL247247+#endif /* CONFIG_PM */248248+43249static struct irq_chip vic_chip = {44250 .name = "VIC",45251 .ack = vic_mask_irq,46252 .mask = vic_mask_irq,47253 .unmask = vic_unmask_irq,254254+ .set_wake = vic_set_wake,48255};4925650257/**···26051 * @base: iomem base address26152 * @irq_start: starting interrupt number, must be muliple of 3226253 * @vic_sources: bitmask of interrupt sources to allow5454+ * @resume_sources: bitmask of interrupt sources to allow for resume26355 */26456void __init vic_init(void __iomem *base, unsigned int irq_start,265265- u32 vic_sources)5757+ u32 vic_sources, u32 resume_sources)26658{26759 unsigned int i;26860···28777 writel(value, base + VIC_PL190_VECT_ADDR);28878 }28979290290- for (i = 0; i < 16; i++) {291291- void __iomem *reg = base + VIC_VECT_CNTL0 + (i * 4);292292- writel(VIC_VECT_CNTL_ENABLE | i, reg);293293- }294294-295295- writel(32, base + VIC_PL190_DEF_VECT_ADDR);8080+ vic_init2(base);2968129782 for (i = 0; i < 32; i++) {29883 if (vic_sources & (1 << i)) {···29994 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);30095 }30196 }9797+9898+ vic_pm_register(base, irq_start, resume_sources);30299}
+138
arch/arm/include/asm/hardware/pl080.h
···11+/* arch/arm/include/asm/hardware/pl080.h22+ *33+ * Copyright 2008 Openmoko, Inc.44+ * Copyright 2008 Simtec Electronics55+ * http://armlinux.simtec.co.uk/66+ * Ben Dooks <ben@simtec.co.uk>77+ *88+ * ARM PrimeCell PL080 DMA controller99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+*/1414+1515+/* Note, there are some Samsung updates to this controller block which1616+ * make it not entierly compatible with the PL080 specification from1717+ * ARM. When in doubt, check the Samsung documentation first.1818+ *1919+ * The Samsung defines are PL080S, and add an extra controll register,2020+ * the ability to move more than 2^11 counts of data and some extra2121+ * OneNAND features.2222+*/2323+2424+#define PL080_INT_STATUS (0x00)2525+#define PL080_TC_STATUS (0x04)2626+#define PL080_TC_CLEAR (0x08)2727+#define PL080_ERR_STATUS (0x0C)2828+#define PL080_ERR_CLEAR (0x10)2929+#define PL080_RAW_TC_STATUS (0x14)3030+#define PL080_RAW_ERR_STATUS (0x18)3131+#define PL080_EN_CHAN (0x1c)3232+#define PL080_SOFT_BREQ (0x20)3333+#define PL080_SOFT_SREQ (0x24)3434+#define PL080_SOFT_LBREQ (0x28)3535+#define PL080_SOFT_LSREQ (0x2C)3636+3737+#define PL080_CONFIG (0x30)3838+#define PL080_CONFIG_M2_BE (1 << 2)3939+#define PL080_CONFIG_M1_BE (1 << 1)4040+#define PL080_CONFIG_ENABLE (1 << 0)4141+4242+#define PL080_SYNC (0x34)4343+4444+/* Per channel configuration registers */4545+4646+#define PL008_Cx_STRIDE (0x20)4747+#define PL080_Cx_BASE(x) ((0x100 + (x * 0x20)))4848+#define PL080_Cx_SRC_ADDR(x) ((0x100 + (x * 0x20)))4949+#define PL080_Cx_DST_ADDR(x) ((0x104 + (x * 0x20)))5050+#define PL080_Cx_LLI(x) ((0x108 + (x * 0x20)))5151+#define PL080_Cx_CONTROL(x) ((0x10C + (x * 0x20)))5252+#define PL080_Cx_CONFIG(x) ((0x110 + (x * 0x20)))5353+#define PL080S_Cx_CONTROL2(x) ((0x110 + (x * 0x20)))5454+#define PL080S_Cx_CONFIG(x) ((0x114 + (x * 0x20)))5555+5656+#define PL080_CH_SRC_ADDR (0x00)5757+#define PL080_CH_DST_ADDR (0x04)5858+#define PL080_CH_LLI (0x08)5959+#define PL080_CH_CONTROL (0x0C)6060+#define PL080_CH_CONFIG (0x10)6161+#define PL080S_CH_CONTROL2 (0x10)6262+#define PL080S_CH_CONFIG (0x14)6363+6464+#define PL080_LLI_ADDR_MASK (0x3fffffff << 2)6565+#define PL080_LLI_ADDR_SHIFT (2)6666+#define PL080_LLI_LM_AHB2 (1 << 0)6767+6868+#define PL080_CONTROL_TC_IRQ_EN (1 << 31)6969+#define PL080_CONTROL_PROT_MASK (0x7 << 28)7070+#define PL080_CONTROL_PROT_SHIFT (28)7171+#define PL080_CONTROL_PROT_SYS (1 << 28)7272+#define PL080_CONTROL_DST_INCR (1 << 27)7373+#define PL080_CONTROL_SRC_INCR (1 << 26)7474+#define PL080_CONTROL_DST_AHB2 (1 << 25)7575+#define PL080_CONTROL_SRC_AHB2 (1 << 24)7676+#define PL080_CONTROL_DWIDTH_MASK (0x7 << 21)7777+#define PL080_CONTROL_DWIDTH_SHIFT (21)7878+#define PL080_CONTROL_SWIDTH_MASK (0x7 << 18)7979+#define PL080_CONTROL_SWIDTH_SHIFT (18)8080+#define PL080_CONTROL_DB_SIZE_MASK (0x7 << 15)8181+#define PL080_CONTROL_DB_SIZE_SHIFT (15)8282+#define PL080_CONTROL_SB_SIZE_MASK (0x7 << 12)8383+#define PL080_CONTROL_SB_SIZE_SHIFT (12)8484+#define PL080_CONTROL_TRANSFER_SIZE_MASK (0xfff << 0)8585+#define PL080_CONTROL_TRANSFER_SIZE_SHIFT (0)8686+8787+#define PL080_BSIZE_1 (0x0)8888+#define PL080_BSIZE_4 (0x1)8989+#define PL080_BSIZE_8 (0x2)9090+#define PL080_BSIZE_16 (0x3)9191+#define PL080_BSIZE_32 (0x4)9292+#define PL080_BSIZE_64 (0x5)9393+#define PL080_BSIZE_128 (0x6)9494+#define PL080_BSIZE_256 (0x7)9595+9696+#define PL080_WIDTH_8BIT (0x0)9797+#define PL080_WIDTH_16BIT (0x1)9898+#define PL080_WIDTH_32BIT (0x2)9999+100100+#define PL080_CONFIG_HALT (1 << 18)101101+#define PL080_CONFIG_ACTIVE (1 << 17) /* RO */102102+#define PL080_CONFIG_LOCK (1 << 16)103103+#define PL080_CONFIG_TC_IRQ_MASK (1 << 15)104104+#define PL080_CONFIG_ERR_IRQ_MASK (1 << 14)105105+#define PL080_CONFIG_FLOW_CONTROL_MASK (0x7 << 11)106106+#define PL080_CONFIG_FLOW_CONTROL_SHIFT (11)107107+#define PL080_CONFIG_DST_SEL_MASK (0xf << 6)108108+#define PL080_CONFIG_DST_SEL_SHIFT (6)109109+#define PL080_CONFIG_SRC_SEL_MASK (0xf << 1)110110+#define PL080_CONFIG_SRC_SEL_SHIFT (1)111111+#define PL080_CONFIG_ENABLE (1 << 0)112112+113113+#define PL080_FLOW_MEM2MEM (0x0)114114+#define PL080_FLOW_MEM2PER (0x1)115115+#define PL080_FLOW_PER2MEM (0x2)116116+#define PL080_FLOW_SRC2DST (0x3)117117+#define PL080_FLOW_SRC2DST_DST (0x4)118118+#define PL080_FLOW_MEM2PER_PER (0x5)119119+#define PL080_FLOW_PER2MEM_PER (0x6)120120+#define PL080_FLOW_SRC2DST_SRC (0x7)121121+122122+/* DMA linked list chain structure */123123+124124+struct pl080_lli {125125+ u32 src_addr;126126+ u32 dst_addr;127127+ u32 next_lli;128128+ u32 control0;129129+};130130+131131+struct pl080s_lli {132132+ u32 src_addr;133133+ u32 dst_addr;134134+ u32 next_lli;135135+ u32 control0;136136+ u32 control1;137137+};138138+
···33333434int s3c2400_gpio_getirq(unsigned int pin)3535{3636- if (pin < S3C2410_GPE0 || pin > S3C2400_GPE7_EINT7)3737- return -1; /* not valid interrupts */3636+ if (pin < S3C2410_GPE(0) || pin > S3C2400_GPE(7))3737+ return -EINVAL; /* not valid interrupts */38383939- return (pin - S3C2410_GPE0) + IRQ_EINT0;3939+ return (pin - S3C2410_GPE(0)) + IRQ_EINT0;4040}41414242EXPORT_SYMBOL(s3c2400_gpio_getirq);
+8
arch/arm/mach-s3c2410/Kconfig
···5959 bool "IPAQ H1940"6060 select CPU_S3C24106161 select PM_H1940 if PM6262+ select S3C_DEV_USB_HOST6263 help6364 Say Y here if you are using the HP IPAQ H19406465···7170config MACH_N307271 bool "Acer N30 family"7372 select CPU_S3C24107373+ select S3C_DEV_USB_HOST7474 help7575 Say Y here if you want suppt for the Acer N30, Acer N35,7676 Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs.···8482 select MACH_BAST_IDE8583 select S3C24XX_DCLK8684 select ISA8585+ select S3C_DEV_USB_HOST8786 help8887 Say Y here if you are using the Simtec Electronics EB2410ITX8988 development board (also known as BAST)···9289config MACH_OTOM9390 bool "NexVision OTOM Board"9491 select CPU_S3C24109292+ select S3C_DEV_USB_HOST9593 help9694 Say Y here if you are using the Nex Vision OTOM board9795···10096 bool "AML M5900 Series"10197 select CPU_S3C241010298 select PM_SIMTEC if PM9999+ select S3C_DEV_USB_HOST103100 help104101 Say Y here if you are using the American Microsystems M5900 Series105102 <http://www.amltd.com>···116111config MACH_TCT_HAMMER117112 bool "TCT Hammer Board"118113 select CPU_S3C2410114114+ select S3C_DEV_USB_HOST119115 help120116 Say Y here if you are using the TinCanTools Hammer Board121117 <http://www.tincantools.com>···128122 select SIMTEC_NOR129123 select MACH_BAST_IDE130124 select CPU_S3C2410125125+ select S3C_DEV_USB_HOST131126 help132127 Say Y here if you are using the Thorcom VR1000 board.133128134129config MACH_QT2410135130 bool "QT2410"136131 select CPU_S3C2410132132+ select S3C_DEV_USB_HOST137133 help138134 Say Y here if you are using the Armzone QT2410139135
···33 * Copyright (C) 2003,2004,2006 Simtec Electronics44 * Ben Dooks <ben@simtec.co.uk>55 *66- * Samsung S3C241XX DMA support66+ * Samsung S3C24XX DMA support77 *88 * This program is free software; you can redistribute it and/or modify99 * it under the terms of the GNU General Public License version 2 as···1313#ifndef __ASM_ARCH_DMA_H1414#define __ASM_ARCH_DMA_H __FILE__15151616+#include <plat/dma.h>1617#include <linux/sysdev.h>1717-#include <mach/hardware.h>18181919#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */2020···55555656/* we have 4 dma channels */5757#ifndef CONFIG_CPU_S3C24435858-#define S3C2410_DMA_CHANNELS (4)5858+#define S3C_DMA_CHANNELS (4)5959#else6060-#define S3C2410_DMA_CHANNELS (6)6060+#define S3C_DMA_CHANNELS (6)6161#endif62626363/* types */···6767 S3C2410_DMA_RUNNING,6868 S3C2410_DMA_PAUSED6969};7070-71707271/* enum s3c2410_dma_loadst7372 *···103104 S3C2410_DMALOAD_1LOADED_1RUNNING,104105};105106106106-enum s3c2410_dma_buffresult {107107- S3C2410_RES_OK,108108- S3C2410_RES_ERR,109109- S3C2410_RES_ABORT110110-};111111-112112-enum s3c2410_dmasrc {113113- S3C2410_DMASRC_HW, /* source is memory */114114- S3C2410_DMASRC_MEM /* source is hardware */115115-};116116-117117-/* enum s3c2410_chan_op118118- *119119- * operation codes passed to the DMA code by the user, and also used120120- * to inform the current channel owner of any changes to the system state121121-*/122122-123123-enum s3c2410_chan_op {124124- S3C2410_DMAOP_START,125125- S3C2410_DMAOP_STOP,126126- S3C2410_DMAOP_PAUSE,127127- S3C2410_DMAOP_RESUME,128128- S3C2410_DMAOP_FLUSH,129129- S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */130130- S3C2410_DMAOP_STARTED, /* indicate channel started */131131-};132107133108/* flags */134109···112139113140/* dma buffer */114141115115-struct s3c2410_dma_client {116116- char *name;117117-};142142+struct s3c2410_dma_buf;118143119119-/* s3c2410_dma_buf_s144144+/* s3c2410_dma_buf120145 *121146 * internally used buffer structure to describe a queued or running122147 * buffer.123148*/124149125125-struct s3c2410_dma_buf;126150struct s3c2410_dma_buf {127151 struct s3c2410_dma_buf *next;128152 int magic; /* magic */···130160};131161132162/* [1] is this updated for both recv/send modes? */133133-134134-struct s3c2410_dma_chan;135135-136136-/* s3c2410_dma_cbfn_t137137- *138138- * buffer callback routine type139139-*/140140-141141-typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *,142142- void *buf, int size,143143- enum s3c2410_dma_buffresult result);144144-145145-typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,146146- enum s3c2410_chan_op );147163148164struct s3c2410_dma_stats {149165 unsigned long loads;···162206163207 /* channel configuration */164208 enum s3c2410_dmasrc source;209209+ enum dma_ch req_ch;165210 unsigned long dev_addr;166211 unsigned long load_timeout;167212 unsigned int flags; /* channel flags */168168- unsigned int hw_cfg; /* last hw config */169213170214 struct s3c24xx_dma_map *map; /* channel hw maps */171215···192236 struct sys_device dev;193237};194238195195-/* the currently allocated channel information */196196-extern struct s3c2410_dma_chan s3c2410_chans[];197197-198198-/* note, we don't really use dma_device_t at the moment */199239typedef unsigned long dma_device_t;200200-201201-/* functions --------------------------------------------------------------- */202202-203203-/* s3c2410_dma_request204204- *205205- * request a dma channel exclusivley206206-*/207207-208208-extern int s3c2410_dma_request(unsigned int channel,209209- struct s3c2410_dma_client *, void *dev);210210-211211-212212-/* s3c2410_dma_ctrl213213- *214214- * change the state of the dma channel215215-*/216216-217217-extern int s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op);218218-219219-/* s3c2410_dma_setflags220220- *221221- * set the channel's flags to a given state222222-*/223223-224224-extern int s3c2410_dma_setflags(unsigned int channel,225225- unsigned int flags);226226-227227-/* s3c2410_dma_free228228- *229229- * free the dma channel (will also abort any outstanding operations)230230-*/231231-232232-extern int s3c2410_dma_free(unsigned int channel, struct s3c2410_dma_client *);233233-234234-/* s3c2410_dma_enqueue235235- *236236- * place the given buffer onto the queue of operations for the channel.237237- * The buffer must be allocated from dma coherent memory, or the Dcache/WB238238- * drained before the buffer is given to the DMA system.239239-*/240240-241241-extern int s3c2410_dma_enqueue(unsigned int channel, void *id,242242- dma_addr_t data, int size);243243-244244-/* s3c2410_dma_config245245- *246246- * configure the dma channel247247-*/248248-249249-extern int s3c2410_dma_config(unsigned int channel, int xferunit, int dcon);250250-251251-/* s3c2410_dma_devconfig252252- *253253- * configure the device we're talking to254254-*/255255-256256-extern int s3c2410_dma_devconfig(int channel, enum s3c2410_dmasrc source,257257- int hwcfg, unsigned long devaddr);258258-259259-/* s3c2410_dma_getposition260260- *261261- * get the position that the dma transfer is currently at262262-*/263263-264264-extern int s3c2410_dma_getposition(unsigned int channel,265265- dma_addr_t *src, dma_addr_t *dest);266266-267267-extern int s3c2410_dma_set_opfn(unsigned int, s3c2410_dma_opfn_t rtn);268268-extern int s3c2410_dma_set_buffdone_fn(unsigned int, s3c2410_dma_cbfn_t rtn);269269-270270-/* DMA Register definitions */271271-272272-#define S3C2410_DMA_DISRC (0x00)273273-#define S3C2410_DMA_DISRCC (0x04)274274-#define S3C2410_DMA_DIDST (0x08)275275-#define S3C2410_DMA_DIDSTC (0x0C)276276-#define S3C2410_DMA_DCON (0x10)277277-#define S3C2410_DMA_DSTAT (0x14)278278-#define S3C2410_DMA_DCSRC (0x18)279279-#define S3C2410_DMA_DCDST (0x1C)280280-#define S3C2410_DMA_DMASKTRIG (0x20)281281-#define S3C2412_DMA_DMAREQSEL (0x24)282282-#define S3C2443_DMA_DMAREQSEL (0x24)283283-284284-#define S3C2410_DISRCC_INC (1<<0)285285-#define S3C2410_DISRCC_APB (1<<1)286286-287287-#define S3C2410_DMASKTRIG_STOP (1<<2)288288-#define S3C2410_DMASKTRIG_ON (1<<1)289289-#define S3C2410_DMASKTRIG_SWTRIG (1<<0)290290-291291-#define S3C2410_DCON_DEMAND (0<<31)292292-#define S3C2410_DCON_HANDSHAKE (1<<31)293293-#define S3C2410_DCON_SYNC_PCLK (0<<30)294294-#define S3C2410_DCON_SYNC_HCLK (1<<30)295295-296296-#define S3C2410_DCON_INTREQ (1<<29)297297-298298-#define S3C2410_DCON_CH0_XDREQ0 (0<<24)299299-#define S3C2410_DCON_CH0_UART0 (1<<24)300300-#define S3C2410_DCON_CH0_SDI (2<<24)301301-#define S3C2410_DCON_CH0_TIMER (3<<24)302302-#define S3C2410_DCON_CH0_USBEP1 (4<<24)303303-304304-#define S3C2410_DCON_CH1_XDREQ1 (0<<24)305305-#define S3C2410_DCON_CH1_UART1 (1<<24)306306-#define S3C2410_DCON_CH1_I2SSDI (2<<24)307307-#define S3C2410_DCON_CH1_SPI (3<<24)308308-#define S3C2410_DCON_CH1_USBEP2 (4<<24)309309-310310-#define S3C2410_DCON_CH2_I2SSDO (0<<24)311311-#define S3C2410_DCON_CH2_I2SSDI (1<<24)312312-#define S3C2410_DCON_CH2_SDI (2<<24)313313-#define S3C2410_DCON_CH2_TIMER (3<<24)314314-#define S3C2410_DCON_CH2_USBEP3 (4<<24)315315-316316-#define S3C2410_DCON_CH3_UART2 (0<<24)317317-#define S3C2410_DCON_CH3_SDI (1<<24)318318-#define S3C2410_DCON_CH3_SPI (2<<24)319319-#define S3C2410_DCON_CH3_TIMER (3<<24)320320-#define S3C2410_DCON_CH3_USBEP4 (4<<24)321321-322322-#define S3C2410_DCON_SRCSHIFT (24)323323-#define S3C2410_DCON_SRCMASK (7<<24)324324-325325-#define S3C2410_DCON_BYTE (0<<20)326326-#define S3C2410_DCON_HALFWORD (1<<20)327327-#define S3C2410_DCON_WORD (2<<20)328328-329329-#define S3C2410_DCON_AUTORELOAD (0<<22)330330-#define S3C2410_DCON_NORELOAD (1<<22)331331-#define S3C2410_DCON_HWTRIG (1<<23)332332-333333-#ifdef CONFIG_CPU_S3C2440334334-#define S3C2440_DIDSTC_CHKINT (1<<2)335335-336336-#define S3C2440_DCON_CH0_I2SSDO (5<<24)337337-#define S3C2440_DCON_CH0_PCMIN (6<<24)338338-339339-#define S3C2440_DCON_CH1_PCMOUT (5<<24)340340-#define S3C2440_DCON_CH1_SDI (6<<24)341341-342342-#define S3C2440_DCON_CH2_PCMIN (5<<24)343343-#define S3C2440_DCON_CH2_MICIN (6<<24)344344-345345-#define S3C2440_DCON_CH3_MICIN (5<<24)346346-#define S3C2440_DCON_CH3_PCMOUT (6<<24)347347-#endif348348-349349-#ifdef CONFIG_CPU_S3C2412350350-351351-#define S3C2412_DMAREQSEL_SRC(x) ((x)<<1)352352-353353-#define S3C2412_DMAREQSEL_HW (1)354354-355355-#define S3C2412_DMAREQSEL_SPI0TX S3C2412_DMAREQSEL_SRC(0)356356-#define S3C2412_DMAREQSEL_SPI0RX S3C2412_DMAREQSEL_SRC(1)357357-#define S3C2412_DMAREQSEL_SPI1TX S3C2412_DMAREQSEL_SRC(2)358358-#define S3C2412_DMAREQSEL_SPI1RX S3C2412_DMAREQSEL_SRC(3)359359-#define S3C2412_DMAREQSEL_I2STX S3C2412_DMAREQSEL_SRC(4)360360-#define S3C2412_DMAREQSEL_I2SRX S3C2412_DMAREQSEL_SRC(5)361361-#define S3C2412_DMAREQSEL_TIMER S3C2412_DMAREQSEL_SRC(9)362362-#define S3C2412_DMAREQSEL_SDI S3C2412_DMAREQSEL_SRC(10)363363-#define S3C2412_DMAREQSEL_USBEP1 S3C2412_DMAREQSEL_SRC(13)364364-#define S3C2412_DMAREQSEL_USBEP2 S3C2412_DMAREQSEL_SRC(14)365365-#define S3C2412_DMAREQSEL_USBEP3 S3C2412_DMAREQSEL_SRC(15)366366-#define S3C2412_DMAREQSEL_USBEP4 S3C2412_DMAREQSEL_SRC(16)367367-#define S3C2412_DMAREQSEL_XDREQ0 S3C2412_DMAREQSEL_SRC(17)368368-#define S3C2412_DMAREQSEL_XDREQ1 S3C2412_DMAREQSEL_SRC(18)369369-#define S3C2412_DMAREQSEL_UART0_0 S3C2412_DMAREQSEL_SRC(19)370370-#define S3C2412_DMAREQSEL_UART0_1 S3C2412_DMAREQSEL_SRC(20)371371-#define S3C2412_DMAREQSEL_UART1_0 S3C2412_DMAREQSEL_SRC(21)372372-#define S3C2412_DMAREQSEL_UART1_1 S3C2412_DMAREQSEL_SRC(22)373373-#define S3C2412_DMAREQSEL_UART2_0 S3C2412_DMAREQSEL_SRC(23)374374-#define S3C2412_DMAREQSEL_UART2_1 S3C2412_DMAREQSEL_SRC(24)375375-376376-#endif377377-378378-#define S3C2443_DMAREQSEL_SRC(x) ((x)<<1)379379-380380-#define S3C2443_DMAREQSEL_HW (1)381381-382382-#define S3C2443_DMAREQSEL_SPI0TX S3C2443_DMAREQSEL_SRC(0)383383-#define S3C2443_DMAREQSEL_SPI0RX S3C2443_DMAREQSEL_SRC(1)384384-#define S3C2443_DMAREQSEL_SPI1TX S3C2443_DMAREQSEL_SRC(2)385385-#define S3C2443_DMAREQSEL_SPI1RX S3C2443_DMAREQSEL_SRC(3)386386-#define S3C2443_DMAREQSEL_I2STX S3C2443_DMAREQSEL_SRC(4)387387-#define S3C2443_DMAREQSEL_I2SRX S3C2443_DMAREQSEL_SRC(5)388388-#define S3C2443_DMAREQSEL_TIMER S3C2443_DMAREQSEL_SRC(9)389389-#define S3C2443_DMAREQSEL_SDI S3C2443_DMAREQSEL_SRC(10)390390-#define S3C2443_DMAREQSEL_XDREQ0 S3C2443_DMAREQSEL_SRC(17)391391-#define S3C2443_DMAREQSEL_XDREQ1 S3C2443_DMAREQSEL_SRC(18)392392-#define S3C2443_DMAREQSEL_UART0_0 S3C2443_DMAREQSEL_SRC(19)393393-#define S3C2443_DMAREQSEL_UART0_1 S3C2443_DMAREQSEL_SRC(20)394394-#define S3C2443_DMAREQSEL_UART1_0 S3C2443_DMAREQSEL_SRC(21)395395-#define S3C2443_DMAREQSEL_UART1_1 S3C2443_DMAREQSEL_SRC(22)396396-#define S3C2443_DMAREQSEL_UART2_0 S3C2443_DMAREQSEL_SRC(23)397397-#define S3C2443_DMAREQSEL_UART2_1 S3C2443_DMAREQSEL_SRC(24)398398-#define S3C2443_DMAREQSEL_UART3_0 S3C2443_DMAREQSEL_SRC(25)399399-#define S3C2443_DMAREQSEL_UART3_1 S3C2443_DMAREQSEL_SRC(26)400400-#define S3C2443_DMAREQSEL_PCMOUT S3C2443_DMAREQSEL_SRC(27)401401-#define S3C2443_DMAREQSEL_PCMIN S3C2443_DMAREQSEL_SRC(28)402402-#define S3C2443_DMAREQSEL_MICIN S3C2443_DMAREQSEL_SRC(29)403240404241#endif /* __ASM_ARCH_DMA_H */
+1-1
arch/arm/mach-s3c2410/include/mach/gpio-core.h
···2424{2525 struct s3c_gpio_chip *chip;26262727- if (pin > S3C2410_GPG10)2727+ if (pin > S3C2410_GPG(10))2828 return NULL;29293030 chip = &s3c24xx_gpios[pin/32];
+103
arch/arm/mach-s3c2410/include/mach/gpio-fns.h
···11+/* arch/arm/mach-s3c2410/include/mach/gpio-fns.h22+ *33+ * Copyright (c) 2003,2009 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ *66+ * S3C2410 - hardware77+ *88+ * This program is free software; you can redistribute it and/or modify99+ * it under the terms of the GNU General Public License version 2 as1010+ * published by the Free Software Foundation.1111+*/1212+1313+/* These functions are in the to-be-removed category and it is strongly1414+ * encouraged not to use these in new code. They will be marked deprecated1515+ * very soon.1616+ *1717+ * Most of the functionality can be either replaced by the gpiocfg calls1818+ * for the s3c platform or by the generic GPIOlib API.1919+*/2020+2121+/* external functions for GPIO support2222+ *2323+ * These allow various different clients to access the same GPIO2424+ * registers without conflicting. If your driver only owns the entire2525+ * GPIO register, then it is safe to ioremap/__raw_{read|write} to it.2626+*/2727+2828+/* s3c2410_gpio_cfgpin2929+ *3030+ * set the configuration of the given pin to the value passed.3131+ *3232+ * eg:3333+ * s3c2410_gpio_cfgpin(S3C2410_GPA(0), S3C2410_GPA0_ADDR0);3434+ * s3c2410_gpio_cfgpin(S3C2410_GPE(8), S3C2410_GPE8_SDDAT1);3535+*/3636+3737+extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function);3838+3939+extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);4040+4141+/* s3c2410_gpio_getirq4242+ *4343+ * turn the given pin number into the corresponding IRQ number4444+ *4545+ * returns:4646+ * < 0 = no interrupt for this pin4747+ * >=0 = interrupt number for the pin4848+*/4949+5050+extern int s3c2410_gpio_getirq(unsigned int pin);5151+5252+#ifdef CONFIG_CPU_S3C24005353+5454+extern int s3c2400_gpio_getirq(unsigned int pin);5555+5656+#endif /* CONFIG_CPU_S3C2400 */5757+5858+/* s3c2410_gpio_irqfilter5959+ *6060+ * set the irq filtering on the given pin6161+ *6262+ * on = 0 => disable filtering6363+ * 1 => enable filtering6464+ *6565+ * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with6666+ * width of filter (0 through 63)6767+ *6868+ *6969+*/7070+7171+extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,7272+ unsigned int config);7373+7474+/* s3c2410_gpio_pullup7575+ *7676+ * configure the pull-up control on the given pin7777+ *7878+ * to = 1 => disable the pull-up7979+ * 0 => enable the pull-up8080+ *8181+ * eg;8282+ *8383+ * s3c2410_gpio_pullup(S3C2410_GPB(0), 0);8484+ * s3c2410_gpio_pullup(S3C2410_GPE(8), 0);8585+*/8686+8787+extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);8888+8989+/* s3c2410_gpio_getpull9090+ *9191+ * Read the state of the pull-up on a given pin9292+ *9393+ * return:9494+ * < 0 => error code9595+ * 0 => enabled9696+ * 1 => disabled9797+*/9898+9999+extern int s3c2410_gpio_getpull(unsigned int pin);100100+101101+extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);102102+103103+extern unsigned int s3c2410_gpio_getpin(unsigned int pin);
···15151616#ifndef __ASSEMBLY__17171818-/* external functions for GPIO support1919- *2020- * These allow various different clients to access the same GPIO2121- * registers without conflicting. If your driver only owns the entire2222- * GPIO register, then it is safe to ioremap/__raw_{read|write} to it.2323-*/2424-2525-/* s3c2410_gpio_cfgpin2626- *2727- * set the configuration of the given pin to the value passed.2828- *2929- * eg:3030- * s3c2410_gpio_cfgpin(S3C2410_GPA0, S3C2410_GPA0_ADDR0);3131- * s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1);3232-*/3333-3434-extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function);3535-3636-extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);3737-3838-/* s3c2410_gpio_getirq3939- *4040- * turn the given pin number into the corresponding IRQ number4141- *4242- * returns:4343- * < 0 = no interrupt for this pin4444- * >=0 = interrupt number for the pin4545-*/4646-4747-extern int s3c2410_gpio_getirq(unsigned int pin);4848-4949-/* s3c2410_gpio_irq2pin5050- *5151- * turn the given irq number into the corresponding GPIO number5252- *5353- * returns:5454- * < 0 = no pin5555- * >=0 = gpio pin number5656-*/5757-5858-extern int s3c2410_gpio_irq2pin(unsigned int irq);5959-6060-#ifdef CONFIG_CPU_S3C24006161-6262-extern int s3c2400_gpio_getirq(unsigned int pin);6363-6464-#endif /* CONFIG_CPU_S3C2400 */6565-6666-/* s3c2410_gpio_irqfilter6767- *6868- * set the irq filtering on the given pin6969- *7070- * on = 0 => disable filtering7171- * 1 => enable filtering7272- *7373- * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with7474- * width of filter (0 through 63)7575- *7676- *7777-*/7878-7979-extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,8080- unsigned int config);8181-8282-/* s3c2410_gpio_pullup8383- *8484- * configure the pull-up control on the given pin8585- *8686- * to = 1 => disable the pull-up8787- * 0 => enable the pull-up8888- *8989- * eg;9090- *9191- * s3c2410_gpio_pullup(S3C2410_GPB0, 0);9292- * s3c2410_gpio_pullup(S3C2410_GPE8, 0);9393-*/9494-9595-extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);9696-9797-/* s3c2410_gpio_getpull9898- *9999- * Read the state of the pull-up on a given pin100100- *101101- * return:102102- * < 0 => error code103103- * 0 => enabled104104- * 1 => disabled105105-*/106106-107107-extern int s3c2410_gpio_getpull(unsigned int pin);108108-109109-extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);110110-111111-extern unsigned int s3c2410_gpio_getpin(unsigned int pin);112112-11318extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg);1141911520#ifdef CONFIG_CPU_S3C2440
···1111*/12121313#include <mach/hardware.h>1414-#include <linux/io.h>1515-1616-#include <plat/regs-watchdog.h>1717-#include <mach/regs-clock.h>1818-1919-#include <linux/clk.h>2020-#include <linux/err.h>1414+#include <plat/watchdog-reset.h>21152216extern void (*s3c24xx_reset_hook)(void);23172418static void2519arch_reset(char mode, const char *cmd)2620{2727- struct clk *wdtclk;2828-2921 if (mode == 's') {3022 cpu_reset(0);3123 }···2533 if (s3c24xx_reset_hook)2634 s3c24xx_reset_hook();27352828- printk("arch_reset: attempting watchdog reset\n");2929-3030- __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */3131-3232- wdtclk = clk_get(NULL, "watchdog");3333- if (!IS_ERR(wdtclk)) {3434- clk_enable(wdtclk);3535- } else3636- printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);3737-3838- /* put initial values into count and data */3939- __raw_writel(0x80, S3C2410_WTCNT);4040- __raw_writel(0x80, S3C2410_WTDAT);4141-4242- /* set the watchdog to go and reset... */4343- __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN |4444- S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON);4545-4646- /* wait for reset to assert... */4747- mdelay(500);4848-4949- printk(KERN_ERR "Watchdog reset failed to assert reset\n");5050-5151- /* delay to allow the serial port to show the message */5252- mdelay(50);3636+ arch_wdt_reset();53375438 /* we'll take a jump through zero as a poor second */5539 cpu_reset(0);
···1818#include <linux/types.h>1919#include <linux/interrupt.h>2020#include <linux/list.h>2121+#include <linux/gpio.h>2122#include <linux/timer.h>2223#include <linux/init.h>2324#include <linux/device.h>2525+#include <linux/gpio.h>2426#include <linux/io.h>25272628#include <asm/mach/arch.h>···31293230#include <mach/bast-map.h>3331#include <mach/bast-irq.h>3434-#include <mach/regs-gpio.h>35323633#include <mach/hardware.h>3734#include <asm/irq.h>···5453 power_state[port] = to;55545655 if (power_state[0] && power_state[1])5757- s3c2410_gpio_setpin(S3C2410_GPB4, 0);5656+ gpio_set_value(S3C2410_GPB(4), 0);5857 else5959- s3c2410_gpio_setpin(S3C2410_GPB4, 1);5858+ gpio_set_value(S3C2410_GPB(4), 1);6059}61606261static irqreturn_t···6463{6564 struct s3c2410_hcd_info *info = pw;66656767- if (s3c2410_gpio_getpin(S3C2410_GPG10) == 0) {6666+ if (gpio_get_value(S3C2410_GPG(10)) == 0) {6867 pr_debug("usb_simtec: over-current irq (oc detected)\n");6968 s3c2410_usb_report_oc(info, 3);7069 } else {···107106108107int usb_simtec_init(void)109108{110110- printk("USB Power Control, (c) 2004 Simtec Electronics\n");111111- s3c_device_usb.dev.platform_data = &usb_simtec_info;109109+ int ret;112110113113- s3c2410_gpio_cfgpin(S3C2410_GPB4, S3C2410_GPB4_OUTP);114114- s3c2410_gpio_setpin(S3C2410_GPB4, 1);111111+ printk("USB Power Control, (c) 2004 Simtec Electronics\n");112112+113113+ ret = gpio_request(S3C2410_GPB(4), "USB power control");114114+ if (ret < 0) {115115+ pr_err("%s: failed to get GPB4\n", __func__);116116+ return ret;117117+ }118118+119119+ ret = gpio_request(S3C2410_GPG(10), "USB overcurrent");120120+ if (ret < 0) {121121+ pr_err("%s: failed to get GPG10\n", __func__);122122+ gpio_free(S3C2410_GPB(4));123123+ return ret;124124+ }125125+126126+ /* turn power on */127127+ gpio_direction_output(S3C2410_GPB(4), 1);128128+ gpio_direction_input(S3C2410_GPG(10));129129+130130+ s3c_device_usb.dev.platform_data = &usb_simtec_info;115131 return 0;116132}
+3
arch/arm/mach-s3c2412/Kconfig
···3838config MACH_JIVE3939 bool "Logitech Jive"4040 select CPU_S3C24124141+ select S3C_DEV_USB_HOST4142 help4243 Say Y here if you are using the Logitech Jive.4344···5150 select CPU_S3C24125251 select MACH_S3C24135352 select MACH_SMDK5353+ select S3C_DEV_USB_HOST5454 help5555 Say Y here if you are using an SMDK24135656···7472config MACH_VSTMS7573 bool "VMSTMS"7674 select CPU_S3C24127575+ select S3C_DEV_USB_HOST7776 help7877 Say Y here if you are using an VSTMS board7978
···1717#include <linux/list.h>1818#include <linux/timer.h>1919#include <linux/init.h>2020+#include <linux/gpio.h>2021#include <linux/serial_core.h>2122#include <linux/platform_device.h>2223#include <linux/io.h>···8584 switch (cmd)8685 {8786 case S3C2410_UDC_P_ENABLE :8888- s3c2410_gpio_setpin(S3C2410_GPF2, 1);8787+ s3c2410_gpio_setpin(S3C2410_GPF(2), 1);8988 break;9089 case S3C2410_UDC_P_DISABLE :9191- s3c2410_gpio_setpin(S3C2410_GPF2, 0);9090+ s3c2410_gpio_setpin(S3C2410_GPF(2), 0);9291 break;9392 case S3C2410_UDC_P_RESET :9493 break;···135134{ /* Turn off suspend on both USB ports, and switch the136135 * selectable USB port to USB device mode. */137136138138- s3c2410_gpio_setpin(S3C2410_GPF2, 0);139139- s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPIO_OUTPUT);137137+ s3c2410_gpio_setpin(S3C2410_GPF(2), 0);138138+ s3c2410_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT);140139141140 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |142141 S3C2410_MISCCR_USBSUSPND0 |
+5
arch/arm/mach-s3c2440/Kconfig
···3333 select PM_SIMTEC if PM3434 select HAVE_PATA_PLATFORM3535 select S3C24XX_GPIO_EXTRA643636+ select S3C_DEV_USB_HOST3637 help3738 Say Y here if you are using the Simtec Electronics ANUBIS3839 development system···4443 select S3C24XX_DCLK4544 select PM_SIMTEC if PM4645 select S3C24XX_GPIO_EXTRA1284646+ select S3C_DEV_USB_HOST4747 help4848 Say Y here if you are using the Simtec IM2440D20 module, also4949 known as the Osiris.···6058 bool "SMDK2440"6159 select CPU_S3C24406260 select MACH_SMDK6161+ select S3C_DEV_USB_HOST6362 help6463 Say Y here if you are using the SMDK2440.65646665config MACH_NEXCODER_24406766 bool "NexVision NEXCODER 2440 Light Board"6867 select CPU_S3C24406868+ select S3C_DEV_USB_HOST6969 help7070 Say Y here if you are using the Nex Vision NEXCODER 2440 Light Board7171···8076config MACH_AT2440EVB8177 bool "Avantech AT2440EVB development board"8278 select CPU_S3C24407979+ select S3C_DEV_USB_HOST8380 help8481 Say Y here if you are using the AT2440EVB development board8582
···55#66# Licensed under GPLv27788-# Currently nothing here, this will be added later88+# Configuration options for the S3C6410 CPU99+1010+config CPU_S3C64001111+ bool1212+ select CPU_S3C6400_INIT1313+ select CPU_S3C6400_CLOCK1414+ help1515+ Enable S3C6400 CPU support1616+1717+config S3C6400_SETUP_SDHCI1818+ bool1919+ help2020+ Internal configuration for default SDHCI2121+ setup for S3C6400.2222+2323+# S36400 Macchine support2424+2525+config MACH_SMDK64002626+ bool "SMDK6400"2727+ select CPU_S3C64002828+ select S3C_DEV_HSMMC2929+ select S3C6400_SETUP_SDHCI3030+ help3131+ Machine support for the Samsung SMDK6400
+9-1
arch/arm/mach-s3c6400/Makefile
···12121313# Core support for S3C6400 system14141515-obj-n += blank.o1515+obj-$(CONFIG_CPU_S3C6400) += s3c6400.o1616+1717+# setup support1818+1919+obj-$(CONFIG_S3C6400_SETUP_SDHCI) += setup-sdhci.o2020+2121+# Machine support2222+2323+obj-$(CONFIG_MACH_SMDK6400) += mach-smdk6400.o
+58-1
arch/arm/mach-s3c6400/include/mach/dma.h
···1111#ifndef __ASM_ARCH_DMA_H1212#define __ASM_ARCH_DMA_H __FILE__13131414-/* currently nothing here, placeholder */1414+#define S3C_DMA_CHANNELS (16)1515+1616+/* see mach-s3c2410/dma.h for notes on dma channel numbers */1717+1818+/* Note, for the S3C64XX architecture we keep the DMACH_1919+ * defines in the order they are allocated to [S]DMA0/[S]DMA12020+ * so that is easy to do DHACH_ -> DMA controller conversion2121+ */2222+enum dma_ch {2323+ /* DMA0/SDMA0 */2424+ DMACH_UART0 = 0,2525+ DMACH_UART0_SRC2,2626+ DMACH_UART1,2727+ DMACH_UART1_SRC2,2828+ DMACH_UART2,2929+ DMACH_UART2_SRC2,3030+ DMACH_UART3,3131+ DMACH_UART3_SRC2,3232+ DMACH_PCM0_TX,3333+ DMACH_PCM0_RX,3434+ DMACH_I2S0_OUT,3535+ DMACH_I2S0_IN,3636+ DMACH_SPI0_TX,3737+ DMACH_SPI0_RX,3838+ DMACH_HSI_I2SV40_TX,3939+ DMACH_HSI_I2SV40_RX,4040+4141+ /* DMA1/SDMA1 */4242+ DMACH_PCM1_TX = 16,4343+ DMACH_PCM1_RX,4444+ DMACH_I2S1_OUT,4545+ DMACH_I2S1_IN,4646+ DMACH_SPI1_TX,4747+ DMACH_SPI1_RX,4848+ DMACH_AC97_PCMOUT,4949+ DMACH_AC97_PCMIN,5050+ DMACH_AC97_MICIN,5151+ DMACH_PWM,5252+ DMACH_IRDA,5353+ DMACH_EXTERNAL,5454+ DMACH_RES1,5555+ DMACH_RES2,5656+ DMACH_SECURITY_RX, /* SDMA1 only */5757+ DMACH_SECURITY_TX, /* SDMA1 only */5858+ DMACH_MAX /* the end */5959+};6060+6161+static __inline__ int s3c_dma_has_circular(void)6262+{6363+ /* we will be supporting ciruclar buffers as soon as we have DMA6464+ * engine support.6565+ */6666+ return 1;6767+}6868+6969+#define S3C2410_DMAF_CIRCULAR (1 << 0)7070+7171+#include <plat/dma.h>15721673#endif /* __ASM_ARCH_IRQ_H */
···11+/* linux/arch/arm/mach-s3c6400/include/mach/regs-clock.h22+ *33+ * Copyright 2008 Openmoko, Inc.44+ * Copyright 2008 Simtec Electronics55+ * http://armlinux.simtec.co.uk/66+ * Ben Dooks <ben@simtec.co.uk>77+ *88+ * S3C64XX - clock register compatibility with s3c24xx99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+*/1414+1515+#include <plat/regs-clock.h>1616+
+7-1
arch/arm/mach-s3c6400/include/mach/system.h
···1111#ifndef __ASM_ARCH_SYSTEM_H1212#define __ASM_ARCH_SYSTEM_H __FILE__13131414+#include <plat/watchdog-reset.h>1515+1416static void arch_idle(void)1517{1618 /* nothing here yet */···20182119static void arch_reset(char mode, const char *cmd)2220{2323- /* nothing here yet */2121+ if (mode != 's')2222+ arch_wdt_reset();2323+2424+ /* if all else fails, or mode was for soft, jump to 0 */2525+ cpu_reset(0);2426}25272628#endif /* __ASM_ARCH_IRQ_H */
···11+/* linux/arch/arm/mach-s3c6410/cpu.c22+ *33+ * Copyright 2009 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ * http://armlinux.simtec.co.uk/66+ *77+ * This program is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License version 2 as99+ * published by the Free Software Foundation.1010+*/1111+1212+#include <linux/kernel.h>1313+#include <linux/types.h>1414+#include <linux/interrupt.h>1515+#include <linux/list.h>1616+#include <linux/timer.h>1717+#include <linux/init.h>1818+#include <linux/clk.h>1919+#include <linux/io.h>2020+#include <linux/sysdev.h>2121+#include <linux/serial_core.h>2222+#include <linux/platform_device.h>2323+2424+#include <asm/mach/arch.h>2525+#include <asm/mach/map.h>2626+#include <asm/mach/irq.h>2727+2828+#include <mach/hardware.h>2929+#include <asm/irq.h>3030+3131+#include <plat/cpu-freq.h>3232+#include <plat/regs-serial.h>3333+#include <plat/regs-clock.h>3434+3535+#include <plat/cpu.h>3636+#include <plat/devs.h>3737+#include <plat/clock.h>3838+#include <plat/sdhci.h>3939+#include <plat/iic-core.h>4040+#include <plat/s3c6400.h>4141+4242+void __init s3c6400_map_io(void)4343+{4444+ /* setup SDHCI */4545+4646+ s3c6400_default_sdhci0();4747+ s3c6400_default_sdhci1();4848+4949+ /* the i2c devices are directly compatible with s3c2440 */5050+ s3c_i2c0_setname("s3c2440-i2c");5151+}5252+5353+void __init s3c6400_init_clocks(int xtal)5454+{5555+ printk(KERN_DEBUG "%s: initialising clocks\n", __func__);5656+ s3c24xx_register_baseclocks(xtal);5757+ s3c64xx_register_clocks();5858+ s3c6400_register_clocks(S3C6400_CLKDIV0_ARM_MASK);5959+ s3c6400_setup_clocks();6060+}6161+6262+void __init s3c6400_init_irq(void)6363+{6464+ /* VIC0 does not have IRQS 5..7,6565+ * VIC1 is fully populated. */6666+ s3c64xx_init_irq(~0 & ~(0xf << 5), ~0);6767+}6868+6969+struct sysdev_class s3c6400_sysclass = {7070+ .name = "s3c6400-core",7171+};7272+7373+static struct sys_device s3c6400_sysdev = {7474+ .cls = &s3c6400_sysclass,7575+};7676+7777+static int __init s3c6400_core_init(void)7878+{7979+ return sysdev_class_register(&s3c6400_sysclass);8080+}8181+8282+core_initcall(s3c6400_core_init);8383+8484+int __init s3c6400_init(void)8585+{8686+ printk("S3C6400: Initialising architecture\n");8787+8888+ return sysdev_register(&s3c6400_sysdev);8989+}
+63
arch/arm/mach-s3c6400/setup-sdhci.c
···11+/* linux/arch/arm/mach-s3c6410/setup-sdhci.c22+ *33+ * Copyright 2008 Simtec Electronics44+ * Copyright 2008 Simtec Electronics55+ * Ben Dooks <ben@simtec.co.uk>66+ * http://armlinux.simtec.co.uk/77+ *88+ * S3C6410 - Helper functions for settign up SDHCI device(s) (HSMMC)99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+*/1414+1515+#include <linux/kernel.h>1616+#include <linux/types.h>1717+#include <linux/interrupt.h>1818+#include <linux/platform_device.h>1919+#include <linux/io.h>2020+2121+#include <linux/mmc/card.h>2222+#include <linux/mmc/host.h>2323+2424+#include <plat/regs-sdhci.h>2525+#include <plat/sdhci.h>2626+2727+/* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */2828+2929+char *s3c6400_hsmmc_clksrcs[4] = {3030+ [0] = "hsmmc",3131+ [1] = "hsmmc",3232+ [2] = "mmc_bus",3333+ /* [3] = "48m", - note not succesfully used yet */3434+};3535+3636+void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,3737+ void __iomem *r,3838+ struct mmc_ios *ios,3939+ struct mmc_card *card)4040+{4141+ u32 ctrl2, ctrl3;4242+4343+ ctrl2 = readl(r + S3C_SDHCI_CONTROL2);4444+ ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;4545+ ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |4646+ S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |4747+ S3C_SDHCI_CTRL2_ENFBCLKRX |4848+ S3C_SDHCI_CTRL2_DFCNT_NONE |4949+ S3C_SDHCI_CTRL2_ENCLKOUTHOLD);5050+5151+ if (ios->clock < 25 * 1000000)5252+ ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |5353+ S3C_SDHCI_CTRL3_FCSEL2 |5454+ S3C_SDHCI_CTRL3_FCSEL1 |5555+ S3C_SDHCI_CTRL3_FCSEL0);5656+ else5757+ ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);5858+5959+ printk(KERN_INFO "%s: CTRL 2=%08x, 3=%08x\n", __func__, ctrl2, ctrl3);6060+ writel(ctrl2, r + S3C_SDHCI_CONTROL2);6161+ writel(ctrl3, r + S3C_SDHCI_CONTROL3);6262+}6363+
+37
arch/arm/mach-s3c6410/Kconfig
···16161717config S3C6410_SETUP_SDHCI1818 bool1919+ select S3C64XX_SETUP_SDHCI_GPIO1920 help2021 Internal helper functions for S3C6410 based SDHCI systems2222+2323+config MACH_ANW64102424+ bool "A&W6410"2525+ select CPU_S3C64102626+ select S3C_DEV_FB2727+ select S3C64XX_SETUP_FB_24BPP2828+ help2929+ Machine support for the A&W641021302231config MACH_SMDK64102332 bool "SMDK6410"···3526 select S3C_DEV_HSMMC13627 select S3C_DEV_I2C13728 select S3C_DEV_FB2929+ select S3C_DEV_USB_HOST3030+ select S3C_DEV_USB_HSOTG3831 select S3C6410_SETUP_SDHCI3932 select S3C64XX_SETUP_I2C14033 select S3C64XX_SETUP_FB_24BPP···7160 channels 0 and 1 are the same.72617362endchoice6363+6464+config SMDK6410_WM1190_EV16565+ bool "Support Wolfson Microelectronics 1190-EV1 PMIC card"6666+ depends on MACH_SMDK64106767+ select REGULATOR6868+ select REGULATOR_WM83506969+ select MFD_WM8350_I2C7070+ select MFD_WM8350_CONFIG_MODE_07171+ select MFD_WM8350_CONFIG_MODE_37272+ select MFD_WM8352_CONFIG_MODE_07373+ help7474+ The Wolfson Microelectronics 1190-EV1 is a WM835x based PMIC7575+ and audio daughtercard for the Samsung SMDK6410 reference7676+ platform. Enabling this option will build support for this7777+ module into the kernel. The presence of the module will be7878+ detected at runtime so the the resulting kernel can be used7979+ with or without the 1190-EV1 fitted.8080+8181+config MACH_NCP8282+ bool "NCP"8383+ select CPU_S3C64108484+ select S3C_DEV_I2C18585+ select S3C_DEV_HSMMC18686+ select S3C64XX_SETUP_I2C18787+ help8888+ Machine support for the Samsung NCP
···7171 Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>7272 for more information.73737474+config S3C_PM_DEBUG_LED_SMDK7575+ bool "SMDK LED suspend/resume debugging"7676+ depends on PM && (MACH_SMDK6410)7777+ help7878+ Say Y here to enable the use of the SMDK LEDs on the baseboard7979+ for debugging of the state of the suspend and resume process.8080+8181+ Note, this currently only works for S3C64XX based SMDK boards.8282+7483config S3C2410_PM_CHECK7584 bool "S3C2410 PM Suspend Memory CRC"7685 depends on PM && CRC32···159150 Internal configuration to enable S3C64XX style GPIO configuration160151 functions.161152153153+# DMA154154+155155+config S3C_DMA156156+ bool157157+ help158158+ Internal configuration for S3C DMA core159159+162160# device definitions to compile in163161164162config S3C_DEV_HSMMC···187171 bool188172 help189173 Compile in platform device definition for framebuffer174174+175175+config S3C_DEV_USB_HOST176176+ bool177177+ help178178+ Compile in platform device definition for USB host.179179+180180+config S3C_DEV_USB_HSOTG181181+ bool182182+ help183183+ Compile in platform device definition for USB high-speed OtG190184191185endif
···11+/* linux/arch/arm/plat-s3c/dev-usb-hsotg.c22+ *33+ * Copyright 2008 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ * http://armlinux.simtec.co.uk/66+ *77+ * S3C series device definition for USB high-speed UDC/OtG block88+ *99+ * This program is free software; you can redistribute it and/or modify1010+ * it under the terms of the GNU General Public License version 2 as1111+ * published by the Free Software Foundation.1212+*/1313+1414+#include <linux/kernel.h>1515+#include <linux/string.h>1616+#include <linux/platform_device.h>1717+1818+#include <mach/irqs.h>1919+#include <mach/map.h>2020+2121+#include <plat/devs.h>2222+2323+static struct resource s3c_usb_hsotg_resources[] = {2424+ [0] = {2525+ .start = S3C_PA_USB_HSOTG,2626+ .end = S3C_PA_USB_HSOTG + 0x10000 - 1,2727+ .flags = IORESOURCE_MEM,2828+ },2929+ [1] = {3030+ .start = IRQ_OTG,3131+ .end = IRQ_OTG,3232+ .flags = IORESOURCE_IRQ,3333+ },3434+};3535+3636+struct platform_device s3c_device_usb_hsotg = {3737+ .name = "s3c-hsotg",3838+ .id = -1,3939+ .num_resources = ARRAY_SIZE(s3c_usb_hsotg_resources),4040+ .resource = s3c_usb_hsotg_resources,4141+};
+50
arch/arm/plat-s3c/dev-usb.c
···11+/* linux/arch/arm/plat-s3c/dev-usb.c22+ *33+ * Copyright 2008 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ * http://armlinux.simtec.co.uk/66+ *77+ * S3C series device definition for USB host88+ *99+ * This program is free software; you can redistribute it and/or modify1010+ * it under the terms of the GNU General Public License version 2 as1111+ * published by the Free Software Foundation.1212+*/1313+1414+#include <linux/kernel.h>1515+#include <linux/string.h>1616+#include <linux/platform_device.h>1717+1818+#include <mach/irqs.h>1919+#include <mach/map.h>2020+2121+#include <plat/devs.h>2222+2323+2424+static struct resource s3c_usb_resource[] = {2525+ [0] = {2626+ .start = S3C_PA_USBHOST,2727+ .end = S3C_PA_USBHOST + 0x100 - 1,2828+ .flags = IORESOURCE_MEM,2929+ },3030+ [1] = {3131+ .start = IRQ_USBH,3232+ .end = IRQ_USBH,3333+ .flags = IORESOURCE_IRQ,3434+ }3535+};3636+3737+static u64 s3c_device_usb_dmamask = 0xffffffffUL;3838+3939+struct platform_device s3c_device_usb = {4040+ .name = "s3c2410-ohci",4141+ .id = -1,4242+ .num_resources = ARRAY_SIZE(s3c_usb_resource),4343+ .resource = s3c_usb_resource,4444+ .dev = {4545+ .dma_mask = &s3c_device_usb_dmamask,4646+ .coherent_dma_mask = 0xffffffffUL4747+ }4848+};4949+5050+EXPORT_SYMBOL(s3c_device_usb);
+86
arch/arm/plat-s3c/dma.c
···11+/* linux/arch/arm/plat-s3c/dma.c22+ *33+ * Copyright (c) 2003-2005,2006,2009 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ * http://armlinux.simtec.co.uk/66+ *77+ * S3C DMA core88+ *99+ * This program is free software; you can redistribute it and/or modify1010+ * it under the terms of the GNU General Public License version 2 as1111+ * published by the Free Software Foundation.1212+*/1313+1414+struct s3c2410_dma_buf;1515+1616+#include <linux/kernel.h>1717+#include <linux/module.h>1818+#include <linux/errno.h>1919+2020+#include <mach/dma.h>2121+#include <mach/irqs.h>2222+2323+#include <plat/dma-plat.h>2424+2525+/* dma channel state information */2626+struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS];2727+struct s3c2410_dma_chan *s3c_dma_chan_map[DMACH_MAX];2828+2929+/* s3c_dma_lookup_channel3030+ *3131+ * change the dma channel number given into a real dma channel id3232+*/3333+3434+struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel)3535+{3636+ if (channel & DMACH_LOW_LEVEL)3737+ return &s3c2410_chans[channel & ~DMACH_LOW_LEVEL];3838+ else3939+ return s3c_dma_chan_map[channel];4040+}4141+4242+/* do we need to protect the settings of the fields from4343+ * irq?4444+*/4545+4646+int s3c2410_dma_set_opfn(unsigned int channel, s3c2410_dma_opfn_t rtn)4747+{4848+ struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);4949+5050+ if (chan == NULL)5151+ return -EINVAL;5252+5353+ pr_debug("%s: chan=%p, op rtn=%p\n", __func__, chan, rtn);5454+5555+ chan->op_fn = rtn;5656+5757+ return 0;5858+}5959+EXPORT_SYMBOL(s3c2410_dma_set_opfn);6060+6161+int s3c2410_dma_set_buffdone_fn(unsigned int channel, s3c2410_dma_cbfn_t rtn)6262+{6363+ struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);6464+6565+ if (chan == NULL)6666+ return -EINVAL;6767+6868+ pr_debug("%s: chan=%p, callback rtn=%p\n", __func__, chan, rtn);6969+7070+ chan->callback_fn = rtn;7171+7272+ return 0;7373+}7474+EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn);7575+7676+int s3c2410_dma_setflags(unsigned int channel, unsigned int flags)7777+{7878+ struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);7979+8080+ if (chan == NULL)8181+ return -EINVAL;8282+8383+ chan->flags = flags;8484+ return 0;8585+}8686+EXPORT_SYMBOL(s3c2410_dma_setflags);
+10-1
arch/arm/plat-s3c/gpio.c
···1616#include <linux/io.h>1717#include <linux/gpio.h>18181919-#include <plat/gpio-core.h>1919+#include <mach/gpio-core.h>20202121#ifdef CONFIG_S3C_GPIO_TRACK2222struct s3c_gpio_chip *s3c_gpios[S3C_GPIO_END];···139139 gc->set = s3c_gpiolib_set;140140 if (!gc->get)141141 gc->get = s3c_gpiolib_get;142142+143143+#ifdef CONFIG_PM144144+ if (chip->pm != NULL) {145145+ if (!chip->pm->save || !chip->pm->resume)146146+ printk(KERN_ERR "gpio: %s has missing PM functions\n",147147+ gc->label);148148+ } else149149+ printk(KERN_ERR "gpio: %s has no PM function\n", gc->label);150150+#endif142151143152 /* gpiochip_add() prints own failure message on error. */144153 ret = gpiochip_add(gc);
+6-4
arch/arm/plat-s3c/include/plat/adc.h
···1919extern int s3c_adc_start(struct s3c_adc_client *client,2020 unsigned int channel, unsigned int nr_samples);21212222-extern struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev,2323- void (*select)(unsigned selected),2424- void (*conv)(unsigned d0, unsigned d1),2525- unsigned int is_ts);2222+extern struct s3c_adc_client *2323+ s3c_adc_register(struct platform_device *pdev,2424+ void (*select)(unsigned selected),2525+ void (*conv)(unsigned d0, unsigned d1,2626+ unsigned *samples_left),2727+ unsigned int is_ts);26282729extern void s3c_adc_release(struct s3c_adc_client *client);2830
···11+/* arch/arm/plat-s3c/include/plat/dma.h22+ *33+ * Copyright 2008 Openmoko, Inc.44+ * Copyright 2008 Simtec Electronics55+ * Ben Dooks <ben@simtec.co.uk>66+ * http://armlinux.simtec.co.uk/77+ *88+ * Samsung S3C DMA core support99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+*/1414+1515+extern struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel);1616+1717+extern struct s3c2410_dma_chan *s3c_dma_chan_map[];1818+1919+/* the currently allocated channel information */2020+extern struct s3c2410_dma_chan s3c2410_chans[];2121+2222+
+127
arch/arm/plat-s3c/include/plat/dma.h
···11+/* arch/arm/plat-s3c/include/plat/dma.h22+ *33+ * Copyright (C) 2003,2004,2006 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ *66+ * Samsung S3C DMA support77+ *88+ * This program is free software; you can redistribute it and/or modify99+ * it under the terms of the GNU General Public License version 2 as1010+ * published by the Free Software Foundation.1111+*/1212+1313+enum s3c2410_dma_buffresult {1414+ S3C2410_RES_OK,1515+ S3C2410_RES_ERR,1616+ S3C2410_RES_ABORT1717+};1818+1919+enum s3c2410_dmasrc {2020+ S3C2410_DMASRC_HW, /* source is memory */2121+ S3C2410_DMASRC_MEM /* source is hardware */2222+};2323+2424+/* enum s3c2410_chan_op2525+ *2626+ * operation codes passed to the DMA code by the user, and also used2727+ * to inform the current channel owner of any changes to the system state2828+*/2929+3030+enum s3c2410_chan_op {3131+ S3C2410_DMAOP_START,3232+ S3C2410_DMAOP_STOP,3333+ S3C2410_DMAOP_PAUSE,3434+ S3C2410_DMAOP_RESUME,3535+ S3C2410_DMAOP_FLUSH,3636+ S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */3737+ S3C2410_DMAOP_STARTED, /* indicate channel started */3838+};3939+4040+struct s3c2410_dma_client {4141+ char *name;4242+};4343+4444+struct s3c2410_dma_chan;4545+4646+/* s3c2410_dma_cbfn_t4747+ *4848+ * buffer callback routine type4949+*/5050+5151+typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *,5252+ void *buf, int size,5353+ enum s3c2410_dma_buffresult result);5454+5555+typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,5656+ enum s3c2410_chan_op );5757+5858+5959+6060+/* s3c2410_dma_request6161+ *6262+ * request a dma channel exclusivley6363+*/6464+6565+extern int s3c2410_dma_request(unsigned int channel,6666+ struct s3c2410_dma_client *, void *dev);6767+6868+6969+/* s3c2410_dma_ctrl7070+ *7171+ * change the state of the dma channel7272+*/7373+7474+extern int s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op);7575+7676+/* s3c2410_dma_setflags7777+ *7878+ * set the channel's flags to a given state7979+*/8080+8181+extern int s3c2410_dma_setflags(unsigned int channel,8282+ unsigned int flags);8383+8484+/* s3c2410_dma_free8585+ *8686+ * free the dma channel (will also abort any outstanding operations)8787+*/8888+8989+extern int s3c2410_dma_free(unsigned int channel, struct s3c2410_dma_client *);9090+9191+/* s3c2410_dma_enqueue9292+ *9393+ * place the given buffer onto the queue of operations for the channel.9494+ * The buffer must be allocated from dma coherent memory, or the Dcache/WB9595+ * drained before the buffer is given to the DMA system.9696+*/9797+9898+extern int s3c2410_dma_enqueue(unsigned int channel, void *id,9999+ dma_addr_t data, int size);100100+101101+/* s3c2410_dma_config102102+ *103103+ * configure the dma channel104104+*/105105+106106+extern int s3c2410_dma_config(unsigned int channel, int xferunit);107107+108108+/* s3c2410_dma_devconfig109109+ *110110+ * configure the device we're talking to111111+*/112112+113113+extern int s3c2410_dma_devconfig(int channel, enum s3c2410_dmasrc source,114114+ unsigned long devaddr);115115+116116+/* s3c2410_dma_getposition117117+ *118118+ * get the position that the dma transfer is currently at119119+*/120120+121121+extern int s3c2410_dma_getposition(unsigned int channel,122122+ dma_addr_t *src, dma_addr_t *dest);123123+124124+extern int s3c2410_dma_set_opfn(unsigned int, s3c2410_dma_opfn_t rtn);125125+extern int s3c2410_dma_set_buffdone_fn(unsigned int, s3c2410_dma_cbfn_t rtn);126126+127127+
+30
arch/arm/plat-s3c/include/plat/gpio-core.h
···2020 * specific code.2121*/22222323+struct s3c_gpio_chip;2424+2525+/**2626+ * struct s3c_gpio_pm - power management (suspend/resume) information2727+ * @save: Routine to save the state of the GPIO block2828+ * @resume: Routine to resume the GPIO block.2929+ */3030+struct s3c_gpio_pm {3131+ void (*save)(struct s3c_gpio_chip *chip);3232+ void (*resume)(struct s3c_gpio_chip *chip);3333+};3434+2335struct s3c_gpio_cfg;24362537/**···3927 * @chip: The chip structure to be exported via gpiolib.4028 * @base: The base pointer to the gpio configuration registers.4129 * @config: special function and pull-resistor control information.3030+ * @pm_save: Save information for suspend/resume support.4231 *4332 * This wrapper provides the necessary information for the Samsung4433 * specific gpios being registered with gpiolib.···4734struct s3c_gpio_chip {4835 struct gpio_chip chip;4936 struct s3c_gpio_cfg *config;3737+ struct s3c_gpio_pm *pm;5038 void __iomem *base;3939+#ifdef CONFIG_PM4040+ u32 pm_save[4];4141+#endif5142};52435344static inline struct s3c_gpio_chip *to_s3c_gpio(struct gpio_chip *gpc)···92759376static inline void s3c_gpiolib_track(struct s3c_gpio_chip *chip) { }9477#endif7878+7979+#ifdef CONFIG_PM8080+extern struct s3c_gpio_pm s3c_gpio_pm_1bit;8181+extern struct s3c_gpio_pm s3c_gpio_pm_2bit;8282+extern struct s3c_gpio_pm s3c_gpio_pm_4bit;8383+#define __gpio_pm(x) x8484+#else8585+#define s3c_gpio_pm_1bit NULL8686+#define s3c_gpio_pm_2bit NULL8787+#define s3c_gpio_pm_4bit NULL8888+#define __gpio_pm(x) NULL8989+9090+#endif /* CONFIG_PM */
+15
arch/arm/plat-s3c/include/plat/pm.h
···44444545extern unsigned long s3c_pm_flags;46464747+extern unsigned char pm_uart_udivslot; /* true to save UART UDIVSLOT */4848+4749/* from sleep.S */48504951extern int s3c_cpu_save(unsigned long *saveblk);···9088 u32 ufcon;9189 u32 umcon;9290 u32 ubrdiv;9191+ u32 udivslot;9392};94939594/* helper functions to save/restore lists of registers. */···126123#else127124#define S3C_PMDBG(fmt...) printk(KERN_DEBUG fmt)128125#endif126126+127127+#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK128128+/**129129+ * s3c_pm_debug_smdkled() - Debug PM suspend/resume via SMDK Board LEDs130130+ * @set: set bits for the state of the LEDs131131+ * @clear: clear bits for the state of the LEDs.132132+ */133133+extern void s3c_pm_debug_smdkled(u32 set, u32 clear);134134+135135+#else136136+static inline void s3c_pm_debug_smdkled(u32 set, u32 clear) { }137137+#endif /* CONFIG_S3C_PM_DEBUG_LED_SMDK */129138130139/* suspend memory checking */131140
···11+/* arch/arm/plat-s3c/include/plat/udc-hs.h22+ *33+ * Copyright 2008 Openmoko, Inc.44+ * Copyright 2008 Simtec Electronics55+ * Ben Dooks <ben@simtec.co.uk>66+ * http://armlinux.simtec.co.uk/77+ *88+ * S3C USB2.0 High-speed / OtG platform information99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+*/1414+1515+enum s3c_hostg_dmamode {1616+ S3C_HSOTG_DMA_NONE, /* do not use DMA at-all */1717+ S3C_HSOTG_DMA_ONLY, /* always use DMA */1818+ S3C_HSOTG_DMA_DRV, /* DMA is chosen by driver */1919+};2020+2121+/**2222+ * struct s3c_hsotg_plat - platform data for high-speed otg/udc2323+ * @dma: Whether to use DMA or not.2424+ * @is_osc: The clock source is an oscillator, not a crystal2525+ */2626+struct s3c_hsotg_plat {2727+ enum s3c_hostg_dmamode dma;2828+ unsigned int is_osc : 1;2929+};
+49
arch/arm/plat-s3c/include/plat/watchdog-reset.h
···11+/* arch/arm/plat-s3c/include/plat/watchdog-reset.h22+ *33+ * Copyright (c) 2008 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ *66+ * S3C2410 - System define for arch_reset() function77+ *88+ * This program is free software; you can redistribute it and/or modify99+ * it under the terms of the GNU General Public License version 2 as1010+ * published by the Free Software Foundation.1111+*/1212+1313+#include <plat/regs-watchdog.h>1414+#include <mach/map.h>1515+1616+#include <linux/clk.h>1717+#include <linux/err.h>1818+#include <linux/io.h>1919+2020+static inline void arch_wdt_reset(void)2121+{2222+ struct clk *wdtclk;2323+2424+ printk("arch_reset: attempting watchdog reset\n");2525+2626+ __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */2727+2828+ wdtclk = clk_get(NULL, "watchdog");2929+ if (!IS_ERR(wdtclk)) {3030+ clk_enable(wdtclk);3131+ } else3232+ printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);3333+3434+ /* put initial values into count and data */3535+ __raw_writel(0x80, S3C2410_WTCNT);3636+ __raw_writel(0x80, S3C2410_WTDAT);3737+3838+ /* set the watchdog to go and reset... */3939+ __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN |4040+ S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON);4141+4242+ /* wait for reset to assert... */4343+ mdelay(500);4444+4545+ printk(KERN_ERR "Watchdog reset failed to assert reset\n");4646+4747+ /* delay to allow the serial port to show the message */4848+ mdelay(50);4949+}
+380
arch/arm/plat-s3c/pm-gpio.c
···11+22+/* linux/arch/arm/plat-s3c/pm-gpio.c33+ *44+ * Copyright 2008 Openmoko, Inc.55+ * Copyright 2008 Simtec Electronics66+ * Ben Dooks <ben@simtec.co.uk>77+ * http://armlinux.simtec.co.uk/88+ *99+ * S3C series GPIO PM code1010+ *1111+ * This program is free software; you can redistribute it and/or modify1212+ * it under the terms of the GNU General Public License version 2 as1313+ * published by the Free Software Foundation.1414+*/1515+1616+#include <linux/kernel.h>1717+#include <linux/sysdev.h>1818+#include <linux/init.h>1919+#include <linux/io.h>2020+#include <linux/gpio.h>2121+2222+#include <mach/gpio-core.h>2323+#include <plat/pm.h>2424+2525+/* PM GPIO helpers */2626+2727+#define OFFS_CON (0x00)2828+#define OFFS_DAT (0x04)2929+#define OFFS_UP (0x08)3030+3131+static void s3c_gpio_pm_1bit_save(struct s3c_gpio_chip *chip)3232+{3333+ chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);3434+ chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);3535+}3636+3737+static void s3c_gpio_pm_1bit_resume(struct s3c_gpio_chip *chip)3838+{3939+ void __iomem *base = chip->base;4040+ u32 old_gpcon = __raw_readl(base + OFFS_CON);4141+ u32 old_gpdat = __raw_readl(base + OFFS_DAT);4242+ u32 gps_gpcon = chip->pm_save[0];4343+ u32 gps_gpdat = chip->pm_save[1];4444+ u32 gpcon;4545+4646+ /* GPACON only has one bit per control / data and no PULLUPs.4747+ * GPACON[x] = 0 => Output, 1 => SFN */4848+4949+ /* first set all SFN bits to SFN */5050+5151+ gpcon = old_gpcon | gps_gpcon;5252+ __raw_writel(gpcon, base + OFFS_CON);5353+5454+ /* now set all the other bits */5555+5656+ __raw_writel(gps_gpdat, base + OFFS_DAT);5757+ __raw_writel(gps_gpcon, base + OFFS_CON);5858+5959+ S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",6060+ chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);6161+}6262+6363+struct s3c_gpio_pm s3c_gpio_pm_1bit = {6464+ .save = s3c_gpio_pm_1bit_save,6565+ .resume = s3c_gpio_pm_1bit_resume,6666+};6767+6868+static void s3c_gpio_pm_2bit_save(struct s3c_gpio_chip *chip)6969+{7070+ chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON);7171+ chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT);7272+ chip->pm_save[2] = __raw_readl(chip->base + OFFS_UP);7373+}7474+7575+/* Test whether the given masked+shifted bits of an GPIO configuration7676+ * are one of the SFN (special function) modes. */7777+7878+static inline int is_sfn(unsigned long con)7979+{8080+ return con >= 2;8181+}8282+8383+/* Test if the given masked+shifted GPIO configuration is an input */8484+8585+static inline int is_in(unsigned long con)8686+{8787+ return con == 0;8888+}8989+9090+/* Test if the given masked+shifted GPIO configuration is an output */9191+9292+static inline int is_out(unsigned long con)9393+{9494+ return con == 1;9595+}9696+9797+/**9898+ * s3c_gpio_pm_2bit_resume() - restore the given GPIO bank9999+ * @chip: The chip information to resume.100100+ *101101+ * Restore one of the GPIO banks that was saved during suspend. This is102102+ * not as simple as once thought, due to the possibility of glitches103103+ * from the order that the CON and DAT registers are set in.104104+ *105105+ * The three states the pin can be are {IN,OUT,SFN} which gives us 9106106+ * combinations of changes to check. Three of these, if the pin stays107107+ * in the same configuration can be discounted. This leaves us with108108+ * the following:109109+ *110110+ * { IN => OUT } Change DAT first111111+ * { IN => SFN } Change CON first112112+ * { OUT => SFN } Change CON first, so new data will not glitch113113+ * { OUT => IN } Change CON first, so new data will not glitch114114+ * { SFN => IN } Change CON first115115+ * { SFN => OUT } Change DAT first, so new data will not glitch [1]116116+ *117117+ * We do not currently deal with the UP registers as these control118118+ * weak resistors, so a small delay in change should not need to bring119119+ * these into the calculations.120120+ *121121+ * [1] this assumes that writing to a pin DAT whilst in SFN will set the122122+ * state for when it is next output.123123+ */124124+static void s3c_gpio_pm_2bit_resume(struct s3c_gpio_chip *chip)125125+{126126+ void __iomem *base = chip->base;127127+ u32 old_gpcon = __raw_readl(base + OFFS_CON);128128+ u32 old_gpdat = __raw_readl(base + OFFS_DAT);129129+ u32 gps_gpcon = chip->pm_save[0];130130+ u32 gps_gpdat = chip->pm_save[1];131131+ u32 gpcon, old, new, mask;132132+ u32 change_mask = 0x0;133133+ int nr;134134+135135+ /* restore GPIO pull-up settings */136136+ __raw_writel(chip->pm_save[2], base + OFFS_UP);137137+138138+ /* Create a change_mask of all the items that need to have139139+ * their CON value changed before their DAT value, so that140140+ * we minimise the work between the two settings.141141+ */142142+143143+ for (nr = 0, mask = 0x03; nr < 32; nr += 2, mask <<= 2) {144144+ old = (old_gpcon & mask) >> nr;145145+ new = (gps_gpcon & mask) >> nr;146146+147147+ /* If there is no change, then skip */148148+149149+ if (old == new)150150+ continue;151151+152152+ /* If both are special function, then skip */153153+154154+ if (is_sfn(old) && is_sfn(new))155155+ continue;156156+157157+ /* Change is IN => OUT, do not change now */158158+159159+ if (is_in(old) && is_out(new))160160+ continue;161161+162162+ /* Change is SFN => OUT, do not change now */163163+164164+ if (is_sfn(old) && is_out(new))165165+ continue;166166+167167+ /* We should now be at the case of IN=>SFN,168168+ * OUT=>SFN, OUT=>IN, SFN=>IN. */169169+170170+ change_mask |= mask;171171+ }172172+173173+174174+ /* Write the new CON settings */175175+176176+ gpcon = old_gpcon & ~change_mask;177177+ gpcon |= gps_gpcon & change_mask;178178+179179+ __raw_writel(gpcon, base + OFFS_CON);180180+181181+ /* Now change any items that require DAT,CON */182182+183183+ __raw_writel(gps_gpdat, base + OFFS_DAT);184184+ __raw_writel(gps_gpcon, base + OFFS_CON);185185+186186+ S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n",187187+ chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);188188+}189189+190190+struct s3c_gpio_pm s3c_gpio_pm_2bit = {191191+ .save = s3c_gpio_pm_2bit_save,192192+ .resume = s3c_gpio_pm_2bit_resume,193193+};194194+195195+#ifdef CONFIG_ARCH_S3C64XX196196+static void s3c_gpio_pm_4bit_save(struct s3c_gpio_chip *chip)197197+{198198+ chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON);199199+ chip->pm_save[2] = __raw_readl(chip->base + OFFS_DAT);200200+ chip->pm_save[3] = __raw_readl(chip->base + OFFS_UP);201201+202202+ if (chip->chip.ngpio > 8)203203+ chip->pm_save[0] = __raw_readl(chip->base - 4);204204+}205205+206206+static u32 s3c_gpio_pm_4bit_mask(u32 old_gpcon, u32 gps_gpcon)207207+{208208+ u32 old, new, mask;209209+ u32 change_mask = 0x0;210210+ int nr;211211+212212+ for (nr = 0, mask = 0x0f; nr < 16; nr += 4, mask <<= 4) {213213+ old = (old_gpcon & mask) >> nr;214214+ new = (gps_gpcon & mask) >> nr;215215+216216+ /* If there is no change, then skip */217217+218218+ if (old == new)219219+ continue;220220+221221+ /* If both are special function, then skip */222222+223223+ if (is_sfn(old) && is_sfn(new))224224+ continue;225225+226226+ /* Change is IN => OUT, do not change now */227227+228228+ if (is_in(old) && is_out(new))229229+ continue;230230+231231+ /* Change is SFN => OUT, do not change now */232232+233233+ if (is_sfn(old) && is_out(new))234234+ continue;235235+236236+ /* We should now be at the case of IN=>SFN,237237+ * OUT=>SFN, OUT=>IN, SFN=>IN. */238238+239239+ change_mask |= mask;240240+ }241241+242242+ return change_mask;243243+}244244+245245+static void s3c_gpio_pm_4bit_con(struct s3c_gpio_chip *chip, int index)246246+{247247+ void __iomem *con = chip->base + (index * 4);248248+ u32 old_gpcon = __raw_readl(con);249249+ u32 gps_gpcon = chip->pm_save[index + 1];250250+ u32 gpcon, mask;251251+252252+ mask = s3c_gpio_pm_4bit_mask(old_gpcon, gps_gpcon);253253+254254+ gpcon = old_gpcon & ~mask;255255+ gpcon |= gps_gpcon & mask;256256+257257+ __raw_writel(gpcon, con);258258+}259259+260260+static void s3c_gpio_pm_4bit_resume(struct s3c_gpio_chip *chip)261261+{262262+ void __iomem *base = chip->base;263263+ u32 old_gpcon[2];264264+ u32 old_gpdat = __raw_readl(base + OFFS_DAT);265265+ u32 gps_gpdat = chip->pm_save[2];266266+267267+ /* First, modify the CON settings */268268+269269+ old_gpcon[0] = 0;270270+ old_gpcon[1] = __raw_readl(base + OFFS_CON);271271+272272+ s3c_gpio_pm_4bit_con(chip, 0);273273+ if (chip->chip.ngpio > 8) {274274+ old_gpcon[0] = __raw_readl(base - 4);275275+ s3c_gpio_pm_4bit_con(chip, -1);276276+ }277277+278278+ /* Now change the configurations that require DAT,CON */279279+280280+ __raw_writel(chip->pm_save[2], base + OFFS_DAT);281281+ __raw_writel(chip->pm_save[1], base + OFFS_CON);282282+ if (chip->chip.ngpio > 8)283283+ __raw_writel(chip->pm_save[0], base - 4);284284+285285+ __raw_writel(chip->pm_save[2], base + OFFS_DAT);286286+ __raw_writel(chip->pm_save[3], base + OFFS_UP);287287+288288+ if (chip->chip.ngpio > 8) {289289+ S3C_PMDBG("%s: CON4 %08x,%08x => %08x,%08x, DAT %08x => %08x\n",290290+ chip->chip.label, old_gpcon[0], old_gpcon[1],291291+ __raw_readl(base - 4),292292+ __raw_readl(base + OFFS_CON),293293+ old_gpdat, gps_gpdat);294294+ } else295295+ S3C_PMDBG("%s: CON4 %08x => %08x, DAT %08x => %08x\n",296296+ chip->chip.label, old_gpcon[1],297297+ __raw_readl(base + OFFS_CON),298298+ old_gpdat, gps_gpdat);299299+}300300+301301+struct s3c_gpio_pm s3c_gpio_pm_4bit = {302302+ .save = s3c_gpio_pm_4bit_save,303303+ .resume = s3c_gpio_pm_4bit_resume,304304+};305305+#endif /* CONFIG_ARCH_S3C64XX */306306+307307+/**308308+ * s3c_pm_save_gpio() - save gpio chip data for suspend309309+ * @ourchip: The chip for suspend.310310+ */311311+static void s3c_pm_save_gpio(struct s3c_gpio_chip *ourchip)312312+{313313+ struct s3c_gpio_pm *pm = ourchip->pm;314314+315315+ if (pm == NULL || pm->save == NULL)316316+ S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);317317+ else318318+ pm->save(ourchip);319319+}320320+321321+/**322322+ * s3c_pm_save_gpios() - Save the state of the GPIO banks.323323+ *324324+ * For all the GPIO banks, save the state of each one ready for going325325+ * into a suspend mode.326326+ */327327+void s3c_pm_save_gpios(void)328328+{329329+ struct s3c_gpio_chip *ourchip;330330+ unsigned int gpio_nr;331331+332332+ for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) {333333+ ourchip = s3c_gpiolib_getchip(gpio_nr);334334+ if (!ourchip)335335+ continue;336336+337337+ s3c_pm_save_gpio(ourchip);338338+339339+ S3C_PMDBG("%s: save %08x,%08x,%08x,%08x\n",340340+ ourchip->chip.label,341341+ ourchip->pm_save[0],342342+ ourchip->pm_save[1],343343+ ourchip->pm_save[2],344344+ ourchip->pm_save[3]);345345+346346+ gpio_nr += ourchip->chip.ngpio;347347+ gpio_nr += CONFIG_S3C_GPIO_SPACE;348348+ }349349+}350350+351351+/**352352+ * s3c_pm_resume_gpio() - restore gpio chip data after suspend353353+ * @ourchip: The suspended chip.354354+ */355355+static void s3c_pm_resume_gpio(struct s3c_gpio_chip *ourchip)356356+{357357+ struct s3c_gpio_pm *pm = ourchip->pm;358358+359359+ if (pm == NULL || pm->resume == NULL)360360+ S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);361361+ else362362+ pm->resume(ourchip);363363+}364364+365365+void s3c_pm_restore_gpios(void)366366+{367367+ struct s3c_gpio_chip *ourchip;368368+ unsigned int gpio_nr;369369+370370+ for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) {371371+ ourchip = s3c_gpiolib_getchip(gpio_nr);372372+ if (!ourchip)373373+ continue;374374+375375+ s3c_pm_resume_gpio(ourchip);376376+377377+ gpio_nr += ourchip->chip.ngpio;378378+ gpio_nr += CONFIG_S3C_GPIO_SPACE;379379+ }380380+}
+17-2
arch/arm/plat-s3c/pm.c
···21212222#include <asm/cacheflush.h>2323#include <mach/hardware.h>2424+#include <mach/map.h>24252526#include <plat/regs-serial.h>2627#include <mach/regs-clock.h>2727-#include <mach/regs-gpio.h>2828-#include <mach/regs-mem.h>2928#include <mach/regs-irq.h>3029#include <asm/irq.h>3130···69707071/* Save the UART configurations if we are configured for debug. */71727373+unsigned char pm_uart_udivslot;7474+7275#ifdef CONFIG_S3C2410_PM_DEBUG73767477struct pm_uart_save uart_save[CONFIG_SERIAL_SAMSUNG_UARTS];···8483 save->ufcon = __raw_readl(regs + S3C2410_UFCON);8584 save->umcon = __raw_readl(regs + S3C2410_UMCON);8685 save->ubrdiv = __raw_readl(regs + S3C2410_UBRDIV);8686+8787+ if (pm_uart_udivslot)8888+ save->udivslot = __raw_readl(regs + S3C2443_DIVSLOT);8989+9090+ S3C_PMDBG("UART[%d]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n",9191+ uart, save->ulcon, save->ucon, save->ufcon, save->ubrdiv);8792}88938994static void s3c_pm_save_uarts(void)···10598{10699 void __iomem *regs = S3C_VA_UARTx(uart);107100101101+ s3c_pm_arch_update_uart(regs, save);102102+108103 __raw_writel(save->ulcon, regs + S3C2410_ULCON);109104 __raw_writel(save->ucon, regs + S3C2410_UCON);110105 __raw_writel(save->ufcon, regs + S3C2410_UFCON);111106 __raw_writel(save->umcon, regs + S3C2410_UMCON);112107 __raw_writel(save->ubrdiv, regs + S3C2410_UBRDIV);108108+109109+ if (pm_uart_udivslot)110110+ __raw_writel(save->udivslot, regs + S3C2443_DIVSLOT);113111}114112115113static void s3c_pm_restore_uarts(void)···324312 s3c_pm_arch_show_resume_irqs();325313326314 S3C_PMDBG("%s: post sleep, preparing to return\n", __func__);315315+316316+ /* LEDs should now be 1110 */317317+ s3c_pm_debug_smdkled(1 << 1, 0);327318328319 s3c_pm_check_restore();329320
+1
arch/arm/plat-s3c24xx/Kconfig
···7171config S3C2410_DMA7272 bool "S3C2410 DMA support"7373 depends on ARCH_S3C24107474+ select S3C_DMA7475 help7576 S3C2410 DMA support. This is needed for drivers like sound which7677 use the S3C2410's DMA system to move data to and from the
···3030#include <linux/suspend.h>3131#include <linux/errno.h>3232#include <linux/time.h>3333+#include <linux/gpio.h>3334#include <linux/interrupt.h>3435#include <linux/serial_core.h>3536#include <linux/io.h>···7675 SAVE_ITEM(S3C2410_CLKSLOW),7776};78777979-static struct gpio_sleep {8080- void __iomem *base;8181- unsigned int gpcon;8282- unsigned int gpdat;8383- unsigned int gpup;8484-} gpio_save[] = {8585- [0] = {8686- .base = S3C2410_GPACON,8787- },8888- [1] = {8989- .base = S3C2410_GPBCON,9090- },9191- [2] = {9292- .base = S3C2410_GPCCON,9393- },9494- [3] = {9595- .base = S3C2410_GPDCON,9696- },9797- [4] = {9898- .base = S3C2410_GPECON,9999- },100100- [5] = {101101- .base = S3C2410_GPFCON,102102- },103103- [6] = {104104- .base = S3C2410_GPGCON,105105- },106106- [7] = {107107- .base = S3C2410_GPHCON,108108- },109109-};110110-11178static struct sleep_save misc_save[] = {11279 SAVE_ITEM(S3C2410_DCLKCON),11380};114114-1158111682/* s3c_pm_check_resume_pin11783 *···124156 * and then configure it as an input if it is not125157 */126158127127- for (pin = S3C2410_GPF0; pin <= S3C2410_GPF7; pin++) {128128- s3c_pm_check_resume_pin(pin, pin - S3C2410_GPF0);159159+ for (pin = S3C2410_GPF(0); pin <= S3C2410_GPF(7); pin++) {160160+ s3c_pm_check_resume_pin(pin, pin - S3C2410_GPF(0));129161 }130162131131- for (pin = S3C2410_GPG0; pin <= S3C2410_GPG7; pin++) {132132- s3c_pm_check_resume_pin(pin, (pin - S3C2410_GPG0)+8);133133- }134134-}135135-136136-/* offsets for CON/DAT/UP registers */137137-138138-#define OFFS_CON (S3C2410_GPACON - S3C2410_GPACON)139139-#define OFFS_DAT (S3C2410_GPADAT - S3C2410_GPACON)140140-#define OFFS_UP (S3C2410_GPBUP - S3C2410_GPBCON)141141-142142-/* s3c_pm_save_gpios()143143- *144144- * Save the state of the GPIOs145145- */146146-147147-void s3c_pm_save_gpios(void)148148-{149149- struct gpio_sleep *gps = gpio_save;150150- unsigned int gpio;151151-152152- for (gpio = 0; gpio < ARRAY_SIZE(gpio_save); gpio++, gps++) {153153- void __iomem *base = gps->base;154154-155155- gps->gpcon = __raw_readl(base + OFFS_CON);156156- gps->gpdat = __raw_readl(base + OFFS_DAT);157157-158158- if (gpio > 0)159159- gps->gpup = __raw_readl(base + OFFS_UP);160160-163163+ for (pin = S3C2410_GPG(0); pin <= S3C2410_GPG(7); pin++) {164164+ s3c_pm_check_resume_pin(pin, (pin - S3C2410_GPG(0))+8);161165 }162166}163167164164-/* Test whether the given masked+shifted bits of an GPIO configuration165165- * are one of the SFN (special function) modes. */166166-167167-static inline int is_sfn(unsigned long con)168168-{169169- return (con == 2 || con == 3);170170-}171171-172172-/* Test if the given masked+shifted GPIO configuration is an input */173173-174174-static inline int is_in(unsigned long con)175175-{176176- return con == 0;177177-}178178-179179-/* Test if the given masked+shifted GPIO configuration is an output */180180-181181-static inline int is_out(unsigned long con)182182-{183183- return con == 1;184184-}185185-186186-/**187187- * s3c2410_pm_restore_gpio() - restore the given GPIO bank188188- * @index: The number of the GPIO bank being resumed.189189- * @gps: The sleep confgiuration for the bank.190190- *191191- * Restore one of the GPIO banks that was saved during suspend. This is192192- * not as simple as once thought, due to the possibility of glitches193193- * from the order that the CON and DAT registers are set in.194194- *195195- * The three states the pin can be are {IN,OUT,SFN} which gives us 9196196- * combinations of changes to check. Three of these, if the pin stays197197- * in the same configuration can be discounted. This leaves us with198198- * the following:199199- *200200- * { IN => OUT } Change DAT first201201- * { IN => SFN } Change CON first202202- * { OUT => SFN } Change CON first, so new data will not glitch203203- * { OUT => IN } Change CON first, so new data will not glitch204204- * { SFN => IN } Change CON first205205- * { SFN => OUT } Change DAT first, so new data will not glitch [1]206206- *207207- * We do not currently deal with the UP registers as these control208208- * weak resistors, so a small delay in change should not need to bring209209- * these into the calculations.210210- *211211- * [1] this assumes that writing to a pin DAT whilst in SFN will set the212212- * state for when it is next output.213213- */214214-215215-static void s3c2410_pm_restore_gpio(int index, struct gpio_sleep *gps)216216-{217217- void __iomem *base = gps->base;218218- unsigned long gps_gpcon = gps->gpcon;219219- unsigned long gps_gpdat = gps->gpdat;220220- unsigned long old_gpcon;221221- unsigned long old_gpdat;222222- unsigned long old_gpup = 0x0;223223- unsigned long gpcon;224224- int nr;225225-226226- old_gpcon = __raw_readl(base + OFFS_CON);227227- old_gpdat = __raw_readl(base + OFFS_DAT);228228-229229- if (base == S3C2410_GPACON) {230230- /* GPACON only has one bit per control / data and no PULLUPs.231231- * GPACON[x] = 0 => Output, 1 => SFN */232232-233233- /* first set all SFN bits to SFN */234234-235235- gpcon = old_gpcon | gps->gpcon;236236- __raw_writel(gpcon, base + OFFS_CON);237237-238238- /* now set all the other bits */239239-240240- __raw_writel(gps_gpdat, base + OFFS_DAT);241241- __raw_writel(gps_gpcon, base + OFFS_CON);242242- } else {243243- unsigned long old, new, mask;244244- unsigned long change_mask = 0x0;245245-246246- old_gpup = __raw_readl(base + OFFS_UP);247247-248248- /* Create a change_mask of all the items that need to have249249- * their CON value changed before their DAT value, so that250250- * we minimise the work between the two settings.251251- */252252-253253- for (nr = 0, mask = 0x03; nr < 32; nr += 2, mask <<= 2) {254254- old = (old_gpcon & mask) >> nr;255255- new = (gps_gpcon & mask) >> nr;256256-257257- /* If there is no change, then skip */258258-259259- if (old == new)260260- continue;261261-262262- /* If both are special function, then skip */263263-264264- if (is_sfn(old) && is_sfn(new))265265- continue;266266-267267- /* Change is IN => OUT, do not change now */268268-269269- if (is_in(old) && is_out(new))270270- continue;271271-272272- /* Change is SFN => OUT, do not change now */273273-274274- if (is_sfn(old) && is_out(new))275275- continue;276276-277277- /* We should now be at the case of IN=>SFN,278278- * OUT=>SFN, OUT=>IN, SFN=>IN. */279279-280280- change_mask |= mask;281281- }282282-283283- /* Write the new CON settings */284284-285285- gpcon = old_gpcon & ~change_mask;286286- gpcon |= gps_gpcon & change_mask;287287-288288- __raw_writel(gpcon, base + OFFS_CON);289289-290290- /* Now change any items that require DAT,CON */291291-292292- __raw_writel(gps_gpdat, base + OFFS_DAT);293293- __raw_writel(gps_gpcon, base + OFFS_CON);294294- __raw_writel(gps->gpup, base + OFFS_UP);295295- }296296-297297- S3C_PMDBG("GPIO[%d] CON %08lx => %08lx, DAT %08lx => %08lx\n",298298- index, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);299299-}300300-301301-302302-/** s3c2410_pm_restore_gpios()303303- *304304- * Restore the state of the GPIOs305305- */306306-307307-void s3c_pm_restore_gpios(void)308308-{309309- struct gpio_sleep *gps = gpio_save;310310- int gpio;311311-312312- for (gpio = 0; gpio < ARRAY_SIZE(gpio_save); gpio++, gps++) {313313- s3c2410_pm_restore_gpio(gpio, gps);314314- }315315-}316168317169void s3c_pm_restore_core(void)318170{
···1919 select S3C_GPIO_PULL_UPDOWN2020 select S3C_GPIO_CFG_S3C24XX2121 select S3C_GPIO_CFG_S3C64XX2222+ select USB_ARCH_HAS_OHCI2223 help2324 Base platform code for any Samsung S3C64XX device2425···3837 help3938 Common clock support code for the S3C6400 that is shared4039 by other CPUs in the series, such as the S3C6410.4040+4141+config S3C64XX_DMA4242+ bool "S3C64XX DMA"4343+ select S3C_DMA41444245# platform specific device setup4346···6358 bool6459 help6560 Common setup code for S3C64XX with an 24bpp RGB display helper.6161+6262+config S3C64XX_SETUP_SDHCI_GPIO6363+ bool6464+ help6565+ Common setup code for S3C64XX SDHCI GPIO configurations66666767endif
···11+/* linux/arch/arm/plat-s3c64xx/include/plat/dma-plat.h22+ *33+ * Copyright 2009 Openmoko, Inc.44+ * Copyright 2009 Simtec Electronics55+ * Ben Dooks <ben@simtec.co.uk>66+ * http://armlinux.simtec.co.uk/77+ *88+ * S3C64XX DMA core99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+*/1414+1515+#define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */1616+1717+struct s3c64xx_dma_buff;1818+1919+/** s3c64xx_dma_buff - S3C64XX DMA buffer descriptor2020+ * @next: Pointer to next buffer in queue or ring.2121+ * @pw: Client provided identifier2222+ * @lli: Pointer to hardware descriptor this buffer is associated with.2323+ * @lli_dma: Hardare address of the descriptor.2424+ */2525+struct s3c64xx_dma_buff {2626+ struct s3c64xx_dma_buff *next;2727+2828+ void *pw;2929+ struct pl080_lli *lli;3030+ dma_addr_t lli_dma;3131+};3232+3333+struct s3c64xx_dmac;3434+3535+struct s3c2410_dma_chan {3636+ unsigned char number; /* number of this dma channel */3737+ unsigned char in_use; /* channel allocated */3838+ unsigned char bit; /* bit for enable/disable/etc */3939+ unsigned char hw_width;4040+ unsigned char peripheral;4141+4242+ unsigned int flags;4343+ enum s3c2410_dmasrc source;4444+4545+4646+ dma_addr_t dev_addr;4747+4848+ struct s3c2410_dma_client *client;4949+ struct s3c64xx_dmac *dmac; /* pointer to controller */5050+5151+ void __iomem *regs;5252+5353+ /* cdriver callbacks */5454+ s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */5555+ s3c2410_dma_opfn_t op_fn; /* channel op callback */5656+5757+ /* buffer list and information */5858+ struct s3c64xx_dma_buff *curr; /* current dma buffer */5959+ struct s3c64xx_dma_buff *next; /* next buffer to load */6060+ struct s3c64xx_dma_buff *end; /* end of queue */6161+6262+ /* note, when channel is running in circular mode, curr is the6363+ * first buffer enqueued, end is the last and curr is where the6464+ * last buffer-done event is set-at. The buffers are not freed6565+ * and the last buffer hardware descriptor points back to the6666+ * first.6767+ */6868+};6969+7070+#include <plat/dma-core.h>
+1
arch/arm/plat-s3c64xx/include/plat/irqs.h
···157157158158#define S3C_EINT(x) ((x) + S3C_IRQ_EINT_BASE)159159#define IRQ_EINT(x) S3C_EINT(x)160160+#define IRQ_EINT_BIT(x) ((x) - S3C_EINT(0))160161161162/* Next the external interrupt groups. These are similar to the IRQ_EINT(x)162163 * that they are sourced from the GPIO pins but with a different scheme for
+98
arch/arm/plat-s3c64xx/include/plat/pm-core.h
···11+/* linux/arch/arm/plat-s3c64xx/include/plat/pm-core.h22+ *33+ * Copyright 2008 Openmoko, Inc.44+ * Copyright 2008 Simtec Electronics55+ * Ben Dooks <ben@simtec.co.uk>66+ * http://armlinux.simtec.co.uk/77+ *88+ * S3C64XX - PM core support for arch/arm/plat-s3c/pm.c99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+ */1414+1515+#include <plat/regs-gpio.h>1616+1717+static inline void s3c_pm_debug_init_uart(void)1818+{1919+ u32 tmp = __raw_readl(S3C_PCLK_GATE);2020+2121+ /* As a note, since the S3C64XX UARTs generally have multiple2222+ * clock sources, we simply enable PCLK at the moment and hope2323+ * that the resume settings for the UART are suitable for the2424+ * use with PCLK.2525+ */2626+2727+ tmp |= S3C_CLKCON_PCLK_UART0;2828+ tmp |= S3C_CLKCON_PCLK_UART1;2929+ tmp |= S3C_CLKCON_PCLK_UART2;3030+ tmp |= S3C_CLKCON_PCLK_UART3;3131+3232+ __raw_writel(tmp, S3C_PCLK_GATE);3333+ udelay(10);3434+}3535+3636+static inline void s3c_pm_arch_prepare_irqs(void)3737+{3838+ /* VIC should have already been taken care of */3939+4040+ /* clear any pending EINT0 interrupts */4141+ __raw_writel(__raw_readl(S3C64XX_EINT0PEND), S3C64XX_EINT0PEND);4242+}4343+4444+static inline void s3c_pm_arch_stop_clocks(void)4545+{4646+}4747+4848+static inline void s3c_pm_arch_show_resume_irqs(void)4949+{5050+}5151+5252+/* make these defines, we currently do not have any need to change5353+ * the IRQ wake controls depending on the CPU we are running on */5454+5555+#define s3c_irqwake_eintallow ((1 << 28) - 1)5656+#define s3c_irqwake_intallow (0)5757+5858+static inline void s3c_pm_arch_update_uart(void __iomem *regs,5959+ struct pm_uart_save *save)6060+{6161+ u32 ucon = __raw_readl(regs + S3C2410_UCON);6262+ u32 ucon_clk = ucon & S3C6400_UCON_CLKMASK;6363+ u32 save_clk = save->ucon & S3C6400_UCON_CLKMASK;6464+ u32 new_ucon;6565+ u32 delta;6666+6767+ /* S3C64XX UART blocks only support level interrupts, so ensure that6868+ * when we restore unused UART blocks we force the level interrupt6969+ * settigs. */7070+ save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL;7171+7272+ /* We have a constraint on changing the clock type of the UART7373+ * between UCLKx and PCLK, so ensure that when we restore UCON7474+ * that the CLK field is correctly modified if the bootloader7575+ * has changed anything.7676+ */7777+ if (ucon_clk != save_clk) {7878+ new_ucon = save->ucon;7979+ delta = ucon_clk ^ save_clk;8080+8181+ /* change from UCLKx => wrong PCLK,8282+ * either UCLK can be tested for by a bit-test8383+ * with UCLK0 */8484+ if (ucon_clk & S3C6400_UCON_UCLK0 &&8585+ !(save_clk & S3C6400_UCON_UCLK0) &&8686+ delta & S3C6400_UCON_PCLK2) {8787+ new_ucon &= ~S3C6400_UCON_UCLK0;8888+ } else if (delta == S3C6400_UCON_PCLK2) {8989+ /* as an precaution, don't change from9090+ * PCLK2 => PCLK or vice-versa */9191+ new_ucon ^= S3C6400_UCON_PCLK2;9292+ }9393+9494+ S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n",9595+ ucon, new_ucon, save->ucon);9696+ save->ucon = new_ucon;9797+ }9898+}
···11+/* arch/arm/plat-s3c64xx/irq-pm.c22+ *33+ * Copyright 2008 Openmoko, Inc.44+ * Copyright 2008 Simtec Electronics55+ * Ben Dooks <ben@simtec.co.uk>66+ * http://armlinux.simtec.co.uk/77+ *88+ * S3C64XX - Interrupt handling Power Management99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+ */1414+1515+#include <linux/kernel.h>1616+#include <linux/sysdev.h>1717+#include <linux/interrupt.h>1818+#include <linux/serial_core.h>1919+#include <linux/irq.h>2020+#include <linux/io.h>2121+2222+#include <mach/map.h>2323+2424+#include <plat/regs-serial.h>2525+#include <plat/regs-timer.h>2626+#include <plat/regs-gpio.h>2727+#include <plat/cpu.h>2828+#include <plat/pm.h>2929+3030+/* We handled all the IRQ types in this code, to save having to make several3131+ * small files to handle each different type separately. Having the EINT_GRP3232+ * code here shouldn't be as much bloat as the IRQ table space needed when3333+ * they are enabled. The added benefit is we ensure that these registers are3434+ * in the same state as we suspended.3535+ */3636+3737+static struct sleep_save irq_save[] = {3838+ SAVE_ITEM(S3C64XX_PRIORITY),3939+ SAVE_ITEM(S3C64XX_EINT0CON0),4040+ SAVE_ITEM(S3C64XX_EINT0CON1),4141+ SAVE_ITEM(S3C64XX_EINT0FLTCON0),4242+ SAVE_ITEM(S3C64XX_EINT0FLTCON1),4343+ SAVE_ITEM(S3C64XX_EINT0FLTCON2),4444+ SAVE_ITEM(S3C64XX_EINT0FLTCON3),4545+ SAVE_ITEM(S3C64XX_EINT0MASK),4646+ SAVE_ITEM(S3C64XX_TINT_CSTAT),4747+};4848+4949+static struct irq_grp_save {5050+ u32 fltcon;5151+ u32 con;5252+ u32 mask;5353+} eint_grp_save[5];5454+5555+static u32 irq_uart_mask[CONFIG_SERIAL_SAMSUNG_UARTS];5656+5757+static int s3c64xx_irq_pm_suspend(struct sys_device *dev, pm_message_t state)5858+{5959+ struct irq_grp_save *grp = eint_grp_save;6060+ int i;6161+6262+ S3C_PMDBG("%s: suspending IRQs\n", __func__);6363+6464+ s3c_pm_do_save(irq_save, ARRAY_SIZE(irq_save));6565+6666+ for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++)6767+ irq_uart_mask[i] = __raw_readl(S3C_VA_UARTx(i) + S3C64XX_UINTM);6868+6969+ for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {7070+ grp->con = __raw_readl(S3C64XX_EINT12CON + (i * 4));7171+ grp->mask = __raw_readl(S3C64XX_EINT12MASK + (i * 4));7272+ grp->fltcon = __raw_readl(S3C64XX_EINT12FLTCON + (i * 4));7373+ }7474+7575+ return 0;7676+}7777+7878+static int s3c64xx_irq_pm_resume(struct sys_device *dev)7979+{8080+ struct irq_grp_save *grp = eint_grp_save;8181+ int i;8282+8383+ S3C_PMDBG("%s: resuming IRQs\n", __func__);8484+8585+ s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));8686+8787+ for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++)8888+ __raw_writel(irq_uart_mask[i], S3C_VA_UARTx(i) + S3C64XX_UINTM);8989+9090+ for (i = 0; i < ARRAY_SIZE(eint_grp_save); i++, grp++) {9191+ __raw_writel(grp->con, S3C64XX_EINT12CON + (i * 4));9292+ __raw_writel(grp->mask, S3C64XX_EINT12MASK + (i * 4));9393+ __raw_writel(grp->fltcon, S3C64XX_EINT12FLTCON + (i * 4));9494+ }9595+9696+ S3C_PMDBG("%s: IRQ configuration restored\n", __func__);9797+ return 0;9898+}9999+100100+static struct sysdev_driver s3c64xx_irq_driver = {101101+ .suspend = s3c64xx_irq_pm_suspend,102102+ .resume = s3c64xx_irq_pm_resume,103103+};104104+105105+static int __init s3c64xx_irq_pm_init(void)106106+{107107+ return sysdev_driver_register(&s3c64xx_sysclass, &s3c64xx_irq_driver);108108+}109109+110110+arch_initcall(s3c64xx_irq_pm_init);111111+
+4-5
arch/arm/plat-s3c64xx/irq.c
···14141515#include <linux/kernel.h>1616#include <linux/interrupt.h>1717+#include <linux/serial_core.h>1718#include <linux/irq.h>1819#include <linux/io.h>19202021#include <asm/hardware/vic.h>21222223#include <mach/map.h>2424+#include <plat/regs-serial.h>2325#include <plat/regs-timer.h>2426#include <plat/cpu.h>2527···137135}138136139137/* UART interrupt registers, not worth adding to seperate include header */140140-#define S3C64XX_UINTP 0x30141141-#define S3C64XX_UINTSP 0x34142142-#define S3C64XX_UINTM 0x38143138144139static void s3c_irq_uart_mask(unsigned int irq)145140{···232233 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);233234234235 /* initialise the pair of VICs */235235- vic_init(S3C_VA_VIC0, S3C_VIC0_BASE, vic0_valid);236236- vic_init(S3C_VA_VIC1, S3C_VIC1_BASE, vic1_valid);236236+ vic_init(S3C_VA_VIC0, S3C_VIC0_BASE, vic0_valid, 0);237237+ vic_init(S3C_VA_VIC1, S3C_VIC1_BASE, vic1_valid, 0);237238238239 /* add the timer sub-irqs */239240
+175
arch/arm/plat-s3c64xx/pm.c
···11+/* linux/arch/arm/plat-s3c64xx/pm.c22+ *33+ * Copyright 2008 Openmoko, Inc.44+ * Copyright 2008 Simtec Electronics55+ * Ben Dooks <ben@simtec.co.uk>66+ * http://armlinux.simtec.co.uk/77+ *88+ * S3C64XX CPU PM support.99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+*/1414+1515+#include <linux/init.h>1616+#include <linux/suspend.h>1717+#include <linux/serial_core.h>1818+#include <linux/io.h>1919+2020+#include <mach/map.h>2121+2222+#include <plat/pm.h>2323+#include <plat/regs-sys.h>2424+#include <plat/regs-gpio.h>2525+#include <plat/regs-clock.h>2626+#include <plat/regs-syscon-power.h>2727+#include <plat/regs-gpio-memport.h>2828+2929+#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK3030+#include <plat/gpio-bank-n.h>3131+3232+void s3c_pm_debug_smdkled(u32 set, u32 clear)3333+{3434+ unsigned long flags;3535+ u32 reg;3636+3737+ local_irq_save(flags);3838+ reg = __raw_readl(S3C64XX_GPNCON);3939+ reg &= ~(S3C64XX_GPN_CONMASK(12) | S3C64XX_GPN_CONMASK(13) |4040+ S3C64XX_GPN_CONMASK(14) | S3C64XX_GPN_CONMASK(15));4141+ reg |= S3C64XX_GPN_OUTPUT(12) | S3C64XX_GPN_OUTPUT(13) |4242+ S3C64XX_GPN_OUTPUT(14) | S3C64XX_GPN_OUTPUT(15);4343+ __raw_writel(reg, S3C64XX_GPNCON);4444+4545+ reg = __raw_readl(S3C64XX_GPNDAT);4646+ reg &= ~(clear << 12);4747+ reg |= set << 12;4848+ __raw_writel(reg, S3C64XX_GPNDAT);4949+5050+ local_irq_restore(flags);5151+}5252+#endif5353+5454+static struct sleep_save core_save[] = {5555+ SAVE_ITEM(S3C_APLL_LOCK),5656+ SAVE_ITEM(S3C_MPLL_LOCK),5757+ SAVE_ITEM(S3C_EPLL_LOCK),5858+ SAVE_ITEM(S3C_CLK_SRC),5959+ SAVE_ITEM(S3C_CLK_DIV0),6060+ SAVE_ITEM(S3C_CLK_DIV1),6161+ SAVE_ITEM(S3C_CLK_DIV2),6262+ SAVE_ITEM(S3C_CLK_OUT),6363+ SAVE_ITEM(S3C_HCLK_GATE),6464+ SAVE_ITEM(S3C_PCLK_GATE),6565+ SAVE_ITEM(S3C_SCLK_GATE),6666+ SAVE_ITEM(S3C_MEM0_GATE),6767+6868+ SAVE_ITEM(S3C_EPLL_CON1),6969+ SAVE_ITEM(S3C_EPLL_CON0),7070+7171+ SAVE_ITEM(S3C64XX_MEM0DRVCON),7272+ SAVE_ITEM(S3C64XX_MEM1DRVCON),7373+7474+#ifndef CONFIG_CPU_FREQ7575+ SAVE_ITEM(S3C_APLL_CON),7676+ SAVE_ITEM(S3C_MPLL_CON),7777+#endif7878+};7979+8080+static struct sleep_save misc_save[] = {8181+ SAVE_ITEM(S3C64XX_AHB_CON0),8282+ SAVE_ITEM(S3C64XX_AHB_CON1),8383+ SAVE_ITEM(S3C64XX_AHB_CON2),8484+8585+ SAVE_ITEM(S3C64XX_SPCON),8686+8787+ SAVE_ITEM(S3C64XX_MEM0CONSTOP),8888+ SAVE_ITEM(S3C64XX_MEM1CONSTOP),8989+ SAVE_ITEM(S3C64XX_MEM0CONSLP0),9090+ SAVE_ITEM(S3C64XX_MEM0CONSLP1),9191+ SAVE_ITEM(S3C64XX_MEM1CONSLP),9292+};9393+9494+void s3c_pm_configure_extint(void)9595+{9696+ __raw_writel(s3c_irqwake_eintmask, S3C64XX_EINT_MASK);9797+}9898+9999+void s3c_pm_restore_core(void)100100+{101101+ __raw_writel(0, S3C64XX_EINT_MASK);102102+103103+ s3c_pm_debug_smdkled(1 << 2, 0);104104+105105+ s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));106106+ s3c_pm_do_restore(misc_save, ARRAY_SIZE(misc_save));107107+}108108+109109+void s3c_pm_save_core(void)110110+{111111+ s3c_pm_do_save(misc_save, ARRAY_SIZE(misc_save));112112+ s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));113113+}114114+115115+/* since both s3c6400 and s3c6410 share the same sleep pm calls, we116116+ * put the per-cpu code in here until any new cpu comes along and changes117117+ * this.118118+ */119119+120120+#include <plat/regs-gpio.h>121121+122122+static void s3c64xx_cpu_suspend(void)123123+{124124+ unsigned long tmp;125125+126126+ /* set our standby method to sleep */127127+128128+ tmp = __raw_readl(S3C64XX_PWR_CFG);129129+ tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;130130+ tmp |= S3C64XX_PWRCFG_CFG_WFI_SLEEP;131131+ __raw_writel(tmp, S3C64XX_PWR_CFG);132132+133133+ /* clear any old wakeup */134134+135135+ __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT),136136+ S3C64XX_WAKEUP_STAT);137137+138138+ /* set the LED state to 0110 over sleep */139139+ s3c_pm_debug_smdkled(3 << 1, 0xf);140140+141141+ /* issue the standby signal into the pm unit. Note, we142142+ * issue a write-buffer drain just in case */143143+144144+ tmp = 0;145145+146146+ asm("b 1f\n\t"147147+ ".align 5\n\t"148148+ "1:\n\t"149149+ "mcr p15, 0, %0, c7, c10, 5\n\t"150150+ "mcr p15, 0, %0, c7, c10, 4\n\t"151151+ "mcr p15, 0, %0, c7, c0, 4" :: "r" (tmp));152152+153153+ /* we should never get past here */154154+155155+ panic("sleep resumed to originator?");156156+}157157+158158+static void s3c64xx_pm_prepare(void)159159+{160160+ /* store address of resume. */161161+ __raw_writel(virt_to_phys(s3c_cpu_resume), S3C64XX_INFORM0);162162+163163+ /* ensure previous wakeup state is cleared before sleeping */164164+ __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT), S3C64XX_WAKEUP_STAT);165165+}166166+167167+static int s3c64xx_pm_init(void)168168+{169169+ pm_cpu_prep = s3c64xx_pm_prepare;170170+ pm_cpu_sleep = s3c64xx_cpu_suspend;171171+ pm_uart_udivslot = 1;172172+ return 0;173173+}174174+175175+arch_initcall(s3c64xx_pm_init);
+105-1
arch/arm/plat-s3c64xx/s3c6400-clock.c
···133133 .sources = &clk_src_mpll,134134};135135136136+static unsigned int armclk_mask;137137+138138+static unsigned long s3c64xx_clk_arm_get_rate(struct clk *clk)139139+{140140+ unsigned long rate = clk_get_rate(clk->parent);141141+ u32 clkdiv;142142+143143+ /* divisor mask starts at bit0, so no need to shift */144144+ clkdiv = __raw_readl(S3C_CLK_DIV0) & armclk_mask;145145+146146+ return rate / (clkdiv + 1);147147+}148148+149149+static unsigned long s3c64xx_clk_arm_round_rate(struct clk *clk,150150+ unsigned long rate)151151+{152152+ unsigned long parent = clk_get_rate(clk->parent);153153+ u32 div;154154+155155+ if (parent < rate)156156+ return rate;157157+158158+ div = (parent / rate) - 1;159159+ if (div > armclk_mask)160160+ div = armclk_mask;161161+162162+ return parent / (div + 1);163163+}164164+165165+static int s3c64xx_clk_arm_set_rate(struct clk *clk, unsigned long rate)166166+{167167+ unsigned long parent = clk_get_rate(clk->parent);168168+ u32 div;169169+ u32 val;170170+171171+ if (rate < parent / (armclk_mask + 1))172172+ return -EINVAL;173173+174174+ rate = clk_round_rate(clk, rate);175175+ div = clk_get_rate(clk->parent) / rate;176176+177177+ val = __raw_readl(S3C_CLK_DIV0);178178+ val &= armclk_mask;179179+ val |= (div - 1);180180+ __raw_writel(val, S3C_CLK_DIV0);181181+182182+ return 0;183183+184184+}185185+186186+static struct clk clk_arm = {187187+ .name = "armclk",188188+ .id = -1,189189+ .parent = &clk_mout_apll.clk,190190+ .get_rate = s3c64xx_clk_arm_get_rate,191191+ .set_rate = s3c64xx_clk_arm_set_rate,192192+ .round_rate = s3c64xx_clk_arm_round_rate,193193+};194194+136195static unsigned long s3c64xx_clk_doutmpll_get_rate(struct clk *clk)137196{138197 unsigned long rate = clk_get_rate(clk->parent);···579520 .reg_divider = S3C_CLK_DIV2,580521};581522523523+static struct clk *clkset_camif_list[] = {524524+ &clk_h2,525525+};526526+527527+static struct clk_sources clkset_camif = {528528+ .sources = clkset_camif_list,529529+ .nr_sources = ARRAY_SIZE(clkset_camif_list),530530+};531531+532532+static struct clksrc_clk clk_camif = {533533+ .clk = {534534+ .name = "camera",535535+ .id = -1,536536+ .ctrlbit = S3C_CLKCON_SCLK_CAM,537537+ .enable = s3c64xx_sclk_ctrl,538538+ .set_parent = s3c64xx_setparent_clksrc,539539+ .get_rate = s3c64xx_getrate_clksrc,540540+ .set_rate = s3c64xx_setrate_clksrc,541541+ .round_rate = s3c64xx_roundrate_clksrc,542542+ },543543+ .shift = 0,544544+ .mask = 0,545545+ .sources = &clkset_camif,546546+ .divider_shift = S3C6400_CLKDIV0_CAM_SHIFT,547547+ .reg_divider = S3C_CLK_DIV0,548548+};549549+582550/* Clock initialisation code */583551584552static struct clksrc_clk *init_parents[] = {···622536 &clk_audio0,623537 &clk_audio1,624538 &clk_irda,539539+ &clk_camif,625540};626541627542static void __init_or_cpufreq s3c6400_set_clksrc(struct clksrc_clk *clk)···695608 clk_fout_epll.rate = epll;696609 clk_fout_apll.rate = apll;697610611611+ clk_h2.rate = hclk2;698612 clk_h.rate = hclk;699613 clk_p.rate = pclk;700614 clk_f.rate = fclk;···723635 &clk_audio0.clk,724636 &clk_audio1.clk,725637 &clk_irda.clk,638638+ &clk_camif.clk,639639+ &clk_arm,726640};727641728728-void __init s3c6400_register_clocks(void)642642+/**643643+ * s3c6400_register_clocks - register clocks for s3c6400 and above644644+ * @armclk_divlimit: Divisor mask for ARMCLK645645+ *646646+ * Register the clocks for the S3C6400 and above SoC range, such647647+ * as ARMCLK and the clocks which have divider chains attached.648648+ *649649+ * This call does not setup the clocks, which is left to the650650+ * s3c6400_setup_clocks() call which may be needed by the cpufreq651651+ * or resume code to re-set the clocks if the bootloader has changed652652+ * them.653653+ */654654+void __init s3c6400_register_clocks(unsigned armclk_divlimit)729655{730656 struct clk *clkp;731657 int ret;732658 int ptr;659659+660660+ armclk_mask = armclk_divlimit;733661734662 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {735663 clkp = clks[ptr];
+55
arch/arm/plat-s3c64xx/setup-sdhci-gpio.c
···11+/* linux/arch/arm/plat-s3c64xx/setup-sdhci-gpio.c22+ *33+ * Copyright 2008 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ * http://armlinux.simtec.co.uk/66+ *77+ * S3C64XX - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)88+ *99+ * This program is free software; you can redistribute it and/or modify1010+ * it under the terms of the GNU General Public License version 2 as1111+ * published by the Free Software Foundation.1212+*/1313+1414+#include <linux/kernel.h>1515+#include <linux/types.h>1616+#include <linux/interrupt.h>1717+#include <linux/platform_device.h>1818+#include <linux/io.h>1919+2020+#include <mach/gpio.h>2121+#include <plat/gpio-cfg.h>2222+2323+void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)2424+{2525+ unsigned int gpio;2626+ unsigned int end;2727+2828+ end = S3C64XX_GPG(2 + width);2929+3030+ /* Set all the necessary GPG pins to special-function 0 */3131+ for (gpio = S3C64XX_GPG(0); gpio < end; gpio++) {3232+ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));3333+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);3434+ }3535+3636+ s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);3737+ s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));3838+}3939+4040+void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)4141+{4242+ unsigned int gpio;4343+ unsigned int end;4444+4545+ end = S3C64XX_GPH(2 + width);4646+4747+ /* Set all the necessary GPG pins to special-function 0 */4848+ for (gpio = S3C64XX_GPH(0); gpio < end; gpio++) {4949+ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));5050+ s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);5151+ }5252+5353+ s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);5454+ s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));5555+}
+144
arch/arm/plat-s3c64xx/sleep.S
···11+/* linux/0arch/arm/plat-s3c64xx/sleep.S22+ *33+ * Copyright 2008 Openmoko, Inc.44+ * Copyright 2008 Simtec Electronics55+ * Ben Dooks <ben@simtec.co.uk>66+ * http://armlinux.simtec.co.uk/77+ *88+ * S3C64XX CPU sleep code99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+*/1414+1515+#include <linux/linkage.h>1616+#include <asm/assembler.h>1717+#include <mach/map.h>1818+1919+#undef S3C64XX_VA_GPIO2020+#define S3C64XX_VA_GPIO (0x0)2121+2222+#include <plat/regs-gpio.h>2323+#include <plat/gpio-bank-n.h>2424+2525+#define LL_UART (S3C_PA_UART + (0x400 * CONFIG_S3C_LOWLEVEL_UART_PORT))2626+2727+ .text2828+2929+ /* s3c_cpu_save3030+ *3131+ * Save enough processor state to allow the restart of the pm.c3232+ * code after resume.3333+ *3434+ * entry:3535+ * r0 = pointer to the save block3636+ */3737+3838+ENTRY(s3c_cpu_save)3939+ stmfd sp!, { r4 - r12, lr }4040+4141+ mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID4242+ mrc p15, 0, r5, c3, c0, 0 @ Domain ID4343+ mrc p15, 0, r6, c2, c0, 0 @ Translation Table BASE04444+ mrc p15, 0, r7, c2, c0, 1 @ Translation Table BASE14545+ mrc p15, 0, r8, c2, c0, 2 @ Translation Table Control4646+ mrc p15, 0, r9, c1, c0, 0 @ Control register4747+ mrc p15, 0, r10, c1, c0, 1 @ Auxiliary control register4848+ mrc p15, 0, r11, c1, c0, 2 @ Co-processor access controls4949+5050+ stmia r0, { r4 - r13 } @ Save CP registers and SP5151+5252+ @@ save our state to ram5353+ bl s3c_pm_cb_flushcache5454+5555+ @@ call final suspend code5656+ ldr r0, =pm_cpu_sleep5757+ ldr pc, [r0]5858+5959+ @@ return to the caller, after the MMU is turned on.6060+ @@ restore the last bits of the stack and return.6161+resume_with_mmu:6262+ ldmfd sp!, { r4 - r12, pc } @ return, from sp from s3c_cpu_save6363+6464+ .data6565+6666+ /* the next bit is code, but it requires easy access to the6767+ * s3c_sleep_save_phys data before the MMU is switched on, so6868+ * we store the code that needs this variable in the .data where6969+ * the value can be written to (the .text segment is RO).7070+ */7171+7272+ .global s3c_sleep_save_phys7373+s3c_sleep_save_phys:7474+ .word 07575+7676+ /* Sleep magic, the word before the resume entry point so that the7777+ * bootloader can check for a resumeable image. */7878+7979+ .word 0x2bedf00d8080+8181+ /* s3c_cpu_reusme8282+ *8383+ * This is the entry point, stored by whatever method the bootloader8484+ * requires to get the kernel runnign again. This code expects to be8585+ * entered with no caches live and the MMU disabled. It will then8686+ * restore the MMU and other basic CP registers saved and restart8787+ * the kernel C code to finish the resume code.8888+ */8989+9090+ENTRY(s3c_cpu_resume)9191+ msr cpsr_c, #PSR_I_BIT | PSR_F_BIT | SVC_MODE9292+ ldr r2, =LL_UART /* for debug */9393+9494+#ifdef CONFIG_S3C_PM_DEBUG_LED_SMDK9595+ /* Initialise the GPIO state if we are debugging via the SMDK LEDs,9696+ * as the uboot version supplied resets these to inputs during the9797+ * resume checks.9898+ */9999+100100+ ldr r3, =S3C64XX_PA_GPIO101101+ ldr r0, [ r3, #S3C64XX_GPNCON ]102102+ bic r0, r0, #(S3C64XX_GPN_CONMASK(12) | S3C64XX_GPN_CONMASK(13) | \103103+ S3C64XX_GPN_CONMASK(14) | S3C64XX_GPN_CONMASK(15))104104+ orr r0, r0, #(S3C64XX_GPN_OUTPUT(12) | S3C64XX_GPN_OUTPUT(13) | \105105+ S3C64XX_GPN_OUTPUT(14) | S3C64XX_GPN_OUTPUT(15))106106+ str r0, [ r3, #S3C64XX_GPNCON ]107107+108108+ ldr r0, [ r3, #S3C64XX_GPNDAT ]109109+ bic r0, r0, #0xf << 12 @ GPN12..15110110+ orr r0, r0, #1 << 15 @ GPN15111111+ str r0, [ r3, #S3C64XX_GPNDAT ]112112+#endif113113+114114+ /* __v6_setup from arch/arm/mm/proc-v6.S, ensure that the caches115115+ * are thoroughly cleaned just in case the bootloader didn't do it116116+ * for us. */117117+ mov r0, #0118118+ mcr p15, 0, r0, c7, c14, 0 @ clean+invalidate D cache119119+ mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache120120+ mcr p15, 0, r0, c7, c15, 0 @ clean+invalidate cache121121+ mcr p15, 0, r0, c7, c10, 4 @ drain write buffer122122+ @@mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs123123+ @@mcr p15, 0, r0, c7, c7, 0 @ Invalidate I + D caches124124+125125+ ldr r0, s3c_sleep_save_phys126126+ ldmia r0, { r4 - r13 }127127+128128+ mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID129129+ mcr p15, 0, r5, c3, c0, 0 @ Domain ID130130+ mcr p15, 0, r6, c2, c0, 0 @ Translation Table BASE0131131+ mcr p15, 0, r7, c2, c0, 1 @ Translation Table BASE1132132+ mcr p15, 0, r8, c2, c0, 2 @ Translation Table Control133133+ mcr p15, 0, r10, c1, c0, 1 @ Auxiliary control register134134+135135+ mov r0, #0 @ restore copro access controls136136+ mcr p15, 0, r11, c1, c0, 2 @ Co-processor access controls137137+ mcr p15, 0, r0, c7, c5, 4138138+139139+ ldr r2, =resume_with_mmu140140+ mcr p15, 0, r9, c1, c0, 0 /* turn mmu back on */141141+ nop142142+ mov pc, r2 /* jump back */143143+144144+ .end