aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-05 21:21:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-05 21:21:21 -0400
commitc861cd3e92d92ae946e19099f198018fcb4fd887 (patch)
treefab678a30a85cf80038c560221d6ab01812a3891 /arch/arm/plat-samsung
parent7abec10c623d9e0416dab6919a0ea22e6283516b (diff)
parentb8bc83971cc20cae3c3b65c26a804f350d74960c (diff)
Merge branch 'next/devel2' of git://git.linaro.org/people/arnd/arm-soc
* 'next/devel2' of git://git.linaro.org/people/arnd/arm-soc: (30 commits) ARM: mmp: register internal sram bank ARM: mmp: register audio sram bank ARM: mmp: add sram allocator gpio/samsung: Complain loudly if we don't know the SoC ARM: S3C64XX: Fix SoC identification for S3C64xx devices ARM: S3C2443: Remove redundant s3c_register_clocks call for init_clocks ARM: S3C24XX: Add devname for hsmmc1 pclk ARM: S3C24XX: use clk_get_rate to init fclk in common_setup_clocks ARM: S3C2443: Accommodate cpufreq frequency scheme in armdiv ARM: S3C2443: handle unset armdiv values gracefully ARM: S3C2443: Add get_rate operation for clk_armdiv ARM: S3C2416: Add comment describing the armdiv/armclk ARM: S3C2443: Move clk_arm and clk_armdiv to common code ARM: S3C24XX: Add infrastructure to transmit armdiv to common code ARM: S3C2416: Add armdiv_mask constant ARM: EXYNOS4: Add support for M-5MOLS camera on Nuri board ARM: EXYNOS4: Enable MFC on ORIGEN ARM: SAMSUNG: Add support s3c2416-adc for S3C2416/S3C2450 ARM: SAMSUNG: Add support s3c2443-adc for S3C2443 ARM: SAMSUNG: Allow overriding of adc device name for S3C24XX ...
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/adc.c43
-rw-r--r--arch/arm/plat-samsung/include/plat/adc-core.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h6
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-adc.h3
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c2443.h7
5 files changed, 43 insertions, 18 deletions
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index ee8deef19481..33ecd0c9f0c3 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -41,6 +41,8 @@
41 41
42enum s3c_cpu_type { 42enum s3c_cpu_type {
43 TYPE_ADCV1, /* S3C24XX */ 43 TYPE_ADCV1, /* S3C24XX */
44 TYPE_ADCV11, /* S3C2443 */
45 TYPE_ADCV12, /* S3C2416, S3C2450 */
44 TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */ 46 TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */
45 TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */ 47 TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */
46}; 48};
@@ -98,13 +100,17 @@ static inline void s3c_adc_select(struct adc_device *adc,
98 100
99 client->select_cb(client, 1); 101 client->select_cb(client, 1);
100 102
101 con &= ~S3C2410_ADCCON_MUXMASK; 103 if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2)
104 con &= ~S3C2410_ADCCON_MUXMASK;
102 con &= ~S3C2410_ADCCON_STDBM; 105 con &= ~S3C2410_ADCCON_STDBM;
103 con &= ~S3C2410_ADCCON_STARTMASK; 106 con &= ~S3C2410_ADCCON_STARTMASK;
104 107
105 if (!client->is_ts) { 108 if (!client->is_ts) {
106 if (cpu == TYPE_ADCV3) 109 if (cpu == TYPE_ADCV3)
107 writel(client->channel & 0xf, adc->regs + S5P_ADCMUX); 110 writel(client->channel & 0xf, adc->regs + S5P_ADCMUX);
111 else if (cpu == TYPE_ADCV11 || cpu == TYPE_ADCV12)
112 writel(client->channel & 0xf,
113 adc->regs + S3C2443_ADCMUX);
108 else 114 else
109 con |= S3C2410_ADCCON_SELMUX(client->channel); 115 con |= S3C2410_ADCCON_SELMUX(client->channel);
110 } 116 }
@@ -293,13 +299,13 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
293 299
294 client->nr_samples--; 300 client->nr_samples--;
295 301
296 if (cpu != TYPE_ADCV1) { 302 if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV11) {
297 /* S3C64XX/S5P ADC resolution is 12-bit */
298 data0 &= 0xfff;
299 data1 &= 0xfff;
300 } else {
301 data0 &= 0x3ff; 303 data0 &= 0x3ff;
302 data1 &= 0x3ff; 304 data1 &= 0x3ff;
305 } else {
306 /* S3C2416/S3C64XX/S5P ADC resolution is 12-bit */
307 data0 &= 0xfff;
308 data1 &= 0xfff;
303 } 309 }
304 310
305 if (client->convert_cb) 311 if (client->convert_cb)
@@ -320,7 +326,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
320 } 326 }
321 327
322exit: 328exit:
323 if (cpu != TYPE_ADCV1) { 329 if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) {
324 /* Clear ADC interrupt */ 330 /* Clear ADC interrupt */
325 writel(0, adc->regs + S3C64XX_ADCCLRINT); 331 writel(0, adc->regs + S3C64XX_ADCCLRINT);
326 } 332 }
@@ -332,6 +338,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
332 struct device *dev = &pdev->dev; 338 struct device *dev = &pdev->dev;
333 struct adc_device *adc; 339 struct adc_device *adc;
334 struct resource *regs; 340 struct resource *regs;
341 enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
335 int ret; 342 int ret;
336 unsigned tmp; 343 unsigned tmp;
337 344
@@ -394,10 +401,13 @@ static int s3c_adc_probe(struct platform_device *pdev)
394 clk_enable(adc->clk); 401 clk_enable(adc->clk);
395 402
396 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; 403 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
397 if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) { 404
398 /* Enable 12-bit ADC resolution */ 405 /* Enable 12-bit ADC resolution */
406 if (cpu == TYPE_ADCV12)
407 tmp |= S3C2416_ADCCON_RESSEL;
408 if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
399 tmp |= S3C64XX_ADCCON_RESSEL; 409 tmp |= S3C64XX_ADCCON_RESSEL;
400 } 410
401 writel(tmp, adc->regs + S3C2410_ADCCON); 411 writel(tmp, adc->regs + S3C2410_ADCCON);
402 412
403 dev_info(dev, "attached adc driver\n"); 413 dev_info(dev, "attached adc driver\n");
@@ -464,6 +474,7 @@ static int s3c_adc_resume(struct device *dev)
464 struct platform_device *pdev = container_of(dev, 474 struct platform_device *pdev = container_of(dev,
465 struct platform_device, dev); 475 struct platform_device, dev);
466 struct adc_device *adc = platform_get_drvdata(pdev); 476 struct adc_device *adc = platform_get_drvdata(pdev);
477 enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
467 int ret; 478 int ret;
468 unsigned long tmp; 479 unsigned long tmp;
469 480
@@ -474,9 +485,13 @@ static int s3c_adc_resume(struct device *dev)
474 enable_irq(adc->irq); 485 enable_irq(adc->irq);
475 486
476 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; 487 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
488
477 /* Enable 12-bit ADC resolution */ 489 /* Enable 12-bit ADC resolution */
478 if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) 490 if (cpu == TYPE_ADCV12)
491 tmp |= S3C2416_ADCCON_RESSEL;
492 if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
479 tmp |= S3C64XX_ADCCON_RESSEL; 493 tmp |= S3C64XX_ADCCON_RESSEL;
494
480 writel(tmp, adc->regs + S3C2410_ADCCON); 495 writel(tmp, adc->regs + S3C2410_ADCCON);
481 496
482 return 0; 497 return 0;
@@ -492,6 +507,12 @@ static struct platform_device_id s3c_adc_driver_ids[] = {
492 .name = "s3c24xx-adc", 507 .name = "s3c24xx-adc",
493 .driver_data = TYPE_ADCV1, 508 .driver_data = TYPE_ADCV1,
494 }, { 509 }, {
510 .name = "s3c2443-adc",
511 .driver_data = TYPE_ADCV11,
512 }, {
513 .name = "s3c2416-adc",
514 .driver_data = TYPE_ADCV12,
515 }, {
495 .name = "s3c64xx-adc", 516 .name = "s3c64xx-adc",
496 .driver_data = TYPE_ADCV2, 517 .driver_data = TYPE_ADCV2,
497 }, { 518 }, {
diff --git a/arch/arm/plat-samsung/include/plat/adc-core.h b/arch/arm/plat-samsung/include/plat/adc-core.h
index a281568d5856..a927bee55359 100644
--- a/arch/arm/plat-samsung/include/plat/adc-core.h
+++ b/arch/arm/plat-samsung/include/plat/adc-core.h
@@ -20,7 +20,7 @@
20/* re-define device name depending on support. */ 20/* re-define device name depending on support. */
21static inline void s3c_adc_setname(char *name) 21static inline void s3c_adc_setname(char *name)
22{ 22{
23#ifdef CONFIG_SAMSUNG_DEV_ADC 23#if defined(CONFIG_SAMSUNG_DEV_ADC) || defined(CONFIG_PLAT_S3C24XX)
24 s3c_device_adc.name = name; 24 s3c_device_adc.name = name;
25#endif 25#endif
26} 26}
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 54f370f0fc07..40fd7b6b5e66 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -25,7 +25,6 @@ extern unsigned long samsung_cpu_id;
25 25
26#define S3C6400_CPU_ID 0x36400000 26#define S3C6400_CPU_ID 0x36400000
27#define S3C6410_CPU_ID 0x36410000 27#define S3C6410_CPU_ID 0x36410000
28#define S3C64XX_CPU_ID (S3C6400_CPU_ID & S3C6410_CPU_ID)
29#define S3C64XX_CPU_MASK 0xFFFFF000 28#define S3C64XX_CPU_MASK 0xFFFFF000
30 29
31#define S5P6440_CPU_ID 0x56440000 30#define S5P6440_CPU_ID 0x56440000
@@ -50,7 +49,8 @@ static inline int is_samsung_##name(void) \
50} 49}
51 50
52IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) 51IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
53IS_SAMSUNG_CPU(s3c64xx, S3C64XX_CPU_ID, S3C64XX_CPU_MASK) 52IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
53IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
54IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) 54IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
55IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) 55IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
56IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) 56IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
@@ -69,7 +69,7 @@ IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
69#endif 69#endif
70 70
71#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) 71#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
72# define soc_is_s3c64xx() is_samsung_s3c64xx() 72# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
73#else 73#else
74# define soc_is_s3c64xx() 0 74# define soc_is_s3c64xx() 0
75#endif 75#endif
diff --git a/arch/arm/plat-samsung/include/plat/regs-adc.h b/arch/arm/plat-samsung/include/plat/regs-adc.h
index 035e8c38d69c..70612100120f 100644
--- a/arch/arm/plat-samsung/include/plat/regs-adc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-adc.h
@@ -20,6 +20,7 @@
20#define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C) 20#define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C)
21#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) 21#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10)
22#define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) 22#define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14)
23#define S3C2443_ADCMUX S3C2410_ADCREG(0x18)
23#define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) 24#define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18)
24#define S5P_ADCMUX S3C2410_ADCREG(0x1C) 25#define S5P_ADCMUX S3C2410_ADCREG(0x1C)
25#define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) 26#define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20)
@@ -33,6 +34,7 @@
33#define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6) 34#define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6)
34#define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3) 35#define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3)
35#define S3C2410_ADCCON_MUXMASK (0x7<<3) 36#define S3C2410_ADCCON_MUXMASK (0x7<<3)
37#define S3C2416_ADCCON_RESSEL (1 << 3)
36#define S3C2410_ADCCON_STDBM (1<<2) 38#define S3C2410_ADCCON_STDBM (1<<2)
37#define S3C2410_ADCCON_READ_START (1<<1) 39#define S3C2410_ADCCON_READ_START (1<<1)
38#define S3C2410_ADCCON_ENABLE_START (1<<0) 40#define S3C2410_ADCCON_ENABLE_START (1<<0)
@@ -40,6 +42,7 @@
40 42
41 43
42/* ADCTSC Register Bits */ 44/* ADCTSC Register Bits */
45#define S3C2443_ADCTSC_UD_SEN (1 << 8)
43#define S3C2410_ADCTSC_YM_SEN (1<<7) 46#define S3C2410_ADCTSC_YM_SEN (1<<7)
44#define S3C2410_ADCTSC_YP_SEN (1<<6) 47#define S3C2410_ADCTSC_YP_SEN (1<<6)
45#define S3C2410_ADCTSC_XM_SEN (1<<5) 48#define S3C2410_ADCTSC_XM_SEN (1<<5)
diff --git a/arch/arm/plat-samsung/include/plat/s3c2443.h b/arch/arm/plat-samsung/include/plat/s3c2443.h
index 4b2ac9a272b2..7fae1a050694 100644
--- a/arch/arm/plat-samsung/include/plat/s3c2443.h
+++ b/arch/arm/plat-samsung/include/plat/s3c2443.h
@@ -37,10 +37,11 @@ extern int s3c2443_baseclk_add(void);
37struct clk; /* some files don't need clk.h otherwise */ 37struct clk; /* some files don't need clk.h otherwise */
38 38
39typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base); 39typedef unsigned int (*pll_fn)(unsigned int reg, unsigned int base);
40typedef unsigned int (*fdiv_fn)(unsigned long clkcon0);
41 40
42extern void s3c2443_common_setup_clocks(pll_fn get_mpll, fdiv_fn fdiv); 41extern void s3c2443_common_setup_clocks(pll_fn get_mpll);
43extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, fdiv_fn fdiv); 42extern void s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
43 unsigned int *divs, int nr_divs,
44 int divmask);
44 45
45extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable); 46extern int s3c2443_clkcon_enable_h(struct clk *clk, int enable);
46extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable); 47extern int s3c2443_clkcon_enable_p(struct clk *clk, int enable);