1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
|
/* -*- linux-c -*-
*
* linux/arch/arm/mach-s3c2443/mach-cc9m2443js.c
*
* Copyright (c) 2007 Simtec Electronics
* Copyright (c) 2008 Digi International Spain
* Ben Dooks <ben@simtec.co.uk>
* Miriam Ruiz <Miriam.Ruiz@digi.com>
* Luis Galdos <luis.galdos@digi.com>
*
* http://www.fluff.org/ben/smdk2443/
* http://www.digi.com/products/embeddedsolutions/connectcore9m.jsp
*
* Thanks to Samsung for the loan of an SMDK2443
*
* 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.
*
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/dma-mapping.h>
#include <linux/smc911x.h>
#include <linux/crc32.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <mach/hardware.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <asm/delay.h>
#include <plat/regs-serial.h>
#include <mach/regs-gpio.h>
#include <mach/regs-gpioj.h>
#include <mach/regs-lcd.h>
#include <mach/regs-s3c2443-clock.h>
#include <mach/idle.h>
#include <mach/fb.h>
#include <asm/plat-s3c24xx/spi.h>
#include <mach/gpio.h>
#include <linux/spi/spi.h>
#include <plat/s3c2410.h>
#include <plat/s3c2440.h>
#include <plat/clock.h>
#include <plat/devs.h>
#include <plat/cpu.h>
#include <plat/hsmmc.h>
#include <plat/ts.h>
#include <plat/udc.h>
#include <plat/pcmcia.h>
#include <mach/irqs.h>
#include <mach/regs-irq.h>
#include <plat/irq.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/mtd/partitions.h>
#include <plat/common-smdk.h>
#include <asm/plat-s3c24xx/mci.h>
#include <asm/plat-s3c/nand.h>
#include <asm/plat-s3c/iic.h>
#include "displays/displays.h"
#include "cc9m2443js-pm.h"
#include "pipermain.h"
#include "piper-ccw9m2443.h"
/*
* IMPORTANT: We are using the Ethernet-driver of the Blackfin-project because:
* - The driver from the Vanilla-kernel is not working out of the box
* - After some modifications (for accessing to the FIFO correctly) the driver
* has some performance-problems (lost some packets)
* - The driver doesn't use the new NAPI for reading from the controller
* (Luis Galdos)
*/
static struct resource smsc911x_device_resources[] = {
[0] = {
.name = "smsc911x-memory",
.start = S3C2410_CS5,
.end = S3C2410_CS5 + SZ_1M - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_EINT9,
.end = IRQ_EINT9,
.flags = IORESOURCE_IRQ,
},
};
static struct smc911x_platdata cc9m2443_smsc9118 = {
.flags = SMC911X_USE_16BIT,
.irq_flags = IRQF_DISABLED | IRQF_TRIGGER_FALLING,
.irq_polarity = 0,
};
static struct platform_device smsc911x_device = {
.name = "smsc911x",
.id = -1,
.num_resources = ARRAY_SIZE(smsc911x_device_resources),
.resource = smsc911x_device_resources,
.dev = {
.platform_data = &cc9m2443_smsc9118,
}
};
/* @XXX: The macro will be used for external board-devices under cc9m2443-custom.h */
#if !defined(CC9M2443_I2C_BASE_BOARD_DEVICES)
#define CC9M2443_I2C_BASE_BOARD_DEVICES
/*#define CC9M2443_I2C_BASE_BOARD_DEVICES \
{ \
.driver_name = "rtc-ds1307", \
.addr = 0x68, \
.type = "ds1337", \
} \
#endif */
#endif
/*
* This is the external IRQ for the RTC. Since the GPIO for the RTC-IRQ is not
* available on the connect of the module, the GPIO can be used only with the RTC.
*/
#define CC9M2443_RTC_IRQ (IRQ_EINT7)
#define CC9M2443_RTC_IRQ_GPIO (S3C2410_GPF7)
#define CC9M2443_RTC_IRQ_CFG (S3C2410_GPF7_EINT7)
/* I2C devices */
#if defined(CONFIG_GPIO_PCA953X) || defined(CONFIG_GPIO_PCA953X_MODULE)
#include <linux/i2c/pca953x.h>
static struct pca953x_platform_data pca9554_data = {
.gpio_base = 147,
};
#endif
static struct i2c_board_info cc9m2443_i2c_devices[] = {
{
I2C_BOARD_INFO("ds1337", 0x68),
.irq = CC9M2443_RTC_IRQ
},
#if defined(CONFIG_GPIO_PCA953X) || defined(CONFIG_GPIO_PCA953X_MODULE)
{
I2C_BOARD_INFO("pca9554", 0x20),
.platform_data = &pca9554_data,
},
#endif
CC9M2443_I2C_BASE_BOARD_DEVICES
};
static struct map_desc cc9m2443_iodesc[] __initdata = {
/* ISA IO Space map (memory space selected by A24) */
{
.virtual = (u32)S3C24XX_VA_ISA_WORD,
.pfn = __phys_to_pfn(S3C2410_CS2),
.length = 0x10000,
.type = MT_DEVICE,
}, {
.virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
.pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
.length = SZ_4M,
.type = MT_DEVICE,
}, {
.virtual = (u32)S3C24XX_VA_ISA_BYTE,
.pfn = __phys_to_pfn(S3C2410_CS2),
.length = 0x10000,
.type = MT_DEVICE,
}, {
.virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
.pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
.length = SZ_4M,
.type = MT_DEVICE,
}, {
.virtual = (u32)CC9M2443_VA_LAN,
.pfn = __phys_to_pfn(CC9M2443_PA_LAN),
.length = CC9M2443_SZ_LAN,
.type = MT_DEVICE,
}
};
/* Macros for the default port configuration on the CC9M2443 */
#define CC9M2443_PORT_UCON (S3C2412_UCON_PCLK | \
S3C2410_UCON_RXIRQMODE | \
S3C2410_UCON_TXIRQMODE | \
S3C2410_UCON_RXFIFO_TOI | \
S3C2443_UCON_RXERR_IRQEN | \
S3C2410_UCON_TXILEVEL | \
S3C2410_UCON_RXILEVEL)
#define CC9M2443_PORT_UFCON (S3C2410_UFCON_FIFOMODE | \
S3C2440_UFCON_RXTRIG8 | \
S3C2440_UFCON_TXTRIG16)
#define CC9M2443_PORT_LCON (S3C2410_LCON_CS8)
static struct s3c2410_uartcfg cc9m2443_uartcfgs[] __initdata = {
#ifdef CONFIG_SERIAL_S3C2410_ENABLE_PORTA
{
.hwport = 0,
.flags = 0,
.ucon = CC9M2443_PORT_UCON,
.ulcon = S3C2410_LCON_CS8,
.ufcon = CC9M2443_PORT_UFCON,
.rx_gpio = S3C2410_GPH1,
.rx_cfg = S3C2443_GPH1_RXD0,
.tx_gpio = S3C2410_GPH0,
.tx_cfg = S3C2443_GPH0_TXD0,
#if defined(CONFIG_SERIAL_S3C2410_PORTA_HWCTRL)
.rts_gpio = S3C2410_GPH9,
.rts_cfg = S3C2443_GPH9_nRTS0,
.cts_gpio = S3C2410_GPH8,
.cts_cfg = S3C2443_GPH8_nCTS0,
#endif /* CONFIG_SERIAL_S3C2410_PORTA_HWCTRL */
},
#endif /* CONFIG_SERIAL_S3C2410_ENABLE_PORTA */
#ifdef CONFIG_SERIAL_S3C2410_ENABLE_PORTB
{
.hwport = 1,
.flags = 0,
.ucon = CC9M2443_PORT_UCON,
.ulcon = CC9M2443_PORT_LCON,
.ufcon = CC9M2443_PORT_UFCON,
.rx_gpio = S3C2410_GPH3,
.rx_cfg = S3C2443_GPH3_RXD1,
.tx_gpio = S3C2410_GPH2,
.tx_cfg = S3C2443_GPH2_TXD1,
#if defined(CONFIG_SERIAL_S3C2410_PORTB_HWCTRL)
.rts_gpio = S3C2443_GPH11,
.rts_cfg = S3C2443_GPH11_nRTS1,
.cts_gpio = S3C2410_GPH10,
.cts_cfg = S3C2443_GPH10_nCTS1,
#endif /* CONFIG_SERIAL_S3C2410_PORTB_HWCTRL */
},
#endif /* CONFIG_SERIAL_S3C2410_ENABLE_PORTB */
#ifdef CONFIG_SERIAL_S3C2410_ENABLE_PORTC
{
.hwport = 2,
.flags = 0,
.ucon = CC9M2443_PORT_UCON,
.ulcon = CC9M2443_PORT_LCON,
.ufcon = CC9M2443_PORT_UFCON,
.rx_gpio = S3C2410_GPH5 ,
.rx_cfg = S3C2443_GPH5_RXD2,
.tx_gpio = S3C2410_GPH4 ,
.tx_cfg = S3C2443_GPH4_TXD2,
#if defined(CONFIG_SERIAL_S3C2410_PORTC_HWCTRL)
.rts_gpio = S3C2410_GPH6,
.rts_cfg = S3C2443_GPH6_nRTS2,
.cts_gpio = S3C2410_GPH7,
.cts_cfg = S3C2443_GPH7_nCTS2,
#endif /* CONFIG_SERIAL_S3C2410_PORTC_HWCTRL */
},
#endif /* CONFIG_SERIAL_S3C2410_ENABLE_PORTC */
#ifdef CONFIG_SERIAL_S3C2410_ENABLE_PORTD
{
.hwport = 3,
.flags = 0,
.ucon = CC9M2443_PORT_UCON,
.ulcon = CC9M2443_PORT_LCON,
.ufcon = CC9M2443_PORT_UFCON,
.rx_gpio = S3C2410_GPH7,
.rx_cfg = S3C2443_GPH7_RXD3,
.tx_gpio = S3C2410_GPH6,
.tx_cfg = S3C2443_GPH6_TXD3,
}
#endif /* CONFIG_SERIAL_S3C2410_ENABLE_PORTD */
};
/* This is required for the LCD-display */
static struct s3c2443fb_mach_info cc9m2443fb_mach = {
.displays = display_list,
.num_displays = ARRAY_SIZE(display_list),
/* Set the GPIO-configuration */
.gpccon = 0xaaa002a8,
.gpccon_mask = 0xfff003fc,
.gpcup = 0xfff003fc,
.gpcup_mask = 0xfff003fc,
.gpdcon = 0xaaa0aaa0,
.gpdcon_mask = 0xfff0fff0,
.gpdup = 0xfff0fff0,
.gpdup_mask = 0xfff0fff0,
};
/* This is for the LCD platform device */
static struct resource s3c2443_tft_resource[] = {
[0] = {
.start = S3C24XX_PA_TFTLCD,
.end = S3C24XX_PA_TFTLCD + S3C24XX_SZ_LCD - 1,
.flags = IORESOURCE_MEM,
},
/* No irq for s3c2443 tft driver */
};
static u64 s3c2443_lcd_dmamask = 0xffffffffUL;
struct platform_device s3c_device_tft_lcd = {
.name = "s3c2443fb-tft",
.id = -1,
.num_resources = ARRAY_SIZE(s3c2443_tft_resource),
.resource = s3c2443_tft_resource,
.dev = {
.dma_mask = &s3c2443_lcd_dmamask,
.coherent_dma_mask = 0xffffffffUL,
.platform_data = &cc9m2443fb_mach,
}
};
/*
* SDIO device for the CC9M2443JS
* The correct driver name is "s3c2440-sdi" and NOT "s3c2410-sdi"
*/
static struct resource cc9m2443_sdi_resource[] = {
[0] = {
.start = S3C2410_PA_SDI,
.end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_SDI,
.end = IRQ_SDI,
.flags = IORESOURCE_IRQ,
}
};
static struct s3c24xx_mci_pdata cc9m2443_sdi_pdata = {
.gpio_detect = S3C2410_GPF1,
.gpio_wprotect = S3C2410_GPG9,
.dma_enable = 1,
};
struct platform_device cc9m2443_device_sdi = {
.name = "s3c2440-sdi",
.id = -1,
.num_resources = ARRAY_SIZE(cc9m2443_sdi_resource),
.resource = cc9m2443_sdi_resource,
.dev = {
.platform_data = &cc9m2443_sdi_pdata,
}
};
/* High-speed MMC/SD */
static struct resource cc9m2443_hsmmc_resource[] = {
[0] = {
.start = S3C2443_PA_HSMMC,
.end = S3C2443_PA_HSMMC + S3C2443_SZ_HSMMC - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_S3C2443_HSMMC,
.end = IRQ_S3C2443_HSMMC,
.flags = IORESOURCE_IRQ,
}
};
static u64 cc9m2443_device_hsmmc_dmamask = 0xffffffffUL;
#define HOST_CAPS (MMC_CAP_4_BIT_DATA | \
MMC_CAP_8_BIT_DATA | \
MMC_CAP_MMC_HIGHSPEED | \
MMC_CAP_SD_HIGHSPEED)
struct s3c_hsmmc_cfg cc9m2443_hsmmc_platform = {
.hwport = 0,
.host_caps = HOST_CAPS,
.ctrl3[0] = 0x00800080,
.ctrl3[1] = 0x00800080,
.clk_name[0] = "hclk", /* 1st clock HCLK */
.clk_name[1] = "hsmmc-div", /* 2nd clock hsmmc-epll */
.clk_name[2] = "hsmmc-ext", /* 3rd clock external */
.gpio_wprotect = S3C2443_GPJ15,
.gpio_detect = S3C2443_GPJ14,
.gpio_led = S3C2443_GPJ13,
};
struct platform_device cc9m2443_device_hsmmc = {
.name = "s3c-hsmmc",
.id = 0,
.num_resources = ARRAY_SIZE(cc9m2443_hsmmc_resource),
.resource = cc9m2443_hsmmc_resource,
.dev = {
.dma_mask = &cc9m2443_device_hsmmc_dmamask,
.coherent_dma_mask = 0xffffffffUL,
.platform_data = &cc9m2443_hsmmc_platform,
}
};
/* Touch device */
static struct resource cc9m2443_ts_resource[] = {
[0] = {
.start = S3C2410_PA_ADC,
.end = S3C2410_PA_ADC + S3C24XX_SZ_ADC - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_ADC,
.flags = IORESOURCE_IRQ,
},
[2] = {
.start = IRQ_TC,
.flags = IORESOURCE_IRQ,
}
};
/* @XXX: Set the correct values */
static struct s3c_ts_mach_info cc9m2443_ts_info = {
.delay = 1,
.presc = 255,
.oversampling_shift = 1,
.xmin = 0x3ff,
.ymin = 0x3ff,
.trigger_ms = 1,
.probes = 9,
};
struct platform_device cc9m2443_device_ts = {
.name = "s3c24xx-ts",
.id = -1,
.num_resources = ARRAY_SIZE(cc9m2443_ts_resource),
.resource = cc9m2443_ts_resource,
.dev = {
.platform_data = &cc9m2443_ts_info,
}
};
/* This is the High Speed SPI-master of the S3C2443 */
static struct s3c2443_spi_info cc9m2443_hsspi_info = {
.bus_num = 0,
.num_chipselect = 1,
.input_clk = S3C2443_HSSPI_INCLK_PCLK,
.miso = {
.nr = S3C2410_GPE11,
.cfg = S3C2410_GPE11_SPIMISO0,
},
.mosi = {
.nr = S3C2410_GPE12,
.cfg = S3C2410_GPE12_SPIMOSI0,
},
.clk = {
.nr = S3C2410_GPE13,
.cfg = S3C2410_GPE13_SPICLK0,
},
.cs[0] = {
.nr = S3C2443_GPL13,
.cfg = S3C2443_GPL13_nSS0,
}
};
static struct resource cc9m2443_hsspi_resources[] = {
{
.start = S3C2443_PA_HSSPI,
.end = S3C2443_PA_HSSPI + S3C2443_SZ_HSSPI - 1,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_SPI0,
.flags = IORESOURCE_IRQ,
}
};
static struct platform_device cc9m2443_device_hsspi = {
.name = "spi-s3c2443",
.id = 0,
.resource = cc9m2443_hsspi_resources,
.num_resources = ARRAY_SIZE(cc9m2443_hsspi_resources),
.dev = {
.platform_data = &cc9m2443_hsspi_info,
.coherent_dma_mask = DMA_BIT_MASK(32),
}
};
/* This is the USB-device of the S3C2443 */
static struct resource cc9m2443_udc_resources[] = {
[0] = {
.start = S3C2443_PA_USBDEV,
.end = S3C2443_PA_USBDEV+ S3C2443_SZ_USBDEV - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_USBD,
.end = IRQ_USBD,
.flags = IORESOURCE_IRQ,
}
};
static struct s3c2410_udc_mach_info cc9m2443_udc_pdata = {
.vbus_pin = S3C2410_GPF5,
.vbus_pin_inverted = 0,
.udc_command = NULL,
};
static struct platform_device cc9m2443_device_udc = {
.name = "s3c2443_udc",
.id = -1,
.num_resources = ARRAY_SIZE(cc9m2443_udc_resources),
.resource = cc9m2443_udc_resources,
.dev = {
.platform_data = &cc9m2443_udc_pdata,
}
};
static struct resource s3c2443_ide_resource[] = {
[0] = {
.start = S3C2443_PA_CFATA,
.end = S3C2443_PA_CFATA + S3C2443_SZ_CFATA,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_S3C2443_CFCON,
.end = IRQ_S3C2443_CFCON,
.flags = IORESOURCE_IRQ,
}
};
struct platform_device s3c443_device_ide = {
.name = "s3c2443-ide",
.id = 0,
.num_resources = ARRAY_SIZE(s3c2443_ide_resource),
.resource = s3c2443_ide_resource,
};
static struct resource s3c2443_pcmcia_resource[] = {
[0] = {
.start = S3C2443_PA_CFATA,
.end = S3C2443_PA_CFATA + S3C2443_SZ_CFATA,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_S3C2443_CFCON,
.end = IRQ_S3C2443_CFCON,
.flags = IORESOURCE_IRQ,
}
};
static struct s3c2443_pcmcia_pdata cc9m2443js_pcmcia_pdata = {
.gpio_detect = S3C2410_GPG10,
};
struct platform_device s3c443_device_pcmcia = {
.name = "s3c2443-pcmcia",
.id = 0,
.num_resources = ARRAY_SIZE(s3c2443_pcmcia_resource),
.resource = s3c2443_pcmcia_resource,
.dev = {
.platform_data = &cc9m2443js_pcmcia_pdata,
}
};
static struct resource s3c2443_adc_resources[] = {
[0] = {
.name = "s3c2443-adc",
.start = S3C2410_PA_ADC,
.end = S3C2410_PA_ADC + S3C24XX_SZ_ADC - 1,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device s3c2443_device_adc = {
.name = "s3c2443-adc",
.id = -1,
.resource = s3c2443_adc_resources,
.num_resources = ARRAY_SIZE(s3c2443_adc_resources),
.dev = {
.platform_data = &cc9m2443_ts_info, /* shared between touch and adc*/
}
};
/* Platform devices for the CC9M2443 */
static struct platform_device *cc9m2443_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_tft_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_nand,
&smsc911x_device,
&cc9m2443_device_sdi,
&cc9m2443_device_hsmmc,
&cc9m2443_device_ts,
&cc9m2443_device_hsspi,
&cc9m2443_device_udc,
&s3c443_device_ide,
&s3c443_device_pcmcia,
&s3c2443_device_adc,
};
static void __init cc9m2443_map_io(void)
{
struct s3c2410_uartcfg *cfg;
int cnt;
s3c24xx_init_io(cc9m2443_iodesc, ARRAY_SIZE(cc9m2443_iodesc));
s3c24xx_init_clocks(12000000);
/*
* Init the GPIOs for the UART-ports
* @XXX: We can probably move this part to the UART-driver, but for this
* moment let's initialize the GPIOs at this place
* Luis Galdos
*/
for (cnt = 0; cnt < ARRAY_SIZE(cc9m2443_uartcfgs); cnt++) {
cfg = &cc9m2443_uartcfgs[cnt];
s3c2410_gpio_cfgpin(cfg->rx_gpio, cfg->rx_cfg);
s3c2410_gpio_cfgpin(cfg->tx_gpio, cfg->tx_cfg);
if (cfg->cts_gpio && cfg->rts_gpio) {
s3c2410_gpio_cfgpin(cfg->cts_gpio, cfg->cts_cfg);
s3c2410_gpio_cfgpin(cfg->rts_gpio, cfg->rts_cfg);
}
}
s3c24xx_init_uarts(cc9m2443_uartcfgs, ARRAY_SIZE(cc9m2443_uartcfgs));
}
/*
* These are the NAND-timing parameters
* @TODO: Set the correct timing parameters for the NAND-device
*/
static struct s3c2410_platform_nand cc9m2443_nand_info = {
.tacls = 20,
.twrph0 = 50,
.twrph1 = 20,
.nr_sets = 1,
.sets = NULL,
};
/*
* Platform data for the I2C-bus driver
* @XXX: Verify the correct bus clocks for this device
*/
#if !defined(CONFIG_I2C_S3C2410_ADAPTER_NR)
#define CONFIG_I2C_S3C2410_ADAPTER_NR -1
#endif
static struct s3c2410_platform_i2c cc9m2443_i2c_info = {
.flags = 0,
.bus_freq = 400 * 1000,
.max_freq = 500 * 1000,
.bus_num = CONFIG_I2C_S3C2410_ADAPTER_NR,
};
/* SPI devices */
static struct spi_board_info spi_devices[] __initdata = {
#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
{
.modalias = "spidev",
.max_speed_hz = 500000,
.bus_num = 0,
.chip_select = 0,
},
#endif
};
#if defined(CONFIG_DIGI_PIPER_WIFI)
#if !defined(CONFIG_PIPER_STATUS_LED_GPIO)
#define CONFIG_PIPER_STATUS_LED_GPIO -1
#endif
static struct piper_pdata ccw9m2443_piper_pdata = {
.rst_gpio = 19,
.irq_gpio = 90,
.status_led_gpio = CONFIG_PIPER_STATUS_LED_GPIO,
.i2c_adapter_num = CONFIG_I2C_S3C2410_ADAPTER_NR,
};
static void __init ccw9m2443js_fixup(struct machine_desc *desc,
struct tag *tags, char **cmdline,
struct meminfo *mi)
{
unsigned char *mac = phys_to_virt(desc->boot_params) + 0xf00;
wcd_data_t *pwcal;
u32 crc;
/* 8 bytes after the mac address, its located the calibration data */
pwcal = (wcd_data_t *)(mac + 8);
memcpy(&ccw9m2443_piper_pdata.macaddr[0], mac, 6);
if (!strncmp(pwcal->header.magic_string, WCD_MAGIC,
sizeof(pwcal->header.magic_string))) {
/* check version */
if (((pwcal->header.ver_major >= '1') && (pwcal->header.ver_major <= '9')) &&
((pwcal->header.ver_minor >= '0') && (pwcal->header.ver_minor <= '9'))) {
crc = ~crc32_le(~0, (unsigned char const *)pwcal->cal_curves_bg,
pwcal->header.wcd_len);
if (crc == pwcal->header.wcd_crc) {
memcpy(&ccw9m2443_piper_pdata.wcd, pwcal, sizeof(wcd_data_t));
return;
}
}
}
memset(&ccw9m2443_piper_pdata.wcd, 0, sizeof(wcd_data_t));
}
#endif
static void __init cc9m2443_machine_init(void)
{
printk("Starting Linux on ARM ConnectCore 9M 2443\n");
s3c_device_nand.dev.platform_data = &cc9m2443_nand_info;
s3c_device_i2c.dev.platform_data = &cc9m2443_i2c_info;
/* Enable the pullup for the write protect GPIO of the SD-port */
s3c2410_gpio_pullup(S3C2410_GPG9, 0x0);
/* For the bus detection we MUST activate the pull-down */
s3c2443_gpio_extpull(S3C2410_GPF5, 1);
/* Though this call the probes of the different drivers will be called */
platform_add_devices(cc9m2443_devices, ARRAY_SIZE(cc9m2443_devices));
/*
* Configure the IO for the external IRQ of the RTC
* @XXX: This is probably not the best place for configuring the trigget-type,
* but the RTC-driver doesn't touch this configuration (hope)
* (Luis Galdos)
*/
s3c2443_gpio_cfgpin(CC9M2443_RTC_IRQ_GPIO, CC9M2443_RTC_IRQ_CFG);
set_irq_type(CC9M2443_RTC_IRQ, IRQF_TRIGGER_FALLING);
/* The first argument is the bus or adapter number to attach the devices */
i2c_register_board_info(CONFIG_I2C_S3C2410_ADAPTER_NR,
cc9m2443_i2c_devices,
ARRAY_SIZE(cc9m2443_i2c_devices));
/* SPI devices */
spi_register_board_info(spi_devices, ARRAY_SIZE(spi_devices));
#if defined(CONFIG_DIGI_PIPER_WIFI)
/* 802.11 */
add_device_ccw9m2443_piper(&ccw9m2443_piper_pdata);
#endif
/* Call the function for enabling the PM support */
#if defined(CONFIG_MACH_CC9M2443JS_PM)
cc9m2443js_pm_init();
#endif
}
MACHINE_START(CCW9M2443JS, "ConnectCore Wi-9M 2443 on a JSCC9M2443 Devboard")
.phys_io = S3C2410_PA_UART,
.io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
.boot_params = S3C2410_SDRAM_PA + 0x100,
#if defined(CONFIG_DIGI_PIPER_WIFI)
.fixup = ccw9m2443js_fixup,
#endif
.init_irq = s3c24xx_init_irq,
.map_io = cc9m2443_map_io,
.init_machine = cc9m2443_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END
|