pinctrl-intel.c (9c1852b459f04f6309e40d1d167512b0a5598529) | pinctrl-intel.c (17fab473693e8357a9aa6fee4fbed6c13a34bd81) |
---|---|
1/* 2 * Intel pinctrl/GPIO core driver. 3 * 4 * Copyright (C) 2015, Intel Corporation 5 * Authors: Mathias Nyman <mathias.nyman@linux.intel.com> 6 * Mika Westerberg <mika.westerberg@linux.intel.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 339 unchanged lines hidden (view full) --- 348 writel(value, padcfg0); 349 } 350 351 raw_spin_unlock_irqrestore(&pctrl->lock, flags); 352 353 return 0; 354} 355 | 1/* 2 * Intel pinctrl/GPIO core driver. 3 * 4 * Copyright (C) 2015, Intel Corporation 5 * Authors: Mathias Nyman <mathias.nyman@linux.intel.com> 6 * Mika Westerberg <mika.westerberg@linux.intel.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 339 unchanged lines hidden (view full) --- 348 writel(value, padcfg0); 349 } 350 351 raw_spin_unlock_irqrestore(&pctrl->lock, flags); 352 353 return 0; 354} 355 |
356static void __intel_gpio_set_direction(void __iomem *padcfg0, bool input) 357{ 358 u32 value; 359 360 value = readl(padcfg0); 361 if (input) { 362 value &= ~PADCFG0_GPIORXDIS; 363 value |= PADCFG0_GPIOTXDIS; 364 } else { 365 value &= ~PADCFG0_GPIOTXDIS; 366 value |= PADCFG0_GPIORXDIS; 367 } 368 writel(value, padcfg0); 369} 370 |
|
356static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, 357 struct pinctrl_gpio_range *range, 358 unsigned pin) 359{ 360 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 361 void __iomem *padcfg0; 362 unsigned long flags; 363 u32 value; --- 6 unchanged lines hidden (view full) --- 370 } 371 372 padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0); 373 /* Put the pad into GPIO mode */ 374 value = readl(padcfg0) & ~PADCFG0_PMODE_MASK; 375 /* Disable SCI/SMI/NMI generation */ 376 value &= ~(PADCFG0_GPIROUTIOXAPIC | PADCFG0_GPIROUTSCI); 377 value &= ~(PADCFG0_GPIROUTSMI | PADCFG0_GPIROUTNMI); | 371static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, 372 struct pinctrl_gpio_range *range, 373 unsigned pin) 374{ 375 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 376 void __iomem *padcfg0; 377 unsigned long flags; 378 u32 value; --- 6 unchanged lines hidden (view full) --- 385 } 386 387 padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0); 388 /* Put the pad into GPIO mode */ 389 value = readl(padcfg0) & ~PADCFG0_PMODE_MASK; 390 /* Disable SCI/SMI/NMI generation */ 391 value &= ~(PADCFG0_GPIROUTIOXAPIC | PADCFG0_GPIROUTSCI); 392 value &= ~(PADCFG0_GPIROUTSMI | PADCFG0_GPIROUTNMI); |
378 /* Disable TX buffer and enable RX (this will be input) */ 379 value &= ~PADCFG0_GPIORXDIS; 380 value |= PADCFG0_GPIOTXDIS; | |
381 writel(value, padcfg0); 382 | 393 writel(value, padcfg0); 394 |
395 /* Disable TX buffer and enable RX (this will be input) */ 396 __intel_gpio_set_direction(padcfg0, true); 397 |
|
383 raw_spin_unlock_irqrestore(&pctrl->lock, flags); 384 385 return 0; 386} 387 388static int intel_gpio_set_direction(struct pinctrl_dev *pctldev, 389 struct pinctrl_gpio_range *range, 390 unsigned pin, bool input) 391{ 392 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 393 void __iomem *padcfg0; 394 unsigned long flags; | 398 raw_spin_unlock_irqrestore(&pctrl->lock, flags); 399 400 return 0; 401} 402 403static int intel_gpio_set_direction(struct pinctrl_dev *pctldev, 404 struct pinctrl_gpio_range *range, 405 unsigned pin, bool input) 406{ 407 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 408 void __iomem *padcfg0; 409 unsigned long flags; |
395 u32 value; | |
396 397 raw_spin_lock_irqsave(&pctrl->lock, flags); 398 399 padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0); | 410 411 raw_spin_lock_irqsave(&pctrl->lock, flags); 412 413 padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0); |
414 __intel_gpio_set_direction(padcfg0, input); |
|
400 | 415 |
401 value = readl(padcfg0); 402 if (input) 403 value |= PADCFG0_GPIOTXDIS; 404 else 405 value &= ~PADCFG0_GPIOTXDIS; 406 writel(value, padcfg0); 407 | |
408 raw_spin_unlock_irqrestore(&pctrl->lock, flags); 409 410 return 0; 411} 412 413static const struct pinmux_ops intel_pinmux_ops = { 414 .get_functions_count = intel_get_functions_count, 415 .get_function_name = intel_get_function_name, --- 781 unchanged lines hidden --- | 416 raw_spin_unlock_irqrestore(&pctrl->lock, flags); 417 418 return 0; 419} 420 421static const struct pinmux_ops intel_pinmux_ops = { 422 .get_functions_count = intel_get_functions_count, 423 .get_function_name = intel_get_function_name, --- 781 unchanged lines hidden --- |