mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
pinctrl: sprd: Add Spreadtrum pin control driver
This patch adds the pin control driver for Spreadtrum SC9860 platform. Signed-off-by: Baolin Wang <baolin.wang@spreadtrum.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
committed by
Linus Walleij
parent
e6f3f66903
commit
41d32cfce1
@@ -350,6 +350,7 @@ source "drivers/pinctrl/qcom/Kconfig"
|
||||
source "drivers/pinctrl/samsung/Kconfig"
|
||||
source "drivers/pinctrl/sh-pfc/Kconfig"
|
||||
source "drivers/pinctrl/spear/Kconfig"
|
||||
source "drivers/pinctrl/sprd/Kconfig"
|
||||
source "drivers/pinctrl/stm32/Kconfig"
|
||||
source "drivers/pinctrl/sunxi/Kconfig"
|
||||
source "drivers/pinctrl/tegra/Kconfig"
|
||||
|
||||
@@ -56,6 +56,7 @@ obj-$(CONFIG_ARCH_QCOM) += qcom/
|
||||
obj-$(CONFIG_PINCTRL_SAMSUNG) += samsung/
|
||||
obj-$(CONFIG_PINCTRL_SH_PFC) += sh-pfc/
|
||||
obj-$(CONFIG_PINCTRL_SPEAR) += spear/
|
||||
obj-y += sprd/
|
||||
obj-$(CONFIG_PINCTRL_STM32) += stm32/
|
||||
obj-$(CONFIG_PINCTRL_SUNXI) += sunxi/
|
||||
obj-y += ti/
|
||||
|
||||
17
drivers/pinctrl/sprd/Kconfig
Normal file
17
drivers/pinctrl/sprd/Kconfig
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# Spreadtrum pin control drivers
|
||||
#
|
||||
|
||||
config PINCTRL_SPRD
|
||||
bool "Spreadtrum pinctrl driver"
|
||||
select PINMUX
|
||||
select PINCONF
|
||||
select GENERIC_PINCONF
|
||||
select GENERIC_PINMUX_FUNCTIONS
|
||||
help
|
||||
Say Y here to enable Spreadtrum pinctrl driver
|
||||
|
||||
config PINCTRL_SPRD_SC9860
|
||||
bool "Spreadtrum SC9860 pinctrl driver"
|
||||
help
|
||||
Say Y here to enable Spreadtrum SC9860 pinctrl driver
|
||||
2
drivers/pinctrl/sprd/Makefile
Normal file
2
drivers/pinctrl/sprd/Makefile
Normal file
@@ -0,0 +1,2 @@
|
||||
obj-$(CONFIG_PINCTRL_SPRD) += pinctrl-sprd.o
|
||||
obj-$(CONFIG_PINCTRL_SPRD_SC9860) += pinctrl-sprd-sc9860.o
|
||||
972
drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c
Normal file
972
drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c
Normal file
File diff suppressed because it is too large
Load Diff
1113
drivers/pinctrl/sprd/pinctrl-sprd.c
Normal file
1113
drivers/pinctrl/sprd/pinctrl-sprd.c
Normal file
File diff suppressed because it is too large
Load Diff
67
drivers/pinctrl/sprd/pinctrl-sprd.h
Normal file
67
drivers/pinctrl/sprd/pinctrl-sprd.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Driver header file for pin controller driver
|
||||
* Copyright (C) 2017 Spreadtrum - http://www.spreadtrum.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __PINCTRL_SPRD_H__
|
||||
#define __PINCTRL_SPRD_H__
|
||||
|
||||
struct platform_device;
|
||||
|
||||
#define NUM_OFFSET (20)
|
||||
#define TYPE_OFFSET (16)
|
||||
#define BIT_OFFSET (8)
|
||||
#define WIDTH_OFFSET (4)
|
||||
|
||||
#define SPRD_PIN_INFO(num, type, offset, width, reg) \
|
||||
(((num) & 0xFFF) << NUM_OFFSET | \
|
||||
((type) & 0xF) << TYPE_OFFSET | \
|
||||
((offset) & 0xFF) << BIT_OFFSET | \
|
||||
((width) & 0xF) << WIDTH_OFFSET | \
|
||||
((reg) & 0xF))
|
||||
|
||||
#define SPRD_PINCTRL_PIN(pin) SPRD_PINCTRL_PIN_DATA(pin, #pin)
|
||||
|
||||
#define SPRD_PINCTRL_PIN_DATA(a, b) \
|
||||
{ \
|
||||
.name = b, \
|
||||
.num = (((a) >> NUM_OFFSET) & 0xfff), \
|
||||
.type = (((a) >> TYPE_OFFSET) & 0xf), \
|
||||
.bit_offset = (((a) >> BIT_OFFSET) & 0xff), \
|
||||
.bit_width = ((a) >> WIDTH_OFFSET & 0xf), \
|
||||
.reg = ((a) & 0xf) \
|
||||
}
|
||||
|
||||
enum pin_type {
|
||||
GLOBAL_CTRL_PIN,
|
||||
COMMON_PIN,
|
||||
MISC_PIN,
|
||||
};
|
||||
|
||||
struct sprd_pins_info {
|
||||
const char *name;
|
||||
unsigned int num;
|
||||
enum pin_type type;
|
||||
|
||||
/* for global control pins configuration */
|
||||
unsigned long bit_offset;
|
||||
unsigned long bit_width;
|
||||
unsigned int reg;
|
||||
};
|
||||
|
||||
int sprd_pinctrl_core_probe(struct platform_device *pdev,
|
||||
struct sprd_pins_info *sprd_soc_pin_info,
|
||||
int pins_cnt);
|
||||
int sprd_pinctrl_remove(struct platform_device *pdev);
|
||||
void sprd_pinctrl_shutdown(struct platform_device *pdev);
|
||||
|
||||
#endif /* __PINCTRL_SPRD_H__ */
|
||||
Reference in New Issue
Block a user