2 * linux/arch/arm/mach-pxa/generic.c
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
8 * Code common to all PXA machines.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * Since this file should be linked before any other machine specific file,
15 * the __initcall() here will be executed first. This serves as default
16 * initialization stuff for PXA machines which can be overridden later if
19 #include <linux/module.h>
20 #include <linux/kernel.h>
21 #include <linux/init.h>
22 #include <linux/delay.h>
23 #include <linux/device.h>
24 #include <linux/ioport.h>
27 #include <asm/hardware.h>
29 #include <asm/system.h>
30 #include <asm/pgtable.h>
31 #include <asm/mach/map.h>
33 #include <asm/arch/udc.h>
34 #include <asm/arch/pxafb.h>
39 * Handy function to set GPIO alternate functions
42 void pxa_gpio_mode(int gpio_mode)
45 int gpio = gpio_mode & GPIO_MD_MASK_NR;
46 int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
49 local_irq_save(flags);
50 if (gpio_mode & GPIO_MD_MASK_DIR)
51 GPDR(gpio) |= GPIO_bit(gpio);
53 GPDR(gpio) &= ~GPIO_bit(gpio);
54 gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
55 GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2));
56 local_irq_restore(flags);
59 EXPORT_SYMBOL(pxa_gpio_mode);
62 * Intel PXA2xx internal register mapping.
64 * Note 1: not all PXA2xx variants implement all those addresses.
66 * Note 2: virtual 0xfffe0000-0xffffffff is reserved for the vector table
67 * and cache flush area.
69 static struct map_desc standard_io_desc[] __initdata = {
70 /* virtual physical length type */
71 { 0xf2000000, 0x40000000, 0x01800000, MT_DEVICE }, /* Devs */
72 { 0xf4000000, 0x44000000, 0x00100000, MT_DEVICE }, /* LCD */
73 { 0xf6000000, 0x48000000, 0x00100000, MT_DEVICE }, /* Mem Ctl */
74 { 0xf8000000, 0x4c000000, 0x00100000, MT_DEVICE }, /* USB host */
75 { 0xfa000000, 0x50000000, 0x00100000, MT_DEVICE }, /* Camera */
76 { 0xfe000000, 0x58000000, 0x00100000, MT_DEVICE }, /* IMem ctl */
77 { 0xff000000, 0x00000000, 0x00100000, MT_DEVICE } /* UNCACHED_PHYS_0 */
80 void __init pxa_map_io(void)
82 iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc));
83 get_clk_frequency_khz(1);
87 static struct resource pxamci_resources[] = {
91 .flags = IORESOURCE_MEM,
96 .flags = IORESOURCE_IRQ,
100 static u64 pxamci_dmamask = 0xffffffffUL;
102 static struct platform_device pxamci_device = {
106 .dma_mask = &pxamci_dmamask,
107 .coherent_dma_mask = 0xffffffff,
109 .num_resources = ARRAY_SIZE(pxamci_resources),
110 .resource = pxamci_resources,
114 static struct pxa2xx_udc_mach_info pxa_udc_info;
116 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info)
118 memcpy(&pxa_udc_info, info, sizeof *info);
120 EXPORT_SYMBOL(pxa_set_udc_info);
122 static struct resource pxa2xx_udc_resources[] = {
126 .flags = IORESOURCE_MEM,
131 .flags = IORESOURCE_IRQ,
135 static u64 udc_dma_mask = ~(u32)0;
137 static struct platform_device udc_device = {
138 .name = "pxa2xx_udc",
140 .resource = pxa2xx_udc_resources,
141 .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
143 .platform_data = &pxa_udc_info,
144 .dma_mask = &udc_dma_mask,
148 static struct pxafb_mach_info pxa_fb_info;
150 void __init set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info)
152 memcpy(&pxa_fb_info,hard_pxa_fb_info,sizeof(struct pxafb_mach_info));
154 EXPORT_SYMBOL(set_pxa_fb_info);
156 static struct resource pxafb_resources[] = {
160 .flags = IORESOURCE_MEM,
165 .flags = IORESOURCE_IRQ,
169 static u64 fb_dma_mask = ~(u64)0;
171 static struct platform_device pxafb_device = {
175 .platform_data = &pxa_fb_info,
176 .dma_mask = &fb_dma_mask,
177 .coherent_dma_mask = 0xffffffff,
179 .num_resources = ARRAY_SIZE(pxafb_resources),
180 .resource = pxafb_resources,
183 static struct platform_device *devices[] __initdata = {
189 static int __init pxa_init(void)
191 return platform_add_devices(devices, ARRAY_SIZE(devices));
194 subsys_initcall(pxa_init);