From fea2efe3bba15f0aa8f840fbe052699808187cb6 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 15 Sep 2005 12:30:11 +0100 Subject: [ARM] Remove PFN_TO_NID for !DISCONTIGMEM Platform classes need not define PFN_TO_NID when DISCONTIGMEM is not selected. Signed-off-by: Russell King --- include/asm-arm/arch-aaec2000/memory.h | 4 ---- include/asm-arm/arch-iop3xx/memory.h | 2 -- include/asm-arm/arch-lh7a40x/memory.h | 4 ---- include/asm-arm/arch-omap/memory.h | 1 - include/asm-arm/arch-pxa/memory.h | 4 ---- include/asm-arm/arch-sa1100/memory.h | 4 ---- 6 files changed, 19 deletions(-) (limited to 'include') diff --git a/include/asm-arm/arch-aaec2000/memory.h b/include/asm-arm/arch-aaec2000/memory.h index 681b6a6171a1..79c90813bc3e 100644 --- a/include/asm-arm/arch-aaec2000/memory.h +++ b/include/asm-arm/arch-aaec2000/memory.h @@ -64,10 +64,6 @@ #define NODE_MAX_MEM_SHIFT 26 #define NODE_MAX_MEM_SIZE (1 << NODE_MAX_MEM_SHIFT) -#else - -#define PFN_TO_NID(addr) (0) - #endif /* CONFIG_DISCONTIGMEM */ #endif /* __ASM_ARCH_MEMORY_H */ diff --git a/include/asm-arm/arch-iop3xx/memory.h b/include/asm-arm/arch-iop3xx/memory.h index dc4735cb0c10..45351f5cd904 100644 --- a/include/asm-arm/arch-iop3xx/memory.h +++ b/include/asm-arm/arch-iop3xx/memory.h @@ -36,6 +36,4 @@ #endif -#define PFN_TO_NID(addr) (0) - #endif diff --git a/include/asm-arm/arch-lh7a40x/memory.h b/include/asm-arm/arch-lh7a40x/memory.h index 7e2fea372663..c650e6feb9d5 100644 --- a/include/asm-arm/arch-lh7a40x/memory.h +++ b/include/asm-arm/arch-lh7a40x/memory.h @@ -85,10 +85,6 @@ (((unsigned long)(addr) & 0x01ffffff) >> PAGE_SHIFT) # endif -#else - -# define PFN_TO_NID(addr) (0) - #endif #endif diff --git a/include/asm-arm/arch-omap/memory.h b/include/asm-arm/arch-omap/memory.h index 84f81e315a25..ef32d61eec7a 100644 --- a/include/asm-arm/arch-omap/memory.h +++ b/include/asm-arm/arch-omap/memory.h @@ -86,6 +86,5 @@ #endif /* CONFIG_ARCH_OMAP1510 */ -#define PHYS_TO_NID(addr) (0) #endif diff --git a/include/asm-arm/arch-pxa/memory.h b/include/asm-arm/arch-pxa/memory.h index 217a80b820ff..58bad9748b5c 100644 --- a/include/asm-arm/arch-pxa/memory.h +++ b/include/asm-arm/arch-pxa/memory.h @@ -67,10 +67,6 @@ #define LOCAL_MAP_NR(addr) \ (((unsigned long)(addr) & 0x03ffffff) >> PAGE_SHIFT) -#else - -#define PFN_TO_NID(addr) (0) - #endif #endif diff --git a/include/asm-arm/arch-sa1100/memory.h b/include/asm-arm/arch-sa1100/memory.h index 32d3d5bde34d..8743ff5c1b23 100644 --- a/include/asm-arm/arch-sa1100/memory.h +++ b/include/asm-arm/arch-sa1100/memory.h @@ -99,10 +99,6 @@ __arch_adjust_zones(int node, unsigned long *size, unsigned long *holes) #define LOCAL_MAP_NR(addr) \ (((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT) -#else - -#define PFN_TO_NID(addr) (0) - #endif #endif -- cgit v1.2.3 From 917afce1000d978dfd3f07da5da9d864bc49c77e Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Thu, 15 Sep 2005 13:00:25 +0100 Subject: [ARM] 2911/1: ixp2000_reg_{read,write} accessors Patch from Lennert Buytenhek This patch: - changes the ixp2000_reg_write accessor to take a 'volatile void *' instead of a 'volatile unsigned long *', which then allows passing in a u32 * as first argument without being greeted with a warning; and - adds an ixp2000_reg_read accessor. We can then use these accessors in ixp2000 code to access on-chip peripherals, instead of directly dereferencing pointers. This is for use by the ixp2000 microengine driver which was recently announced on netdev. We can't use readl/writel on the ixp2000 since it is usually run in big-endian mode, and on big-endian platforms, readl/writel perform byteswapping. A future patch will remove the readback from ixp2000_reg_write, since it's not needed to prevent erratum #66, and add manual readbacks to the places that need them (writes are not synchronous since we map in device space using XCB=101 nowadays), such as interrupt disabling and GPIO manipulation. See also: http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2005-February/027084.html Patch has been ACKed by Jeff Garzik. Signed-off-by: Lennert Buytenhek Signed-off-by: Russell King --- include/asm-arm/arch-ixp2000/platform.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/asm-arm/arch-ixp2000/platform.h b/include/asm-arm/arch-ixp2000/platform.h index c0caf3e3e6fd..6519498dbe25 100644 --- a/include/asm-arm/arch-ixp2000/platform.h +++ b/include/asm-arm/arch-ixp2000/platform.h @@ -31,20 +31,24 @@ #include /* Pickup local_irq_ functions */ -static inline void ixp2000_reg_write(volatile unsigned long *reg, unsigned long val) +static inline void ixp2000_reg_write(volatile void *reg, unsigned long val) { - volatile unsigned long dummy; + unsigned long dummy; unsigned long flags; local_irq_save(flags); - *reg = val; + *((volatile unsigned long *)reg) = val; barrier(); - dummy = *reg; + dummy = *((volatile unsigned long *)reg); local_irq_restore(flags); } #else -#define ixp2000_reg_write(reg, val) (*reg = val) +static inline void ixp2000_reg_write(volatile void *reg, unsigned long val) +{ + *((volatile unsigned long *)reg) = val; +} #endif /* IXDP2400 || IXDP2401 */ +#define ixp2000_reg_read(reg) (*((volatile unsigned long *)reg)) /* * Boards may multiplex different devices on the 2nd channel of -- cgit v1.2.3 From 44449bbf4b051ef7bbea648602f4e21658fe2354 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Thu, 15 Sep 2005 13:00:52 +0100 Subject: [ARM] 2909/1: remove IXP2000_PROD_ID Patch from Lennert Buytenhek The intel docs call it IXP2000_PRODUCT_ID, and we have a definition for IXP2000_PRODUCT_ID as well, so IXP2000_PROD_ID can go. It's only used in one place. Signed-off-by: Lennert Buytenhek Signed-off-by: Deepak Saxena Signed-off-by: Russell King --- include/asm-arm/arch-ixp2000/ixp2000-regs.h | 2 -- include/asm-arm/arch-ixp2000/platform.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'include') diff --git a/include/asm-arm/arch-ixp2000/ixp2000-regs.h b/include/asm-arm/arch-ixp2000/ixp2000-regs.h index 75623f81ef75..32aece069869 100644 --- a/include/asm-arm/arch-ixp2000/ixp2000-regs.h +++ b/include/asm-arm/arch-ixp2000/ixp2000-regs.h @@ -370,8 +370,6 @@ #define GLOBAL_REG_BASE (IXP2000_GLOBAL_REG_VIRT_BASE + 0x0a00) #define GLOBAL_REG(x) (volatile unsigned long*)(GLOBAL_REG_BASE | (x)) -#define IXP2000_PROD_ID GLOBAL_REG(0x00) - #define IXP2000_MAJ_PROD_TYPE_MASK 0x001F0000 #define IXP2000_MAJ_PROD_TYPE_IXP2000 0x00000000 #define IXP2000_MIN_PROD_TYPE_MASK 0x0000FF00 diff --git a/include/asm-arm/arch-ixp2000/platform.h b/include/asm-arm/arch-ixp2000/platform.h index 6519498dbe25..abdcf51bd283 100644 --- a/include/asm-arm/arch-ixp2000/platform.h +++ b/include/asm-arm/arch-ixp2000/platform.h @@ -88,7 +88,7 @@ void ixp2000_release_slowport(struct slowport_cfg *); */ static inline unsigned ixp2000_has_broken_slowport(void) { - unsigned long id = *IXP2000_PROD_ID; + unsigned long id = *IXP2000_PRODUCT_ID; unsigned long id_prod = id & (IXP2000_MAJ_PROD_TYPE_MASK | IXP2000_MIN_PROD_TYPE_MASK); return (((id_prod == -- cgit v1.2.3 From f29d245549aa38325c37716dbecea8d817c00274 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 15 Sep 2005 14:53:22 +0100 Subject: [ARM] 2913/1: PXA Poodle: Cleanup some unneeded code Patch from Richard Purdie This patch cleans up the PXA Poodle platform code removing an unneeded static iomap. It also corrects errors in the platform header file and adds a missing GPIO define. Signed-off-by: Richard Purdie Signed-off-by: Russell King --- arch/arm/mach-pxa/poodle.c | 31 ++++++++++--------------------- include/asm-arm/arch-pxa/poodle.h | 25 +++++++++++++------------ 2 files changed, 23 insertions(+), 33 deletions(-) (limited to 'include') diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 47cfb8bb8318..7c4a1cebfd6b 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c @@ -126,6 +126,15 @@ static void __init poodle_init(void) { int ret = 0; + /* setup sleep mode values */ + PWER = 0x00000002; + PFER = 0x00000000; + PRER = 0x00000002; + PGSR0 = 0x00008000; + PGSR1 = 0x003F0202; + PGSR2 = 0x0001C000; + PCFR |= PCFR_OPDE; + /* cpu initialize */ /* Pgsr Register */ PGSR0 = 0x0146dd80; @@ -171,32 +180,12 @@ static void __init fixup_poodle(struct machine_desc *desc, sharpsl_save_param(); } -static struct map_desc poodle_io_desc[] __initdata = { - /* virtual physical length */ - { 0xef800000, 0x00000000, 0x00800000, MT_DEVICE }, /* Boot Flash */ -}; - -static void __init poodle_map_io(void) -{ - pxa_map_io(); - iotable_init(poodle_io_desc, ARRAY_SIZE(poodle_io_desc)); - - /* setup sleep mode values */ - PWER = 0x00000002; - PFER = 0x00000000; - PRER = 0x00000002; - PGSR0 = 0x00008000; - PGSR1 = 0x003F0202; - PGSR2 = 0x0001C000; - PCFR |= PCFR_OPDE; -} - MACHINE_START(POODLE, "SHARP Poodle") .phys_ram = 0xa0000000, .phys_io = 0x40000000, .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, .fixup = fixup_poodle, - .map_io = poodle_map_io, + .map_io = pxa_map_io, .init_irq = pxa_init_irq, .timer = &pxa_timer, .init_machine = poodle_init, diff --git a/include/asm-arm/arch-pxa/poodle.h b/include/asm-arm/arch-pxa/poodle.h index 58bda9d571a5..6b5ac5144e70 100644 --- a/include/asm-arm/arch-pxa/poodle.h +++ b/include/asm-arm/arch-pxa/poodle.h @@ -37,24 +37,25 @@ #define POODLE_GPIO_nSD_DETECT (9) #define POODLE_GPIO_MAIN_BAT_LOW (13) #define POODLE_GPIO_BAT_COVER (13) +#define POODLE_GPIO_USB_PULLUP (20) #define POODLE_GPIO_ADC_TEMP_ON (21) #define POODLE_GPIO_BYPASS_ON (36) #define POODLE_GPIO_CHRG_ON (38) #define POODLE_GPIO_CHRG_FULL (16) /* PXA GPIOs */ -#define POODLE_IRQ_GPIO_ON_KEY IRQ_GPIO0 -#define POODLE_IRQ_GPIO_AC_IN IRQ_GPIO1 -#define POODLE_IRQ_GPIO_HP_IN IRQ_GPIO4 -#define POODLE_IRQ_GPIO_CO IRQ_GPIO16 -#define POODLE_IRQ_GPIO_TP_INT IRQ_GPIO5 -#define POODLE_IRQ_GPIO_WAKEUP IRQ_GPIO11 -#define POODLE_IRQ_GPIO_GA_INT IRQ_GPIO10 -#define POODLE_IRQ_GPIO_CF_IRQ IRQ_GPIO17 -#define POODLE_IRQ_GPIO_CF_CD IRQ_GPIO14 -#define POODLE_IRQ_GPIO_nSD_INT IRQ_GPIO8 -#define POODLE_IRQ_GPIO_nSD_DETECT IRQ_GPIO9 -#define POODLE_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO13 +#define POODLE_IRQ_GPIO_ON_KEY IRQ_GPIO(0) +#define POODLE_IRQ_GPIO_AC_IN IRQ_GPIO(1) +#define POODLE_IRQ_GPIO_HP_IN IRQ_GPIO(4) +#define POODLE_IRQ_GPIO_CO IRQ_GPIO(16) +#define POODLE_IRQ_GPIO_TP_INT IRQ_GPIO(5) +#define POODLE_IRQ_GPIO_WAKEUP IRQ_GPIO(11) +#define POODLE_IRQ_GPIO_GA_INT IRQ_GPIO(10) +#define POODLE_IRQ_GPIO_CF_IRQ IRQ_GPIO(17) +#define POODLE_IRQ_GPIO_CF_CD IRQ_GPIO(14) +#define POODLE_IRQ_GPIO_nSD_INT IRQ_GPIO(8) +#define POODLE_IRQ_GPIO_nSD_DETECT IRQ_GPIO(9) +#define POODLE_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(13) /* SCOOP GPIOs */ #define POODLE_SCOOP_CHARGE_ON SCOOP_GPCR_PA11 -- cgit v1.2.3 From 1b3cb73f7306f97a68fa973dec9f3c3b68bd29cf Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 15 Sep 2005 15:17:59 +0100 Subject: [ARM] Tighten pfn_valid() test. Thomas Gleixner reported that mmaping and unmapping each physical page in turn eventually caused the kernel to oops. It appears that pfn_valid() in the discontigmem case was too simplistic for proper operation. Tighten the logic so we also check if the PFN is within the range of the selected memory node. Signed-off-by: Russell King --- include/asm-arm/memory.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h index e47bea7d1723..a8a933a775db 100644 --- a/include/asm-arm/memory.h +++ b/include/asm-arm/memory.h @@ -160,12 +160,25 @@ static inline __deprecated void *bus_to_virt(unsigned long x) #define page_to_pfn(page) \ (( (page) - page_zone(page)->zone_mem_map) \ + page_zone(page)->zone_start_pfn) + #define pfn_to_page(pfn) \ (PFN_TO_MAPBASE(pfn) + LOCAL_MAP_NR((pfn) << PAGE_SHIFT)) -#define pfn_valid(pfn) (PFN_TO_NID(pfn) < MAX_NUMNODES) + +#define pfn_valid(pfn) \ + ({ \ + unsigned int nid = PFN_TO_NID(pfn); \ + int valid = nid < MAX_NUMNODES; \ + if (valid) { \ + pg_data_t *node = NODE_DATA(nid); \ + valid = (pfn - node->node_start_pfn) < \ + node->node_spanned_pages; \ + } \ + valid; \ + }) #define virt_to_page(kaddr) \ (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr)) + #define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES) /* -- cgit v1.2.3