1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * (C) Copyright 2009 Samsung Electronics 4 * Minkyu Kang <mk7.kang@samsung.com> 5 */ 6 7 #ifndef __ASM_ARCH_GPIO_H 8 #define __ASM_ARCH_GPIO_H 9 10 #ifndef __ASSEMBLY__ 11 struct s5p_gpio_bank { 12 unsigned int con; 13 unsigned int dat; 14 unsigned int pull; 15 unsigned int drv; 16 unsigned int pdn_con; 17 unsigned int pdn_pull; 18 unsigned char res1[8]; 19 }; 20 21 /* A list of valid GPIO numbers for the asm-generic/gpio.h interface */ 22 enum s5pc100_gpio_pin { 23 S5PC100_GPIO_A00, 24 S5PC100_GPIO_A01, 25 S5PC100_GPIO_A02, 26 S5PC100_GPIO_A03, 27 S5PC100_GPIO_A04, 28 S5PC100_GPIO_A05, 29 S5PC100_GPIO_A06, 30 S5PC100_GPIO_A07, 31 S5PC100_GPIO_A10, 32 S5PC100_GPIO_A11, 33 S5PC100_GPIO_A12, 34 S5PC100_GPIO_A13, 35 S5PC100_GPIO_A14, 36 S5PC100_GPIO_A15, 37 S5PC100_GPIO_A16, 38 S5PC100_GPIO_A17, 39 S5PC100_GPIO_B0, 40 S5PC100_GPIO_B1, 41 S5PC100_GPIO_B2, 42 S5PC100_GPIO_B3, 43 S5PC100_GPIO_B4, 44 S5PC100_GPIO_B5, 45 S5PC100_GPIO_B6, 46 S5PC100_GPIO_B7, 47 S5PC100_GPIO_C0, 48 S5PC100_GPIO_C1, 49 S5PC100_GPIO_C2, 50 S5PC100_GPIO_C3, 51 S5PC100_GPIO_C4, 52 S5PC100_GPIO_C5, 53 S5PC100_GPIO_C6, 54 S5PC100_GPIO_C7, 55 S5PC100_GPIO_D0, 56 S5PC100_GPIO_D1, 57 S5PC100_GPIO_D2, 58 S5PC100_GPIO_D3, 59 S5PC100_GPIO_D4, 60 S5PC100_GPIO_D5, 61 S5PC100_GPIO_D6, 62 S5PC100_GPIO_D7, 63 S5PC100_GPIO_E00, 64 S5PC100_GPIO_E01, 65 S5PC100_GPIO_E02, 66 S5PC100_GPIO_E03, 67 S5PC100_GPIO_E04, 68 S5PC100_GPIO_E05, 69 S5PC100_GPIO_E06, 70 S5PC100_GPIO_E07, 71 S5PC100_GPIO_E10, 72 S5PC100_GPIO_E11, 73 S5PC100_GPIO_E12, 74 S5PC100_GPIO_E13, 75 S5PC100_GPIO_E14, 76 S5PC100_GPIO_E15, 77 S5PC100_GPIO_E16, 78 S5PC100_GPIO_E17, 79 S5PC100_GPIO_F00, 80 S5PC100_GPIO_F01, 81 S5PC100_GPIO_F02, 82 S5PC100_GPIO_F03, 83 S5PC100_GPIO_F04, 84 S5PC100_GPIO_F05, 85 S5PC100_GPIO_F06, 86 S5PC100_GPIO_F07, 87 S5PC100_GPIO_F10, 88 S5PC100_GPIO_F11, 89 S5PC100_GPIO_F12, 90 S5PC100_GPIO_F13, 91 S5PC100_GPIO_F14, 92 S5PC100_GPIO_F15, 93 S5PC100_GPIO_F16, 94 S5PC100_GPIO_F17, 95 S5PC100_GPIO_F20, 96 S5PC100_GPIO_F21, 97 S5PC100_GPIO_F22, 98 S5PC100_GPIO_F23, 99 S5PC100_GPIO_F24, 100 S5PC100_GPIO_F25, 101 S5PC100_GPIO_F26, 102 S5PC100_GPIO_F27, 103 S5PC100_GPIO_F30, 104 S5PC100_GPIO_F31, 105 S5PC100_GPIO_F32, 106 S5PC100_GPIO_F33, 107 S5PC100_GPIO_F34, 108 S5PC100_GPIO_F35, 109 S5PC100_GPIO_F36, 110 S5PC100_GPIO_F37, 111 S5PC100_GPIO_G00, 112 S5PC100_GPIO_G01, 113 S5PC100_GPIO_G02, 114 S5PC100_GPIO_G03, 115 S5PC100_GPIO_G04, 116 S5PC100_GPIO_G05, 117 S5PC100_GPIO_G06, 118 S5PC100_GPIO_G07, 119 S5PC100_GPIO_G10, 120 S5PC100_GPIO_G11, 121 S5PC100_GPIO_G12, 122 S5PC100_GPIO_G13, 123 S5PC100_GPIO_G14, 124 S5PC100_GPIO_G15, 125 S5PC100_GPIO_G16, 126 S5PC100_GPIO_G17, 127 S5PC100_GPIO_G20, 128 S5PC100_GPIO_G21, 129 S5PC100_GPIO_G22, 130 S5PC100_GPIO_G23, 131 S5PC100_GPIO_G24, 132 S5PC100_GPIO_G25, 133 S5PC100_GPIO_G26, 134 S5PC100_GPIO_G27, 135 S5PC100_GPIO_G30, 136 S5PC100_GPIO_G31, 137 S5PC100_GPIO_G32, 138 S5PC100_GPIO_G33, 139 S5PC100_GPIO_G34, 140 S5PC100_GPIO_G35, 141 S5PC100_GPIO_G36, 142 S5PC100_GPIO_G37, 143 S5PC100_GPIO_I0, 144 S5PC100_GPIO_I1, 145 S5PC100_GPIO_I2, 146 S5PC100_GPIO_I3, 147 S5PC100_GPIO_I4, 148 S5PC100_GPIO_I5, 149 S5PC100_GPIO_I6, 150 S5PC100_GPIO_I7, 151 S5PC100_GPIO_J00, 152 S5PC100_GPIO_J01, 153 S5PC100_GPIO_J02, 154 S5PC100_GPIO_J03, 155 S5PC100_GPIO_J04, 156 S5PC100_GPIO_J05, 157 S5PC100_GPIO_J06, 158 S5PC100_GPIO_J07, 159 S5PC100_GPIO_J10, 160 S5PC100_GPIO_J11, 161 S5PC100_GPIO_J12, 162 S5PC100_GPIO_J13, 163 S5PC100_GPIO_J14, 164 S5PC100_GPIO_J15, 165 S5PC100_GPIO_J16, 166 S5PC100_GPIO_J17, 167 S5PC100_GPIO_J20, 168 S5PC100_GPIO_J21, 169 S5PC100_GPIO_J22, 170 S5PC100_GPIO_J23, 171 S5PC100_GPIO_J24, 172 S5PC100_GPIO_J25, 173 S5PC100_GPIO_J26, 174 S5PC100_GPIO_J27, 175 S5PC100_GPIO_J30, 176 S5PC100_GPIO_J31, 177 S5PC100_GPIO_J32, 178 S5PC100_GPIO_J33, 179 S5PC100_GPIO_J34, 180 S5PC100_GPIO_J35, 181 S5PC100_GPIO_J36, 182 S5PC100_GPIO_J37, 183 S5PC100_GPIO_J40, 184 S5PC100_GPIO_J41, 185 S5PC100_GPIO_J42, 186 S5PC100_GPIO_J43, 187 S5PC100_GPIO_J44, 188 S5PC100_GPIO_J45, 189 S5PC100_GPIO_J46, 190 S5PC100_GPIO_J47, 191 S5PC100_GPIO_K00, 192 S5PC100_GPIO_K01, 193 S5PC100_GPIO_K02, 194 S5PC100_GPIO_K03, 195 S5PC100_GPIO_K04, 196 S5PC100_GPIO_K05, 197 S5PC100_GPIO_K06, 198 S5PC100_GPIO_K07, 199 S5PC100_GPIO_K10, 200 S5PC100_GPIO_K11, 201 S5PC100_GPIO_K12, 202 S5PC100_GPIO_K13, 203 S5PC100_GPIO_K14, 204 S5PC100_GPIO_K15, 205 S5PC100_GPIO_K16, 206 S5PC100_GPIO_K17, 207 S5PC100_GPIO_K20, 208 S5PC100_GPIO_K21, 209 S5PC100_GPIO_K22, 210 S5PC100_GPIO_K23, 211 S5PC100_GPIO_K24, 212 S5PC100_GPIO_K25, 213 S5PC100_GPIO_K26, 214 S5PC100_GPIO_K27, 215 S5PC100_GPIO_K30, 216 S5PC100_GPIO_K31, 217 S5PC100_GPIO_K32, 218 S5PC100_GPIO_K33, 219 S5PC100_GPIO_K34, 220 S5PC100_GPIO_K35, 221 S5PC100_GPIO_K36, 222 S5PC100_GPIO_K37, 223 S5PC100_GPIO_L00, 224 S5PC100_GPIO_L01, 225 S5PC100_GPIO_L02, 226 S5PC100_GPIO_L03, 227 S5PC100_GPIO_L04, 228 S5PC100_GPIO_L05, 229 S5PC100_GPIO_L06, 230 S5PC100_GPIO_L07, 231 S5PC100_GPIO_L10, 232 S5PC100_GPIO_L11, 233 S5PC100_GPIO_L12, 234 S5PC100_GPIO_L13, 235 S5PC100_GPIO_L14, 236 S5PC100_GPIO_L15, 237 S5PC100_GPIO_L16, 238 S5PC100_GPIO_L17, 239 S5PC100_GPIO_L20, 240 S5PC100_GPIO_L21, 241 S5PC100_GPIO_L22, 242 S5PC100_GPIO_L23, 243 S5PC100_GPIO_L24, 244 S5PC100_GPIO_L25, 245 S5PC100_GPIO_L26, 246 S5PC100_GPIO_L27, 247 S5PC100_GPIO_L30, 248 S5PC100_GPIO_L31, 249 S5PC100_GPIO_L32, 250 S5PC100_GPIO_L33, 251 S5PC100_GPIO_L34, 252 S5PC100_GPIO_L35, 253 S5PC100_GPIO_L36, 254 S5PC100_GPIO_L37, 255 S5PC100_GPIO_L40, 256 S5PC100_GPIO_L41, 257 S5PC100_GPIO_L42, 258 S5PC100_GPIO_L43, 259 S5PC100_GPIO_L44, 260 S5PC100_GPIO_L45, 261 S5PC100_GPIO_L46, 262 S5PC100_GPIO_L47, 263 S5PC100_GPIO_H00, 264 S5PC100_GPIO_H01, 265 S5PC100_GPIO_H02, 266 S5PC100_GPIO_H03, 267 S5PC100_GPIO_H04, 268 S5PC100_GPIO_H05, 269 S5PC100_GPIO_H06, 270 S5PC100_GPIO_H07, 271 S5PC100_GPIO_H10, 272 S5PC100_GPIO_H11, 273 S5PC100_GPIO_H12, 274 S5PC100_GPIO_H13, 275 S5PC100_GPIO_H14, 276 S5PC100_GPIO_H15, 277 S5PC100_GPIO_H16, 278 S5PC100_GPIO_H17, 279 S5PC100_GPIO_H20, 280 S5PC100_GPIO_H21, 281 S5PC100_GPIO_H22, 282 S5PC100_GPIO_H23, 283 S5PC100_GPIO_H24, 284 S5PC100_GPIO_H25, 285 S5PC100_GPIO_H26, 286 S5PC100_GPIO_H27, 287 S5PC100_GPIO_H30, 288 S5PC100_GPIO_H31, 289 S5PC100_GPIO_H32, 290 S5PC100_GPIO_H33, 291 S5PC100_GPIO_H34, 292 S5PC100_GPIO_H35, 293 S5PC100_GPIO_H36, 294 S5PC100_GPIO_H37, 295 296 S5PC100_GPIO_MAX_PORT 297 }; 298 299 enum s5pc110_gpio_pin { 300 S5PC110_GPIO_A00, 301 S5PC110_GPIO_A01, 302 S5PC110_GPIO_A02, 303 S5PC110_GPIO_A03, 304 S5PC110_GPIO_A04, 305 S5PC110_GPIO_A05, 306 S5PC110_GPIO_A06, 307 S5PC110_GPIO_A07, 308 S5PC110_GPIO_A10, 309 S5PC110_GPIO_A11, 310 S5PC110_GPIO_A12, 311 S5PC110_GPIO_A13, 312 S5PC110_GPIO_A14, 313 S5PC110_GPIO_A15, 314 S5PC110_GPIO_A16, 315 S5PC110_GPIO_A17, 316 S5PC110_GPIO_B0, 317 S5PC110_GPIO_B1, 318 S5PC110_GPIO_B2, 319 S5PC110_GPIO_B3, 320 S5PC110_GPIO_B4, 321 S5PC110_GPIO_B5, 322 S5PC110_GPIO_B6, 323 S5PC110_GPIO_B7, 324 S5PC110_GPIO_C00, 325 S5PC110_GPIO_C01, 326 S5PC110_GPIO_C02, 327 S5PC110_GPIO_C03, 328 S5PC110_GPIO_C04, 329 S5PC110_GPIO_C05, 330 S5PC110_GPIO_C06, 331 S5PC110_GPIO_C07, 332 S5PC110_GPIO_C10, 333 S5PC110_GPIO_C11, 334 S5PC110_GPIO_C12, 335 S5PC110_GPIO_C13, 336 S5PC110_GPIO_C14, 337 S5PC110_GPIO_C15, 338 S5PC110_GPIO_C16, 339 S5PC110_GPIO_C17, 340 S5PC110_GPIO_D00, 341 S5PC110_GPIO_D01, 342 S5PC110_GPIO_D02, 343 S5PC110_GPIO_D03, 344 S5PC110_GPIO_D04, 345 S5PC110_GPIO_D05, 346 S5PC110_GPIO_D06, 347 S5PC110_GPIO_D07, 348 S5PC110_GPIO_D10, 349 S5PC110_GPIO_D11, 350 S5PC110_GPIO_D12, 351 S5PC110_GPIO_D13, 352 S5PC110_GPIO_D14, 353 S5PC110_GPIO_D15, 354 S5PC110_GPIO_D16, 355 S5PC110_GPIO_D17, 356 S5PC110_GPIO_E00, 357 S5PC110_GPIO_E01, 358 S5PC110_GPIO_E02, 359 S5PC110_GPIO_E03, 360 S5PC110_GPIO_E04, 361 S5PC110_GPIO_E05, 362 S5PC110_GPIO_E06, 363 S5PC110_GPIO_E07, 364 S5PC110_GPIO_E10, 365 S5PC110_GPIO_E11, 366 S5PC110_GPIO_E12, 367 S5PC110_GPIO_E13, 368 S5PC110_GPIO_E14, 369 S5PC110_GPIO_E15, 370 S5PC110_GPIO_E16, 371 S5PC110_GPIO_E17, 372 S5PC110_GPIO_F00, 373 S5PC110_GPIO_F01, 374 S5PC110_GPIO_F02, 375 S5PC110_GPIO_F03, 376 S5PC110_GPIO_F04, 377 S5PC110_GPIO_F05, 378 S5PC110_GPIO_F06, 379 S5PC110_GPIO_F07, 380 S5PC110_GPIO_F10, 381 S5PC110_GPIO_F11, 382 S5PC110_GPIO_F12, 383 S5PC110_GPIO_F13, 384 S5PC110_GPIO_F14, 385 S5PC110_GPIO_F15, 386 S5PC110_GPIO_F16, 387 S5PC110_GPIO_F17, 388 S5PC110_GPIO_F20, 389 S5PC110_GPIO_F21, 390 S5PC110_GPIO_F22, 391 S5PC110_GPIO_F23, 392 S5PC110_GPIO_F24, 393 S5PC110_GPIO_F25, 394 S5PC110_GPIO_F26, 395 S5PC110_GPIO_F27, 396 S5PC110_GPIO_F30, 397 S5PC110_GPIO_F31, 398 S5PC110_GPIO_F32, 399 S5PC110_GPIO_F33, 400 S5PC110_GPIO_F34, 401 S5PC110_GPIO_F35, 402 S5PC110_GPIO_F36, 403 S5PC110_GPIO_F37, 404 S5PC110_GPIO_G00, 405 S5PC110_GPIO_G01, 406 S5PC110_GPIO_G02, 407 S5PC110_GPIO_G03, 408 S5PC110_GPIO_G04, 409 S5PC110_GPIO_G05, 410 S5PC110_GPIO_G06, 411 S5PC110_GPIO_G07, 412 S5PC110_GPIO_G10, 413 S5PC110_GPIO_G11, 414 S5PC110_GPIO_G12, 415 S5PC110_GPIO_G13, 416 S5PC110_GPIO_G14, 417 S5PC110_GPIO_G15, 418 S5PC110_GPIO_G16, 419 S5PC110_GPIO_G17, 420 S5PC110_GPIO_G20, 421 S5PC110_GPIO_G21, 422 S5PC110_GPIO_G22, 423 S5PC110_GPIO_G23, 424 S5PC110_GPIO_G24, 425 S5PC110_GPIO_G25, 426 S5PC110_GPIO_G26, 427 S5PC110_GPIO_G27, 428 S5PC110_GPIO_G30, 429 S5PC110_GPIO_G31, 430 S5PC110_GPIO_G32, 431 S5PC110_GPIO_G33, 432 S5PC110_GPIO_G34, 433 S5PC110_GPIO_G35, 434 S5PC110_GPIO_G36, 435 S5PC110_GPIO_G37, 436 S5PC110_GPIO_I0, 437 S5PC110_GPIO_I1, 438 S5PC110_GPIO_I2, 439 S5PC110_GPIO_I3, 440 S5PC110_GPIO_I4, 441 S5PC110_GPIO_I5, 442 S5PC110_GPIO_I6, 443 S5PC110_GPIO_I7, 444 S5PC110_GPIO_J00, 445 S5PC110_GPIO_J01, 446 S5PC110_GPIO_J02, 447 S5PC110_GPIO_J03, 448 S5PC110_GPIO_J04, 449 S5PC110_GPIO_J05, 450 S5PC110_GPIO_J06, 451 S5PC110_GPIO_J07, 452 S5PC110_GPIO_J10, 453 S5PC110_GPIO_J11, 454 S5PC110_GPIO_J12, 455 S5PC110_GPIO_J13, 456 S5PC110_GPIO_J14, 457 S5PC110_GPIO_J15, 458 S5PC110_GPIO_J16, 459 S5PC110_GPIO_J17, 460 S5PC110_GPIO_J20, 461 S5PC110_GPIO_J21, 462 S5PC110_GPIO_J22, 463 S5PC110_GPIO_J23, 464 S5PC110_GPIO_J24, 465 S5PC110_GPIO_J25, 466 S5PC110_GPIO_J26, 467 S5PC110_GPIO_J27, 468 S5PC110_GPIO_J30, 469 S5PC110_GPIO_J31, 470 S5PC110_GPIO_J32, 471 S5PC110_GPIO_J33, 472 S5PC110_GPIO_J34, 473 S5PC110_GPIO_J35, 474 S5PC110_GPIO_J36, 475 S5PC110_GPIO_J37, 476 S5PC110_GPIO_J40, 477 S5PC110_GPIO_J41, 478 S5PC110_GPIO_J42, 479 S5PC110_GPIO_J43, 480 S5PC110_GPIO_J44, 481 S5PC110_GPIO_J45, 482 S5PC110_GPIO_J46, 483 S5PC110_GPIO_J47, 484 S5PC110_GPIO_MP010, 485 S5PC110_GPIO_MP011, 486 S5PC110_GPIO_MP012, 487 S5PC110_GPIO_MP013, 488 S5PC110_GPIO_MP014, 489 S5PC110_GPIO_MP015, 490 S5PC110_GPIO_MP016, 491 S5PC110_GPIO_MP017, 492 S5PC110_GPIO_MP020, 493 S5PC110_GPIO_MP021, 494 S5PC110_GPIO_MP022, 495 S5PC110_GPIO_MP023, 496 S5PC110_GPIO_MP024, 497 S5PC110_GPIO_MP025, 498 S5PC110_GPIO_MP026, 499 S5PC110_GPIO_MP027, 500 S5PC110_GPIO_MP030, 501 S5PC110_GPIO_MP031, 502 S5PC110_GPIO_MP032, 503 S5PC110_GPIO_MP033, 504 S5PC110_GPIO_MP034, 505 S5PC110_GPIO_MP035, 506 S5PC110_GPIO_MP036, 507 S5PC110_GPIO_MP037, 508 S5PC110_GPIO_MP040, 509 S5PC110_GPIO_MP041, 510 S5PC110_GPIO_MP042, 511 S5PC110_GPIO_MP043, 512 S5PC110_GPIO_MP044, 513 S5PC110_GPIO_MP045, 514 S5PC110_GPIO_MP046, 515 S5PC110_GPIO_MP047, 516 S5PC110_GPIO_MP050, 517 S5PC110_GPIO_MP051, 518 S5PC110_GPIO_MP052, 519 S5PC110_GPIO_MP053, 520 S5PC110_GPIO_MP054, 521 S5PC110_GPIO_MP055, 522 S5PC110_GPIO_MP056, 523 S5PC110_GPIO_MP057, 524 S5PC110_GPIO_MP060, 525 S5PC110_GPIO_MP061, 526 S5PC110_GPIO_MP062, 527 S5PC110_GPIO_MP063, 528 S5PC110_GPIO_MP064, 529 S5PC110_GPIO_MP065, 530 S5PC110_GPIO_MP066, 531 S5PC110_GPIO_MP067, 532 S5PC110_GPIO_MP070, 533 S5PC110_GPIO_MP071, 534 S5PC110_GPIO_MP072, 535 S5PC110_GPIO_MP073, 536 S5PC110_GPIO_MP074, 537 S5PC110_GPIO_MP075, 538 S5PC110_GPIO_MP076, 539 S5PC110_GPIO_MP077, 540 S5PC110_GPIO_MP100, 541 S5PC110_GPIO_MP101, 542 S5PC110_GPIO_MP102, 543 S5PC110_GPIO_MP103, 544 S5PC110_GPIO_MP104, 545 S5PC110_GPIO_MP105, 546 S5PC110_GPIO_MP106, 547 S5PC110_GPIO_MP107, 548 S5PC110_GPIO_MP110, 549 S5PC110_GPIO_MP111, 550 S5PC110_GPIO_MP112, 551 S5PC110_GPIO_MP113, 552 S5PC110_GPIO_MP114, 553 S5PC110_GPIO_MP115, 554 S5PC110_GPIO_MP116, 555 S5PC110_GPIO_MP117, 556 S5PC110_GPIO_MP120, 557 S5PC110_GPIO_MP121, 558 S5PC110_GPIO_MP122, 559 S5PC110_GPIO_MP123, 560 S5PC110_GPIO_MP124, 561 S5PC110_GPIO_MP125, 562 S5PC110_GPIO_MP126, 563 S5PC110_GPIO_MP127, 564 S5PC110_GPIO_MP130, 565 S5PC110_GPIO_MP131, 566 S5PC110_GPIO_MP132, 567 S5PC110_GPIO_MP133, 568 S5PC110_GPIO_MP134, 569 S5PC110_GPIO_MP135, 570 S5PC110_GPIO_MP136, 571 S5PC110_GPIO_MP137, 572 S5PC110_GPIO_MP140, 573 S5PC110_GPIO_MP141, 574 S5PC110_GPIO_MP142, 575 S5PC110_GPIO_MP143, 576 S5PC110_GPIO_MP144, 577 S5PC110_GPIO_MP145, 578 S5PC110_GPIO_MP146, 579 S5PC110_GPIO_MP147, 580 S5PC110_GPIO_MP150, 581 S5PC110_GPIO_MP151, 582 S5PC110_GPIO_MP152, 583 S5PC110_GPIO_MP153, 584 S5PC110_GPIO_MP154, 585 S5PC110_GPIO_MP155, 586 S5PC110_GPIO_MP156, 587 S5PC110_GPIO_MP157, 588 S5PC110_GPIO_MP160, 589 S5PC110_GPIO_MP161, 590 S5PC110_GPIO_MP162, 591 S5PC110_GPIO_MP163, 592 S5PC110_GPIO_MP164, 593 S5PC110_GPIO_MP165, 594 S5PC110_GPIO_MP166, 595 S5PC110_GPIO_MP167, 596 S5PC110_GPIO_MP170, 597 S5PC110_GPIO_MP171, 598 S5PC110_GPIO_MP172, 599 S5PC110_GPIO_MP173, 600 S5PC110_GPIO_MP174, 601 S5PC110_GPIO_MP175, 602 S5PC110_GPIO_MP176, 603 S5PC110_GPIO_MP177, 604 S5PC110_GPIO_MP180, 605 S5PC110_GPIO_MP181, 606 S5PC110_GPIO_MP182, 607 S5PC110_GPIO_MP183, 608 S5PC110_GPIO_MP184, 609 S5PC110_GPIO_MP185, 610 S5PC110_GPIO_MP186, 611 S5PC110_GPIO_MP187, 612 S5PC110_GPIO_MP200, 613 S5PC110_GPIO_MP201, 614 S5PC110_GPIO_MP202, 615 S5PC110_GPIO_MP203, 616 S5PC110_GPIO_MP204, 617 S5PC110_GPIO_MP205, 618 S5PC110_GPIO_MP206, 619 S5PC110_GPIO_MP207, 620 S5PC110_GPIO_MP210, 621 S5PC110_GPIO_MP211, 622 S5PC110_GPIO_MP212, 623 S5PC110_GPIO_MP213, 624 S5PC110_GPIO_MP214, 625 S5PC110_GPIO_MP215, 626 S5PC110_GPIO_MP216, 627 S5PC110_GPIO_MP217, 628 S5PC110_GPIO_MP220, 629 S5PC110_GPIO_MP221, 630 S5PC110_GPIO_MP222, 631 S5PC110_GPIO_MP223, 632 S5PC110_GPIO_MP224, 633 S5PC110_GPIO_MP225, 634 S5PC110_GPIO_MP226, 635 S5PC110_GPIO_MP227, 636 S5PC110_GPIO_MP230, 637 S5PC110_GPIO_MP231, 638 S5PC110_GPIO_MP232, 639 S5PC110_GPIO_MP233, 640 S5PC110_GPIO_MP234, 641 S5PC110_GPIO_MP235, 642 S5PC110_GPIO_MP236, 643 S5PC110_GPIO_MP237, 644 S5PC110_GPIO_MP240, 645 S5PC110_GPIO_MP241, 646 S5PC110_GPIO_MP242, 647 S5PC110_GPIO_MP243, 648 S5PC110_GPIO_MP244, 649 S5PC110_GPIO_MP245, 650 S5PC110_GPIO_MP246, 651 S5PC110_GPIO_MP247, 652 S5PC110_GPIO_MP250, 653 S5PC110_GPIO_MP251, 654 S5PC110_GPIO_MP252, 655 S5PC110_GPIO_MP253, 656 S5PC110_GPIO_MP254, 657 S5PC110_GPIO_MP255, 658 S5PC110_GPIO_MP256, 659 S5PC110_GPIO_MP257, 660 S5PC110_GPIO_MP260, 661 S5PC110_GPIO_MP261, 662 S5PC110_GPIO_MP262, 663 S5PC110_GPIO_MP263, 664 S5PC110_GPIO_MP264, 665 S5PC110_GPIO_MP265, 666 S5PC110_GPIO_MP266, 667 S5PC110_GPIO_MP267, 668 S5PC110_GPIO_MP270, 669 S5PC110_GPIO_MP271, 670 S5PC110_GPIO_MP272, 671 S5PC110_GPIO_MP273, 672 S5PC110_GPIO_MP274, 673 S5PC110_GPIO_MP275, 674 S5PC110_GPIO_MP276, 675 S5PC110_GPIO_MP277, 676 S5PC110_GPIO_MP280, 677 S5PC110_GPIO_MP281, 678 S5PC110_GPIO_MP282, 679 S5PC110_GPIO_MP283, 680 S5PC110_GPIO_MP284, 681 S5PC110_GPIO_MP285, 682 S5PC110_GPIO_MP286, 683 S5PC110_GPIO_MP287, 684 S5PC110_GPIO_H00, 685 S5PC110_GPIO_H01, 686 S5PC110_GPIO_H02, 687 S5PC110_GPIO_H03, 688 S5PC110_GPIO_H04, 689 S5PC110_GPIO_H05, 690 S5PC110_GPIO_H06, 691 S5PC110_GPIO_H07, 692 S5PC110_GPIO_H10, 693 S5PC110_GPIO_H11, 694 S5PC110_GPIO_H12, 695 S5PC110_GPIO_H13, 696 S5PC110_GPIO_H14, 697 S5PC110_GPIO_H15, 698 S5PC110_GPIO_H16, 699 S5PC110_GPIO_H17, 700 S5PC110_GPIO_H20, 701 S5PC110_GPIO_H21, 702 S5PC110_GPIO_H22, 703 S5PC110_GPIO_H23, 704 S5PC110_GPIO_H24, 705 S5PC110_GPIO_H25, 706 S5PC110_GPIO_H26, 707 S5PC110_GPIO_H27, 708 S5PC110_GPIO_H30, 709 S5PC110_GPIO_H31, 710 S5PC110_GPIO_H32, 711 S5PC110_GPIO_H33, 712 S5PC110_GPIO_H34, 713 S5PC110_GPIO_H35, 714 S5PC110_GPIO_H36, 715 S5PC110_GPIO_H37, 716 717 S5PC110_GPIO_MAX_PORT 718 }; 719 720 struct gpio_info { 721 unsigned int reg_addr; /* Address of register for this part */ 722 unsigned int max_gpio; /* Maximum GPIO in this part */ 723 }; 724 725 #define S5PC100_GPIO_NUM_PARTS 1 726 static struct gpio_info s5pc100_gpio_data[S5PC100_GPIO_NUM_PARTS] = { 727 { S5PC100_GPIO_BASE, S5PC100_GPIO_MAX_PORT }, 728 }; 729 730 #define S5PC110_GPIO_NUM_PARTS 1 731 static struct gpio_info s5pc110_gpio_data[S5PC110_GPIO_NUM_PARTS] = { 732 { S5PC110_GPIO_BASE, S5PC110_GPIO_MAX_PORT }, 733 }; 734 735 static inline struct gpio_info *get_gpio_data(void) 736 { 737 if (cpu_is_s5pc100()) 738 return s5pc100_gpio_data; 739 else if (cpu_is_s5pc110()) 740 return s5pc110_gpio_data; 741 742 return NULL; 743 } 744 745 static inline unsigned int get_bank_num(void) 746 { 747 if (cpu_is_s5pc100()) 748 return S5PC100_GPIO_NUM_PARTS; 749 else if (cpu_is_s5pc110()) 750 return S5PC110_GPIO_NUM_PARTS; 751 752 return 0; 753 } 754 755 /* 756 * This structure helps mapping symbolic GPIO names into indices from 757 * exynos5_gpio_pin/exynos5420_gpio_pin enums. 758 * 759 * By convention, symbolic GPIO name is defined as follows: 760 * 761 * g[p]<bank><set><bit>, where 762 * p is optional 763 * <bank> - a single character bank name, as defined by the SOC 764 * <set> - a single digit set number 765 * <bit> - bit number within the set (in 0..7 range). 766 * 767 * <set><bit> essentially form an octal number of the GPIO pin within the bank 768 * space. On the 5420 architecture some banks' sets do not start not from zero 769 * ('d' starts from 1 and 'j' starts from 4). To compensate for that and 770 * maintain flat number space withoout holes, those banks use offsets to be 771 * deducted from the pin number. 772 */ 773 struct gpio_name_num_table { 774 char bank; /* bank name symbol */ 775 u8 bank_size; /* total number of pins in the bank */ 776 char bank_offset; /* offset of the first bank's pin */ 777 unsigned int base; /* index of the first bank's pin in the enum */ 778 }; 779 780 #define GPIO_PER_BANK 8 781 #define GPIO_ENTRY(name, base, top, offset) { name, top - base, offset, base } 782 static const struct gpio_name_num_table s5pc100_gpio_table[] = { 783 GPIO_ENTRY('a', S5PC100_GPIO_A00, S5PC100_GPIO_B0, 0), 784 GPIO_ENTRY('b', S5PC100_GPIO_B0, S5PC100_GPIO_C0, 0), 785 GPIO_ENTRY('c', S5PC100_GPIO_C0, S5PC100_GPIO_D0, 0), 786 GPIO_ENTRY('d', S5PC100_GPIO_D0, S5PC100_GPIO_E00, 0), 787 GPIO_ENTRY('e', S5PC100_GPIO_E00, S5PC100_GPIO_F00, 0), 788 GPIO_ENTRY('f', S5PC100_GPIO_F00, S5PC100_GPIO_G00, 0), 789 GPIO_ENTRY('g', S5PC100_GPIO_G00, S5PC100_GPIO_I0, 0), 790 GPIO_ENTRY('i', S5PC100_GPIO_I0, S5PC100_GPIO_J00, 0), 791 GPIO_ENTRY('j', S5PC100_GPIO_J00, S5PC100_GPIO_K00, 0), 792 GPIO_ENTRY('k', S5PC100_GPIO_K00, S5PC100_GPIO_L00, 0), 793 GPIO_ENTRY('l', S5PC100_GPIO_L00, S5PC100_GPIO_H00, 0), 794 GPIO_ENTRY('h', S5PC100_GPIO_H00, S5PC100_GPIO_MAX_PORT, 0), 795 { 0 } 796 }; 797 798 static const struct gpio_name_num_table s5pc110_gpio_table[] = { 799 GPIO_ENTRY('a', S5PC110_GPIO_A00, S5PC110_GPIO_B0, 0), 800 GPIO_ENTRY('b', S5PC110_GPIO_B0, S5PC110_GPIO_C00, 0), 801 GPIO_ENTRY('c', S5PC110_GPIO_C00, S5PC110_GPIO_D00, 0), 802 GPIO_ENTRY('d', S5PC110_GPIO_D00, S5PC110_GPIO_E00, 0), 803 GPIO_ENTRY('e', S5PC110_GPIO_E00, S5PC110_GPIO_F00, 0), 804 GPIO_ENTRY('f', S5PC110_GPIO_F00, S5PC110_GPIO_G00, 0), 805 GPIO_ENTRY('g', S5PC110_GPIO_G00, S5PC110_GPIO_I0, 0), 806 GPIO_ENTRY('i', S5PC110_GPIO_I0, S5PC110_GPIO_J00, 0), 807 GPIO_ENTRY('j', S5PC110_GPIO_J00, S5PC110_GPIO_MP010, 0), 808 GPIO_ENTRY('h', S5PC110_GPIO_H00, S5PC110_GPIO_MAX_PORT, 0), 809 { 0 } 810 }; 811 812 /* functions */ 813 void gpio_cfg_pin(int gpio, int cfg); 814 void gpio_set_pull(int gpio, int mode); 815 void gpio_set_drv(int gpio, int mode); 816 void gpio_set_rate(int gpio, int mode); 817 int s5p_gpio_get_pin(unsigned gpio); 818 819 /* GPIO pins per bank */ 820 #define GPIO_PER_BANK 8 821 #endif 822 823 /* Pin configurations */ 824 #define S5P_GPIO_INPUT 0x0 825 #define S5P_GPIO_OUTPUT 0x1 826 #define S5P_GPIO_IRQ 0xf 827 #define S5P_GPIO_FUNC(x) (x) 828 829 /* Pull mode */ 830 #define S5P_GPIO_PULL_NONE 0x0 831 #define S5P_GPIO_PULL_DOWN 0x1 832 #define S5P_GPIO_PULL_UP 0x2 833 834 /* Drive Strength level */ 835 #define S5P_GPIO_DRV_1X 0x0 836 #define S5P_GPIO_DRV_3X 0x1 837 #define S5P_GPIO_DRV_2X 0x2 838 #define S5P_GPIO_DRV_4X 0x3 839 #define S5P_GPIO_DRV_FAST 0x0 840 #define S5P_GPIO_DRV_SLOW 0x1 841 842 #endif 843