diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2018-09-28 11:58:52 -0400 |
|---|---|---|
| committer | Arnd Bergmann <arnd@arndb.de> | 2018-09-28 11:59:19 -0400 |
| commit | e6ff514e27b859e36305629698f233f1dfe641ef (patch) | |
| tree | e930e29d0b4b50f9615b3af600f8d83eea4f91c7 | |
| parent | 3a60f1182bce850c2f12343a78e157d40af7b1a0 (diff) | |
| parent | 1137ceee76ba8b8c698e11b7150e35524f071bda (diff) | |
Merge tag 'omap-for-v4.20/omap1-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/soc
A series of omap1 gpio changes for ams-delta
Janusz Krzysztofik has cleaned up ams-delta gpio usage along with
generic gpio framework improvments. This series contains the omap1
specific clean-up for ams-delta modem and unused gpios.
Note that this conflicts with the gpio-omap changes queued into
an immutable gpio branch ib-omap for the gpio-omap.h header file.
The merge resolution is to drop the IS_BUILTIN(CONFIG_GPIO_OMAP)
section and keep the #endif tagged for __ASSEMBLER__.
* tag 'omap-for-v4.20/omap1-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
ARM: OMAP1: ams-delta: Don't request unused GPIOs
ARM: OMAP1: ams-delta-fiq: Use <linux/platform_data/gpio-omap.h>
ARM: OMAP1: ams-delta: register MODEM device earlier
ARM: OMAP1: ams-delta: initialize latch2 pins to safe values
ARM: OMAP1: ams-delta: assign MODEM IRQ from GPIO descriptor
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
| -rw-r--r-- | arch/arm/mach-omap1/ams-delta-fiq-handler.S | 12 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/board-ams-delta.c | 161 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/include/mach/board-ams-delta.h | 7 | ||||
| -rw-r--r-- | include/linux/platform_data/gpio-omap.h | 4 |
4 files changed, 96 insertions, 88 deletions
diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S index ddc27638ba2a..e3faa0274b56 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S +++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | #include <linux/linkage.h> | 16 | #include <linux/linkage.h> |
| 17 | #include <linux/platform_data/ams-delta-fiq.h> | 17 | #include <linux/platform_data/ams-delta-fiq.h> |
| 18 | #include <linux/platform_data/gpio-omap.h> | ||
| 18 | 19 | ||
| 19 | #include <asm/assembler.h> | 20 | #include <asm/assembler.h> |
| 20 | #include <mach/board-ams-delta.h> | 21 | #include <mach/board-ams-delta.h> |
| @@ -24,17 +25,10 @@ | |||
| 24 | #include "soc.h" | 25 | #include "soc.h" |
| 25 | 26 | ||
| 26 | /* | 27 | /* |
| 27 | * GPIO related definitions, copied from arch/arm/plat-omap/gpio.c. | 28 | * OMAP1510 GPIO related symbol copied from arch/arm/mach-omap1/gpio15xx.c. |
| 28 | * Unfortunately, those were not placed in a separate header file. | 29 | * Unfortunately, it was not placed in a separate header file. |
| 29 | */ | 30 | */ |
| 30 | #define OMAP1510_GPIO_BASE 0xFFFCE000 | 31 | #define OMAP1510_GPIO_BASE 0xFFFCE000 |
| 31 | #define OMAP1510_GPIO_DATA_INPUT 0x00 | ||
| 32 | #define OMAP1510_GPIO_DATA_OUTPUT 0x04 | ||
| 33 | #define OMAP1510_GPIO_DIR_CONTROL 0x08 | ||
| 34 | #define OMAP1510_GPIO_INT_CONTROL 0x0c | ||
| 35 | #define OMAP1510_GPIO_INT_MASK 0x10 | ||
| 36 | #define OMAP1510_GPIO_INT_STATUS 0x14 | ||
| 37 | #define OMAP1510_GPIO_PIN_CONTROL 0x18 | ||
| 38 | 32 | ||
| 39 | /* GPIO register bitmasks */ | 33 | /* GPIO register bitmasks */ |
| 40 | #define KEYBRD_DATA_MASK (0x1 << AMS_DELTA_GPIO_PIN_KEYBRD_DATA) | 34 | #define KEYBRD_DATA_MASK (0x1 << AMS_DELTA_GPIO_PIN_KEYBRD_DATA) |
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index dd28d2614d7f..318925ae3ebe 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c | |||
| @@ -250,39 +250,6 @@ static struct platform_device latch2_gpio_device = { | |||
| 250 | #define LATCH2_PIN_HOOKFLASH1 14 | 250 | #define LATCH2_PIN_HOOKFLASH1 14 |
| 251 | #define LATCH2_PIN_HOOKFLASH2 15 | 251 | #define LATCH2_PIN_HOOKFLASH2 15 |
| 252 | 252 | ||
| 253 | static const struct gpio latch_gpios[] __initconst = { | ||
| 254 | { | ||
| 255 | .gpio = LATCH1_GPIO_BASE + 6, | ||
| 256 | .flags = GPIOF_OUT_INIT_LOW, | ||
| 257 | .label = "dockit1", | ||
| 258 | }, | ||
| 259 | { | ||
| 260 | .gpio = LATCH1_GPIO_BASE + 7, | ||
| 261 | .flags = GPIOF_OUT_INIT_LOW, | ||
| 262 | .label = "dockit2", | ||
| 263 | }, | ||
| 264 | { | ||
| 265 | .gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN, | ||
| 266 | .flags = GPIOF_OUT_INIT_LOW, | ||
| 267 | .label = "scard_rstin", | ||
| 268 | }, | ||
| 269 | { | ||
| 270 | .gpio = AMS_DELTA_GPIO_PIN_SCARD_CMDVCC, | ||
| 271 | .flags = GPIOF_OUT_INIT_LOW, | ||
| 272 | .label = "scard_cmdvcc", | ||
| 273 | }, | ||
| 274 | { | ||
| 275 | .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 14, | ||
| 276 | .flags = GPIOF_OUT_INIT_LOW, | ||
| 277 | .label = "hookflash1", | ||
| 278 | }, | ||
| 279 | { | ||
| 280 | .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 15, | ||
| 281 | .flags = GPIOF_OUT_INIT_LOW, | ||
| 282 | .label = "hookflash2", | ||
| 283 | }, | ||
| 284 | }; | ||
| 285 | |||
| 286 | static struct regulator_consumer_supply modem_nreset_consumers[] = { | 253 | static struct regulator_consumer_supply modem_nreset_consumers[] = { |
| 287 | REGULATOR_SUPPLY("RESET#", "serial8250.1"), | 254 | REGULATOR_SUPPLY("RESET#", "serial8250.1"), |
| 288 | REGULATOR_SUPPLY("POR", "cx20442-codec"), | 255 | REGULATOR_SUPPLY("POR", "cx20442-codec"), |
| @@ -321,20 +288,6 @@ struct modem_private_data { | |||
| 321 | 288 | ||
| 322 | static struct modem_private_data modem_priv; | 289 | static struct modem_private_data modem_priv; |
| 323 | 290 | ||
| 324 | void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) | ||
| 325 | { | ||
| 326 | int bit = 0; | ||
| 327 | u16 bitpos = 1 << bit; | ||
| 328 | |||
| 329 | for (; bit < ngpio; bit++, bitpos = bitpos << 1) { | ||
| 330 | if (!(mask & bitpos)) | ||
| 331 | continue; | ||
| 332 | else | ||
| 333 | gpio_set_value(base + bit, (value & bitpos) != 0); | ||
| 334 | } | ||
| 335 | } | ||
| 336 | EXPORT_SYMBOL(ams_delta_latch_write); | ||
| 337 | |||
| 338 | static struct resource ams_delta_nand_resources[] = { | 291 | static struct resource ams_delta_nand_resources[] = { |
| 339 | [0] = { | 292 | [0] = { |
| 340 | .start = OMAP1_MPUIO_BASE, | 293 | .start = OMAP1_MPUIO_BASE, |
| @@ -630,6 +583,28 @@ static struct gpiod_hog ams_delta_gpio_hogs[] = { | |||
| 630 | {}, | 583 | {}, |
| 631 | }; | 584 | }; |
| 632 | 585 | ||
| 586 | static struct plat_serial8250_port ams_delta_modem_ports[]; | ||
| 587 | |||
| 588 | /* | ||
| 589 | * Obtain MODEM IRQ GPIO descriptor using its hardware pin | ||
| 590 | * number and assign related IRQ number to the MODEM port. | ||
| 591 | * Keep the GPIO descriptor open so nobody steps in. | ||
| 592 | */ | ||
| 593 | static void __init modem_assign_irq(struct gpio_chip *chip) | ||
| 594 | { | ||
| 595 | struct gpio_desc *gpiod; | ||
| 596 | |||
| 597 | gpiod = gpiochip_request_own_desc(chip, AMS_DELTA_GPIO_PIN_MODEM_IRQ, | ||
| 598 | "modem_irq"); | ||
| 599 | if (IS_ERR(gpiod)) { | ||
| 600 | pr_err("%s: modem IRQ GPIO request failed (%ld)\n", __func__, | ||
| 601 | PTR_ERR(gpiod)); | ||
| 602 | } else { | ||
| 603 | gpiod_direction_input(gpiod); | ||
| 604 | ams_delta_modem_ports[0].irq = gpiod_to_irq(gpiod); | ||
| 605 | } | ||
| 606 | } | ||
| 607 | |||
| 633 | /* | 608 | /* |
| 634 | * The purpose of this function is to take care of proper initialization of | 609 | * The purpose of this function is to take care of proper initialization of |
| 635 | * devices and data structures which depend on GPIO lines provided by OMAP GPIO | 610 | * devices and data structures which depend on GPIO lines provided by OMAP GPIO |
| @@ -649,7 +624,47 @@ static void __init omap_gpio_deps_init(void) | |||
| 649 | return; | 624 | return; |
| 650 | } | 625 | } |
| 651 | 626 | ||
| 627 | /* | ||
| 628 | * Start with FIQ initialization as it may have to request | ||
| 629 | * and release successfully each OMAP GPIO pin in turn. | ||
| 630 | */ | ||
| 652 | ams_delta_init_fiq(chip, &ams_delta_serio_device); | 631 | ams_delta_init_fiq(chip, &ams_delta_serio_device); |
| 632 | |||
| 633 | modem_assign_irq(chip); | ||
| 634 | } | ||
| 635 | |||
| 636 | /* | ||
| 637 | * Initialize latch2 pins with values which are safe for dependent on-board | ||
| 638 | * devices or useful for their successull initialization even before GPIO | ||
| 639 | * driver takes control over the latch pins: | ||
| 640 | * - LATCH2_PIN_LCD_VBLEN = 0 | ||
| 641 | * - LATCH2_PIN_LCD_NDISP = 0 Keep LCD device powered off before its | ||
| 642 | * driver takes control over it. | ||
| 643 | * - LATCH2_PIN_NAND_NCE = 0 | ||
| 644 | * - LATCH2_PIN_NAND_NWP = 0 Keep NAND device down and write- | ||
| 645 | * protected before its driver takes | ||
| 646 | * control over it. | ||
| 647 | * - LATCH2_PIN_KEYBRD_PWR = 0 Keep keyboard powered off before serio | ||
| 648 | * driver takes control over it. | ||
| 649 | * - LATCH2_PIN_KEYBRD_DATAOUT = 0 Keep low to avoid corruption of first | ||
| 650 | * byte of data received from attached | ||
| 651 | * keyboard when serio device is probed; | ||
| 652 | * the pin is also hogged low by the latch2 | ||
| 653 | * GPIO driver as soon as it is ready. | ||
| 654 | * - LATCH2_PIN_MODEM_NRESET = 1 Enable voice MODEM device, allowing for | ||
| 655 | * its successful probe even before a | ||
| 656 | * regulator it depends on, which in turn | ||
| 657 | * takes control over the pin, is set up. | ||
| 658 | * - LATCH2_PIN_MODEM_CODEC = 1 Attach voice MODEM CODEC data port | ||
| 659 | * to the MODEM so the CODEC is under | ||
| 660 | * control even if audio driver doesn't | ||
| 661 | * take it over. | ||
| 662 | */ | ||
| 663 | static void __init ams_delta_latch2_init(void) | ||
| 664 | { | ||
| 665 | u16 latch2 = 1 << LATCH2_PIN_MODEM_NRESET | 1 << LATCH2_PIN_MODEM_CODEC; | ||
| 666 | |||
| 667 | __raw_writew(latch2, LATCH2_VIRT); | ||
| 653 | } | 668 | } |
| 654 | 669 | ||
| 655 | static void __init ams_delta_init(void) | 670 | static void __init ams_delta_init(void) |
| @@ -673,6 +688,7 @@ static void __init ams_delta_init(void) | |||
| 673 | omap_cfg_reg(J18_1610_CAM_D7); | 688 | omap_cfg_reg(J18_1610_CAM_D7); |
| 674 | 689 | ||
