📄 s3c2410-linux-2.6.11.1-apm-08.11.02.patch
字号:
+}++static inline void+s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)+{+ unsigned long mask;+ unsigned long submask;++ submask = __raw_readl(S3C2410_INTSUBMSK);+ mask = __raw_readl(S3C2410_INTMSK);++ submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));+ mask &= ~parentbit;++ /* write back masks */+ __raw_writel(submask, S3C2410_INTSUBMSK);+ __raw_writel(mask, S3C2410_INTMSK);+}+++static inline void+s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)+{+ unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);++ s3c_irqsub_mask(irqno, parentmask, group);++ __raw_writel(bit, S3C2410_SUBSRCPND);++ /* only ack parent if we've got all the irqs (seems we must+ * ack, all and hope that the irq system retriggers ok when+ * the interrupt goes off again)+ */++ if (1) {+ __raw_writel(parentmask, S3C2410_SRCPND);+ __raw_writel(parentmask, S3C2410_INTPND);+ }+}++static inline void+s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)+{+ unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);++ __raw_writel(bit, S3C2410_SUBSRCPND);++ /* only ack parent if we've got all the irqs (seems we must+ * ack, all and hope that the irq system retriggers ok when+ * the interrupt goes off again)+ */++ if (1) {+ __raw_writel(parentmask, S3C2410_SRCPND);+ __raw_writel(parentmask, S3C2410_INTPND);+ }+}++/* exported for use in arch/arm/mach-s3c2410 */++#ifdef CONFIG_PM+extern int s3c_irq_wake(unsigned int irqno, unsigned int state);+#else+#define s3c_irq_wake NULL+#endif++extern int s3c_irqext_type(unsigned int irq, unsigned int type);diff -urN s3c2410-linux-2.6.11.1/arch/arm/mach-s3c2410/mach-smdk2410.c s3c2410-linux-2.6.11.1-apm-08.11.02/arch/arm/mach-s3c2410/mach-smdk2410.c--- s3c2410-linux-2.6.11.1/arch/arm/mach-s3c2410/mach-smdk2410.c 2006-12-03 05:20:23.000000000 -0500+++ s3c2410-linux-2.6.11.1-apm-08.11.02/arch/arm/mach-s3c2410/mach-smdk2410.c 2008-11-02 08:45:16.000000000 -0500@@ -37,6 +37,7 @@ #include <linux/list.h> #include <linux/timer.h> #include <linux/init.h>+#include <linux/delay.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>@@ -53,8 +54,6 @@ #include "cpu.h" #include "asm/arch/smdk2410.h" -- #include <asm/hardware/clock.h> #include <asm/arch/usb-control.h> #include <asm/arch/regs-clock.h>@@ -66,6 +65,10 @@ #include <asm/arch-s3c2410/s3c2410_ts.h> #include <asm/arch-s3c2410/regs-sdi.h> +#include "pm.h"+#include <asm/arch/regs-irq.h>+#include "irq.h"+ static struct map_desc smdk2410_iodesc[] __initdata = { /* nothing here yet */ {vSMDK2410_ETH_IO, pSMDK2410_ETH_IO, SZ_1M, MT_DEVICE},@@ -123,20 +126,6 @@ .devices_count = ARRAY_SIZE(smdk2410_devices) }; -int upllvalue_set(void)-{- unsigned long upllvalue;- unsigned long misccr;-- upllvalue = (0x78<<12)|(0x02<<4)|(0x03);- __raw_writel(upllvalue,S3C2410_UPLLCON);- misccr = __raw_readl(S3C2410_MISCCR);- misccr |= S3C2410_MISCCR_USBHOST;- misccr &= ~(S3C2410_MISCCR_USBSUSPND0 | S3C2410_MISCCR_USBSUSPND1);- __raw_writel(misccr,S3C2410_MISCCR);- return 0;-}- void __init smdk2410_map_io(void) { s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));@@ -150,24 +139,48 @@ { s3c24xx_init_irq(); }-//start add by lili-static struct s3c2410_hcd_info smdk2410_usbcfg = { - .port[0] = { - .flags = S3C_HCDFLG_USED - },- .port[1] = {- .flags = S3C_HCDFLG_USED- }-}; -void __init smdk2410_init_usb(void)+static struct s3c2410_hcd_info usb_s3c2410_info = {+ .port[0] = {+ .flags = S3C_HCDFLG_USED+ },+ .port[1] = {+ .flags = S3C_HCDFLG_USED+ }+};++int __init s3c2410_init_usb(void)+{+ unsigned long upllvalue;+ printk("USB Control, (c) 2006 pc104\n");+ s3c_device_usb.dev.platform_data = &usb_s3c2410_info;++ s3c2410_modify_misccr(S3C2410_MISCCR_USBSUSPND0 |+ S3C2410_MISCCR_USBSUSPND1 |+ S3C2410_MISCCR_USBHOST, 0x0);+ + upllvalue = (0x78<<12)|(0x02<<4)|(0x03);+ while(upllvalue!=__raw_readl(S3C2410_UPLLCON))+ {+ __raw_writel(upllvalue,S3C2410_UPLLCON);+ mdelay(1);+ }+ return 0;+}++void __init smdk_init(void) {- upllvalue_set();- printk("init USB, (c) 2005 bit.lili@gmail.com\n");-// s3c_device_usb.dev.dma_mask = &smdk2410_usbcfg;- s3c_device_usb.dev.platform_data = &smdk2410_usbcfg;+#ifdef CONFIG_PM ++ s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2);+ set_irq_type(IRQ_EINT2, __IRQT_FALEDGE);+ s3c_irq_wake(IRQ_EINT2, 1);++#endif + s3c2410_init_usb();++ s3c2410_pm_init(); }-//end add MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch * to SMDK2410 */@@ -177,6 +190,7 @@ MAPIO(smdk2410_map_io) INITIRQ(smdk2410_init_irq) .timer = &s3c24xx_timer,+ .init_machine = smdk_init, MACHINE_END diff -urN s3c2410-linux-2.6.11.1/arch/arm/mach-s3c2410/pm.c s3c2410-linux-2.6.11.1-apm-08.11.02/arch/arm/mach-s3c2410/pm.c--- s3c2410-linux-2.6.11.1/arch/arm/mach-s3c2410/pm.c 2005-06-01 19:38:57.000000000 -0400+++ s3c2410-linux-2.6.11.1-apm-08.11.02/arch/arm/mach-s3c2410/pm.c 2008-11-02 08:32:12.000000000 -0500@@ -28,7 +28,6 @@ * Modifications: * 10-Mar-2005 LCVR Changed S3C2410_VA_UART to S3C24XX_VA_UART */- #include <linux/config.h> #include <linux/init.h> #include <linux/suspend.h>@@ -58,7 +57,11 @@ /* cache functions from arch/arm/mm/proc-arm920.S */ +#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH extern void arm920_flush_kern_cache_all(void);+#else+static void arm920_flush_kern_cache_all(void) { }+#endif #define PFX "s3c24xx-pm: " @@ -396,7 +399,7 @@ { for (; count > 0; count--, ptr++) { ptr->val = __raw_readl(ptr->reg);- DBG("saved %08lx value %08lx\n", ptr->reg, ptr->val);+ DBG("saved %08lx value %08lx\n", ptr->reg, ptr->val); } } @@ -585,14 +588,16 @@ s3c2410_pm_check_store(); - // need to make some form of time-delta- /* send the cpu to sleep... */ __raw_writel(0x00, S3C2410_CLKCON); /* turn off clocks over sleep */ s3c2410_cpu_suspend(regs_save); + /* restore the cpu state */++ cpu_init();+ /* unset the return-from-sleep flag, to ensure reset */ tmp = __raw_readl(S3C2410_GSTATUS2);diff -urN s3c2410-linux-2.6.11.1/arch/arm/mach-s3c2410/sleep.S s3c2410-linux-2.6.11.1-apm-08.11.02/arch/arm/mach-s3c2410/sleep.S--- s3c2410-linux-2.6.11.1/arch/arm/mach-s3c2410/sleep.S 2005-03-04 12:26:42.000000000 -0500+++ s3c2410-linux-2.6.11.1-apm-08.11.02/arch/arm/mach-s3c2410/sleep.S 2008-11-02 08:32:12.000000000 -0500@@ -23,7 +23,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */- #include <linux/config.h> #include <linux/linkage.h> #include <asm/assembler.h>@@ -59,15 +58,16 @@ mrc p15, 0, r5, c13, c0, 0 @ PID mrc p15, 0, r6, c3, c0, 0 @ Domain ID mrc p15, 0, r7, c2, c0, 0 @ translation table base address- mrc p15, 0, r8, c2, c0, 0 @ auxiliary control register- mrc p15, 0, r9, c1, c0, 0 @ control register+ mrc p15, 0, r8, c1, c0, 0 @ control register stmia r0, { r4 - r13 } @@ flush the caches to ensure everything is back out to @@ SDRAM before the core powers down +#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH bl arm920_flush_kern_cache_all+#endif @@ prepare cpu to sleep @@ -127,7 +127,7 @@ */ ENTRY(s3c2410_cpu_resume)- mov r0, #PSR_I_BIT | PSR_F_BIT | MODE_SVC+ mov r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE msr cpsr_c, r0 @@ load UART to allow us to print the two characters for@@ -165,7 +165,6 @@ mcr p15, 0, r5, c13, c0, 0 @ PID mcr p15, 0, r6, c3, c0, 0 @ Domain ID mcr p15, 0, r7, c2, c0, 0 @ translation table base- mcr p15, 0, r8, c1, c1, 0 @ auxilliary control #ifdef CONFIG_DEBUG_RESUME mov r3, #'R'@@ -173,7 +172,7 @@ #endif ldr r2, =resume_with_mmu- mcr p15, 0, r9, c1, c0, 0 @ turn on MMU, etc+ mcr p15, 0, r8, c1, c0, 0 @ turn on MMU, etc nop @ second-to-last before mmu mov pc, r2 @ go back to virtual address diff -urN s3c2410-linux-2.6.11.1/drivers/char/watchdog/s3c2410_wdt.c s3c2410-linux-2.6.11.1-apm-08.11.02/drivers/char/watchdog/s3c2410_wdt.c--- s3c2410-linux-2.6.11.1/drivers/char/watchdog/s3c2410_wdt.c 2005-06-01 19:39:03.000000000 -0400+++ s3c2410-linux-2.6.11.1-apm-08.11.02/drivers/char/watchdog/s3c2410_wdt.c 2008-11-02 08:32:12.000000000 -0500@@ -486,15 +486,58 @@ return 0; } ++#ifdef CONFIG_PM++static unsigned long wtcon_save;+static unsigned long wtdat_save;++static int s3c2410wdt_suspend(struct device *dev, u32 state, u32 level)+{+ if (level == SUSPEND_POWER_DOWN) {+ /* Save watchdog state, and turn it off. */+ wtcon_save = readl(wdt_base + S3C2410_WTCON);+ wtdat_save = readl(wdt_base + S3C2410_WTDAT);++ /* Note that WTCNT doesn't need to be saved. */+ s3c2410wdt_stop();+ }++ return 0;+}++static int s3c2410wdt_resume(struct device *dev, u32 level)+{+ if (level == RESUME_POWER_ON) {+ /* Restore watchdog state. */++ writel(wtdat_save, wdt_base + S3C2410_WTDAT);+ writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */+ writel(wtcon_save, wdt_base + S3C2410_WTCON);++ printk(KERN_INFO PFX "watchdog %sabled\n",+ (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis");+ }++ return 0;+}++#else+#define s3c2410wdt_suspend NULL+#define s3c2410wdt_resume NULL+#endif /* CONFIG_PM */+++ static struct device_driver s3c2410wdt_driver = { .name = "s3c2410-wdt", .bus = &platform_bus_type, .probe = s3c2410wdt_probe, .remove = s3c2410wdt_remove,+ .suspend = s3c2410wdt_suspend,+ .resume = s3c2410wdt_resume, }; -- static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n"; static int __init watchdog_init(void)diff -urN s3c2410-linux-2.6.11.1/drivers/mtd/nand/s3c2410.c s3c2410-linux-2.6.11.1-apm-08.11.02/drivers/mtd/nand/s3c2410.c--- s3c2410-linux-2.6.11.1/drivers/mtd/nand/s3c2410.c 2005-06-04 00:33:27.000000000 -0400+++ s3c2410-linux-2.6.11.1-apm-08.11.02/drivers/mtd/nand/s3c2410.c 2008-11-02 08:32:12.000000000 -0500@@ -679,11 +679,40 @@ return err; } +#ifdef CONFIG_PM++static int s3c2410_nand_suspend(struct device *dev, u32 state, u32 level)+{+ struct s3c2410_nand_info *info = to_nand_info(dev);++ clk_disable(info->clk);++ return 0;+}++static int s3c2410_nand_resume(struct device *dev, u32 level)+{+ struct s3c2410_nand_info *info = to_nand_info(dev);++ clk_enable(info->clk);+ msleep(1);++ return s3c2410_nand_inithw(info, dev);+}++#else+#define s3c2410_nand_suspend NULL+#define s3c2410_nand_resume NULL+#endif++ static struct device_driver s3c2410_nand_driver = {- .name = "s3c2410-nand",- .bus = &platform_bus_type,+ .name = "s3c2410-nand",+ .bus = &platform_bus_type, .probe = s3c2410_nand_probe, .remove = s3c2410_nand_remove,+ .suspend = s3c2410_nand_suspend,+ .resume = s3c2410_nand_resume, }; static int __init s3c2410_nand_init(void)diff -urN s3c2410-linux-2.6.11.1/drivers/usb/core/hcd.c s3c2410-linux-2.6.11.1-apm-08.11.02/drivers/usb/core/hcd.c--- s3c2410-linux-2.6.11.1/drivers/usb/core/hcd.c 2005-06-01 19:39:11.000000000 -0400+++ s3c2410-linux-2.6.11.1-apm-08.11.02/drivers/usb/core/hcd.c 2008-11-02 08:32:12.000000000 -0500@@ -101,6 +101,9 @@ DECLARE_MUTEX (usb_bus_list_lock); /* exported only for usbfs */ EXPORT_SYMBOL_GPL (usb_bus_list_lock); +/* used for controlling access to virtual root hubs */+static DEFINE_SPINLOCK(hcd_root_hub_lock);+ /* used when updating hcd data */ static DEFINE_SPINLOCK(hcd_data_lock); @@ -1422,7 +1425,6 @@ return hcd->driver->hub_resume (hcd); return 0; }- #endif /*-------------------------------------------------------------------------*/diff -urN s3c2410-linux-2.6.11.1/drivers/usb/host/ohci-s3c2410.c s3c2410-linux-2.6.11.1-apm-08.11.02/drivers/usb/host/ohci-s3c2410.c--- s3c2410-linux-2.6.11.1/drivers/usb/host/ohci-s3c2410.c 2006-08-29 10:39:26.000000000 -0400+++ s3c2410-linux-2.6.11.1-apm-08.11.02/drivers/usb/host/ohci-s3c2410.c 2008-11-02 08:32:12.000000000 -0500@@ -24,6 +24,7 @@ #include <asm/hardware/clock.h> #include <asm/arch/usb-control.h> #include <asm/arch/regs-clock.h>+#include <asm/arch/regs-gpio.h> #define valid_port(idx) ((idx) == 1 || (idx) == 2) @@ -45,14 +46,16 @@ static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd) { struct s3c2410_hcd_info *info = dev->dev.platform_data;+ unsigned long upllvalue = (0x78<<12)|(0x02<<4)|(0x03); dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); clk_enable(clk); //check UPLLCON add by lili- unsigned long upllvalue = (0x78<<12)|(0x02<<4)|(0x03); - while (upllvalue != __raw_readl(S3C2410_UPLLCON)) - {
- __raw_writel(upllvalue, S3C2410_UPLLCON);
mdelay(1);
+ + while (upllvalue != __raw_readl(S3C2410_UPLLCON)) + { + __raw_writel(upllvalue, S3C2410_UPLLCON);+ mdelay(1); } //end if (info != NULL) {@@ -486,10 +489,11 @@ .hub_status_data = ohci_s3c2410_hub_status_data, .hub_control = ohci_s3c2410_hub_control, -#if defined(CONFIG_USB_SUSPEND) && 0+#ifdef CONFIG_PM .hub_suspend = ohci_hub_suspend, .hub_resume = ohci_hub_resume, #endif+ .start_port_reset = ohci_start_port_reset, }; /* device driver */@@ -516,13 +520,68 @@ return 0; } +#ifdef CONFIG_PM+static int ohci_hcd_s3c2410_drv_suspend(struct device * dev, u32 state, u32 level)+{+ struct platform_device *pdev = to_platform_device(dev);+ struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));+ int status = -EINVAL;++ if (level != SUSPEND_POWER_DOWN)+ return 0;++ down(&ohci_to_hcd(ohci)->self.root_hub->serialize);+ status = ohci_hub_suspend(ohci_to_hcd(ohci));+ if (status == 0) {+ s3c2410_stop_hc(pdev);+ ohci_to_hcd(ohci)->self.root_hub->state =+ USB_STATE_SUSPENDED;+ ohci_to_hcd(ohci)->state = HCD_STATE_SUSPENDED;+ dev->power.power_state = PMSG_SUSPEND;+ }+ up(&ohci_to_hcd(ohci)->self.root_hub->serialize);+ return status;+}++static int ohci_hcd_s3c2410_drv_resume(struct device *dev, u32 level)+{+ struct platform_device *pdev = to_platform_device(dev);+ struct usb_hcd *hcd = dev_get_drvdata(dev);+ struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));+ int status = 0;++ if (level != RESUME_POWER_ON)+ return 0;++ if (time_before(jiffies, ohci->next_statechange))+ msleep(5);+ ohci->next_statechange = jiffies;+ s3c2410_start_hc(pdev, hcd);+#ifdef CONFIG_USB_SUSPEND+ status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub);+#else+ down(&ohci_to_hcd(ohci)->self.root_hub->serialize);+ status = ohci_hub_resume(ohci_to_hcd(ohci));+ up(&ohci_to_hcd(ohci)->self.root_hub->serialize);+#endif+ if (status == 0)+ dev->power.power_state = PMSG_ON;++ return status;+}++#else+#define ohci_hcd_s3c2410_drv_suspend NULL+#define ohci_hcd_s3c2410_drv_resume NULL+#endif+ static struct device_driver ohci_hcd_s3c2410_driver = { .name = "s3c2410-ohci", .bus = &platform_bus_type, .probe = ohci_hcd_s3c2410_drv_probe, .remove = ohci_hcd_s3c2410_drv_remove,- /*.suspend = ohci_hcd_s3c2410_drv_suspend, */- /*.resume = ohci_hcd_s3c2410_drv_resume, */+ .suspend = ohci_hcd_s3c2410_drv_suspend, + .resume = ohci_hcd_s3c2410_drv_resume, }; static int __init ohci_hcd_s3c2410_init (void)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -