bk://bk.arm.linux.org.uk/linux-2.6-rmk rmk@flint.arm.linux.org.uk|ChangeSet|20041211170700|13065 rmk # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/12/11 17:07:00+00:00 rmk@flint.arm.linux.org.uk # [ARM] Fix compiler warning for set_speed irda method. # # include/asm-arm/mach/irda.h # 2004/12/11 17:03:55+00:00 rmk@flint.arm.linux.org.uk +1 -1 # set_speed takes an unsigned int speed argument. # # ChangeSet # 2004/12/10 21:29:56+00:00 rmk@flint.arm.linux.org.uk # [ARM] Add resources for sa11x0ir device. # # arch/arm/mach-sa1100/generic.c # 2004/12/10 21:27:01+00:00 rmk@flint.arm.linux.org.uk +22 -0 # Add resources for sa11x0ir device. # # ChangeSet # 2004/12/10 19:11:32+00:00 rmk@flint.arm.linux.org.uk # [ARM] Add platform-based IrDA device support. # # Move the platform specific IrDA support code out of sa1100_ir into # the platform support files. This allows sa1100_ir to build again. # # include/asm-arm/mach/irda.h # 2004/12/10 19:08:04+00:00 rmk@flint.arm.linux.org.uk +20 -0 # # include/asm-arm/mach/irda.h # 2004/12/10 19:08:04+00:00 rmk@flint.arm.linux.org.uk +0 -0 # BitKeeper file /usr/src/bk/linux-2.6-rmk/include/asm-arm/mach/irda.h # # drivers/net/irda/sa1100_ir.c # 2004/12/10 19:08:04+00:00 rmk@flint.arm.linux.org.uk +27 -102 # Remove platform specific code from sa1100_ir, and use the supplied # platform data to handle the platform specific implementation # details. # # arch/arm/mach-sa1100/h3600.c # 2004/12/10 19:08:04+00:00 rmk@flint.arm.linux.org.uk +26 -0 # Add platform-based IrDA device support. # # arch/arm/mach-sa1100/generic.h # 2004/12/10 19:08:04+00:00 rmk@flint.arm.linux.org.uk +3 -0 # Add platform-based IrDA device support. # # arch/arm/mach-sa1100/generic.c # 2004/12/10 19:08:04+00:00 rmk@flint.arm.linux.org.uk +13 -0 # Add platform-based IrDA device support. # # arch/arm/mach-sa1100/assabet.c # 2004/12/10 19:08:03+00:00 rmk@flint.arm.linux.org.uk +43 -0 # Add platform-based IrDA device support. # # ChangeSet # 2004/12/10 16:33:49+00:00 nico@org.rmk.(none) # [ARM PATCH] 2301/1: fix PXA definition of PSSR_OTGPH # # Patch from Nicolas Pitre # # Signed-off-by: Nicolas Pitre # Signed-off-by: Russell King # # include/asm-arm/arch-pxa/pxa-regs.h # 2004/12/10 01:53:22+00:00 nico@org.rmk.(none) +1 -1 # [PATCH] 2301/1: fix PXA definition of PSSR_OTGPH # # ChangeSet # 2004/12/10 16:29:17+00:00 dvrabel@com.rmk.(none) # [ARM PATCH] 2300/1: IXP4xx: remove minor type mismatch warnings # # Patch from David Vrabel # # Remove some minor type mismatch warnings from some IXP4xx specific code. # # Signed-off-by: David Vrabel # Signed-off-by: Russell King # # include/asm-arm/arch-ixp4xx/io.h # 2004/12/09 14:50:35+00:00 dvrabel@com.rmk.(none) +3 -3 # [PATCH] 2300/1: IXP4xx: remove minor type mismatch warnings # # arch/arm/mach-ixp4xx/common-pci.c # 2004/12/09 14:45:17+00:00 dvrabel@com.rmk.(none) +2 -2 # [PATCH] 2300/1: IXP4xx: remove minor type mismatch warnings # # ChangeSet # 2004/12/10 16:24:25+00:00 ben-linux@org.rmk.(none) # [ARM PATCH] 2299/1: S3C2410 - pm debug patch # # Patch from Ben Dooks # # If CONFIG_S3C2410_PM_CHECK is set and CONFIG_S3C2410_PM_DEBUG is # not set, then the pm.c file will not build as uart_save[] is not # defined. # # Signed-off-by: Dimitry Andric # # Signed-off-by: Ben Dooks # Signed-off-by: Russell King # # arch/arm/mach-s3c2410/pm.c # 2004/12/08 12:06:02+00:00 ben-linux@org.rmk.(none) +2 -2 # [PATCH] 2299/1: S3C2410 - pm debug patch # diff -Nru a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c --- a/arch/arm/mach-ixp4xx/common-pci.c 2004-12-12 17:54:44 -08:00 +++ b/arch/arm/mach-ixp4xx/common-pci.c 2004-12-12 17:54:44 -08:00 @@ -238,7 +238,7 @@ return 0xffffffff; } -static int ixp4xx_pci_read_config(struct pci_bus *bus, u16 devfn, int where, int size, u32 *value) +static int ixp4xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) { u32 n, byte_enables, addr, data; u8 bus_num = bus->number; @@ -261,7 +261,7 @@ return PCIBIOS_SUCCESSFUL; } -static int ixp4xx_pci_write_config(struct pci_bus *bus, u16 devfn, int where, int size, u32 value) +static int ixp4xx_pci_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) { u32 n, byte_enables, addr, data; u8 bus_num = bus->number; diff -Nru a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c --- a/arch/arm/mach-s3c2410/pm.c 2004-12-12 17:54:44 -08:00 +++ b/arch/arm/mach-s3c2410/pm.c 2004-12-12 17:54:44 -08:00 @@ -187,6 +187,8 @@ #define DBG(fmt...) printk(KERN_DEBUG fmt) #define s3c2410_pm_debug_init() do { } while(0) + +static struct sleep_save uart_save[] = {}; #endif #if defined(CONFIG_S3C2410_PM_CHECK) && CONFIG_S3C2410_PM_CHECK_CHUNKSIZE != 0 @@ -377,8 +379,6 @@ } #else - -static struct sleep_save uart_save[] = {}; #define s3c2410_pm_check_prepare() do { } while(0) #define s3c2410_pm_check_restore() do { } while(0) diff -Nru a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c --- a/arch/arm/mach-sa1100/assabet.c 2004-12-12 17:54:44 -08:00 +++ b/arch/arm/mach-sa1100/assabet.c 2004-12-12 17:54:44 -08:00 @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -94,6 +95,11 @@ ASSABET_BCR_clear(ASSABET_BCR_LCD_ON); } + +/* + * Assabet flash support code. + */ + #ifdef ASSABET_REV_4 /* * Phase 4 Assabet has two 28F160B3 flash parts in bank 0: @@ -156,6 +162,42 @@ } }; + +/* + * Assabet IrDA support code. + */ + +static int assabet_irda_set_power(struct device *dev, unsigned int state) +{ + static unsigned int bcr_state[4] = { + ASSABET_BCR_IRDA_MD0, + ASSABET_BCR_IRDA_MD1|ASSABET_BCR_IRDA_MD0, + ASSABET_BCR_IRDA_MD1, + 0 + }; + + if (state < 4) { + state = bcr_state[state]; + ASSABET_BCR_clear(state ^ (ASSABET_BCR_IRDA_MD1| + ASSABET_BCR_IRDA_MD0)); + ASSABET_BCR_set(state); + } + return 0; +} + +static void assabet_irda_set_speed(struct device *dev, unsigned int speed) +{ + if (speed < 4000000) + ASSABET_BCR_clear(ASSABET_BCR_IRDA_FSEL); + else + ASSABET_BCR_set(ASSABET_BCR_IRDA_FSEL); +} + +static struct irda_platform_data assabet_irda_data = { + .set_power = assabet_irda_set_power, + .set_speed = assabet_irda_set_speed, +}; + static void __init assabet_init(void) { /* @@ -203,6 +245,7 @@ sa11x0_set_flash_data(&assabet_flash_data, assabet_flash_resources, ARRAY_SIZE(assabet_flash_resources)); + sa11x0_set_irda_data(&assabet_irda_data); } /* diff -Nru a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c --- a/arch/arm/mach-sa1100/generic.c 2004-12-12 17:54:44 -08:00 +++ b/arch/arm/mach-sa1100/generic.c 2004-12-12 17:54:44 -08:00 @@ -283,6 +283,38 @@ sa11x0mtd_device.num_resources = nr; } +static struct resource sa11x0ir_resources[] = { + { + .start = __PREG(Ser2UTCR0), + .end = __PREG(Ser2UTCR0) + 0x24 - 1, + .flags = IORESOURCE_MEM, + }, { + .start = __PREG(Ser2HSCR0), + .end = __PREG(Ser2HSCR0) + 0x1c - 1, + .flags = IORESOURCE_MEM, + }, { + .start = __PREG(Ser2HSCR2), + .end = __PREG(Ser2HSCR2) + 0x04 - 1, + .flags = IORESOURCE_MEM, + }, { + .start = IRQ_Ser2ICP, + .end = IRQ_Ser2ICP, + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device sa11x0ir_device = { + .name = "sa11x0-ir", + .id = -1, + .num_resources = ARRAY_SIZE(sa11x0ir_resources), + .resource = sa11x0ir_resources, +}; + +void sa11x0_set_irda_data(struct irda_platform_data *irda) +{ + sa11x0ir_device.dev.platform_data = irda; +} + static struct platform_device *sa11x0_devices[] __initdata = { &sa11x0udc_device, &sa11x0uart1_device, @@ -297,6 +329,9 @@ static int __init sa1100_init(void) { pm_power_off = sa1100_power_off; + + if (sa11x0ir_device.dev.platform_data) + platform_device_register(&sa11x0ir_device); return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices)); } diff -Nru a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h --- a/arch/arm/mach-sa1100/generic.h 2004-12-12 17:54:44 -08:00 +++ b/arch/arm/mach-sa1100/generic.h 2004-12-12 17:54:44 -08:00 @@ -33,3 +33,6 @@ extern void sa11x0_set_flash_data(struct flash_platform_data *flash, struct resource *res, int nr); + +struct irda_platform_data; +void sa11x0_set_irda_data(struct irda_platform_data *irda); diff -Nru a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c --- a/arch/arm/mach-sa1100/h3600.c 2004-12-12 17:54:44 -08:00 +++ b/arch/arm/mach-sa1100/h3600.c 2004-12-12 17:54:44 -08:00 @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -119,9 +120,34 @@ .flags = IORESOURCE_MEM, }; +/* + * This turns the IRDA power on or off on the Compaq H3600 + */ +static int h3600_irda_set_power(struct device *dev, unsigned int state) +{ + assign_h3600_egpio( IPAQ_EGPIO_IR_ON, state ); + + return 0; +} + +static void h3600_irda_set_speed(struct device *dev, int speed) +{ + if (speed < 4000000) { + clr_h3600_egpio(IPAQ_EGPIO_IR_FSEL); + } else { + set_h3600_egpio(IPAQ_EGPIO_IR_FSEL); + } +} + +static struct irda_platform_data h3600_irda_data = { + .set_power = h3600_irda_set_power, + .set_speed = h3600_irda_set_speed, +}; + static void h3xxx_mach_init(void) { sa11x0_set_flash_data(&h3xxx_flash_data, &h3xxx_flash_resource, 1); + sa11x0_set_irda_data(&h3600_irda_data); } /* diff -Nru a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c --- a/drivers/net/irda/sa1100_ir.c 2004-12-12 17:54:44 -08:00 +++ b/drivers/net/irda/sa1100_ir.c 2004-12-12 17:54:44 -08:00 @@ -39,19 +39,7 @@ #include #include #include -#include - -#include -#include -#include - -#ifndef GPIO_IRDA_FIR -#define GPIO_IRDA_FIR (0) -#endif - -#ifndef GPIO_IRDA_POWER -#define GPIO_IRDA_POWER (0) -#endif +#include static int power_level = 3; static int tx_lpm; @@ -75,6 +63,7 @@ struct net_device_stats stats; struct device *dev; + struct irda_platform_data *pdata; struct irlap_cb *irlap; struct qos_info qos; @@ -170,12 +159,8 @@ Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE; - if (machine_is_assabet()) - ASSABET_BCR_clear(ASSABET_BCR_IRDA_FSEL); - if (machine_is_h3xxx()) - clr_h3600_egpio(IPAQ_EGPIO_IR_FSEL); - if (machine_is_yopy()) - PPSR &= ~GPIO_IRDA_FIR; + if (si->pdata->set_speed) + si->pdata->set_speed(si->dev, speed); si->speed = speed; @@ -194,12 +179,8 @@ si->speed = speed; - if (machine_is_assabet()) - ASSABET_BCR_set(ASSABET_BCR_IRDA_FSEL); - if (machine_is_h3xxx()) - set_h3600_egpio(IPAQ_EGPIO_IR_FSEL); - if (machine_is_yopy()) - PPSR |= GPIO_IRDA_FIR; + if (si->pdata->set_speed) + si->pdata->set_speed(si->dev, speed); sa1100_irda_rx_alloc(si); sa1100_irda_rx_dma_start(si); @@ -216,51 +197,6 @@ } /* - * This sets the IRDA power level on the Assabet. - */ -static inline int -sa1100_irda_set_power_assabet(struct sa1100_irda *si, unsigned int state) -{ - static unsigned int bcr_state[4] = { - ASSABET_BCR_IRDA_MD0, - ASSABET_BCR_IRDA_MD1|ASSABET_BCR_IRDA_MD0, - ASSABET_BCR_IRDA_MD1, - 0 - }; - - if (state < 4) { - state = bcr_state[state]; - ASSABET_BCR_clear(state ^ (ASSABET_BCR_IRDA_MD1| - ASSABET_BCR_IRDA_MD0)); - ASSABET_BCR_set(state); - } - return 0; -} - -/* - * This turns the IRDA power on or off on the Compaq H3600 - */ -static inline int -sa1100_irda_set_power_h3600(struct sa1100_irda *si, unsigned int state) -{ - assign_h3600_egpio( IPAQ_EGPIO_IR_ON, state ); - return 0; -} - -/* - * This turns the IRDA power on or off on the Yopy - */ -static inline int -sa1100_irda_set_power_yopy(struct sa1100_irda *si, unsigned int state) -{ - if (state) - PPSR &= ~GPIO_IRDA_POWER; - else - PPSR |= GPIO_IRDA_POWER; - return 0; -} - -/* * Control the power state of the IrDA transmitter. * State: * 0 - off @@ -274,14 +210,8 @@ __sa1100_irda_set_power(struct sa1100_irda *si, unsigned int state) { int ret = 0; - - if (machine_is_assabet()) - ret = sa1100_irda_set_power_assabet(si, state); - if (machine_is_h3xxx()) - ret = sa1100_irda_set_power_h3600(si, state); - if (machine_is_yopy()) - ret = sa1100_irda_set_power_yopy(si, state); - + if (si->pdata->set_power) + ret = si->pdata->set_power(si->dev, state); return ret; } @@ -304,11 +234,8 @@ /* * Ensure that the ports for this device are setup correctly. */ - if (machine_is_yopy()) { - PPDR |= GPIO_IRDA_POWER | GPIO_IRDA_FIR; - PPSR |= GPIO_IRDA_POWER | GPIO_IRDA_FIR; - PSDR |= GPIO_IRDA_POWER | GPIO_IRDA_FIR; - } + if (si->pdata->startup) + si->pdata->startup(si->dev); /* * Configure PPC for IRDA - we want to drive TXD2 low. @@ -333,10 +260,15 @@ Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; ret = sa1100_irda_set_speed(si, si->speed = 9600); - if (ret) - return ret; + if (ret) { + Ser2UTCR3 = 0; + Ser2HSCR0 = 0; - return 0; + if (si->pdata->shutdown) + si->pdata->shutdown(si->dev); + } + + return ret; } static void sa1100_irda_shutdown(struct sa1100_irda *si) @@ -350,6 +282,9 @@ /* Disable the port. */ Ser2UTCR3 = 0; Ser2HSCR0 = 0; + + if (si->pdata->shutdown) + si->pdata->shutdown(si->dev); } #ifdef CONFIG_PM @@ -959,6 +894,9 @@ unsigned int baudrate_mask; int err; + if (!pdev->dev.platform_data) + return -EINVAL; + err = request_mem_region(__PREG(Ser2UTCR0), 0x24, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_1; @@ -975,6 +913,7 @@ si = dev->priv; si->dev = &pdev->dev; + si->pdata = pdev->dev.platform_data; /* * Initialise the HP-SIR buffers @@ -1028,7 +967,7 @@ err = register_netdev(dev); if (err == 0) - dev_set_drvdata(&pdev->dev, si); + dev_set_drvdata(&pdev->dev, dev); if (err) { err_mem_5: @@ -1074,15 +1013,8 @@ .resume = sa1100_irda_resume, }; -static struct platform_device sa1100ir_device = { - .name = "sa11x0-ir", - .id = 0, -}; - static int __init sa1100_irda_init(void) { - int ret; - /* * Limit power level a sensible range. */ @@ -1091,19 +1023,12 @@ if (power_level > 3) power_level = 3; - ret = driver_register(&sa1100ir_driver); - if (ret == 0) { - ret = platform_device_register(&sa1100ir_device); - if (ret) - driver_unregister(&sa1100ir_driver); - } - return ret; + return driver_register(&sa1100ir_driver); } static void __exit sa1100_irda_exit(void) { driver_unregister(&sa1100ir_driver); - platform_device_unregister(&sa1100ir_device); } module_init(sa1100_irda_init); diff -Nru a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h --- a/include/asm-arm/arch-ixp4xx/io.h 2004-12-12 17:54:44 -08:00 +++ b/include/asm-arm/arch-ixp4xx/io.h 2004-12-12 17:54:44 -08:00 @@ -292,7 +292,7 @@ } static inline void -__ixp4xx_outsb(u32 io_addr, u8 *vaddr, u32 count) +__ixp4xx_outsb(u32 io_addr, const u8 *vaddr, u32 count) { while (count--) outb(*vaddr++, io_addr); @@ -309,7 +309,7 @@ } static inline void -__ixp4xx_outsw(u32 io_addr, u16 *vaddr, u32 count) +__ixp4xx_outsw(u32 io_addr, const u16 *vaddr, u32 count) { while (count--) outw(cpu_to_le16(*vaddr++), io_addr); @@ -322,7 +322,7 @@ } static inline void -__ixp4xx_outsl(u32 io_addr, u32 *vaddr, u32 count) +__ixp4xx_outsl(u32 io_addr, const u32 *vaddr, u32 count) { while (count--) outl(*vaddr++, io_addr); diff -Nru a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h --- a/include/asm-arm/arch-pxa/pxa-regs.h 2004-12-12 17:54:44 -08:00 +++ b/include/asm-arm/arch-pxa/pxa-regs.h 2004-12-12 17:54:44 -08:00 @@ -1494,7 +1494,7 @@ #define PVCR_CommandDelay (0xf80) #define PCFR_PI2C_EN (0x1 << 6) -#define PSSR_OTGPH (1 << 7) /* OTG Peripheral control Hold */ +#define PSSR_OTGPH (1 << 6) /* OTG Peripheral control Hold */ #define PSSR_RDH (1 << 5) /* Read Disable Hold */ #define PSSR_PH (1 << 4) /* Peripheral Control Hold */ #define PSSR_VFS (1 << 2) /* VDD Fault Status */ diff -Nru a/include/asm-arm/mach/irda.h b/include/asm-arm/mach/irda.h --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/include/asm-arm/mach/irda.h 2004-12-12 17:54:44 -08:00 @@ -0,0 +1,20 @@ +/* + * linux/include/asm-arm/mach/irda.h + * + * Copyright (C) 2004 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef __ASM_ARM_MACH_IRDA_H +#define __ASM_ARM_MACH_IRDA_H + +struct irda_platform_data { + int (*startup)(struct device *); + void (*shutdown)(struct device *); + int (*set_power)(struct device *, unsigned int state); + void (*set_speed)(struct device *, unsigned int speed); +}; + +#endif