1/* 2 * (C) Copyright 2003 3 * David Müller ELSOFT AG Switzerland. d.mueller@elsoft.ch 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8/************************************************ 9 * NAME : s3c24x0.h 10 * Version : 31.3.2003 11 * 12 * common stuff for SAMSUNG S3C24X0 SoC 13 ************************************************/ 14 15#ifndef __S3C24X0_H__ 16#define __S3C24X0_H__ 17 18/* Memory controller (see manual chapter 5) */ 19struct s3c24x0_memctl { 20 u32 bwscon; 21 u32 bankcon[8]; 22 u32 refresh; 23 u32 banksize; 24 u32 mrsrb6; 25 u32 mrsrb7; 26}; 27 28 29/* USB HOST (see manual chapter 12) */ 30struct s3c24x0_usb_host { 31 u32 HcRevision; 32 u32 HcControl; 33 u32 HcCommonStatus; 34 u32 HcInterruptStatus; 35 u32 HcInterruptEnable; 36 u32 HcInterruptDisable; 37 u32 HcHCCA; 38 u32 HcPeriodCuttendED; 39 u32 HcControlHeadED; 40 u32 HcControlCurrentED; 41 u32 HcBulkHeadED; 42 u32 HcBuldCurrentED; 43 u32 HcDoneHead; 44 u32 HcRmInterval; 45 u32 HcFmRemaining; 46 u32 HcFmNumber; 47 u32 HcPeriodicStart; 48 u32 HcLSThreshold; 49 u32 HcRhDescriptorA; 50 u32 HcRhDescriptorB; 51 u32 HcRhStatus; 52 u32 HcRhPortStatus1; 53 u32 HcRhPortStatus2; 54}; 55 56 57/* INTERRUPT (see manual chapter 14) */ 58struct s3c24x0_interrupt { 59 u32 srcpnd; 60 u32 intmod; 61 u32 intmsk; 62 u32 priority; 63 u32 intpnd; 64 u32 intoffset; 65#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440) 66 u32 subsrcpnd; 67 u32 intsubmsk; 68#endif 69}; 70 71 72/* DMAS (see manual chapter 8) */ 73struct s3c24x0_dma { 74 u32 disrc; 75#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440) 76 u32 disrcc; 77#endif 78 u32 didst; 79#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440) 80 u32 didstc; 81#endif 82 u32 dcon; 83 u32 dstat; 84 u32 dcsrc; 85 u32 dcdst; 86 u32 dmasktrig; 87#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) \ 88 || defined(CONFIG_S3C2440) 89 u32 res[1]; 90#endif 91}; 92 93struct s3c24x0_dmas { 94 struct s3c24x0_dma dma[4]; 95}; 96 97 98/* CLOCK & POWER MANAGEMENT (see S3C2400 manual chapter 6) */ 99/* (see S3C2410 manual chapter 7) */ 100struct s3c24x0_clock_power { 101 u32 locktime; 102 u32 mpllcon; 103 u32 upllcon; 104 u32 clkcon; 105 u32 clkslow; 106 u32 clkdivn; 107#if defined(CONFIG_S3C2440) 108 u32 camdivn; 109#endif 110}; 111 112 113/* LCD CONTROLLER (see manual chapter 15) */ 114struct s3c24x0_lcd { 115 u32 lcdcon1; 116 u32 lcdcon2; 117 u32 lcdcon3; 118 u32 lcdcon4; 119 u32 lcdcon5; 120 u32 lcdsaddr1; 121 u32 lcdsaddr2; 122 u32 lcdsaddr3; 123 u32 redlut; 124 u32 greenlut; 125 u32 bluelut; 126 u32 res[8]; 127 u32 dithmode; 128 u32 tpal; 129#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440) 130 u32 lcdintpnd; 131 u32 lcdsrcpnd; 132 u32 lcdintmsk; 133 u32 lpcsel; 134#endif 135}; 136 137 138/* NAND FLASH (see manual chapter 6) */ 139struct s3c24x0_nand { 140 u32 nfconf; 141#ifndef CONFIG_S3C2410 142 u32 nfcont; 143#endif 144 u32 nfcmd; 145 u32 nfaddr; 146 u32 nfdata; 147#ifndef CONFIG_S3C2410 148 u32 nfeccd0; 149 u32 nfeccd1; 150 u32 nfeccd; 151#endif 152 u32 nfstat; 153#ifdef CONFIG_S3C2410 154 u32 nfecc; 155#else 156 u32 nfstat0; 157 u32 nfstat1; 158 u32 nfmecc0; 159 u32 nfmecc1; 160 u32 nfsecc; 161 u32 nfsblk; 162 u32 nfeblk; 163#endif 164}; 165 166/* UART (see manual chapter 11) */ 167struct s3c24x0_uart { 168 u32 ulcon; 169 u32 ucon; 170 u32 ufcon; 171 u32 umcon; 172 u32 utrstat; 173 u32 uerstat; 174 u32 ufstat; 175 u32 umstat; 176#ifdef __BIG_ENDIAN 177 u8 res1[3]; 178 u8 utxh; 179 u8 res2[3]; 180 u8 urxh; 181#else /* Little Endian */ 182 u8 utxh; 183 u8 res1[3]; 184 u8 urxh; 185 u8 res2[3]; 186#endif 187 u32 ubrdiv; 188}; 189 190 191/* PWM TIMER (see manual chapter 10) */ 192struct s3c24x0_timer { 193 u32 tcntb; 194 u32 tcmpb; 195 u32 tcnto; 196}; 197 198struct s3c24x0_timers { 199 u32 tcfg0; 200 u32 tcfg1; 201 u32 tcon; 202 struct s3c24x0_timer ch[4]; 203 u32 tcntb4; 204 u32 tcnto4; 205}; 206 207 208/* USB DEVICE (see manual chapter 13) */ 209struct s3c24x0_usb_dev_fifos { 210#ifdef __BIG_ENDIAN 211 u8 res[3]; 212 u8 ep_fifo_reg; 213#else /* little endian */ 214 u8 ep_fifo_reg; 215 u8 res[3]; 216#endif 217}; 218 219struct s3c24x0_usb_dev_dmas { 220#ifdef __BIG_ENDIAN 221 u8 res1[3]; 222 u8 ep_dma_con; 223 u8 res2[3]; 224 u8 ep_dma_unit; 225 u8 res3[3]; 226 u8 ep_dma_fifo; 227 u8 res4[3]; 228 u8 ep_dma_ttc_l; 229 u8 res5[3]; 230 u8 ep_dma_ttc_m; 231 u8 res6[3]; 232 u8 ep_dma_ttc_h; 233#else /* little endian */ 234 u8 ep_dma_con; 235 u8 res1[3]; 236 u8 ep_dma_unit; 237 u8 res2[3]; 238 u8 ep_dma_fifo; 239 u8 res3[3]; 240 u8 ep_dma_ttc_l; 241 u8 res4[3]; 242 u8 ep_dma_ttc_m; 243 u8 res5[3]; 244 u8 ep_dma_ttc_h; 245 u8 res6[3]; 246#endif 247}; 248 249struct s3c24x0_usb_device { 250#ifdef __BIG_ENDIAN 251 u8 res1[3]; 252 u8 func_addr_reg; 253 u8 res2[3]; 254 u8 pwr_reg; 255 u8 res3[3]; 256 u8 ep_int_reg; 257 u8 res4[15]; 258 u8 usb_int_reg; 259 u8 res5[3]; 260 u8 ep_int_en_reg; 261 u8 res6[15]; 262 u8 usb_int_en_reg; 263 u8 res7[3]; 264 u8 frame_num1_reg; 265 u8 res8[3]; 266 u8 frame_num2_reg; 267 u8 res9[3]; 268 u8 index_reg; 269 u8 res10[7]; 270 u8 maxp_reg; 271 u8 res11[3]; 272 u8 ep0_csr_in_csr1_reg; 273 u8 res12[3]; 274 u8 in_csr2_reg; 275 u8 res13[7]; 276 u8 out_csr1_reg; 277 u8 res14[3]; 278 u8 out_csr2_reg; 279 u8 res15[3]; 280 u8 out_fifo_cnt1_reg; 281 u8 res16[3]; 282 u8 out_fifo_cnt2_reg; 283#else /* little endian */ 284 u8 func_addr_reg; 285 u8 res1[3]; 286 u8 pwr_reg; 287 u8 res2[3]; 288 u8 ep_int_reg; 289 u8 res3[15]; 290 u8 usb_int_reg; 291 u8 res4[3]; 292 u8 ep_int_en_reg; 293 u8 res5[15]; 294 u8 usb_int_en_reg; 295 u8 res6[3]; 296 u8 frame_num1_reg; 297 u8 res7[3]; 298 u8 frame_num2_reg; 299 u8 res8[3]; 300 u8 index_reg; 301 u8 res9[7]; 302 u8 maxp_reg; 303 u8 res10[7]; 304 u8 ep0_csr_in_csr1_reg; 305 u8 res11[3]; 306 u8 in_csr2_reg; 307 u8 res12[3]; 308 u8 out_csr1_reg; 309 u8 res13[7]; 310 u8 out_csr2_reg; 311 u8 res14[3]; 312 u8 out_fifo_cnt1_reg; 313 u8 res15[3]; 314 u8 out_fifo_cnt2_reg; 315 u8 res16[3]; 316#endif /* __BIG_ENDIAN */ 317 struct s3c24x0_usb_dev_fifos fifo[5]; 318 struct s3c24x0_usb_dev_dmas dma[5]; 319}; 320 321 322/* WATCH DOG TIMER (see manual chapter 18) */ 323struct s3c24x0_watchdog { 324 u32 wtcon; 325 u32 wtdat; 326 u32 wtcnt; 327}; 328 329/* IIS (see manual chapter 21) */ 330struct s3c24x0_i2s { 331#ifdef __BIG_ENDIAN 332 u16 res1; 333 u16 iiscon; 334 u16 res2; 335 u16 iismod; 336 u16 res3; 337 u16 iispsr; 338 u16 res4; 339 u16 iisfcon; 340 u16 res5; 341 u16 iisfifo; 342#else /* little endian */ 343 u16 iiscon; 344 u16 res1; 345 u16 iismod; 346 u16 res2; 347 u16 iispsr; 348 u16 res3; 349 u16 iisfcon; 350 u16 res4; 351 u16 iisfifo; 352 u16 res5; 353#endif 354}; 355 356 357/* I/O PORT (see manual chapter 9) */ 358struct s3c24x0_gpio { 359#ifdef CONFIG_S3C2400 360 u32 pacon; 361 u32 padat; 362 363 u32 pbcon; 364 u32 pbdat; 365 u32 pbup; 366 367 u32 pccon; 368 u32 pcdat; 369 u32 pcup; 370 371 u32 pdcon; 372 u32 pddat; 373 u32 pdup; 374 375 u32 pecon; 376 u32 pedat; 377 u32 peup; 378 379 u32 pfcon; 380 u32 pfdat; 381 u32 pfup; 382 383 u32 pgcon; 384 u32 pgdat; 385 u32 pgup; 386 387 u32 opencr; 388 389 u32 misccr; 390 u32 extint; 391#endif 392#ifdef CONFIG_S3C2410 393 u32 gpacon; 394 u32 gpadat; 395 u32 res1[2]; 396 u32 gpbcon; 397 u32 gpbdat; 398 u32 gpbup; 399 u32 res2; 400 u32 gpccon; 401 u32 gpcdat; 402 u32 gpcup; 403 u32 res3; 404 u32 gpdcon; 405 u32 gpddat; 406 u32 gpdup; 407 u32 res4; 408 u32 gpecon; 409 u32 gpedat; 410 u32 gpeup; 411 u32 res5; 412 u32 gpfcon; 413 u32 gpfdat; 414 u32 gpfup; 415 u32 res6; 416 u32 gpgcon; 417 u32 gpgdat; 418 u32 gpgup; 419 u32 res7; 420 u32 gphcon; 421 u32 gphdat; 422 u32 gphup; 423 u32 res8; 424 425 u32 misccr; 426 u32 dclkcon; 427 u32 extint0; 428 u32 extint1; 429 u32 extint2; 430 u32 eintflt0; 431 u32 eintflt1; 432 u32 eintflt2; 433 u32 eintflt3; 434 u32 eintmask; 435 u32 eintpend; 436 u32 gstatus0; 437 u32 gstatus1; 438 u32 gstatus2; 439 u32 gstatus3; 440 u32 gstatus4; 441#endif 442#if defined(CONFIG_S3C2440) 443 u32 gpacon; 444 u32 gpadat; 445 u32 res1[2]; 446 u32 gpbcon; 447 u32 gpbdat; 448 u32 gpbup; 449 u32 res2; 450 u32 gpccon; 451 u32 gpcdat; 452 u32 gpcup; 453 u32 res3; 454 u32 gpdcon; 455 u32 gpddat; 456 u32 gpdup; 457 u32 res4; 458 u32 gpecon; 459 u32 gpedat; 460 u32 gpeup; 461 u32 res5; 462 u32 gpfcon; 463 u32 gpfdat; 464 u32 gpfup; 465 u32 res6; 466 u32 gpgcon; 467 u32 gpgdat; 468 u32 gpgup; 469 u32 res7; 470 u32 gphcon; 471 u32 gphdat; 472 u32 gphup; 473 u32 res8; 474 475 u32 misccr; 476 u32 dclkcon; 477 u32 extint0; 478 u32 extint1; 479 u32 extint2; 480 u32 eintflt0; 481 u32 eintflt1; 482 u32 eintflt2; 483 u32 eintflt3; 484 u32 eintmask; 485 u32 eintpend; 486 u32 gstatus0; 487 u32 gstatus1; 488 u32 gstatus2; 489 u32 gstatus3; 490 u32 gstatus4; 491 492 u32 res9; 493 u32 dsc0; 494 u32 dsc1; 495 u32 mslcon; 496 u32 gpjcon; 497 u32 gpjdat; 498 u32 gpjup; 499 u32 res10; 500#endif 501}; 502 503 504/* RTC (see manual chapter 17) */ 505struct s3c24x0_rtc { 506#ifdef __BIG_ENDIAN 507 u8 res1[67]; 508 u8 rtccon; 509 u8 res2[3]; 510 u8 ticnt; 511 u8 res3[11]; 512 u8 rtcalm; 513 u8 res4[3]; 514 u8 almsec; 515 u8 res5[3]; 516 u8 almmin; 517 u8 res6[3]; 518 u8 almhour; 519 u8 res7[3]; 520 u8 almdate; 521 u8 res8[3]; 522 u8 almmon; 523 u8 res9[3]; 524 u8 almyear; 525 u8 res10[3]; 526 u8 rtcrst; 527 u8 res11[3]; 528 u8 bcdsec; 529 u8 res12[3]; 530 u8 bcdmin; 531 u8 res13[3]; 532 u8 bcdhour; 533 u8 res14[3]; 534 u8 bcddate; 535 u8 res15[3]; 536 u8 bcdday; 537 u8 res16[3]; 538 u8 bcdmon; 539 u8 res17[3]; 540 u8 bcdyear; 541#else /* little endian */ 542 u8 res0[64]; 543 u8 rtccon; 544 u8 res1[3]; 545 u8 ticnt; 546 u8 res2[11]; 547 u8 rtcalm; 548 u8 res3[3]; 549 u8 almsec; 550 u8 res4[3]; 551 u8 almmin; 552 u8 res5[3]; 553 u8 almhour; 554 u8 res6[3]; 555 u8 almdate; 556 u8 res7[3]; 557 u8 almmon; 558 u8 res8[3]; 559 u8 almyear; 560 u8 res9[3]; 561 u8 rtcrst; 562 u8 res10[3]; 563 u8 bcdsec; 564 u8 res11[3]; 565 u8 bcdmin; 566 u8 res12[3]; 567 u8 bcdhour; 568 u8 res13[3]; 569 u8 bcddate; 570 u8 res14[3]; 571 u8 bcdday; 572 u8 res15[3]; 573 u8 bcdmon; 574 u8 res16[3]; 575 u8 bcdyear; 576 u8 res17[3]; 577#endif 578}; 579 580 581/* ADC (see manual chapter 16) */ 582struct s3c2400_adc { 583 u32 adccon; 584 u32 adcdat; 585}; 586 587 588/* ADC (see manual chapter 16) */ 589struct s3c2410_adc { 590 u32 adccon; 591 u32 adctsc; 592 u32 adcdly; 593 u32 adcdat0; 594 u32 adcdat1; 595}; 596 597 598/* SPI (see manual chapter 22) */ 599struct s3c24x0_spi_channel { 600 u8 spcon; 601 u8 res1[3]; 602 u8 spsta; 603 u8 res2[3]; 604 u8 sppin; 605 u8 res3[3]; 606 u8 sppre; 607 u8 res4[3]; 608 u8 sptdat; 609 u8 res5[3]; 610 u8 sprdat; 611 u8 res6[3]; 612 u8 res7[16]; 613}; 614 615struct s3c24x0_spi { 616 struct s3c24x0_spi_channel ch[S3C24X0_SPI_CHANNELS]; 617}; 618 619 620/* MMC INTERFACE (see S3C2400 manual chapter 19) */ 621struct s3c2400_mmc { 622#ifdef __BIG_ENDIAN 623 u8 res1[3]; 624 u8 mmcon; 625 u8 res2[3]; 626 u8 mmcrr; 627 u8 res3[3]; 628 u8 mmfcon; 629 u8 res4[3]; 630 u8 mmsta; 631 u16 res5; 632 u16 mmfsta; 633 u8 res6[3]; 634 u8 mmpre; 635 u16 res7; 636 u16 mmlen; 637 u8 res8[3]; 638 u8 mmcr7; 639 u32 mmrsp[4]; 640 u8 res9[3]; 641 u8 mmcmd0; 642 u32 mmcmd1; 643 u16 res10; 644 u16 mmcr16; 645 u8 res11[3]; 646 u8 mmdat; 647#else 648 u8 mmcon; 649 u8 res1[3]; 650 u8 mmcrr; 651 u8 res2[3]; 652 u8 mmfcon; 653 u8 res3[3]; 654 u8 mmsta; 655 u8 res4[3]; 656 u16 mmfsta; 657 u16 res5; 658 u8 mmpre; 659 u8 res6[3]; 660 u16 mmlen; 661 u16 res7; 662 u8 mmcr7; 663 u8 res8[3]; 664 u32 mmrsp[4]; 665 u8 mmcmd0; 666 u8 res9[3]; 667 u32 mmcmd1; 668 u16 mmcr16; 669 u16 res10; 670 u8 mmdat; 671 u8 res11[3]; 672#endif 673}; 674 675 676/* SD INTERFACE (see S3C2410 manual chapter 19) */ 677struct s3c24x0_sdi { 678 u32 sdicon; 679 u32 sdipre; 680 u32 sdicarg; 681 u32 sdiccon; 682 u32 sdicsta; 683 u32 sdirsp0; 684 u32 sdirsp1; 685 u32 sdirsp2; 686 u32 sdirsp3; 687 u32 sdidtimer; 688 u32 sdibsize; 689 u32 sdidcon; 690 u32 sdidcnt; 691 u32 sdidsta; 692 u32 sdifsta; 693#ifdef CONFIG_S3C2410 694 u32 sdidat; 695 u32 sdiimsk; 696#else 697 u32 sdiimsk; 698 u32 sdidat; 699#endif 700}; 701 702#ifdef CONFIG_CMD_MMC 703#include <mmc.h> 704int s3cmmc_initialize(bd_t *bis, int (*getcd)(struct mmc *), 705 int (*getwp)(struct mmc *)); 706#endif 707 708#endif /*__S3C24X0_H__*/ 709