Blame view

arch/arm/mach-sa1100/cerf.c 3.56 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
  /*
   * linux/arch/arm/mach-sa1100/cerf.c
   *
   * 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.
   *
   * Apr-2003 : Removed some old PDA crud [FB]
   * Oct-2003 : Added uart2 resource [FB]
   * Jan-2004 : Removed io map for flash [FB]
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
12
13
14
  #include <linux/init.h>
  #include <linux/kernel.h>
  #include <linux/tty.h>
d052d1bef   Russell King   Create platform_d...
15
  #include <linux/platform_device.h>
119c641c9   Thomas Gleixner   [ARM] 3698/1: ARM...
16
  #include <linux/irq.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
18
19
20
  #include <linux/mtd/mtd.h>
  #include <linux/mtd/partitions.h>
  
  #include <asm/irq.h>
a09e64fbc   Russell King   [ARM] Move includ...
21
  #include <mach/hardware.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
23
24
25
26
27
28
  #include <asm/setup.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/flash.h>
  #include <asm/mach/map.h>
  #include <asm/mach/serial_sa1100.h>
a09e64fbc   Russell King   [ARM] Move includ...
29
30
  #include <mach/cerf.h>
  #include <mach/mcp.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  #include "generic.h"
  
  static struct resource cerfuart2_resources[] = {
  	[0] = {
  		.start	= 0x80030000,
  		.end	= 0x8003ffff,
  		.flags	= IORESOURCE_MEM,
  	},
  };
  
  static struct platform_device cerfuart2_device = {
  	.name		= "sa11x0-uart",
  	.id		= 2,
  	.num_resources	= ARRAY_SIZE(cerfuart2_resources),
  	.resource	= cerfuart2_resources,
  };
  
  static struct platform_device *cerf_devices[] __initdata = {
  	&cerfuart2_device,
  };
  
  #ifdef CONFIG_SA1100_CERF_FLASH_32MB
  #  define CERF_FLASH_SIZE	0x02000000
  #elif defined CONFIG_SA1100_CERF_FLASH_16MB
  #  define CERF_FLASH_SIZE	0x01000000
  #elif defined CONFIG_SA1100_CERF_FLASH_8MB
  #  define CERF_FLASH_SIZE	0x00800000
  #else
  #  error "Undefined flash size for CERF"
  #endif
  
  static struct mtd_partition cerf_partitions[] = {
  	{
  		.name		= "Bootloader",
  		.size		= 0x00020000,
  		.offset		= 0x00000000,
  	}, {
  		.name		= "Params",
  		.size		= 0x00040000,
  		.offset		= 0x00020000,
  	}, {
  		.name		= "Kernel",
  		.size		= 0x00100000,
  		.offset		= 0x00060000,
  	}, {
  		.name		= "Filesystem",
  		.size		= CERF_FLASH_SIZE-0x00160000,
  		.offset		= 0x00160000,
  	}
  };
  
  static struct flash_platform_data cerf_flash_data = {
  	.map_name	= "cfi_probe",
  	.parts		= cerf_partitions,
  	.nr_parts	= ARRAY_SIZE(cerf_partitions),
  };
  
  static struct resource cerf_flash_resource = {
  	.start		= SA1100_CS0_PHYS,
  	.end		= SA1100_CS0_PHYS + SZ_32M - 1,
  	.flags		= IORESOURCE_MEM,
  };
  
  static void __init cerf_init_irq(void)
  {
  	sa1100_init_irq();
6845664a6   Thomas Gleixner   arm: Cleanup the ...
97
  	irq_set_irq_type(CERF_ETH_IRQ, IRQ_TYPE_EDGE_RISING);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
98
99
100
  }
  
  static struct map_desc cerf_io_desc[] __initdata = {
92519d828   Deepak Saxena   [ARM] 2992/1: Rep...
101
102
103
104
105
106
    	{	/* Crystal Ethernet Chip */
  		.virtual	=  0xf0000000,
  		.pfn		= __phys_to_pfn(0x08000000),
  		.length		= 0x00100000,
  		.type		= MT_DEVICE
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  };
  
  static void __init cerf_map_io(void)
  {
  	sa1100_map_io();
  	iotable_init(cerf_io_desc, ARRAY_SIZE(cerf_io_desc));
  
  	sa1100_register_uart(0, 3);
  	sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
  	sa1100_register_uart(2, 1);
  
  	/* set some GPDR bits here while it's safe */
  	GPDR |= CERF_GPIO_CF_RESET;
  }
323cdfc19   Russell King   [MFD] Add SA11x0 ...
121
122
123
  static struct mcp_plat_data cerf_mcp_data = {
  	.mccr0		= MCCR0_ADM,
  	.sclk_rate	= 11981000,
5dd7bf59e   Jochen Friedrich   ARM: sa11x0: Impl...
124
  	.codec		= "ucb1x00",
323cdfc19   Russell King   [MFD] Add SA11x0 ...
125
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
126
127
128
  static void __init cerf_init(void)
  {
  	platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
7a5b4e16c   Russell King   ARM: sa11x0: conv...
129
  	sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
af9081ae6   Jochen Friedrich   ARM: sa1100: Refa...
130
131
132
133
134
135
136
137
138
  
  	/*
  	 * Setup the PPC unit correctly.
  	 */
  	PPDR &= ~PPC_RXD4;
  	PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM;
  	PSDR |= PPC_RXD4;
  	PSDR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
  	PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
7a5b4e16c   Russell King   ARM: sa11x0: conv...
139
  	sa11x0_register_mcp(&cerf_mcp_data);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
140
141
142
  }
  
  MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
e9dea0c65   Russell King   [PATCH] ARM: Remo...
143
  	/* Maintainer: support@intrinsyc.com */
e9dea0c65   Russell King   [PATCH] ARM: Remo...
144
145
  	.map_io		= cerf_map_io,
  	.init_irq	= cerf_init_irq,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
146
147
  	.timer		= &sa1100_timer,
  	.init_machine	= cerf_init,
d9ca5839f   Russell King   ARM: restart: sa1...
148
  	.restart	= sa11x0_restart,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
149
  MACHINE_END