| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-w90x900/w90p910.c |
| 3 | * |
| 4 | * Based on linux/arch/arm/plat-s3c24xx/s3c244x.c by Ben Dooks |
| 5 | * |
| wanzongshun | 604f766 | 2009-05-01 16:14:54 +0100 | [diff] [blame] | 6 | * Copyright (c) 2008 Nuvoton technology corporation. |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 7 | * |
| 8 | * Wan ZongShun <mcuos.com@gmail.com> |
| 9 | * |
| 10 | * W90P910 cpu support |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| wanzongshun | 604f766 | 2009-05-01 16:14:54 +0100 | [diff] [blame] | 14 | * the Free Software Foundation;version 2 of the License. |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 15 | * |
| 16 | */ |
| 17 | |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/types.h> |
| 20 | #include <linux/interrupt.h> |
| 21 | #include <linux/list.h> |
| 22 | #include <linux/timer.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/io.h> |
| wanzongshun | 17198f2 | 2009-02-04 05:01:38 +0100 | [diff] [blame] | 26 | #include <linux/serial_8250.h> |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 27 | |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/map.h> |
| 30 | #include <asm/mach/irq.h> |
| 31 | #include <asm/irq.h> |
| 32 | |
| 33 | #include <mach/hardware.h> |
| 34 | #include <mach/regs-serial.h> |
| 35 | |
| 36 | #include "cpu.h" |
| wanzongshun | 0e4a34b | 2009-06-10 15:50:44 +0100 | [diff] [blame] | 37 | #include "clock.h" |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 38 | |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 39 | /* Initial IO mappings */ |
| 40 | |
| 41 | static struct map_desc w90p910_iodesc[] __initdata = { |
| 42 | IODESC_ENT(IRQ), |
| 43 | IODESC_ENT(GCR), |
| 44 | IODESC_ENT(UART), |
| 45 | IODESC_ENT(TIMER), |
| 46 | IODESC_ENT(EBI), |
| wanzongshun | 604f766 | 2009-05-01 16:14:54 +0100 | [diff] [blame] | 47 | IODESC_ENT(USBEHCIHOST), |
| 48 | IODESC_ENT(USBOHCIHOST), |
| 49 | IODESC_ENT(ADC), |
| wanzongshun | 0351c50 | 2009-05-09 02:39:41 +0100 | [diff] [blame] | 50 | IODESC_ENT(RTC), |
| 51 | IODESC_ENT(KPI), |
| 52 | IODESC_ENT(USBDEV), |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 53 | /*IODESC_ENT(LCD),*/ |
| 54 | }; |
| 55 | |
| wanzongshun | 0e4a34b | 2009-06-10 15:50:44 +0100 | [diff] [blame] | 56 | /* Initial clock declarations. */ |
| 57 | static DEFINE_CLK(lcd, 0); |
| 58 | static DEFINE_CLK(audio, 1); |
| 59 | static DEFINE_CLK(fmi, 4); |
| 60 | static DEFINE_CLK(dmac, 5); |
| 61 | static DEFINE_CLK(atapi, 6); |
| 62 | static DEFINE_CLK(emc, 7); |
| 63 | static DEFINE_CLK(usbd, 8); |
| 64 | static DEFINE_CLK(usbh, 9); |
| 65 | static DEFINE_CLK(g2d, 10);; |
| 66 | static DEFINE_CLK(pwm, 18); |
| 67 | static DEFINE_CLK(ps2, 24); |
| 68 | static DEFINE_CLK(kpi, 25); |
| 69 | static DEFINE_CLK(wdt, 26); |
| 70 | static DEFINE_CLK(gdma, 27); |
| 71 | static DEFINE_CLK(adc, 28); |
| 72 | static DEFINE_CLK(usi, 29); |
| 73 | |
| 74 | static struct clk_lookup w90p910_clkregs[] = { |
| 75 | DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL), |
| 76 | DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL), |
| 77 | DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL), |
| 78 | DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL), |
| 79 | DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL), |
| 80 | DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL), |
| 81 | DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL), |
| 82 | DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL), |
| 83 | DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL), |
| 84 | DEF_CLKLOOK(&clk_pwm, "w90p910-pwm", NULL), |
| 85 | DEF_CLKLOOK(&clk_ps2, "w90p910-ps2", NULL), |
| 86 | DEF_CLKLOOK(&clk_kpi, "w90p910-kpi", NULL), |
| 87 | DEF_CLKLOOK(&clk_wdt, "w90p910-wdt", NULL), |
| 88 | DEF_CLKLOOK(&clk_gdma, "w90p910-gdma", NULL), |
| 89 | DEF_CLKLOOK(&clk_adc, "w90p910-adc", NULL), |
| 90 | DEF_CLKLOOK(&clk_usi, "w90p910-usi", NULL), |
| 91 | }; |
| 92 | |
| wanzongshun | 17198f2 | 2009-02-04 05:01:38 +0100 | [diff] [blame] | 93 | /* Initial serial platform data */ |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 94 | |
| wanzongshun | 17198f2 | 2009-02-04 05:01:38 +0100 | [diff] [blame] | 95 | struct plat_serial8250_port w90p910_uart_data[] = { |
| 96 | W90X900_8250PORT(UART0), |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 97 | }; |
| 98 | |
| wanzongshun | 17198f2 | 2009-02-04 05:01:38 +0100 | [diff] [blame] | 99 | struct platform_device w90p910_serial_device = { |
| 100 | .name = "serial8250", |
| 101 | .id = PLAT8250_DEV_PLATFORM, |
| 102 | .dev = { |
| 103 | .platform_data = w90p910_uart_data, |
| 104 | }, |
| 105 | }; |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 106 | |
| 107 | /*Init W90P910 evb io*/ |
| 108 | |
| 109 | void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size) |
| 110 | { |
| 111 | unsigned long idcode = 0x0; |
| 112 | |
| 113 | iotable_init(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc)); |
| 114 | |
| 115 | idcode = __raw_readl(W90X900PDID); |
| 116 | if (idcode != W90P910_CPUID) |
| 117 | printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode); |
| 118 | } |
| 119 | |
| 120 | /*Init W90P910 clock*/ |
| 121 | |
| wanzongshun | 0e4a34b | 2009-06-10 15:50:44 +0100 | [diff] [blame] | 122 | void __init w90p910_init_clocks(void) |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 123 | { |
| wanzongshun | 0e4a34b | 2009-06-10 15:50:44 +0100 | [diff] [blame] | 124 | clks_register(w90p910_clkregs, ARRAY_SIZE(w90p910_clkregs)); |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | static int __init w90p910_init_cpu(void) |
| 128 | { |
| 129 | return 0; |
| 130 | } |
| 131 | |
| 132 | static int __init w90x900_arch_init(void) |
| 133 | { |
| wanzongshun | 17198f2 | 2009-02-04 05:01:38 +0100 | [diff] [blame] | 134 | return w90p910_init_cpu(); |
| wanzongshun | 7ec80dd | 2008-12-03 03:55:38 +0100 | [diff] [blame] | 135 | } |
| 136 | arch_initcall(w90x900_arch_init); |