Re: [PATCH 6/7] dt-bindings: add header file of ASR8751C pinctrl driver

2019-03-30 Thread Rob Herring
On Sat, Mar 23, 2019 at 10:01:27PM +0800, qiaozhou wrote:
> From: Qiao Zhou 
> 
> Add pinctrl definition and configuration of ASR8751C pins. The
> configuration contains pull up/down, driver strength, edge detection,
> multiple function etc.
> 
> Signed-off-by: qiaozhou 
> ---
>  include/dt-bindings/pinctrl/asr8751c-pinfunc.h | 341 
> +
>  1 file changed, 341 insertions(+)
>  create mode 100644 include/dt-bindings/pinctrl/asr8751c-pinfunc.h
> 
> diff --git a/include/dt-bindings/pinctrl/asr8751c-pinfunc.h 
> b/include/dt-bindings/pinctrl/asr8751c-pinfunc.h
> new file mode 100644
> index 000..b326a6d
> --- /dev/null
> +++ b/include/dt-bindings/pinctrl/asr8751c-pinfunc.h
> @@ -0,0 +1,341 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * This header provides constants for ASR Aquila pinctrl bindings.
> + *
> + * Copyright (c) 2019, ASR Microelectronics(Shanghai) Co., Ltd.
> + * All rights reserved.
> + *
> + * Author: Tim Wang 
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope 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.

Don't need the GPL boilerplate with the SPDX tag.

> + */
> +
> +#ifndef __DTS_ASR8751C_PINFUNC_H
> +#define __DTS_ASR8751C_PINFUNC_H
> +
> +/*
> + * drive-strength = 
> + * SLOW0:  < 75MHz
> + * SLOW1:  < 150MHz
> + * MEDIUM: < 200MHz
> + * FAST:   > 200MHz
> + */
> +#define DS_SLOW0 pinctrl-single,drive-strength = <0x 0x1800>
> +#define DS_SLOW1 pinctrl-single,drive-strength = <0x0800 0x1800>
> +#define DS_MEDIUMpinctrl-single,drive-strength = <0x1000 0x1800>
> +#define DS_FAST  pinctrl-single,drive-strength = <0x1800 
> 0x1800>

Don't do complex definitions. Keep it to simple value defines.

> +
> +/*
> + * Edge detect setting
> + * input-schmitt = ;
> + * input-schmitt-enable = 
> + */
> +
> +/* no edge detect */
> +#define EDGE_NONEpinctrl-single,input-schmitt= <0x00 
> 0x30>;  \
> + pinctrl-single,input-schmitt-enable = <0x40 
> 0x00 0x40 0x40>
> +/* enable edge fall detect only*/
> +#define EDGE_FALLpinctrl-single,input-schmitt= <0x20 
> 0x30>;  \
> + pinctrl-single,input-schmitt-enable = <0x00 
> 0x00 0x40 0x40>
> +/* enable edge rise detect only */
> +#define EDGE_RISEpinctrl-single,input-schmitt= <0x10 
> 0x30>;  \
> + pinctrl-single,input-schmitt-enable = <0x00 
> 0x00 0x40 0x40>
> +/* enable edge fall/rise detect */
> +#define EDGE_BOTHpinctrl-single,input-schmitt= <0x30 
> 0x30>;  \
> + pinctrl-single,input-schmitt-enable = <0x00 
> 0x00 0x40 0x40>
> +
> +/*
> + * bias-pullup = ;
> + * bias-pulldown = 
> + */
> +
> +/* PULL_SEL controlled by Alternative Function */
> +#define PULL_NONEpinctrl-single,bias-pullup  = <0x 
> 0xc000 0x 0xc000>;\
> + pinctrl-single,bias-pulldown= <0x 
> 0xa000 0x 0xa000>
> +/* PULL_SEL controlled by MFPR, enable PULL_UP, disable PULL_DOWN */
> +#define PULL_UP  pinctrl-single,bias-pullup  = 
> <0xc000 0xc000 0x 0xc000>;\
> + pinctrl-single,bias-pulldown= <0x8000 
> 0xa000 0x8000 0xa000>
> +/* PULL_SEL controlled by MFPR, disable PULL_UP, enable PULL_DOWN */
> +#define PULL_DOWNpinctrl-single,bias-pullup  = <0x8000 
> 0xc000 0x8000 0xc000>; \
> + pinctrl-single,bias-pulldown= <0xa000 
> 0xa000 0x 0xa000>
> +/* PULL_SEL controlled by MFPR, enable PULL_UP and PULL_DOWN */
> +#define PULL_BOTHpinctrl-single,bias-pullup  = <0xc000 
> 0xc000 0x8000 0xc000>; \
> + pinctrl-single,bias-pulldown= <0xa000 
> 0xa000 0x8000 0xa000>
> +/* PULL_SEL controlled by MFPR, disable PULL_UP and PULL_DOWN */
> +#define PULL_FLOAT   pinctrl-single,bias-pullup  = <0x8000 
> 0x8000 0x 0xc000>;\
> + pinctrl-single,bias-pulldown= <0x8000 
> 0x8000 0x 0xa000>
> +/* Low Power Mode settings */
> +/* no LPM setting, LPM state same as active */
> +#define LPM_NONE pinctrl-single,low-power-mode = <0x000 0x388>
> +/* LPM, output 0 */
> +#define LPM_DRIVE_LOWpinctrl-single,low-power-mode = <0x208 
> 0x388>
> +/* LPM, output 1*/
> +#define LPM_DRIVE_HIGH   pinctrl-single,low-power-mode = <0x308 
> 0x388>
> +/* LPM, input state */
> +#define LPM_FLOATpinct

[PATCH 6/7] dt-bindings: add header file of ASR8751C pinctrl driver

2019-03-23 Thread qiaozhou
From: Qiao Zhou 

Add pinctrl definition and configuration of ASR8751C pins. The
configuration contains pull up/down, driver strength, edge detection,
multiple function etc.

Signed-off-by: qiaozhou 
---
 include/dt-bindings/pinctrl/asr8751c-pinfunc.h | 341 +
 1 file changed, 341 insertions(+)
 create mode 100644 include/dt-bindings/pinctrl/asr8751c-pinfunc.h

diff --git a/include/dt-bindings/pinctrl/asr8751c-pinfunc.h 
b/include/dt-bindings/pinctrl/asr8751c-pinfunc.h
new file mode 100644
index 000..b326a6d
--- /dev/null
+++ b/include/dt-bindings/pinctrl/asr8751c-pinfunc.h
@@ -0,0 +1,341 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This header provides constants for ASR Aquila pinctrl bindings.
+ *
+ * Copyright (c) 2019, ASR Microelectronics(Shanghai) Co., Ltd.
+ * All rights reserved.
+ *
+ * Author: Tim Wang 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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 __DTS_ASR8751C_PINFUNC_H
+#define __DTS_ASR8751C_PINFUNC_H
+
+/*
+ * drive-strength = 
+ * SLOW0:  < 75MHz
+ * SLOW1:  < 150MHz
+ * MEDIUM: < 200MHz
+ * FAST:   > 200MHz
+ */
+#define DS_SLOW0   pinctrl-single,drive-strength = <0x 0x1800>
+#define DS_SLOW1   pinctrl-single,drive-strength = <0x0800 0x1800>
+#define DS_MEDIUM  pinctrl-single,drive-strength = <0x1000 0x1800>
+#define DS_FASTpinctrl-single,drive-strength = <0x1800 
0x1800>
+
+/*
+ * Edge detect setting
+ * input-schmitt = ;
+ * input-schmitt-enable = 
+ */
+
+/* no edge detect */
+#define EDGE_NONE  pinctrl-single,input-schmitt= <0x00 
0x30>;  \
+   pinctrl-single,input-schmitt-enable = <0x40 
0x00 0x40 0x40>
+/* enable edge fall detect only*/
+#define EDGE_FALL  pinctrl-single,input-schmitt= <0x20 
0x30>;  \
+   pinctrl-single,input-schmitt-enable = <0x00 
0x00 0x40 0x40>
+/* enable edge rise detect only */
+#define EDGE_RISE  pinctrl-single,input-schmitt= <0x10 
0x30>;  \
+   pinctrl-single,input-schmitt-enable = <0x00 
0x00 0x40 0x40>
+/* enable edge fall/rise detect */
+#define EDGE_BOTH  pinctrl-single,input-schmitt= <0x30 
0x30>;  \
+   pinctrl-single,input-schmitt-enable = <0x00 
0x00 0x40 0x40>
+
+/*
+ * bias-pullup = ;
+ * bias-pulldown = 
+ */
+
+/* PULL_SEL controlled by Alternative Function */
+#define PULL_NONE  pinctrl-single,bias-pullup  = <0x 
0xc000 0x 0xc000>;\
+   pinctrl-single,bias-pulldown= <0x 
0xa000 0x 0xa000>
+/* PULL_SEL controlled by MFPR, enable PULL_UP, disable PULL_DOWN */
+#define PULL_UPpinctrl-single,bias-pullup  = 
<0xc000 0xc000 0x 0xc000>;\
+   pinctrl-single,bias-pulldown= <0x8000 
0xa000 0x8000 0xa000>
+/* PULL_SEL controlled by MFPR, disable PULL_UP, enable PULL_DOWN */
+#define PULL_DOWN  pinctrl-single,bias-pullup  = <0x8000 
0xc000 0x8000 0xc000>; \
+   pinctrl-single,bias-pulldown= <0xa000 
0xa000 0x 0xa000>
+/* PULL_SEL controlled by MFPR, enable PULL_UP and PULL_DOWN */
+#define PULL_BOTH  pinctrl-single,bias-pullup  = <0xc000 
0xc000 0x8000 0xc000>; \
+   pinctrl-single,bias-pulldown= <0xa000 
0xa000 0x8000 0xa000>
+/* PULL_SEL controlled by MFPR, disable PULL_UP and PULL_DOWN */
+#define PULL_FLOAT pinctrl-single,bias-pullup  = <0x8000 
0x8000 0x 0xc000>;\
+   pinctrl-single,bias-pulldown= <0x8000 
0x8000 0x 0xa000>
+/* Low Power Mode settings */
+/* no LPM setting, LPM state same as active */
+#define LPM_NONE   pinctrl-single,low-power-mode = <0x000 0x388>
+/* LPM, output 0 */
+#define LPM_DRIVE_LOW  pinctrl-single,low-power-mode = <0x208 0x388>
+/* LPM, output 1*/
+#define LPM_DRIVE_HIGH pinctrl-single,low-power-mode = <0x308 0x388>
+/* LPM, input state */
+#define LPM_FLOAT  pinctrl-single,low-power-mode = <0x288 0x388>
+
+/* Active settings */
+#define MFP_DEFAULTDS_MEDIUM;PULL_NONE;EDGE_NONE;LPM_NONE
+#define MFP_PULL_UPDS_MEDIUM;PULL_UP;EDGE_NONE;LPM_NONE
+#define MFP_PULL_DOWN  DS_MEDIUM;PULL_DOWN;EDGE_NONE;LPM_NONE
+#define MFP_PULL_FLOAT DS_MEDIUM;PULL_FLOAT;EDGE_NONE;LPM_NONE
+
+/* LPM output */
+#define MFP_LPM_DR