diff options
Diffstat (limited to 'arch/arm/plat-s3c64xx')
-rw-r--r-- | arch/arm/plat-s3c64xx/Makefile | 6 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/clock.c | 12 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/cpu.c | 5 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/dev-adc.c | 46 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/dev-audio.c | 91 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/dev-rtc.c | 43 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/dev-spi.c | 180 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/include/plat/regs-srom.h | 59 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/include/plat/spi-clocks.h | 18 |
9 files changed, 459 insertions, 1 deletions
diff --git a/arch/arm/plat-s3c64xx/Makefile b/arch/arm/plat-s3c64xx/Makefile index b85b4359e935..80255a5e1789 100644 --- a/arch/arm/plat-s3c64xx/Makefile +++ b/arch/arm/plat-s3c64xx/Makefile | |||
@@ -13,6 +13,7 @@ obj- := | |||
13 | # Core files | 13 | # Core files |
14 | 14 | ||
15 | obj-y += dev-uart.o | 15 | obj-y += dev-uart.o |
16 | obj-y += dev-rtc.o | ||
16 | obj-y += cpu.o | 17 | obj-y += cpu.o |
17 | obj-y += irq.o | 18 | obj-y += irq.o |
18 | obj-y += irq-eint.o | 19 | obj-y += irq-eint.o |
@@ -35,6 +36,10 @@ obj-$(CONFIG_PM) += irq-pm.o | |||
35 | 36 | ||
36 | obj-$(CONFIG_S3C64XX_DMA) += dma.o | 37 | obj-$(CONFIG_S3C64XX_DMA) += dma.o |
37 | 38 | ||
39 | # ADC support | ||
40 | |||
41 | obj-$(CONFIG_S3C_ADC) += dev-adc.o | ||
42 | |||
38 | # Device setup | 43 | # Device setup |
39 | 44 | ||
40 | obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o | 45 | obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0.o |
@@ -42,3 +47,4 @@ obj-$(CONFIG_S3C64XX_SETUP_I2C1) += setup-i2c1.o | |||
42 | obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP) += setup-fb-24bpp.o | 47 | obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP) += setup-fb-24bpp.o |
43 | obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o | 48 | obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o |
44 | obj-$(CONFIG_SND_S3C24XX_SOC) += dev-audio.o | 49 | obj-$(CONFIG_SND_S3C24XX_SOC) += dev-audio.o |
50 | obj-$(CONFIG_SPI_S3C64XX) += dev-spi.o | ||
diff --git a/arch/arm/plat-s3c64xx/clock.c b/arch/arm/plat-s3c64xx/clock.c index ae5883c00e7a..2989c3a2e94d 100644 --- a/arch/arm/plat-s3c64xx/clock.c +++ b/arch/arm/plat-s3c64xx/clock.c | |||
@@ -141,6 +141,18 @@ static struct clk init_clocks_disable[] = { | |||
141 | .enable = s3c64xx_pclk_ctrl, | 141 | .enable = s3c64xx_pclk_ctrl, |
142 | .ctrlbit = S3C_CLKCON_PCLK_SPI1, | 142 | .ctrlbit = S3C_CLKCON_PCLK_SPI1, |
143 | }, { | 143 | }, { |
144 | .name = "spi_48m", | ||
145 | .id = 0, | ||
146 | .parent = &clk_48m, | ||
147 | .enable = s3c64xx_sclk_ctrl, | ||
148 | .ctrlbit = S3C_CLKCON_SCLK_SPI0_48, | ||
149 | }, { | ||
150 | .name = "spi_48m", | ||
151 | .id = 1, | ||
152 | .parent = &clk_48m, | ||
153 | .enable = s3c64xx_sclk_ctrl, | ||
154 | .ctrlbit = S3C_CLKCON_SCLK_SPI1_48, | ||
155 | }, { | ||
144 | .name = "48m", | 156 | .name = "48m", |
145 | .id = 0, | 157 | .id = 0, |
146 | .parent = &clk_48m, | 158 | .parent = &clk_48m, |
diff --git a/arch/arm/plat-s3c64xx/cpu.c b/arch/arm/plat-s3c64xx/cpu.c index c0e6f2a45154..bc7ca1812e32 100644 --- a/arch/arm/plat-s3c64xx/cpu.c +++ b/arch/arm/plat-s3c64xx/cpu.c | |||
@@ -73,6 +73,11 @@ static struct map_desc s3c_iodesc[] __initdata = { | |||
73 | .length = SZ_4K, | 73 | .length = SZ_4K, |
74 | .type = MT_DEVICE, | 74 | .type = MT_DEVICE, |
75 | }, { | 75 | }, { |
76 | .virtual = (unsigned long)S3C_VA_MEM, | ||
77 | .pfn = __phys_to_pfn(S3C64XX_PA_SROM), | ||
78 | .length = SZ_4K, | ||
79 | .type = MT_DEVICE, | ||
80 | }, { | ||
76 | .virtual = (unsigned long)(S3C_VA_UART + UART_OFFS), | 81 | .virtual = (unsigned long)(S3C_VA_UART + UART_OFFS), |
77 | .pfn = __phys_to_pfn(S3C_PA_UART), | 82 | .pfn = __phys_to_pfn(S3C_PA_UART), |
78 | .length = SZ_4K, | 83 | .length = SZ_4K, |
diff --git a/arch/arm/plat-s3c64xx/dev-adc.c b/arch/arm/plat-s3c64xx/dev-adc.c new file mode 100644 index 000000000000..fafef9b6bcfa --- /dev/null +++ b/arch/arm/plat-s3c64xx/dev-adc.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* linux/arch/arm/plat-s3c64xx/dev-adc.c | ||
2 | * | ||
3 | * Copyright 2010 Maurus Cuelenaere | ||
4 | * | ||
5 | * S3C64xx series device definition for ADC device | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | #include <mach/irqs.h> | ||
17 | #include <mach/map.h> | ||
18 | |||
19 | #include <plat/adc.h> | ||
20 | #include <plat/devs.h> | ||
21 | #include <plat/cpu.h> | ||
22 | |||
23 | static struct resource s3c_adc_resource[] = { | ||
24 | [0] = { | ||
25 | .start = S3C64XX_PA_ADC, | ||
26 | .end = S3C64XX_PA_ADC + SZ_256 - 1, | ||
27 | .flags = IORESOURCE_MEM, | ||
28 | }, | ||
29 | [1] = { | ||
30 | .start = IRQ_TC, | ||
31 | .end = IRQ_TC, | ||
32 | .flags = IORESOURCE_IRQ, | ||
33 | }, | ||
34 | [2] = { | ||
35 | .start = IRQ_ADC, | ||
36 | .end = IRQ_ADC, | ||
37 | .flags = IORESOURCE_IRQ, | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | struct platform_device s3c_device_adc = { | ||
42 | .name = "s3c64xx-adc", | ||
43 | .id = -1, | ||
44 | .num_resources = ARRAY_SIZE(s3c_adc_resource), | ||
45 | .resource = s3c_adc_resource, | ||
46 | }; | ||
diff --git a/arch/arm/plat-s3c64xx/dev-audio.c b/arch/arm/plat-s3c64xx/dev-audio.c index a21a88fbb7e3..cdba3a77ea19 100644 --- a/arch/arm/plat-s3c64xx/dev-audio.c +++ b/arch/arm/plat-s3c64xx/dev-audio.c | |||
@@ -3,7 +3,6 @@ | |||
3 | * Copyright 2009 Wolfson Microelectronics | 3 | * Copyright 2009 Wolfson Microelectronics |
4 | * Mark Brown <broonie@opensource.wolfsonmicro.com> | 4 | * Mark Brown <broonie@opensource.wolfsonmicro.com> |
5 | * | 5 | * |
6 | |||
7 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
9 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
@@ -20,16 +19,69 @@ | |||
20 | 19 | ||
21 | #include <plat/devs.h> | 20 | #include <plat/devs.h> |
22 | #include <plat/audio.h> | 21 | #include <plat/audio.h> |
22 | #include <plat/gpio-bank-c.h> | ||
23 | #include <plat/gpio-bank-d.h> | 23 | #include <plat/gpio-bank-d.h> |
24 | #include <plat/gpio-bank-e.h> | 24 | #include <plat/gpio-bank-e.h> |
25 | #include <plat/gpio-bank-h.h> | ||
25 | #include <plat/gpio-cfg.h> | 26 | #include <plat/gpio-cfg.h> |
26 | 27 | ||
28 | static int s3c64xx_i2sv3_cfg_gpio(struct platform_device *pdev) | ||
29 | { | ||
30 | switch (pdev->id) { | ||
31 | case 0: | ||
32 | s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_I2S0_CLK); | ||
33 | s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_I2S0_CDCLK); | ||
34 | s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_I2S0_LRCLK); | ||
35 | s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_I2S0_DI); | ||
36 | s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_I2S0_D0); | ||
37 | break; | ||
38 | case 1: | ||
39 | s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_I2S1_CLK); | ||
40 | s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_I2S1_CDCLK); | ||
41 | s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_I2S1_LRCLK); | ||
42 | s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_I2S1_DI); | ||
43 | s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_I2S1_D0); | ||
44 | default: | ||
45 | printk(KERN_DEBUG "Invalid I2S Controller number!"); | ||
46 | return -EINVAL; | ||
47 | } | ||
48 | |||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static int s3c64xx_i2sv4_cfg_gpio(struct platform_device *pdev) | ||
53 | { | ||
54 | s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C64XX_GPC4_I2S0_V40_DO); | ||
55 | s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C64XX_GPC5_I2S1_V40_DO); | ||
56 | s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C64XX_GPC7_I2S2_V40_DO); | ||
57 | s3c_gpio_cfgpin(S3C64XX_GPH(6), S3C64XX_GPH6_I2S_V40_BCLK); | ||
58 | s3c_gpio_cfgpin(S3C64XX_GPH(7), S3C64XX_GPH7_I2S_V40_CDCLK); | ||
59 | s3c_gpio_cfgpin(S3C64XX_GPH(8), S3C64XX_GPH8_I2S_V40_LRCLK); | ||
60 | s3c_gpio_cfgpin(S3C64XX_GPH(9), S3C64XX_GPH9_I2S_V40_DI); | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | |||
27 | static struct resource s3c64xx_iis0_resource[] = { | 65 | static struct resource s3c64xx_iis0_resource[] = { |
28 | [0] = { | 66 | [0] = { |
29 | .start = S3C64XX_PA_IIS0, | 67 | .start = S3C64XX_PA_IIS0, |
30 | .end = S3C64XX_PA_IIS0 + 0x100 - 1, | 68 | .end = S3C64XX_PA_IIS0 + 0x100 - 1, |
31 | .flags = IORESOURCE_MEM, | 69 | .flags = IORESOURCE_MEM, |
32 | }, | 70 | }, |
71 | [1] = { | ||
72 | .start = DMACH_I2S0_OUT, | ||
73 | .end = DMACH_I2S0_OUT, | ||
74 | .flags = IORESOURCE_DMA, | ||
75 | }, | ||
76 | [2] = { | ||
77 | .start = DMACH_I2S0_IN, | ||
78 | .end = DMACH_I2S0_IN, | ||
79 | .flags = IORESOURCE_DMA, | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | struct s3c_audio_pdata s3c_i2s0_pdata = { | ||
84 | .cfg_gpio = s3c64xx_i2sv3_cfg_gpio, | ||
33 | }; | 85 | }; |
34 | 86 | ||
35 | struct platform_device s3c64xx_device_iis0 = { | 87 | struct platform_device s3c64xx_device_iis0 = { |
@@ -37,6 +89,9 @@ struct platform_device s3c64xx_device_iis0 = { | |||
37 | .id = 0, | 89 | .id = 0, |
38 | .num_resources = ARRAY_SIZE(s3c64xx_iis0_resource), | 90 | .num_resources = ARRAY_SIZE(s3c64xx_iis0_resource), |
39 | .resource = s3c64xx_iis0_resource, | 91 | .resource = s3c64xx_iis0_resource, |
92 | .dev = { | ||
93 | .platform_data = &s3c_i2s0_pdata, | ||
94 | }, | ||
40 | }; | 95 | }; |
41 | EXPORT_SYMBOL(s3c64xx_device_iis0); | 96 | EXPORT_SYMBOL(s3c64xx_device_iis0); |
42 | 97 | ||
@@ -46,6 +101,20 @@ static struct resource s3c64xx_iis1_resource[] = { | |||
46 | .end = S3C64XX_PA_IIS1 + 0x100 - 1, | 101 | .end = S3C64XX_PA_IIS1 + 0x100 - 1, |
47 | .flags = IORESOURCE_MEM, | 102 | .flags = IORESOURCE_MEM, |
48 | }, | 103 | }, |
104 | [1] = { | ||
105 | .start = DMACH_I2S1_OUT, | ||
106 | .end = DMACH_I2S1_OUT, | ||
107 | .flags = IORESOURCE_DMA, | ||
108 | }, | ||
109 | [2] = { | ||
110 | .start = DMACH_I2S1_IN, | ||
111 | .end = DMACH_I2S1_IN, | ||
112 | .flags = IORESOURCE_DMA, | ||
113 | }, | ||
114 | }; | ||
115 | |||
116 | struct s3c_audio_pdata s3c_i2s1_pdata = { | ||
117 | .cfg_gpio = s3c64xx_i2sv3_cfg_gpio, | ||
49 | }; | 118 | }; |
50 | 119 | ||
51 | struct platform_device s3c64xx_device_iis1 = { | 120 | struct platform_device s3c64xx_device_iis1 = { |
@@ -53,6 +122,9 @@ struct platform_device s3c64xx_device_iis1 = { | |||
53 | .id = 1, | 122 | .id = 1, |
54 | .num_resources = ARRAY_SIZE(s3c64xx_iis1_resource), | 123 | .num_resources = ARRAY_SIZE(s3c64xx_iis1_resource), |
55 | .resource = s3c64xx_iis1_resource, | 124 | .resource = s3c64xx_iis1_resource, |
125 | .dev = { | ||
126 | .platform_data = &s3c_i2s1_pdata, | ||
127 | }, | ||
56 | }; | 128 | }; |
57 | EXPORT_SYMBOL(s3c64xx_device_iis1); | 129 | EXPORT_SYMBOL(s3c64xx_device_iis1); |
58 | 130 | ||
@@ -62,6 +134,20 @@ static struct resource s3c64xx_iisv4_resource[] = { | |||
62 | .end = S3C64XX_PA_IISV4 + 0x100 - 1, | 134 | .end = S3C64XX_PA_IISV4 + 0x100 - 1, |
63 | .flags = IORESOURCE_MEM, | 135 | .flags = IORESOURCE_MEM, |
64 | }, | 136 | }, |
137 | [1] = { | ||
138 | .start = DMACH_HSI_I2SV40_TX, | ||
139 | .end = DMACH_HSI_I2SV40_TX, | ||
140 | .flags = IORESOURCE_DMA, | ||
141 | }, | ||
142 | [2] = { | ||
143 | .start = DMACH_HSI_I2SV40_RX, | ||
144 | .end = DMACH_HSI_I2SV40_RX, | ||
145 | .flags = IORESOURCE_DMA, | ||
146 | }, | ||
147 | }; | ||
148 | |||
149 | struct s3c_audio_pdata s3c_i2sv4_pdata = { | ||
150 | .cfg_gpio = s3c64xx_i2sv4_cfg_gpio, | ||
65 | }; | 151 | }; |
66 | 152 | ||
67 | struct platform_device s3c64xx_device_iisv4 = { | 153 | struct platform_device s3c64xx_device_iisv4 = { |
@@ -69,6 +155,9 @@ struct platform_device s3c64xx_device_iisv4 = { | |||
69 | .id = -1, | 155 | .id = -1, |
70 | .num_resources = ARRAY_SIZE(s3c64xx_iisv4_resource), | 156 | .num_resources = ARRAY_SIZE(s3c64xx_iisv4_resource), |
71 | .resource = s3c64xx_iisv4_resource, | 157 | .resource = s3c64xx_iisv4_resource, |
158 | .dev = { | ||
159 | .platform_data = &s3c_i2sv4_pdata, | ||
160 | }, | ||
72 | }; | 161 | }; |
73 | EXPORT_SYMBOL(s3c64xx_device_iisv4); | 162 | EXPORT_SYMBOL(s3c64xx_device_iisv4); |
74 | 163 | ||
diff --git a/arch/arm/plat-s3c64xx/dev-rtc.c b/arch/arm/plat-s3c64xx/dev-rtc.c new file mode 100644 index 000000000000..b9e7a05f0129 --- /dev/null +++ b/arch/arm/plat-s3c64xx/dev-rtc.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* linux/arch/arm/plat-s3c64xx/dev-rtc.c | ||
2 | * | ||
3 | * Copyright 2009 by Maurus Cuelenaere <mcuelenaere@gmail.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/string.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | |||
14 | #include <mach/irqs.h> | ||
15 | #include <mach/map.h> | ||
16 | |||
17 | #include <plat/devs.h> | ||
18 | |||
19 | static struct resource s3c_rtc_resource[] = { | ||
20 | [0] = { | ||
21 | .start = S3C64XX_PA_RTC, | ||
22 | .end = S3C64XX_PA_RTC + 0xff, | ||
23 | .flags = IORESOURCE_MEM, | ||
24 | }, | ||
25 | [1] = { | ||
26 | .start = IRQ_RTC_ALARM, | ||
27 | .end = IRQ_RTC_ALARM, | ||
28 | .flags = IORESOURCE_IRQ, | ||
29 | }, | ||
30 | [2] = { | ||
31 | .start = IRQ_RTC_TIC, | ||
32 | .end = IRQ_RTC_TIC, | ||
33 | .flags = IORESOURCE_IRQ | ||
34 | } | ||
35 | }; | ||
36 | |||
37 | struct platform_device s3c_device_rtc = { | ||
38 | .name = "s3c64xx-rtc", | ||
39 | .id = -1, | ||
40 | .num_resources = ARRAY_SIZE(s3c_rtc_resource), | ||
41 | .resource = s3c_rtc_resource, | ||
42 | }; | ||
43 | EXPORT_SYMBOL(s3c_device_rtc); | ||
diff --git a/arch/arm/plat-s3c64xx/dev-spi.c b/arch/arm/plat-s3c64xx/dev-spi.c new file mode 100644 index 000000000000..6b6d7af06624 --- /dev/null +++ b/arch/arm/plat-s3c64xx/dev-spi.c | |||
@@ -0,0 +1,180 @@ | |||
1 | /* linux/arch/arm/plat-s3c64xx/dev-spi.c | ||
2 | * | ||
3 | * Copyright (C) 2009 Samsung Electronics Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/string.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/dma-mapping.h> | ||
15 | |||
16 | #include <mach/dma.h> | ||
17 | #include <mach/map.h> | ||
18 | #include <mach/gpio.h> | ||
19 | |||
20 | #include <plat/spi-clocks.h> | ||
21 | #include <plat/s3c64xx-spi.h> | ||
22 | #include <plat/gpio-bank-c.h> | ||
23 | #include <plat/gpio-cfg.h> | ||
24 | #include <plat/irqs.h> | ||
25 | |||
26 | static char *spi_src_clks[] = { | ||
27 | [S3C64XX_SPI_SRCCLK_PCLK] = "pclk", | ||
28 | [S3C64XX_SPI_SRCCLK_SPIBUS] = "spi-bus", | ||
29 | [S3C64XX_SPI_SRCCLK_48M] = "spi_48m", | ||
30 | }; | ||
31 | |||
32 | /* SPI Controller platform_devices */ | ||
33 | |||
34 | /* Since we emulate multi-cs capability, we do not touch the GPC-3,7. | ||
35 | * The emulated CS is toggled by board specific mechanism, as it can | ||
36 | * be either some immediate GPIO or some signal out of some other | ||
37 | * chip in between ... or some yet another way. | ||
38 | * We simply do not assume anything about CS. | ||
39 | */ | ||
40 | static int s3c64xx_spi_cfg_gpio(struct platform_device *pdev) | ||
41 | { | ||
42 | switch (pdev->id) { | ||
43 | case 0: | ||
44 | s3c_gpio_cfgpin(S3C64XX_GPC(0), S3C64XX_GPC0_SPI_MISO0); | ||
45 | s3c_gpio_cfgpin(S3C64XX_GPC(1), S3C64XX_GPC1_SPI_CLKO); | ||
46 | s3c_gpio_cfgpin(S3C64XX_GPC(2), S3C64XX_GPC2_SPI_MOSIO); | ||
47 | s3c_gpio_setpull(S3C64XX_GPC(0), S3C_GPIO_PULL_UP); | ||
48 | s3c_gpio_setpull(S3C64XX_GPC(1), S3C_GPIO_PULL_UP); | ||
49 | s3c_gpio_setpull(S3C64XX_GPC(2), S3C_GPIO_PULL_UP); | ||
50 | break; | ||
51 | |||
52 | case 1: | ||
53 | s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C64XX_GPC4_SPI_MISO1); | ||
54 | s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C64XX_GPC5_SPI_CLK1); | ||
55 | s3c_gpio_cfgpin(S3C64XX_GPC(6), S3C64XX_GPC6_SPI_MOSI1); | ||
56 | s3c_gpio_setpull(S3C64XX_GPC(4), S3C_GPIO_PULL_UP); | ||
57 | s3c_gpio_setpull(S3C64XX_GPC(5), S3C_GPIO_PULL_UP); | ||
58 | s3c_gpio_setpull(S3C64XX_GPC(6), S3C_GPIO_PULL_UP); | ||
59 | break; | ||
60 | |||
61 | default: | ||
62 | dev_err(&pdev->dev, "Invalid SPI Controller number!"); | ||
63 | return -EINVAL; | ||
64 | } | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static struct resource s3c64xx_spi0_resource[] = { | ||
70 | [0] = { | ||
71 | .start = S3C64XX_PA_SPI0, | ||
72 | .end = S3C64XX_PA_SPI0 + 0x100 - 1, | ||
73 | .flags = IORESOURCE_MEM, | ||
74 | }, | ||
75 | [1] = { | ||
76 | .start = DMACH_SPI0_TX, | ||
77 | .end = DMACH_SPI0_TX, | ||
78 | .flags = IORESOURCE_DMA, | ||
79 | }, | ||
80 | [2] = { | ||
81 | .start = DMACH_SPI0_RX, | ||
82 | .end = DMACH_SPI0_RX, | ||
83 | .flags = IORESOURCE_DMA, | ||
84 | }, | ||
85 | [3] = { | ||
86 | .start = IRQ_SPI0, | ||
87 | .end = IRQ_SPI0, | ||
88 | .flags = IORESOURCE_IRQ, | ||
89 | }, | ||
90 | }; | ||
91 | |||
92 | static struct s3c64xx_spi_info s3c64xx_spi0_pdata = { | ||
93 | .cfg_gpio = s3c64xx_spi_cfg_gpio, | ||
94 | .fifo_lvl_mask = 0x7f, | ||
95 | .rx_lvl_offset = 13, | ||
96 | }; | ||
97 | |||
98 | static u64 spi_dmamask = DMA_BIT_MASK(32); | ||
99 | |||
100 | struct platform_device s3c64xx_device_spi0 = { | ||
101 | .name = "s3c64xx-spi", | ||
102 | .id = 0, | ||
103 | .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource), | ||
104 | .resource = s3c64xx_spi0_resource, | ||
105 | .dev = { | ||
106 | .dma_mask = &spi_dmamask, | ||
107 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
108 | .platform_data = &s3c64xx_spi0_pdata, | ||
109 | }, | ||
110 | }; | ||
111 | EXPORT_SYMBOL(s3c64xx_device_spi0); | ||
112 | |||
113 | static struct resource s3c64xx_spi1_resource[] = { | ||
114 | [0] = { | ||
115 | .start = S3C64XX_PA_SPI1, | ||
116 | .end = S3C64XX_PA_SPI1 + 0x100 - 1, | ||
117 | .flags = IORESOURCE_MEM, | ||
118 | }, | ||
119 | [1] = { | ||
120 | .start = DMACH_SPI1_TX, | ||
121 | .end = DMACH_SPI1_TX, | ||
122 | .flags = IORESOURCE_DMA, | ||
123 | }, | ||
124 | [2] = { | ||
125 | .start = DMACH_SPI1_RX, | ||
126 | .end = DMACH_SPI1_RX, | ||
127 | .flags = IORESOURCE_DMA, | ||
128 | }, | ||
129 | [3] = { | ||
130 | .start = IRQ_SPI1, | ||
131 | .end = IRQ_SPI1, | ||
132 | .flags = IORESOURCE_IRQ, | ||
133 | }, | ||
134 | }; | ||
135 | |||
136 | static struct s3c64xx_spi_info s3c64xx_spi1_pdata = { | ||
137 | .cfg_gpio = s3c64xx_spi_cfg_gpio, | ||
138 | .fifo_lvl_mask = 0x7f, | ||
139 | .rx_lvl_offset = 13, | ||
140 | }; | ||
141 | |||
142 | struct platform_device s3c64xx_device_spi1 = { | ||
143 | .name = "s3c64xx-spi", | ||
144 | .id = 1, | ||
145 | .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource), | ||
146 | .resource = s3c64xx_spi1_resource, | ||
147 | .dev = { | ||
148 | .dma_mask = &spi_dmamask, | ||
149 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
150 | .platform_data = &s3c64xx_spi1_pdata, | ||
151 | }, | ||
152 | }; | ||
153 | EXPORT_SYMBOL(s3c64xx_device_spi1); | ||
154 | |||
155 | void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs) | ||
156 | { | ||
157 | /* Reject invalid configuration */ | ||
158 | if (!num_cs || src_clk_nr < 0 | ||
159 | || src_clk_nr > S3C64XX_SPI_SRCCLK_48M) { | ||
160 | printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__); | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | switch (cntrlr) { | ||
165 | case 0: | ||
166 | s3c64xx_spi0_pdata.num_cs = num_cs; | ||
167 | s3c64xx_spi0_pdata.src_clk_nr = src_clk_nr; | ||
168 | s3c64xx_spi0_pdata.src_clk_name = spi_src_clks[src_clk_nr]; | ||
169 | break; | ||
170 | case 1: | ||
171 | s3c64xx_spi1_pdata.num_cs = num_cs; | ||
172 | s3c64xx_spi1_pdata.src_clk_nr = src_clk_nr; | ||
173 | s3c64xx_spi1_pdata.src_clk_name = spi_src_clks[src_clk_nr]; | ||
174 | break; | ||
175 | default: | ||
176 | printk(KERN_ERR "%s: Invalid SPI controller(%d)\n", | ||
177 | __func__, cntrlr); | ||
178 | return; | ||
179 | } | ||
180 | } | ||
diff --git a/arch/arm/plat-s3c64xx/include/plat/regs-srom.h b/arch/arm/plat-s3c64xx/include/plat/regs-srom.h new file mode 100644 index 000000000000..756731b36297 --- /dev/null +++ b/arch/arm/plat-s3c64xx/include/plat/regs-srom.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /* arch/arm/plat-s3c64xx/include/plat/regs-srom.h | ||
2 | * | ||
3 | * Copyright 2009 Andy Green <andy@warmcat.com> | ||
4 | * | ||
5 | * S3C64XX SROM definitions | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef __PLAT_REGS_SROM_H | ||
13 | #define __PLAT_REGS_SROM_H __FILE__ | ||
14 | |||
15 | #define S3C64XX_SROMREG(x) (S3C_VA_MEM + (x)) | ||
16 | |||
17 | #define S3C64XX_SROM_BW S3C64XX_SROMREG(0) | ||
18 | #define S3C64XX_SROM_BC0 S3C64XX_SROMREG(4) | ||
19 | #define S3C64XX_SROM_BC1 S3C64XX_SROMREG(8) | ||
20 | #define S3C64XX_SROM_BC2 S3C64XX_SROMREG(0xc) | ||
21 | #define S3C64XX_SROM_BC3 S3C64XX_SROMREG(0x10) | ||
22 | #define S3C64XX_SROM_BC4 S3C64XX_SROMREG(0x14) | ||
23 | #define S3C64XX_SROM_BC5 S3C64XX_SROMREG(0x18) | ||
24 | |||
25 | /* | ||
26 | * one register BW holds 5 x 4-bit packed settings for NCS0 - NCS4 | ||
27 | */ | ||
28 | |||
29 | #define S3C64XX_SROM_BW__DATAWIDTH__SHIFT 0 | ||
30 | #define S3C64XX_SROM_BW__WAITENABLE__SHIFT 2 | ||
31 | #define S3C64XX_SROM_BW__BYTEENABLE__SHIFT 3 | ||
32 | #define S3C64XX_SROM_BW__CS_MASK 0xf | ||
33 | |||
34 | #define S3C64XX_SROM_BW__NCS0__SHIFT 0 | ||
35 | #define S3C64XX_SROM_BW__NCS1__SHIFT 4 | ||
36 | #define S3C64XX_SROM_BW__NCS2__SHIFT 8 | ||
37 | #define S3C64XX_SROM_BW__NCS3__SHIFT 0xc | ||
38 | #define S3C64XX_SROM_BW__NCS4__SHIFT 0x10 | ||
39 | |||
40 | /* | ||
41 | * applies to same to BCS0 - BCS4 | ||
42 | */ | ||
43 | |||
44 | #define S3C64XX_SROM_BCX__PMC__SHIFT 0 | ||
45 | #define S3C64XX_SROM_BCX__PMC__MASK 3 | ||
46 | #define S3C64XX_SROM_BCX__TACP__SHIFT 4 | ||
47 | #define S3C64XX_SROM_BCX__TACP__MASK 0xf | ||
48 | #define S3C64XX_SROM_BCX__TCAH__SHIFT 8 | ||
49 | #define S3C64XX_SROM_BCX__TCAH__MASK 0xf | ||
50 | #define S3C64XX_SROM_BCX__TCOH__SHIFT 12 | ||
51 | #define S3C64XX_SROM_BCX__TCOH__MASK 0xf | ||
52 | #define S3C64XX_SROM_BCX__TACC__SHIFT 16 | ||
53 | #define S3C64XX_SROM_BCX__TACC__MASK 0x1f | ||
54 | #define S3C64XX_SROM_BCX__TCOS__SHIFT 24 | ||
55 | #define S3C64XX_SROM_BCX__TCOS__MASK 0xf | ||
56 | #define S3C64XX_SROM_BCX__TACS__SHIFT 28 | ||
57 | #define S3C64XX_SROM_BCX__TACS__MASK 0xf | ||
58 | |||
59 | #endif /* _PLAT_REGS_SROM_H */ | ||
diff --git a/arch/arm/plat-s3c64xx/include/plat/spi-clocks.h b/arch/arm/plat-s3c64xx/include/plat/spi-clocks.h new file mode 100644 index 000000000000..524bdae3f625 --- /dev/null +++ b/arch/arm/plat-s3c64xx/include/plat/spi-clocks.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* linux/arch/arm/plat-s3c64xx/include/plat/spi-clocks.h | ||
2 | * | ||
3 | * Copyright (C) 2009 Samsung Electronics Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __S3C64XX_PLAT_SPI_CLKS_H | ||
12 | #define __S3C64XX_PLAT_SPI_CLKS_H __FILE__ | ||
13 | |||
14 | #define S3C64XX_SPI_SRCCLK_PCLK 0 | ||
15 | #define S3C64XX_SPI_SRCCLK_SPIBUS 1 | ||
16 | #define S3C64XX_SPI_SRCCLK_48M 2 | ||
17 | |||
18 | #endif /* __S3C64XX_PLAT_SPI_CLKS_H */ | ||