mpc83xx: Add a GPIO driver for the MPC83XX family
Subsystems (6)
PATCH 1/2 mpc83xx: Add a GPIO driver for the MPC83XX family
--- arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 37 +++++ arch/powerpc/include/asm/gpio.h | 38 +++++ board/freescale/mpc8313erdb/mpc8313erdb.c | 9 + drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 202 ++++++++++++++++++++++++++ 5 files changed, 287 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC83XX_GPIO_H_ +#define _MPC83XX_GPIO_H_ + +/* +* The MCP83xx's 1-2 GPIO controllers each with 32 bits. +*/ +#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif + +#define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) + +void gpio_init_f (void ); +void gpio_init_r (void ); + +#endif /* MPC83XX_GPIO_H_ */
arch/powerpc/include/asm/gpio.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +#include <asm/arch/gpio.h> +/* +* Generic GPIO API +*/ + +int gpio_request (int gp,const char *label); +void gpio_free (int gp); +void gpio_toggle_value (int gp); +int gpio_direction_input (int gp); +int gpio_direction_output (int gp,int value); +int gpio_get_value (int gp); +void gpio_set_value (int gp,int value); + +#endif /* _GPIO_H_ */
board/freescale/mpc8313erdb/mpc8313erdb.c +9 -0
@@ -31,6 +31,9 @@#include <vsc7385.h> #include <ns16550.h> #include <nand.h> +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +#include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -42,6 +45,9 @@ int board_early_init_f(void)if (im->pmc.pmccr1 &PMCCR1_POWER_OFF ) gd->flags |=GD_FLG_SILENT ;#endif +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +gpio_init_f (); +#endif return 0 ; }
@@ -140,6 +146,9 @@ void board_init_f(ulong bootflag)void board_init_r (gd_t *gd,ulong dest_addr) { +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +gpio_init_r (); +#endif nand_boot (); }
drivers/gpio/Makefile +1 -0
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P) += s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/mpc83xx_gpio.c new file +202 -0
202 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 1/2 mpc83xx: Add a GPIO driver for the MPC83XX family
arch/powerpc/include/asm/arch-mpc83xx/gpio.h
Quoted 5 lines · Joe Hershberger
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +0
-0
[snip
arch/powerpc/include/asm/arch-mpc83xx/gpio.h line 35
Quoted 2 lines
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +2
-0+void gpio_init_f (void ); +void gpio_init_r (void );
These are quite generic function names for 83xx to claim. If it's to be part of the generic gpio API, why not add it to asm/gpio.h?
arch/powerpc/include/asm/arch-mpc83xx/gpio.h void board_init_f(ulong bootflag) · line 153
Quoted 9 lines
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +3
-0@@ -140,6 +146,9 @@ void board_init_f(ulong bootflag)void board_init_r (gd_t *gd,ulong dest_addr) { +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +gpio_init_r (); +#endif nand_boot (); }
This instance of board_init_r() is only for CONFIG_NAND_SPL, so this won't do anything.
Maybe create a board_early_init_r() for this board?
-Scott
PATCH 1/2 mpc83xx: Add a GPIO driver for the MPC83XX family
Quoted 7 lines · Scott Wood
arch/powerpc/include/asm/arch-mpc83xx/gpio.h
Quoted 5 lines · Joe Hershberger
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +0
-0[snip
Quoted 5 lines
arch/powerpc/include/asm/arch-mpc83xx/gpio.h line 35
Quoted 2 lines
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +2
-0+void gpio_init_f (void ); +void gpio_init_r (void );These are quite generic function names for 83xx to claim. ?If it's to be part of the generic gpio API, why not add it to
asm/gpio.h?
That's a good point. I'll make them board specific since the board init must call them (there isn't a generic place that will call them).
Quoted 13 lines
arch/powerpc/include/asm/arch-mpc83xx/gpio.h void board_init_f(ulong bootflag) · line 153
Quoted 9 lines
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +3
-0@@ -140,6 +146,9 @@ void board_init_f(ulong bootflag) ?void board_init_r(gd_t *gd, ulong dest_addr) ?{ +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) + ? ? gpio_init_r(); +#endif ? ? ? nand_boot(); ?}This instance of
board_init_r()is only forCONFIG_NAND_SPL, so this won't do anything.
Quoted 1 line
Maybe create a
board_early_init_r()for this board?
Sounds good.
-Joe
PATCH v3 1/2 mpc83xx: Add a GPIO driver for the MPC83XX family
In reply to Scott Wood---
Changes for v2:
- Improved names of INIT constants (to include "CONFIG_")
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c to patch 2/2
Changes for v3:
- gpio_init_* is now mpc83xx_gpio_init_*
arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 37 +++++ arch/powerpc/include/asm/gpio.h | 38 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 198 ++++++++++++++++++++++++++ 4 files changed, 274 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC83XX_GPIO_H_ +#define _MPC83XX_GPIO_H_ + +/* +* The MCP83xx's 1-2 GPIO controllers each with 32 bits. +*/ +#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif + +#define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) + +void mpc83xx_gpio_init_f (void ); +void mpc83xx_gpio_init_r (void ); + +#endif /* MPC83XX_GPIO_H_ */
arch/powerpc/include/asm/gpio.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +#include <asm/arch/gpio.h> +/* +* Generic GPIO API +*/ + +int gpio_request (int gp,const char *label); +void gpio_free (int gp); +void gpio_toggle_value (int gp); +int gpio_direction_input (int gp); +int gpio_direction_output (int gp,int value); +int gpio_get_value (int gp); +void gpio_set_value (int gp,int value); + +#endif /* _GPIO_H_ */
drivers/gpio/Makefile +1 -0
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P) += s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/mpc83xx_gpio.c new file +198 -0
198 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v3 2/2 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
In reply to Scott Wood---
Changes for v2:
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c from patch 1/2
Changes for v3:
- Renamed gpio_init_* to mpc83xx_gpio_init_*
- Added board_early_init_r support to MPC8313ERDB targets
board/freescale/mpc8313erdb/mpc8313erdb.c | 13 +++++++++++++ include/configs/MPC8313ERDB.h | 8 ++++++-- 2 files changed, 19 insertions(+), 2 deletions(-)
board/freescale/mpc8313erdb/mpc8313erdb.c +13 -0
@@ -31,6 +31,9 @@#include <vsc7385.h> #include <ns16550.h> #include <nand.h> +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +#include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -42,10 +45,20 @@ int board_early_init_f(void)if (im->pmc.pmccr1 &PMCCR1_POWER_OFF ) gd->flags |=GD_FLG_SILENT ;#endif +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_f (); +#endif return 0 ; } +int board_early_init_r (void ) +{ +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_r (); +#endif +} +int checkboard (void ) {puts ("Board: Freescale MPC8313ERDB\n" );
include/configs/MPC8313ERDB.h +6 -2
@@ -82,7 +82,8 @@#define CONFIG_SYS_CLK_FREQ CONFIG_83XX_CLKIN -#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_BOARD_EARLY_INIT_F /* call board_early_init_f */ +#define CONFIG_BOARD_EARLY_INIT_R /* call board_early_init_r */ #define CONFIG_SYS_IMMR 0xE0000000
@@ -322,6 +323,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_MPC83XX_GPIO 1 +#define CONFIG_CMD_GPIO 1 +/* * Serial Port */
@@ -535,7 +539,7 @@/* System IO Config */ #define CONFIG_SYS_SICRH (SICRH_TSOBI1 | SICRH_TSOBI2)/* RGMII */ -#define CONFIG_SYS_SICRL SICRL_USBDR_10/* Enable Internal USB Phy */ +#define CONFIG_SYS_SICRL (SICRL_USBDR_10 | SICRL_LBC)/* Enable Internal USB Phy and GPIO on LCD Connector */ #define CONFIG_SYS_HID0_INIT 0x000000000#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
Signature · 1 line
1.6.0.2
PATCH 2/2 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
In reply to Joe Hershberger--- include/configs/MPC8313ERDB.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
include/configs/MPC8313ERDB.h +4 -1
@@ -322,6 +322,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_MPC83XX_GPIO 1 +#define CONFIG_CMD_GPIO 1 +/* * Serial Port */
@@ -535,7 +538,7 @@/* System IO Config */ #define CONFIG_SYS_SICRH (SICRH_TSOBI1 | SICRH_TSOBI2)/* RGMII */ -#define CONFIG_SYS_SICRL SICRL_USBDR_10/* Enable Internal USB Phy */ +#define CONFIG_SYS_SICRL (SICRL_USBDR_10 | SICRL_LBC)/* Enable Internal USB Phy and GPIO on LCD Connector */ #define CONFIG_SYS_HID0_INIT 0x000000000#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
Signature · 1 line
1.6.0.2
PATCH 1/2 mpc83xx: Add a GPIO driver for the MPC83XX family
In reply to Joe HershbergerQuoted 34 lines · On Tue, 9 Aug 2011 17:31:29 -0500 Joe Hershberger <[email protected]>…
arch/powerpc/include/asm/gpio.h new file +28
-0@@ -0,0 +1,38 @@ +/* +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +#include <asm/arch/gpio.h> +/* +* Generic GPIO API +*/
arch/powerpc/include/asm/gpio.h line 38
Quoted 10 lines
arch/powerpc/include/asm/gpio.h new file +10
-0+ +int gpio_request (int gp,const char *label); +void gpio_free (int gp); +void gpio_toggle_value (int gp); +int gpio_direction_input (int gp); +int gpio_direction_output (int gp,int value); +int gpio_get_value (int gp); +void gpio_set_value (int gp,int value); + +#endif /* _GPIO_H_ */
looks like this GPIO API-definition file is starting to be copied for each arch, and there's nothing arch-specific in it. As such, it probably belongs in include/asm-generic/, not arch/powerpc. Other arches need fixing in this area, too.
arch/powerpc/include/asm/gpio.h
Quoted 4 lines
arch/powerpc/include/asm/gpio.h new file +4
-0+/* set GPIO pin 'gp' as an input */ +int gpio_direction_input (int gp) +{ +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;
no volatile
arch/powerpc/include/asm/gpio.h
Quoted 3 lines
arch/powerpc/include/asm/gpio.h new file +3
-0+unsigned int ctrlr; +unsigned int line; +unsigned int lineMask;
no camelCase
arch/powerpc/include/asm/gpio.h
Quoted 9 lines
arch/powerpc/include/asm/gpio.h new file +9
-0+ +/* 32-bits per controller */ + ctrlr = gp >>5 ; + line = gp & (0x1F ); + +/* Big endian */ + lineMask =1 << (31 - line); + + im->gpio[ctrlr].dir &= ~lineMask;
must use i/o accessors and/or clr/setbits_be32, please fix everywhere.
arch/powerpc/include/asm/gpio.h
Quoted 3 lines
arch/powerpc/include/asm/gpio.h new file +3
-0+/* Update the local output buffer soft copy */ + gpio_output_value[ctrlr] = + (gpio_output_value[ctrlr] & ~lineMask) | (value ? lineMask :0 );
what's the use of having a local output buffer soft copy? I don't see it being used anywhere.
Kim
PATCH 1/2 mpc83xx: Add a GPIO driver for the MPC83XX family
Quoted 8 lines · Kim Phillips
Quoted 3 lines · On Tue, 9 Aug 2011 17:31:29 -0500 Joe Hershberger <[email protected]>…
+ ? ? /* Update the local output buffer soft copy */
+ ? ? gpio_output_value[ctrlr] =
+ ? ? ? ? ? ? (gpio_output_value[ctrlr] & ~lineMask) | (value ? lineMask : 0);what's the use of having a local output buffer soft copy? ?I don't see it being used anywhere.
It's used in the line you quoted. If other lines on the same controller are configured for open-collector, but are externally pulled low, then using the DAT register instead of the soft copy will force those to be actively grounded. To avoid this, I use a soft-copy.
-Joe
PATCH v4 1/3 gpio: Move common gpio.h to include/asm-generic
In reply to Kim PhillipsCommon GPIO API used by cmd_gpio should be available to any arch
---
Changes for v4:
- Split out of patch 1/2
arch/arm/include/asm/gpio.h | 39 +-------------------------------------- arch/powerpc/include/asm/gpio.h | 1 + include/asm-generic/gpio.h | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 38 deletions(-) create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 include/asm-generic/gpio.h
arch/arm/include/asm/gpio.h +1 -38
@@ -1,38 +1 @@ -/* -* Copyright (c) 2011, NVIDIA Corp. All rights reserved. -* See file CREDITS for list of people who contributed to this -* project. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* 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. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, -* MA 02111-1307 USA -*/ - -#ifndef _GPIO_H_ -#define _GPIO_H_ - -#include <asm/arch/gpio.h> -/* -* Generic GPIO API -*/ - -int gpio_request (int gp,const char *label); -void gpio_free (int gp); -void gpio_toggle_value (int gp); -int gpio_direction_input (int gp); -int gpio_direction_output (int gp,int value); -int gpio_get_value (int gp); -void gpio_set_value (int gp,int value); - -#endif /* _GPIO_H_ */ +#include <asm-generic/gpio.h>
arch/powerpc/include/asm/gpio.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/gpio.h>
include/asm-generic/gpio.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +#include <asm/arch/gpio.h> +/* +* Generic GPIO API +*/ + +int gpio_request (int gp,const char *label); +void gpio_free (int gp); +void gpio_toggle_value (int gp); +int gpio_direction_input (int gp); +int gpio_direction_output (int gp,int value); +int gpio_get_value (int gp); +void gpio_set_value (int gp,int value); + +#endif /* _GPIO_H_ */
Signature · 1 line
1.6.0.2
PATCH v4 1/3 gpio: Move common gpio.h to include/asm-generic
include/asm-generic/gpio.h line 25
Quoted 3 lines · On Wednesday, August 10, 2011 00:56:40 Joe Hershberger wrote:
include/asm-generic/gpio.h new file +1
-0+#include <asm/arch/gpio.h>
NAK. this belongs in the arch/ specific header.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110810/02a07161/attachment.pgp
PATCH v5 1/3 gpio: Move common gpio.h to include/asm-generic
Common GPIO API used by cmd_gpio should be available to any arch
---
Changes for v4:
- Split out of patch 1/2
Changes for v5:
- Moved asm/arch/gpio.h include to asm/gpio.h
arch/arm/include/asm/gpio.h | 38 +------------------------------------- arch/powerpc/include/asm/gpio.h | 2 ++ include/asm-generic/gpio.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 37 deletions(-) create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 include/asm-generic/gpio.h
arch/arm/include/asm/gpio.h +1 -37
@@ -1,38 +1,2 @@ -/* -* Copyright (c) 2011, NVIDIA Corp. All rights reserved. -* See file CREDITS for list of people who contributed to this -* project. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* 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. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, -* MA 02111-1307 USA -*/ - -#ifndef _GPIO_H_ -#define _GPIO_H_ -#include <asm/arch/gpio.h> -/* -* Generic GPIO API -*/ - -int gpio_request (int gp,const char *label); -void gpio_free (int gp); -void gpio_toggle_value (int gp); -int gpio_direction_input (int gp); -int gpio_direction_output (int gp,int value); -int gpio_get_value (int gp); -void gpio_set_value (int gp,int value); - -#endif /* _GPIO_H_ */ +#include <asm-generic/gpio.h>
arch/powerpc/include/asm/gpio.h new file +2 -0
@@ -0,0 +1,2 @@ +#include <asm/arch/gpio.h> +#include <asm-generic/gpio.h>
include/asm-generic/gpio.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +/* +* Generic GPIO API +*/ + +int gpio_request (int gp,const char *label); +void gpio_free (int gp); +void gpio_toggle_value (int gp); +int gpio_direction_input (int gp); +int gpio_direction_output (int gp,int value); +int gpio_get_value (int gp); +void gpio_set_value (int gp,int value); + +#endif /* _GPIO_H_ */
Signature · 1 line
1.6.0.2
PATCH v5 1/3 gpio: Move common gpio.h to include/asm-generic
include/asm-generic/gpio.h line 35
Quoted 6 lines · On Friday, August 12, 2011 04:11:22 Joe Hershberger wrote:
include/asm-generic/gpio.h new file +6
-0+int gpio_request (int gp,const char *label); +void gpio_free (int gp); +int gpio_direction_input (int gp); +int gpio_direction_output (int gp,int value); +int gpio_get_value (int gp); +void gpio_set_value (int gp,int value);
please use "unsigned gpio". this is what linux does and what most implementations should be doing (since sane people will pull from linux).
Quoted 1 line
+void
gpio_toggle_value(int gp);
this is not currently part of the generic gpio api. this should stay in arm's asm/gpio.h for now, or not implement it at all.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110812/4177be54/attachment.pgp
PATCH v6 1/4 gpio: Move common gpio.h to include/asm-generic
Common GPIO API used by cmd_gpio should be available to any arch
---
Changes for v4:
- Split out of patch 1/2
Changes for v5:
- Moved asm/arch/gpio.h include to asm/gpio.h
Changes for v6:
arch/arm/include/asm/gpio.h | 38 +------------------------------------- arch/powerpc/include/asm/gpio.h | 2 ++ include/asm-generic/gpio.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 37 deletions(-) create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 include/asm-generic/gpio.h
arch/arm/include/asm/gpio.h +1 -37
@@ -1,38 +1,2 @@ -/* -* Copyright (c) 2011, NVIDIA Corp. All rights reserved. -* See file CREDITS for list of people who contributed to this -* project. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* 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. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, -* MA 02111-1307 USA -*/ - -#ifndef _GPIO_H_ -#define _GPIO_H_ -#include <asm/arch/gpio.h> -/* -* Generic GPIO API -*/ - -int gpio_request (int gp,const char *label); -void gpio_free (int gp); -void gpio_toggle_value (int gp); -int gpio_direction_input (int gp); -int gpio_direction_output (int gp,int value); -int gpio_get_value (int gp); -void gpio_set_value (int gp,int value); - -#endif /* _GPIO_H_ */ +#include <asm-generic/gpio.h>
arch/powerpc/include/asm/gpio.h new file +2 -0
@@ -0,0 +1,2 @@ +#include <asm/arch/gpio.h> +#include <asm-generic/gpio.h>
include/asm-generic/gpio.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +/* +* Generic GPIO API +*/ + +int gpio_request (int gp,const char *label); +void gpio_free (int gp); +void gpio_toggle_value (int gp); +int gpio_direction_input (int gp); +int gpio_direction_output (int gp,int value); +int gpio_get_value (int gp); +void gpio_set_value (int gp,int value); + +#endif /* _GPIO_H_ */
Signature · 1 line
1.6.0.2
PATCH v6 1/4 gpio: Move common gpio.h to include/asm-generic
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110814/194b5e71/attachment.pgp
PATCH v6 1/4 gpio: Move common gpio.h to include/asm-generic
In reply to Joe HershbergerQuoted 12 lines · On Fri, 12 Aug 2011 19:10:53 -0500 Joe Hershberger <[email protected]>…
Common GPIO API used by
cmd_gpioshould be available to any archSigned-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Mike Frysinger <[email protected]>---
Changes for v4:
- Split out of patch 1/2
Changes for v5:
- Movedasm/arch/gpio.hinclude toasm/gpio.h
Changes for v6:
Quoted 6 lines
arch/arm/include/asm/gpio.h | 38 +------------------------------------- arch/powerpc/include/asm/gpio.h | 2 ++ include/asm-generic/gpio.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 37 deletions(-) create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 include/asm-generic/gpio.h
applied 4 out of 4 patches.
Wolfgang, technically this is a multi-domain patchseries, and I've overstepped my boundaries for the sake of expediency in adding the GPIO feature to 83xx-land. If this is a problem, and you'd like to apply patches 1 and 2 independently of mpc83xx, please let me know and I'll back the entire series off the mpc83xx tree. Fwiw, I build-tested a couple of ARM boards, including davinci.
Please let me know before I send a pull request when the next branch is made available, or, of course, when the window for the next release opens.
Kim
PATCH v6 1/4 gpio: Move common gpio.h to include/asm-generic
Dear Kim,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 7 lines
arch/arm/include/asm/gpio.h | 38 +------------------------------------- arch/powerpc/include/asm/gpio.h | 2 ++ include/asm-generic/gpio.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 37 deletions(-) create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 include/asm-generic/gpio.h
Quoted 8 lines
applied 4 out of 4 patches.
Wolfgang, technically this is a multi-domain patchseries, and I've overstepped my boundaries for the sake of expediency in adding the GPIO feature to 83xx-land. If this is a problem, and you'd like to apply patches 1 and 2 independently of mpc83xx, please let me know and I'll back the entire series off the mpc83xx tree. Fwiw, I build-tested a couple of ARM boards, including davinci.
As this relates to ARM files, you need Albert's OK here, not mine. [I put Albert on Cc:]
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It's hard to think of you as the end result of millions of years of evolution.
PATCH v6 1/4 gpio: Move common gpio.h to include/asm-generic
Le 15/09/2011 11:45, Wolfgang Denk a ?crit :
Quoted 20 lines
Dear Kim,
Quoted 8 lines · In message<[email protected]> you wrote:
Quoted 7 lines
arch/arm/include/asm/gpio.h | 38 +------------------------------------- arch/powerpc/include/asm/gpio.h | 2 ++ include/asm-generic/gpio.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 37 deletions(-)create mode 100644
arch/powerpc/include/asm/gpio.hcreate mode 100644include/asm-generic/gpio.hQuoted 8 lines
applied 4 out of 4 patches.
Wolfgang, technically this is a multi-domain patchseries, and I've overstepped my boundaries for the sake of expediency in adding the GPIO feature to 83xx-land. If this is a problem, and you'd like to apply patches 1 and 2 independently of mpc83xx, please let me know and I'll back the entire series off the mpc83xx tree. Fwiw, I build-tested a couple of ARM boards, including davinci.
Quoted 2 lines
As this relates to ARM files, you need Albert's OK here, not mine. [I put Albert on Cc:]
Well, it relates to both ARM and PPC equally, but anyway...
Quoted 3 lines
Best regards,
Wolfgang Denk
Amicalement,
Signature · 1 line
Albert.
PATCH v7 1/4 gpio: Move common gpio.h to include/asm-generic
In reply to Joe HershbergerCommon GPIO API used by cmd_gpio should be available to any arch
---
Changes for v4:
- Split out of patch 1/2
Changes for v5:
- Moved asm/arch/gpio.h include to asm/gpio.h
Changes for v6:
Changes for v7:
arch/arm/include/asm/gpio.h | 38 +------------------------------------- arch/powerpc/include/asm/gpio.h | 2 ++ include/asm-generic/gpio.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 37 deletions(-) create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 include/asm-generic/gpio.h
arch/arm/include/asm/gpio.h +1 -37
@@ -1,38 +1,2 @@ -/* -* Copyright (c) 2011, NVIDIA Corp. All rights reserved. -* See file CREDITS for list of people who contributed to this -* project. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* 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. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, -* MA 02111-1307 USA -*/ - -#ifndef _GPIO_H_ -#define _GPIO_H_ -#include <asm/arch/gpio.h> -/* -* Generic GPIO API -*/ - -int gpio_request (int gp,const char *label); -void gpio_free (int gp); -void gpio_toggle_value (int gp); -int gpio_direction_input (int gp); -int gpio_direction_output (int gp,int value); -int gpio_get_value (int gp); -void gpio_set_value (int gp,int value); - -#endif /* _GPIO_H_ */ +#include <asm-generic/gpio.h>
arch/powerpc/include/asm/gpio.h new file +2 -0
@@ -0,0 +1,2 @@ +#include <asm/arch/gpio.h> +#include <asm-generic/gpio.h>
include/asm-generic/gpio.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +/* +* Generic GPIO API +*/ + +int gpio_request (int gp,const char *label); +void gpio_free (int gp); +void gpio_toggle_value (int gp); +int gpio_direction_input (int gp); +int gpio_direction_output (int gp,int value); +int gpio_get_value (int gp); +void gpio_set_value (int gp,int value); + +#endif /* _GPIO_H_ */
Signature · 1 line
1.6.0.2
PATCH v7 1/4 gpio: Move common gpio.h to include/asm-generic
Quoted 5 lines · Joe Hershberger
Common GPIO API used by
cmd_gpioshould be available to any archSigned-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Kim Phillips <[email protected]>
Bye for now,
Signature · 3 lines
Laurence Withers, <[email protected]> http://www.guralp.com/ Direct tel:+447753988197 or tel:+443333408643 Software Engineer General support queries: <[email protected]> CMG-DCM CMG-EAM CMG-NAM
PATCH v7 1/4 gpio: Move common gpio.h to include/asm-generic
Quoted 8 lines · On Wed, 12 Oct 2011 15:55:25 +0000 Laurence Withers <[email protected]> wrote:
Quoted 5 lines · Joe Hershberger
Common GPIO API used by
cmd_gpioshould be available to any archSigned-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Kim Phillips <[email protected]>Tested-by Laurence Withers <[email protected]>
the initial two patches in this patchseries conflict with upstream:
commit 9d2cb8e8e6a3650613eab95c1b30023e81beb15c
Author: Simon Glass <[email protected]> Date: Fri Oct 7 13:53:50 2011 +0000
Add generic gpio.h in asm-generic
And if I try applying the latter two, I get this:
$ ./MAKEALL MPC8313ERDB_33 Configuring for MPC8313ERDB_33 - Board: MPC8313ERDB, Options: SYS_33MHZ mpc83xx_gpio.c:25:22: fatal error: asm/gpio.h: No such file or directory compilation terminated. make[1]: *** No rule to make target `.depend', needed by `libgpio.o'. Stop. make: *** [drivers/gpio/libgpio.o] Error 2 make: *** Waiting for unfinished jobs.... cmd_gpio.c:12:22: fatal error: asm/gpio.h: No such file or directory compilation terminated. make[1]: *** No rule to make target `.depend', needed by `libcommon.o'. Stop. make[1]: *** Waiting for unfinished jobs.... make: *** [common/libcommon.o] Error 2 powerpc-linux-gnu-size: './u-boot': No such file
please rebase and resubmit.
Thanks,
Kim
PATCH v8 1/4 gpio: Modify common gpio.h to more closely match Linux
Change "int gp" to "unsigned gpio"
Add request and free entry-points
---
Changes for v6:
- Linuxize gpio API
Changes for v7:
- checkpatch compliance
Changes for v8:
- Rebase onto 9d2cb8e8e6a3650613eab95c1b30023e81beb15c
include/asm-generic/gpio.h | 39 +++++++++++++++++++++++++++++++-------- 1 files changed, 31 insertions(+), 8 deletions(-)
include/asm-generic/gpio.h +31 -8
@@ -1,5 +1,6 @@/* * Copyright (c) 2011 The Chromium OS Authors. +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. * See file CREDITS for list of people who contributed to this * project. *
@@ -19,6 +20,9 @@* MA 02111-1307 USA */ +#ifndef _ASM_GENERIC_GPIO_H_ +#define _ASM_GENERIC_GPIO_H_ +/* * Generic GPIO API for U-Boot *
@@ -38,37 +42,56 @@*/ /** +* Request ownership of a GPIO. +* +* @param gpio GPIO number +* @param label Name given to the GPIO +* @return 0 if ok, -1 on error +*/ +int gpio_request (unsigned gpio,const char *label); + +/** +* Stop using the GPIO. +* +* @param gpio GPIO number +* @return 0 if ok, -1 on error +*/ +int gpio_free (unsigned gpio); + +/** * Make a GPIO an input. * -* @param gp GPIO number +* @param gpio GPIO number * @return 0 if ok, -1 on error */ -int gpio_direction_input (int gp); +int gpio_direction_input (unsigned gpio);/** * Make a GPIO an output, and set its value. * -* @param gp GPIO number +* @param gpio GPIO number * @param value GPIO value (0 for low or 1 for high) * @return 0 if ok, -1 on error */ -int gpio_direction_output (int gp,int value); +int gpio_direction_output (unsigned gpio,int value);/** * Get a GPIO's value. This will work whether the GPIO is an input * or an output. * -* @param gp GPIO number +* @param gpio GPIO number * @return 0 if low, 1 if high, -1 on error */ -int gpio_get_value (int gp); +int gpio_get_value (unsigned gpio);/** * Set an output GPIO's value. The GPIO must already be an output of * this function may have no effect. * -* @param gp GPIO number +* @param gpio GPIO number * @param value GPIO value (0 for low or 1 for high) * @return 0 if ok, -1 on error */ -int gpio_set_value (int gp,int value); +int gpio_set_value (unsigned gpio,int value); + +#endif /* _ASM_GENERIC_GPIO_H_ */
Signature · 1 line
1.6.0.2
PATCH v8 1/4 gpio: Modify common gpio.h to more closely match Linux
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111105/5d682743/attachment.pgp
PATCH v9 1/4 gpio: Modify common gpio.h to more closely match Linux
In reply to Joe HershbergerChange "int gp" to "unsigned gpio"
Add request and free entry-points
---
Changes for v6:
- Linuxize gpio API
Changes for v7:
- checkpatch compliance
Changes for v8:
- Rebase onto 9d2cb8e8e6a3650613eab95c1b30023e81beb15c
Changes for v9:
include/asm-generic/gpio.h | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-)
include/asm-generic/gpio.h +32 -9
@@ -1,5 +1,6 @@/* * Copyright (c) 2011 The Chromium OS Authors. +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. * See file CREDITS for list of people who contributed to this * project. *
@@ -19,6 +20,9 @@* MA 02111-1307 USA */ +#ifndef _ASM_GENERIC_GPIO_H_ +#define _ASM_GENERIC_GPIO_H_ +/* * Generic GPIO API for U-Boot *
@@ -38,37 +42,56 @@*/ /** +* Request ownership of a GPIO. +* +* @param gpio GPIO number +* @param label Name given to the GPIO +* @return 0 if ok, -1 on error +*/ +int gpio_request (unsigned gpio,const char *label); + +/** +* Stop using the GPIO. This function should not alter pin configuration. +* +* @param gpio GPIO number +* @return 0 if ok, -1 on error +*/ +int gpio_free (unsigned gpio); + +/** * Make a GPIO an input. * -* @param gp GPIO number +* @param gpio GPIO number * @return 0 if ok, -1 on error */ -int gpio_direction_input (int gp); +int gpio_direction_input (unsigned gpio);/** * Make a GPIO an output, and set its value. * -* @param gp GPIO number +* @param gpio GPIO number * @param value GPIO value (0 for low or 1 for high) * @return 0 if ok, -1 on error */ -int gpio_direction_output (int gp,int value); +int gpio_direction_output (unsigned gpio,int value);/** * Get a GPIO's value. This will work whether the GPIO is an input * or an output. * -* @param gp GPIO number +* @param gpio GPIO number * @return 0 if low, 1 if high, -1 on error */ -int gpio_get_value (int gp); +int gpio_get_value (unsigned gpio);/** -* Set an output GPIO's value. The GPIO must already be an output of +* Set an output GPIO's value. The GPIO must already be an output or * this function may have no effect. * -* @param gp GPIO number +* @param gpio GPIO number * @param value GPIO value (0 for low or 1 for high) * @return 0 if ok, -1 on error */ -int gpio_set_value (int gp,int value); +int gpio_set_value (unsigned gpio,int value); + +#endif /* _ASM_GENERIC_GPIO_H_ */
Signature · 1 line
1.6.0.2
PATCH v9 1/4 gpio: Modify common gpio.h to more closely match Linux
Quoted 7 lines · On Fri, 11 Nov 2011 15:55:35 -0600 Joe Hershberger <[email protected]>…
Change "int gp" to "unsigned gpio"
Add request and free entry-pointsSigned-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Kim Phillips <[email protected]>---
I've fixed a merge conflict in #2 for da8xx_gpio.c, tegra2_gpio.c, and extended it to the new mxs_gpio.c, and applied all four patches to u-boot-mpc83xx/next.
Thanks,
Kim
PATCH v9 2/4 gpio: Replace ARM gpio.h with the common API in include/asm-generic
In reply to Joe HershbergerARM boards should use the generic GPIO API
This means changing gpio to unsigned type
Remove the unused gpio_toggle() function which is not part of the API Comment that free should not modify pin state
---
Changes for v4:
- Split out of patch 1/2
Changes for v5:
- Moved asm/arch/gpio.h include to asm/gpio.h
Changes for v6:
Changes for v7:
Changes for v8:
- Include omap-common/gpio.c in retrofit
Changes for v9:
- Tegra gpio_free clears name
- Updated GPIO API for other ARM boards that were added
- Follow API by returning -1 on error instead of -EINVAL
arch/arm/cpu/armv7/omap-common/gpio.c | 35 ++++--- arch/arm/include/asm/gpio.h | 38 +-------- drivers/gpio/da8xx_gpio.c | 78 ++++++++-------- drivers/gpio/mvgpio.c | 74 +++++++-------- drivers/gpio/mxc_gpio.c | 42 ++++----- drivers/gpio/s5p_gpio.c | 47 ++++++---- drivers/gpio/tegra2_gpio.c | 165 +++++++++++++++++---------------- 7 files changed, 229 insertions(+), 250 deletions(-)
arch/arm/cpu/armv7/omap-common/gpio.c +19 -16
@@ -36,7 +36,7 @@* published by the Free Software Foundation. */ #include <common.h> -#include <asm/arch/gpio.h> +#include <asm/gpio.h> #include <asm/io.h> #include <asm/errno.h>
@@ -56,17 +56,17 @@ static inline int get_gpio_index(int gpio)static inline int gpio_valid (int gpio) {if (gpio <0 ) -return -EINVAL ; +return -1 ;if (gpio <192 )return 0 ; -return -EINVAL ; +return -1 ; }static int check_gpio (int gpio) {if (gpio_valid (gpio) <0 ) {printf ("ERROR : check_gpio: invalid GPIO %d\n" , gpio); -return -EINVAL ; +return -1 ; }return 0 ; }
@@ -106,7 +106,7 @@ static int _get_gpio_direction(const struct gpio_bank *bank, int gpio) reg +=OMAP_GPIO_OE ;break ;default : -return -EINVAL ; +return -1 ; } v =__raw_readl (reg);
@@ -142,27 +142,29 @@ static void _set_gpio_dataout(const struct gpio_bank *bank, int gpio,/** * Set value of the specified gpio */ -void gpio_set_value (int gpio,int value) +int gpio_set_value (unsigned gpio,int value) {const struct gpio_bank *bank;if (check_gpio (gpio) <0 ) -return ; +return -1 ; bank =get_gpio_bank (gpio);_set_gpio_dataout (bank,get_gpio_index (gpio), value); + +return 0 ; }/** * Get value of the specified gpio */ -int gpio_get_value (int gpio) +int gpio_get_value (unsigned gpio) {const struct gpio_bank *bank;void *reg;int input;if (check_gpio (gpio) <0 ) -return -EINVAL ; +return -1 ; bank =get_gpio_bank (gpio); reg = bank->base;switch (bank->method) {
@@ -176,11 +178,11 @@ int gpio_get_value(int gpio) reg +=OMAP_GPIO_DATAOUT ;break ;default : -return -EINVAL ; +return -1 ; }break ;default : -return -EINVAL ; +return -1 ; }return (__raw_readl (reg) & (1 <<get_gpio_index (gpio))) !=0 ;
@@ -194,7 +196,7 @@ int gpio_direction_input(unsigned gpio)const struct gpio_bank *bank;if (check_gpio (gpio) <0 ) -return -EINVAL ; +return -1 ; bank =get_gpio_bank (gpio);_set_gpio_direction (bank,get_gpio_index (gpio),1 );
@@ -210,7 +212,7 @@ int gpio_direction_output(unsigned gpio, int value)const struct gpio_bank *bank;if (check_gpio (gpio) <0 ) -return -EINVAL ; +return -1 ; bank =get_gpio_bank (gpio);_set_gpio_dataout (bank,get_gpio_index (gpio), value);
@@ -224,10 +226,10 @@ int gpio_direction_output(unsigned gpio, int value)* * NOTE: Argument 'label' is unused. */ -int gpio_request (int gpio,const char *label) +int gpio_request (unsigned gpio,const char *label) {if (check_gpio (gpio) <0 ) -return -EINVAL ; +return -1 ;return 0 ; }
@@ -235,6 +237,7 @@ int gpio_request(int gpio, const char *label)/** * Reset and free the gpio after using it. */ -void gpio_free (unsigned gpio) +int gpio_free (unsigned gpio) { +return 0 ; }
arch/arm/include/asm/gpio.h +1 -37
@@ -1,38 +1,2 @@ -/* -* Copyright (c) 2011, NVIDIA Corp. All rights reserved. -* See file CREDITS for list of people who contributed to this -* project. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* 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. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, -* MA 02111-1307 USA -*/ - -#ifndef _GPIO_H_ -#define _GPIO_H_ -#include <asm/arch/gpio.h> -/* -* Generic GPIO API -*/ - -int gpio_request (int gp,const char *label); -void gpio_free (int gp); -void gpio_toggle_value (int gp); -int gpio_direction_input (int gp); -int gpio_direction_output (int gp,int value); -int gpio_get_value (int gp); -void gpio_set_value (int gp,int value); - -#endif /* _GPIO_H_ */ +#include <asm-generic/gpio.h>
drivers/gpio/da8xx_gpio.c +40 -38
137 lines not on this page · raw message
drivers/gpio/mvgpio.c +36 -38
117 lines not on this page · raw message
drivers/gpio/mxc_gpio.c +20 -22
96 lines not on this page · raw message
drivers/gpio/s5p_gpio.c +28 -19
81 lines not on this page · raw message
drivers/gpio/tegra2_gpio.c +85 -80
278 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v9 2/4 gpio: Replace ARM gpio.h with the common API in include/asm-generic
Quoted 10 lines · On Fri, 11 Nov 2011 15:55:36 -0600 Joe Hershberger <[email protected]>…
ARM boards should use the generic GPIO API
This means changing gpio to unsigned type
Remove the unusedgpio_toggle()function which is not part of the API Comment that free should not modify pin stateSigned-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Kim Phillips <[email protected]>Cc Albert ARIBAUD <[email protected]>---
I've tested this series on the 8313, and I'm ok with it going in:
I need an ack from the ARM GPIO guys to apply it though (assuming it is to go through 83xx).
Kim
PATCH v9 2/4 gpio: Replace ARM gpio.h with the common API in include/asm-generic
Quoted 14 lines · Kim Phillips
Quoted 10 lines · On Fri, 11 Nov 2011 15:55:36 -0600 Joe Hershberger <[email protected]>…
ARM boards should use the generic GPIO API
This means changing gpio to unsigned type
Remove the unusedgpio_toggle()function which is not part of the API Comment that free should not modify pin stateSigned-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Kim Phillips <[email protected]>Cc Albert ARIBAUD <[email protected]>---
Quoted 6 lines
I've tested this series on the 8313, and I'm ok with it going in:
Acked-by Kim Phillips <[email protected]>I need an ack from the ARM GPIO guys to apply it though (assuming it is to go through 83xx).
It has been Acked by ARM guys several times in several forms. It's pretty straightforward. Not sure if Albert was planning to look at this again.
-Joe
PATCH v9 3/4 mpc83xx: Add a GPIO driver for the MPC83XX family
In reply to Joe Hershberger---
Changes for v2:
- Improved names of INIT constants (to include "CONFIG_")
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c to patch 2/2
Changes for v3:
- gpio_init_* is now mpc83xx_gpio_init_*
Changes for v4:
- no volatile
- no camelCase
- use i/o accessors
Changes for v5:
Changes for v6:
- update to use new GPIO API
Changes for v7:
- checkpatch compliance
Changes for v8:
Changes for v9:
- Change indentation on #define
arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 38 +++++ arch/powerpc/include/asm/gpio.h | 2 + drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 199 ++++++++++++++++++++++++++ 4 files changed, 240 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC83XX_GPIO_H_ +#define _MPC83XX_GPIO_H_ + +/* +* The MCP83xx's 1-2 GPIO controllers each with 32 bits. +*/ +#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || \ + defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif + +#define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) + +void mpc83xx_gpio_init_f (void ); +void mpc83xx_gpio_init_r (void ); + +#endif /* MPC83XX_GPIO_H_ */
arch/powerpc/include/asm/gpio.h new file +2 -0
@@ -0,0 +1,2 @@ +#include <asm/arch/gpio.h> +#include <asm-generic/gpio.h>
drivers/gpio/Makefile +1 -0
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_PCA9698) += pca9698.o COBJS-$(CONFIG_S5P) += s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/mpc83xx_gpio.c new file +199 -0
199 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v9 4/4 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
In reply to Joe Hershberger---
Changes for v2:
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c from patch 1/2
Changes for v3:
- Renamed gpio_init_* to mpc83xx_gpio_init_*
- Added board_early_init_r support to MPC8313ERDB targets
Changes for v4:
- Fixed build warning
Changes for v5:
Changes for v6:
Changes for v7:
- checkpatch compliance
Changes for v8:
Changes for v9:
board/freescale/mpc8313erdb/mpc8313erdb.c | 15 +++++++++++++++ include/configs/MPC8313ERDB.h | 9 +++++++-- 2 files changed, 22 insertions(+), 2 deletions(-)
board/freescale/mpc8313erdb/mpc8313erdb.c +15 -0
@@ -31,6 +31,9 @@#include <vsc7385.h> #include <ns16550.h> #include <nand.h> +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +#include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -42,6 +45,18 @@ int board_early_init_f(void)if (im->pmc.pmccr1 &PMCCR1_POWER_OFF ) gd->flags |=GD_FLG_SILENT ;#endif +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_f (); +#endif + +return 0 ; +} + +int board_early_init_r (void ) +{ +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_r (); +#endif return 0 ; }
include/configs/MPC8313ERDB.h +7 -2
@@ -82,7 +82,8 @@#define CONFIG_SYS_CLK_FREQ CONFIG_83XX_CLKIN -#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_BOARD_EARLY_INIT_F /* call board_early_init_f */ +#define CONFIG_BOARD_EARLY_INIT_R /* call board_early_init_r */ #define CONFIG_SYS_IMMR 0xE0000000
@@ -363,6 +364,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_MPC83XX_GPIO 1 +#define CONFIG_CMD_GPIO 1 +/* * Serial Port */
@@ -581,7 +585,8 @@/* System IO Config */ #define CONFIG_SYS_SICRH (SICRH_TSOBI1 | SICRH_TSOBI2)/* RGMII */ -#define CONFIG_SYS_SICRL SICRL_USBDR_10/* Enable Internal USB Phy */ +/* Enable Internal USB Phy and GPIO on LCD Connector */ +#define CONFIG_SYS_SICRL (SICRL_USBDR_10 | SICRL_LBC)#define CONFIG_SYS_HID0_INIT 0x000000000#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
Signature · 1 line
1.6.0.2
PATCH v8 2/4 gpio: Replace ARM gpio.h with the common API in include/asm-generic
In reply to Kim PhillipsARM boards should use the generic GPIO API
Update the existing gpio implementations to conform the the generic API
---
Changes for v4:
- Split out of patch 1/2
Changes for v5:
- Moved asm/arch/gpio.h include to asm/gpio.h
Changes for v6:
Changes for v7:
Changes for v8:
- Include omap-common/gpio.c in retrofit
arch/arm/cpu/armv7/omap-common/gpio.c | 23 +++-- arch/arm/include/asm/gpio.h | 38 +-------- drivers/gpio/da8xx_gpio.c | 73 +++++++-------- drivers/gpio/tegra2_gpio.c | 160 ++++++++++++++++---------------- 4 files changed, 128 insertions(+), 166 deletions(-)
arch/arm/cpu/armv7/omap-common/gpio.c +13 -10
@@ -36,7 +36,7 @@* published by the Free Software Foundation. */ #include <common.h> -#include <asm/arch/gpio.h> +#include <asm/gpio.h> #include <asm/io.h> #include <asm/errno.h>
@@ -142,20 +142,22 @@ static void _set_gpio_dataout(const struct gpio_bank *bank, int gpio,/** * Set value of the specified gpio */ -void gpio_set_value (int gpio,int value) +int gpio_set_value (unsigned gpio,int value) {const struct gpio_bank *bank;if (check_gpio (gpio) <0 ) -return ; +return -1 ; bank =get_gpio_bank (gpio);_set_gpio_dataout (bank,get_gpio_index (gpio), value); + +return 0 ; }/** * Get value of the specified gpio */ -int gpio_get_value (int gpio) +int gpio_get_value (unsigned gpio) {const struct gpio_bank *bank;void *reg;
@@ -176,11 +178,11 @@ int gpio_get_value(int gpio) reg +=OMAP_GPIO_DATAOUT ;break ;default : -return -EINVAL ; +return -1 ; }break ;default : -return -EINVAL ; +return -1 ; }return (__raw_readl (reg) & (1 <<get_gpio_index (gpio))) !=0 ;
@@ -194,7 +196,7 @@ int gpio_direction_input(unsigned gpio)const struct gpio_bank *bank;if (check_gpio (gpio) <0 ) -return -EINVAL ; +return -1 ; bank =get_gpio_bank (gpio);_set_gpio_direction (bank,get_gpio_index (gpio),1 );
@@ -210,7 +212,7 @@ int gpio_direction_output(unsigned gpio, int value)const struct gpio_bank *bank;if (check_gpio (gpio) <0 ) -return -EINVAL ; +return -1 ; bank =get_gpio_bank (gpio);_set_gpio_dataout (bank,get_gpio_index (gpio), value);
@@ -224,7 +226,7 @@ int gpio_direction_output(unsigned gpio, int value)* * NOTE: Argument 'label' is unused. */ -int gpio_request (int gpio,const char *label) +int gpio_request (unsigned gpio,const char *label) {if (check_gpio (gpio) <0 )return -EINVAL ;
@@ -235,6 +237,7 @@ int gpio_request(int gpio, const char *label)/** * Reset and free the gpio after using it. */ -void gpio_free (unsigned gpio) +int gpio_free (unsigned gpio) { +return 0 ; }
arch/arm/include/asm/gpio.h +1 -37
@@ -1,38 +1,2 @@ -/* -* Copyright (c) 2011, NVIDIA Corp. All rights reserved. -* See file CREDITS for list of people who contributed to this -* project. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* 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. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, -* MA 02111-1307 USA -*/ - -#ifndef _GPIO_H_ -#define _GPIO_H_ -#include <asm/arch/gpio.h> -/* -* Generic GPIO API -*/ - -int gpio_request (int gp,const char *label); -void gpio_free (int gp); -void gpio_toggle_value (int gp); -int gpio_direction_input (int gp); -int gpio_direction_output (int gp,int value); -int gpio_get_value (int gp); -void gpio_set_value (int gp,int value); - -#endif /* _GPIO_H_ */ +#include <asm-generic/gpio.h>
drivers/gpio/da8xx_gpio.c +34 -39
124 lines not on this page · raw message
drivers/gpio/tegra2_gpio.c +80 -80
273 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v8 2/4 gpio: Replace ARM gpio.h with the common API in include/asm-generic
Joe Hershberger wrote at Friday, November 04, 2011 8:25 PM:
Quoted 2 lines
ARM boards should use the generic GPIO API
Update the existing gpio implementations to conform the the generic API
The Tegra changes look mostly OK, but:
a) They are almost entirely unrelated to this patch description; most of the diff is variable renaming and nothing to do with conforming to the API.
b) I've CC'd the main Tegra maintainers to give final comment.
c) Some comments below.
Quoted 1 line
drivers/gpio/tegra2_gpio.c +0
-0
...
drivers/gpio/tegra2_gpio.c
Quoted 5 lines
drivers/gpio/tegra2_gpio.c +2
-1-void gpio_free (int gp) +int gpio_free (unsigned gpio) { +return 0 ; }
If you're doing a cleanup pass on this driver, you may as well make gpio_free() do something; it should probably clear gpio_names[gpio].name and perhaps set the pin back to SFIO - in other words, undo gpio_reqeust().
drivers/gpio/tegra2_gpio.c static char *get_name(int i) · line 179
Quoted 3 lines
drivers/gpio/tegra2_gpio.c +0
-3-void gpio_toggle_value (int gp) -{ -gpio_set_value (gp, !gpio_get_output_value (gp));
You should probably at least mention this function being removed in the commit description. I hope nothing is using it.
Signature · 1 line
nvpublic
PATCH v8 2/4 gpio: Replace ARM gpio.h with the common API in include/asm-generic
Quoted 10 lines · On Monday 07 November 2011 11:35:33 Stephen Warren wrote:
Joe Hershberger wrote at Friday, November 04, 2011 8:25 PM:
drivers/gpio/da8xx_gpio.c static const struct pinmux_config gpio_pinmux[] = { · line 205
Quoted 5 lines
drivers/gpio/da8xx_gpio.c +2
-1-void gpio_free (int gp) +int gpio_free (unsigned gpio) { +return 0 ; }If you're doing a cleanup pass on this driver, you may as well make
gpio_free()do something; it should probably clear gpio_names[gpio].name and perhaps set the pin back to SFIO - in other words, undogpio_reqeust().
i think the decision made in Linux was that freeing a GPIO should not cause it to change tristate or anything. all it should do is mark it as "available" so something else can request it.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111107/4d605bcc/attachment.pgp
PATCH v8 2/4 gpio: Replace ARM gpio.h with the common API in include/asm-generic
Mike Frysinger wrote at Monday, November 07, 2011 10:40 AM:
Quoted 14 lines
* PGP Signed by an unknown key
Quoted 10 lines · On Monday 07 November 2011 11:35:33 Stephen Warren wrote:
Joe Hershberger wrote at Friday, November 04, 2011 8:25 PM:
drivers/gpio/da8xx_gpio.c static const struct pinmux_config gpio_pinmux[] = { · line 205
Quoted 5 lines
drivers/gpio/da8xx_gpio.c +2
-1-void gpio_free (int gp) +int gpio_free (unsigned gpio) { +return 0 ; }If you're doing a cleanup pass on this driver, you may as well make
gpio_free()do something; it should probably clear gpio_names[gpio].name and perhaps set the pin back to SFIO - in other words, undogpio_reqeust().
Quoted 4 lines
i think the decision made in Linux was that freeing a GPIO should not cause it to change tristate or anything. all it should do is mark it as "available" so something else can request it.
-mike
OK, I'll buy that, but presumably gpio_names[gpio].name should still be cleared to indicate the pin is free?
Signature · 1 line
nvpublic
PATCH v8 2/4 gpio: Replace ARM gpio.h with the common API in include/asm-generic
Quoted 15 lines · Stephen Warren
Mike Frysinger wrote at Monday, November 07, 2011 10:40 AM:
Quoted 14 lines
* PGP Signed by an unknown key
Quoted 10 lines · On Monday 07 November 2011 11:35:33 Stephen Warren wrote:
Joe Hershberger wrote at Friday, November 04, 2011 8:25 PM:
Quoted 5 lines
(quoted diff) +1
-1-void gpio_free(int gp) +int gpio_free(unsigned gpio)?{
+ return 0;
?}If you're doing a cleanup pass on this driver, you may as well make
gpio_free()do something; it should probably clear gpio_names[gpio].name and perhaps set the pin back to SFIO - in other words, undogpio_reqeust().
Quoted 7 lines
Quoted 4 lines
i think the decision made in Linux was that freeing a GPIO should not cause it to change tristate or anything. ?all it should do is mark it as "available" so something else can request it.
-mikeOK, I'll buy that, but presumably gpio_names[gpio].name should still be cleared to indicate the pin is free?
Besides, that would directly undo this patch:
http://patchwork.ozlabs.org/patch/119277/
I'll clear the string.
Thanks,
-Joe
PATCH v8 2/4 gpio: Replace ARM gpio.h with the common API in include/asm-generic
In reply to Stephen WarrenQuoted 14 lines · On Monday 07 November 2011 12:02:16 Stephen Warren wrote:
Mike Frysinger wrote at Monday, November 07, 2011 10:40 AM:
Quoted 13 lines · On Monday 07 November 2011 11:35:33 Stephen Warren wrote:
Quoted 11 lines
Joe Hershberger wrote at Friday, November 04, 2011 8:25 PM:
drivers/gpio/da8xx_gpio.c static const struct pinmux_config gpio_pinmux[] = { · line 205
Quoted 5 lines
drivers/gpio/da8xx_gpio.c +2
-1-void gpio_free (int gp) +int gpio_free (unsigned gpio) { +return 0 ; }If you're doing a cleanup pass on this driver, you may as well make
gpio_free()do something; it should probably clear gpio_names[gpio].name and perhaps set the pin back to SFIO - in other words, undogpio_reqeust().
Quoted 6 lines
Quoted 3 lines
i think the decision made in Linux was that freeing a GPIO should not cause it to change tristate or anything. all it should do is mark it as "available" so something else can request it.
OK, I'll buy that, but presumably gpio_names[gpio].name should still be cleared to indicate the pin is free?
if the tegra code is using the gpio_names[] array to determine whether a pin is allocated, then gpio_free() should take care of clearing it
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111107/9c93588d/attachment.pgp
PATCH v8 3/4 mpc83xx: Add a GPIO driver for the MPC83XX family
In reply to Kim Phillips---
Changes for v2:
- Improved names of INIT constants (to include "CONFIG_")
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c to patch 2/2
Changes for v3:
- gpio_init_* is now mpc83xx_gpio_init_*
Changes for v4:
- no volatile
- no camelCase
- use i/o accessors
Changes for v5:
Changes for v6:
- update to use new GPIO API
Changes for v7:
- checkpatch compliance
Changes for v8:
arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 38 +++++ arch/powerpc/include/asm/gpio.h | 2 + drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 198 ++++++++++++++++++++++++++ 4 files changed, 239 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC83XX_GPIO_H_ +#define _MPC83XX_GPIO_H_ + +/* +* The MCP83xx's 1-2 GPIO controllers each with 32 bits. +*/ +#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || \ + defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif + +#define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) + +void mpc83xx_gpio_init_f (void ); +void mpc83xx_gpio_init_r (void ); + +#endif /* MPC83XX_GPIO_H_ */
arch/powerpc/include/asm/gpio.h new file +2 -0
@@ -0,0 +1,2 @@ +#include <asm/arch/gpio.h> +#include <asm-generic/gpio.h>
drivers/gpio/Makefile +1 -0
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_PCA9698) += pca9698.o COBJS-$(CONFIG_S5P) += s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/mpc83xx_gpio.c new file +198 -0
198 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v8 3/4 mpc83xx: Add a GPIO driver for the MPC83XX family
arch/powerpc/include/asm/arch-mpc83xx/gpio.h line 31
Quoted 11 lines · On Friday 04 November 2011 22:25:00 Joe Hershberger wrote:
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +8
-0+#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || \ + defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif
there should not be whitespace before the "#"
Quoted 11 lines
drivers/gpio/mpc83xx_gpio.c new file +8
-0+#ifndef CONFIG_MPC83XX_GPIO_0_INIT_DIRECTION +#define CONFIG_MPC83XX_GPIO_0_INIT_DIRECTION 0 +#endif +#ifndef CONFIG_MPC83XX_GPIO_1_INIT_DIRECTION +#define CONFIG_MPC83XX_GPIO_1_INIT_DIRECTION 0 +#endif +#ifndef CONFIG_MPC83XX_GPIO_0_INIT_OPEN_DRAIN +#define CONFIG_MPC83XX_GPIO_0_INIT_OPEN_DRAIN 0
drivers/gpio/mpc83xx_gpio.c line 45
Quoted 10 lines
drivers/gpio/mpc83xx_gpio.c new file +10
-0+#endif +#ifndef CONFIG_MPC83XX_GPIO_1_INIT_OPEN_DRAIN +#define CONFIG_MPC83XX_GPIO_1_INIT_OPEN_DRAIN 0 +#endif +#ifndef CONFIG_MPC83XX_GPIO_0_INIT_VALUE +#define CONFIG_MPC83XX_GPIO_0_INIT_VALUE 0 +#endif +#ifndef CONFIG_MPC83XX_GPIO_1_INIT_VALUE +#define CONFIG_MPC83XX_GPIO_1_INIT_VALUE 0 +#endif
same here
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111105/5400e35e/attachment.pgp
PATCH v8 4/4 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
In reply to Kim Phillips---
Changes for v2:
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c from patch 1/2
Changes for v3:
- Renamed gpio_init_* to mpc83xx_gpio_init_*
- Added board_early_init_r support to MPC8313ERDB targets
Changes for v4:
- Fixed build warning
Changes for v5:
Changes for v6:
Changes for v7:
- checkpatch compliance
Changes for v8:
board/freescale/mpc8313erdb/mpc8313erdb.c | 15 +++++++++++++++ include/configs/MPC8313ERDB.h | 9 +++++++-- 2 files changed, 22 insertions(+), 2 deletions(-)
board/freescale/mpc8313erdb/mpc8313erdb.c +15 -0
@@ -31,6 +31,9 @@#include <vsc7385.h> #include <ns16550.h> #include <nand.h> +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +#include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -42,6 +45,18 @@ int board_early_init_f(void)if (im->pmc.pmccr1 &PMCCR1_POWER_OFF ) gd->flags |=GD_FLG_SILENT ;#endif +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_f (); +#endif + +return 0 ; +} + +int board_early_init_r (void ) +{ +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_r (); +#endif return 0 ; }
include/configs/MPC8313ERDB.h +7 -2
@@ -82,7 +82,8 @@#define CONFIG_SYS_CLK_FREQ CONFIG_83XX_CLKIN -#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_BOARD_EARLY_INIT_F /* call board_early_init_f */ +#define CONFIG_BOARD_EARLY_INIT_R /* call board_early_init_r */ #define CONFIG_SYS_IMMR 0xE0000000
@@ -363,6 +364,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_MPC83XX_GPIO 1 +#define CONFIG_CMD_GPIO 1 +/* * Serial Port */
@@ -581,7 +585,8 @@/* System IO Config */ #define CONFIG_SYS_SICRH (SICRH_TSOBI1 | SICRH_TSOBI2)/* RGMII */ -#define CONFIG_SYS_SICRL SICRL_USBDR_10/* Enable Internal USB Phy */ +/* Enable Internal USB Phy and GPIO on LCD Connector */ +#define CONFIG_SYS_SICRL (SICRL_USBDR_10 | SICRL_LBC)#define CONFIG_SYS_HID0_INIT 0x000000000#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
Signature · 1 line
1.6.0.2
PATCH v7 2/4 gpio: Modify common gpio.h to more closely match Linux
In reply to Joe HershbergerChange "int gp" to "unsigned gpio"
Update the 2 existing arm implementations to match the new API Remove the gpio_toggle() implementation (never used)
---
Changes for v6:
- Linuxize gpio API
Changes for v7:
- checkpatch compliance
drivers/gpio/da8xx_gpio.c | 62 +++++++++--------- drivers/gpio/tegra2_gpio.c | 157 +++++++++++++++++++++---------------------- include/asm-generic/gpio.h | 13 ++-- 3 files changed, 114 insertions(+), 118 deletions(-)
drivers/gpio/da8xx_gpio.c +31 -31
@@ -181,26 +181,26 @@ static const struct pinmux_config gpio_pinmux[] = { { pinmux(18), 8, 2 }, }; -int gpio_request (int gp,const char *label) +int gpio_request (unsigned gpio,const char *label) { -if (gp >=MAX_NUM_GPIOS ) +if (gpio >=MAX_NUM_GPIOS )return -1 ; -if (gpio_registry[gp].is_registered) +if (gpio_registry[gpio].is_registered)return -1 ; - gpio_registry[gp].is_registered =1 ; -strncpy (gpio_registry[gp].name, label,GPIO_NAME_SIZE ); - gpio_registry[gp].name[GPIO_NAME_SIZE -1 ] =0 ; + gpio_registry[gpio].is_registered =1 ; +strncpy (gpio_registry[gpio].name, label,GPIO_NAME_SIZE ); + gpio_registry[gpio].name[GPIO_NAME_SIZE -1 ] =0 ; -davinci_configure_pin_mux (&gpio_pinmux[gp],1 ); +davinci_configure_pin_mux (&gpio_pinmux[gpio],1 );return 0 ; } -void gpio_free (int gp) +void gpio_free (unsigned gpio) { - gpio_registry[gp].is_registered =0 ; + gpio_registry[gpio].is_registered =0 ; }void gpio_toggle_value (int gp)
@@ -211,60 +211,60 @@ void gpio_toggle_value(int gp)gpio_set_value (gp, !gpio_get_value (gp)); } -int gpio_direction_input (int gp) +int gpio_direction_input (unsigned gpio) {struct davinci_gpio *bank; - bank =GPIO_BANK (gp); -setbits_le32 (&bank->dir,1U <<GPIO_BIT (gp)); + bank =GPIO_BANK (gpio); +setbits_le32 (&bank->dir,1U <<GPIO_BIT (gpio));return 0 ; } -int gpio_direction_output (int gp,int value) +int gpio_direction_output (unsigned gpio,int value) {struct davinci_gpio *bank; - bank =GPIO_BANK (gp); -clrbits_le32 (&bank->dir,1U <<GPIO_BIT (gp)); -gpio_set_value (gp, value); + bank =GPIO_BANK (gpio); +clrbits_le32 (&bank->dir,1U <<GPIO_BIT (gpio)); +gpio_set_value (gpio, value);return 0 ; } -int gpio_get_value (int gp) +int gpio_get_value (unsigned gpio) {struct davinci_gpio *bank;unsigned int ip; - bank =GPIO_BANK (gp); - ip =in_le32 (&bank->in_data) & (1U <<GPIO_BIT (gp)); + bank =GPIO_BANK (gpio); + ip =in_le32 (&bank->in_data) & (1U <<GPIO_BIT (gpio));return ip ?1 :0 ; } -void gpio_set_value (int gp,int value) +void gpio_set_value (unsigned gpio,int value) {struct davinci_gpio *bank; - bank =GPIO_BANK (gp); + bank =GPIO_BANK (gpio);if (value) - bank->set_data =1U <<GPIO_BIT (gp); + bank->set_data =1U <<GPIO_BIT (gpio);else - bank->clr_data =1U <<GPIO_BIT (gp); + bank->clr_data =1U <<GPIO_BIT (gpio); }void gpio_info (void ) { -int gp, dir, val; +unsigned gpio, dir, val;struct davinci_gpio *bank; -for (gp =0 ; gp <MAX_NUM_GPIOS ; ++gp) { - bank =GPIO_BANK (gp); - dir =in_le32 (&bank->dir) & (1U <<GPIO_BIT (gp)); - val =gpio_get_value (gp); +for (gpio =0 ; gpio <MAX_NUM_GPIOS ; ++gpio) { + bank =GPIO_BANK (gpio); + dir =in_le32 (&bank->dir) & (1U <<GPIO_BIT (gpio)); + val =gpio_get_value (gpio);printf ("% 4d: %s: %d [%c] %s\n" , - gp, dir ?" in" :"out" , val, - gpio_registry[gp].is_registered ?'x' :' ' , - gpio_registry[gp].name); + gpio, dir ?" in" :"out" , val, + gpio_registry[gpio].is_registered ?'x' :' ' , + gpio_registry[gpio].name); } }
drivers/gpio/tegra2_gpio.c +77 -80
270 lines not on this page · raw message
include/asm-generic/gpio.h +6 -7
@@ -26,12 +26,11 @@* Generic GPIO API */ -int gpio_request (int gp,const char *label); -void gpio_free (int gp); -void gpio_toggle_value (int gp); -int gpio_direction_input (int gp); -int gpio_direction_output (int gp,int value); -int gpio_get_value (int gp); -void gpio_set_value (int gp,int value); +int gpio_request (unsigned gpio,const char *label); +void gpio_free (unsigned gpio); +int gpio_direction_input (unsigned gpio); +int gpio_get_value (unsigned gpio); +int gpio_direction_output (unsigned gpio,int value); +void gpio_set_value (unsigned gpio,int value);#endif /* _GPIO_H_ */
Signature · 1 line
1.6.0.2
PATCH v7 2/4 gpio: Modify common gpio.h to more closely match Linux
Quoted 7 lines · Joe Hershberger
Change "int gp" to "unsigned gpio"
Update the 2 existing arm implementations to match the new API Remove thegpio_toggle()implementation (never used)Signed-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Kim Phillips <[email protected]>
Bye for now,
Signature · 3 lines
Laurence Withers, <[email protected]> http://www.guralp.com/ Direct tel:+447753988197 or tel:+443333408643 Software Engineer General support queries: <[email protected]> CMG-DCM CMG-EAM CMG-NAM
PATCH v7 3/4 mpc83xx: Add a GPIO driver for the MPC83XX family
In reply to Joe Hershberger---
Changes for v2:
- Improved names of INIT constants (to include "CONFIG_")
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c to patch 2/2
Changes for v3:
- gpio_init_* is now mpc83xx_gpio_init_*
Changes for v4:
- no volatile
- no camelCase
- use i/o accessors
Changes for v5:
Changes for v6:
- update to use new GPIO API
Changes for v7:
- checkpatch compliance
arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 38 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 195 ++++++++++++++++++++++++++ 3 files changed, 234 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC83XX_GPIO_H_ +#define _MPC83XX_GPIO_H_ + +/* +* The MCP83xx's 1-2 GPIO controllers each with 32 bits. +*/ +#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || \ + defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif + +#define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) + +void mpc83xx_gpio_init_f (void ); +void mpc83xx_gpio_init_r (void ); + +#endif /* MPC83XX_GPIO_H_ */
drivers/gpio/Makefile +1 -0
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P) += s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/mpc83xx_gpio.c new file +195 -0
195 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v7 4/4 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
In reply to Joe Hershberger---
Changes for v2:
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c from patch 1/2
Changes for v3:
- Renamed gpio_init_* to mpc83xx_gpio_init_*
- Added board_early_init_r support to MPC8313ERDB targets
Changes for v4:
- Fixed build warning
Changes for v5:
Changes for v6:
Changes for v7:
- checkpatch compliance
board/freescale/mpc8313erdb/mpc8313erdb.c | 15 +++++++++++++++ include/configs/MPC8313ERDB.h | 9 +++++++-- 2 files changed, 22 insertions(+), 2 deletions(-)
board/freescale/mpc8313erdb/mpc8313erdb.c +15 -0
@@ -31,6 +31,9 @@#include <vsc7385.h> #include <ns16550.h> #include <nand.h> +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +#include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -42,6 +45,18 @@ int board_early_init_f(void)if (im->pmc.pmccr1 &PMCCR1_POWER_OFF ) gd->flags |=GD_FLG_SILENT ;#endif +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_f (); +#endif + +return 0 ; +} + +int board_early_init_r (void ) +{ +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_r (); +#endif return 0 ; }
include/configs/MPC8313ERDB.h +7 -2
@@ -82,7 +82,8 @@#define CONFIG_SYS_CLK_FREQ CONFIG_83XX_CLKIN -#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_BOARD_EARLY_INIT_F /* call board_early_init_f */ +#define CONFIG_BOARD_EARLY_INIT_R /* call board_early_init_r */ #define CONFIG_SYS_IMMR 0xE0000000
@@ -322,6 +323,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_MPC83XX_GPIO 1 +#define CONFIG_CMD_GPIO 1 +/* * Serial Port */
@@ -535,7 +539,8 @@/* System IO Config */ #define CONFIG_SYS_SICRH (SICRH_TSOBI1 | SICRH_TSOBI2)/* RGMII */ -#define CONFIG_SYS_SICRL SICRL_USBDR_10/* Enable Internal USB Phy */ +/* Enable Internal USB Phy and GPIO on LCD Connector */ +#define CONFIG_SYS_SICRL (SICRL_USBDR_10 | SICRL_LBC)#define CONFIG_SYS_HID0_INIT 0x000000000#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
Signature · 1 line
1.6.0.2
PATCH v6 2/4 gpio: Modify common gpio.h to more closely match Linux
In reply to Mike FrysingerChange "int gp" to "unsigned gpio"
Update the 2 existing arm implementations to match the new API Remove the gpio_toggle() implementation (never used)
---
Changes for v6:
- Linuxize gpio API
drivers/gpio/da8xx_gpio.c | 71 +++++++++----------- drivers/gpio/tegra2_gpio.c | 156 +++++++++++++++++++++---------------------- include/asm-generic/gpio.h | 13 ++-- 3 files changed, 113 insertions(+), 127 deletions(-)
drivers/gpio/da8xx_gpio.c +31 -40
@@ -185,97 +185,88 @@ static const struct pinmux_config gpio_pinmux[] = { -int gpio_request (int gp,const char *label) +int gpio_request (unsigned gpio,const char *label) { -if (gp >=MAX_NUM_GPIOS ) +if (gpio >=MAX_NUM_GPIOS )return -1 ; -if (gpio_registry[gp].is_registered) +if (gpio_registry[gpio].is_registered)return -1 ; - gpio_registry[gp].is_registered =1 ; -strncpy (gpio_registry[gp].name, label,GPIO_NAME_SIZE ); - gpio_registry[gp].name[GPIO_NAME_SIZE -1 ] =0 ; + gpio_registry[gpio].is_registered =1 ; +strncpy (gpio_registry[gpio].name, label,GPIO_NAME_SIZE ); + gpio_registry[gpio].name[GPIO_NAME_SIZE -1 ] =0 ; -davinci_configure_pin_mux (&gpio_pinmux[gp],1 ); +davinci_configure_pin_mux (&gpio_pinmux[gpio],1 );return 0 ; } -void gpio_free (int gp) +void gpio_free (unsigned gpio) { - gpio_registry[gp].is_registered =0 ; + gpio_registry[gpio].is_registered =0 ; } -void gpio_toggle_value (int gp) +int gpio_direction_input (unsigned gpio) {struct davinci_gpio *bank; - bank =GPIO_BANK (gp); -gpio_set_value (gp, !gpio_get_value (gp)); -} - - -int gpio_direction_input (int gp) -{ -struct davinci_gpio *bank; - - bank =GPIO_BANK (gp); -setbits_le32 (&bank->dir,1U <<GPIO_BIT (gp)); + bank =GPIO_BANK (gpio); +setbits_le32 (&bank->dir,1U <<GPIO_BIT (gpio));return 0 ; } -int gpio_direction_output (int gp,int value) +int gpio_direction_output (unsigned gpio,int value) {struct davinci_gpio *bank; - bank =GPIO_BANK (gp); -clrbits_le32 (&bank->dir,1U <<GPIO_BIT (gp)); -gpio_set_value (gp, value); + bank =GPIO_BANK (gpio); +clrbits_le32 (&bank->dir,1U <<GPIO_BIT (gpio)); +gpio_set_value (gpio, value);return 0 ; } -int gpio_get_value (int gp) +int gpio_get_value (unsigned gpio) {struct davinci_gpio *bank;unsigned int ip; - bank =GPIO_BANK (gp); - ip =in_le32 (&bank->in_data) & (1U <<GPIO_BIT (gp)); + bank =GPIO_BANK (gpio); + ip =in_le32 (&bank->in_data) & (1U <<GPIO_BIT (gpio));return ip ?1 :0 ; } -void gpio_set_value (int gp,int value) +void gpio_set_value (unsigned gpio,int value) {struct davinci_gpio *bank; - bank =GPIO_BANK (gp); + bank =GPIO_BANK (gpio);if (value) - bank->set_data =1U <<GPIO_BIT (gp); + bank->set_data =1U <<GPIO_BIT (gpio);else - bank->clr_data =1U <<GPIO_BIT (gp); + bank->clr_data =1U <<GPIO_BIT (gpio); }void gpio_info (void ) { -int gp, dir, val; +unsigned gpio, dir, val;struct davinci_gpio *bank; -for (gp =0 ; gp <MAX_NUM_GPIOS ; ++gp) { - bank =GPIO_BANK (gp); - dir =in_le32 (&bank->dir) & (1U <<GPIO_BIT (gp)); - val =gpio_get_value (gp); +for (gpio =0 ; gpio <MAX_NUM_GPIOS ; ++gpio) { + bank =GPIO_BANK (gpio); + dir =in_le32 (&bank->dir) & (1U <<GPIO_BIT (gpio)); + val =gpio_get_value (gpio);printf ("% 4d: %s: %d [%c] %s\n" , - gp, dir ?" in" :"out" , val, - gpio_registry[gp].is_registered ?'x' :' ' , - gpio_registry[gp].name); + gpio, dir ?" in" :"out" , val, + gpio_registry[gpio].is_registered ?'x' :' ' , + gpio_registry[gpio].name); } }
drivers/gpio/tegra2_gpio.c +76 -80
269 lines not on this page · raw message
include/asm-generic/gpio.h +6 -7
@@ -26,12 +26,11 @@* Generic GPIO API */ -int gpio_request (int gp,const char *label); -void gpio_free (int gp); -void gpio_toggle_value (int gp); -int gpio_direction_input (int gp); -int gpio_direction_output (int gp,int value); -int gpio_get_value (int gp); -void gpio_set_value (int gp,int value); +int gpio_request (unsigned gpio,const char *label); +void gpio_free (unsigned gpio); +int gpio_direction_input (unsigned gpio); +int gpio_get_value (unsigned gpio); +int gpio_direction_output (unsigned gpio,int value); +void gpio_set_value (unsigned gpio,int value);#endif /* _GPIO_H_ */
Signature · 1 line
1.6.0.2
PATCH v6 2/4 gpio: Modify common gpio.h to more closely match Linux
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110814/45600161/attachment.pgp
PATCH v6 2/4 gpio: Modify common gpio.h to more closely match Linux
In reply to Joe HershbergerDear Joe Hershberger,
Quoted 7 lines · In message <[email protected]> you wrote:
Change "int gp" to "unsigned gpio"
Update the 2 existing arm implementations to match the new API Remove thegpio_toggle()implementation (never used)Signed-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Mike Frysinger <[email protected]>
Quoted 8 lines
---
Changes for v6:
- Linuxize gpio APIdrivers/gpio/da8xx_gpio.c | 71 +++++++++----------- drivers/gpio/tegra2_gpio.c | 156 +++++++++++++++++++++---------------------- include/asm-generic/gpio.h | 13 ++-- 3 files changed, 113 insertions(+), 127 deletions(-)
Checkpatch says:
total: 0 errors, 1 warnings, 415 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de A rolling stone gathers momentum.
PATCH v6 3/4 mpc83xx: Add a GPIO driver for the MPC83XX family
In reply to Mike Frysinger---
Changes for v2:
- Improved names of INIT constants (to include "CONFIG_")
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c to patch 2/2
Changes for v3:
- gpio_init_* is now mpc83xx_gpio_init_*
Changes for v4:
- no volatile
- no camelCase
- use i/o accessors
Changes for v5:
Changes for v6:
- update to use new GPIO API
arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 37 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 194 ++++++++++++++++++++++++++ 3 files changed, 232 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC83XX_GPIO_H_ +#define _MPC83XX_GPIO_H_ + +/* +* The MCP83xx's 1-2 GPIO controllers each with 32 bits. +*/ +#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif + +#define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) + +void mpc83xx_gpio_init_f (void ); +void mpc83xx_gpio_init_r (void ); + +#endif /* MPC83XX_GPIO_H_ */
drivers/gpio/Makefile +1 -0
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P) += s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/mpc83xx_gpio.c new file +194 -0
194 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v6 3/4 mpc83xx: Add a GPIO driver for the MPC83XX family
Dear Joe Hershberger,
Quoted 17 lines · In message <[email protected]> you wrote:
Signed-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Kim Phillips <[email protected]>---
Changes for v2:
- Improved names of INIT constants (to include "CONFIG_")
- Moved changes toboard/freescale/mpc8313erdb/mpc8313erdb.cto patch 2/2
Changes for v3:
- gpio_init_* is now mpc83xx_gpio_init_*
Changes for v4:
- no volatile
- no camelCase
- use i/o accessors
Changes for v5:
Changes for v6:
- update to use new GPIO API
Quoted 6 lines
arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 37 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 194 ++++++++++++++++++++++++++ 3 files changed, 232 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
Checkpatch says:
total: 0 errors, 2 warnings, 238 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
Signature · 10 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Q: How many DEC repairman does it take to fix a flat?
A: Five; four to hold the car up and one to swap tires.
Q: How long does it take?
A: It's indeterminate. It will depend upon how many flats they've
brought with them.
Q: What happens if you've got TWO flats?
A: They replace your generator.PATCH v6 4/4 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
In reply to Mike Frysinger---
Changes for v2:
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c from patch 1/2
Changes for v3:
- Renamed gpio_init_* to mpc83xx_gpio_init_*
- Added board_early_init_r support to MPC8313ERDB targets
Changes for v4:
- Fixed build warning
Changes for v5:
Changes for v6:
board/freescale/mpc8313erdb/mpc8313erdb.c | 15 +++++++++++++++ include/configs/MPC8313ERDB.h | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
board/freescale/mpc8313erdb/mpc8313erdb.c +15 -0
@@ -31,6 +31,9 @@#include <vsc7385.h> #include <ns16550.h> #include <nand.h> +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +#include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -42,6 +45,18 @@ int board_early_init_f(void)if (im->pmc.pmccr1 &PMCCR1_POWER_OFF ) gd->flags |=GD_FLG_SILENT ;#endif +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_f (); +#endif + +return 0 ; +} + +int board_early_init_r (void ) +{ +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_r (); +#endif return 0 ; }
include/configs/MPC8313ERDB.h +6 -2
@@ -82,7 +82,8 @@#define CONFIG_SYS_CLK_FREQ CONFIG_83XX_CLKIN -#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_BOARD_EARLY_INIT_F /* call board_early_init_f */ +#define CONFIG_BOARD_EARLY_INIT_R /* call board_early_init_r */ #define CONFIG_SYS_IMMR 0xE0000000
@@ -322,6 +323,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_MPC83XX_GPIO 1 +#define CONFIG_CMD_GPIO 1 +/* * Serial Port */
@@ -535,7 +539,7 @@/* System IO Config */ #define CONFIG_SYS_SICRH (SICRH_TSOBI1 | SICRH_TSOBI2)/* RGMII */ -#define CONFIG_SYS_SICRL SICRL_USBDR_10/* Enable Internal USB Phy */ +#define CONFIG_SYS_SICRL (SICRL_USBDR_10 | SICRL_LBC)/* Enable Internal USB Phy and GPIO on LCD Connector */ #define CONFIG_SYS_HID0_INIT 0x000000000#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
Signature · 1 line
1.6.0.2
PATCH v6 4/4 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
Dear Joe Hershberger,
Quoted 14 lines · In message <[email protected]> you wrote:
Signed-off-by Joe Hershberger <[email protected]>Cc Joe Hershberger <[email protected]>Cc Kim Phillips <[email protected]>---
Changes for v2:
- Moved changes toboard/freescale/mpc8313erdb/mpc8313erdb.cfrom patch 1/2
Changes for v3:
- Renamed gpio_init_* to mpc83xx_gpio_init_*
- Addedboard_early_init_rsupport to MPC8313ERDB targets
Changes for v4:
- Fixed build warning
Changes for v5:
Changes for v6:
Quoted 3 lines
board/freescale/mpc8313erdb/mpc8313erdb.c | 15 +++++++++++++++ include/configs/MPC8313ERDB.h | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
Checkpatch says:
total: 0 errors, 1 warnings, 53 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de READ THIS BEFORE OPENING PACKAGE: According to Certain Suggested Ver- sions of the Grand Unified Theory, the Primary Particles Constituting this Product May Decay to Nothingness Within the Next Four Hundred Million Years.
PATCH v5 2/3 mpc83xx: Add a GPIO driver for the MPC83XX family
In reply to Mike Frysinger---
Changes for v2:
- Improved names of INIT constants (to include "CONFIG_")
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c to patch 2/2
Changes for v3:
- gpio_init_* is now mpc83xx_gpio_init_*
Changes for v4:
- no volatile
- no camelCase
- use i/o accessors
Changes for v5:
arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 37 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 199 ++++++++++++++++++++++++++ 3 files changed, 237 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC83XX_GPIO_H_ +#define _MPC83XX_GPIO_H_ + +/* +* The MCP83xx's 1-2 GPIO controllers each with 32 bits. +*/ +#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif + +#define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) + +void mpc83xx_gpio_init_f (void ); +void mpc83xx_gpio_init_r (void ); + +#endif /* MPC83XX_GPIO_H_ */
drivers/gpio/Makefile +1 -0
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P) += s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/mpc83xx_gpio.c new file +199 -0
199 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v5 3/3 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
In reply to Mike Frysinger---
Changes for v2:
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c from patch 1/2
Changes for v3:
- Renamed gpio_init_* to mpc83xx_gpio_init_*
- Added board_early_init_r support to MPC8313ERDB targets
Changes for v4:
- Fixed build warning
Changes for v5:
board/freescale/mpc8313erdb/mpc8313erdb.c | 15 +++++++++++++++ include/configs/MPC8313ERDB.h | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
board/freescale/mpc8313erdb/mpc8313erdb.c +15 -0
@@ -31,6 +31,9 @@#include <vsc7385.h> #include <ns16550.h> #include <nand.h> +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +#include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -42,6 +45,18 @@ int board_early_init_f(void)if (im->pmc.pmccr1 &PMCCR1_POWER_OFF ) gd->flags |=GD_FLG_SILENT ;#endif +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_f (); +#endif + +return 0 ; +} + +int board_early_init_r (void ) +{ +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_r (); +#endif return 0 ; }
include/configs/MPC8313ERDB.h +6 -2
@@ -82,7 +82,8 @@#define CONFIG_SYS_CLK_FREQ CONFIG_83XX_CLKIN -#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_BOARD_EARLY_INIT_F /* call board_early_init_f */ +#define CONFIG_BOARD_EARLY_INIT_R /* call board_early_init_r */ #define CONFIG_SYS_IMMR 0xE0000000
@@ -322,6 +323,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_MPC83XX_GPIO 1 +#define CONFIG_CMD_GPIO 1 +/* * Serial Port */
@@ -535,7 +539,7 @@/* System IO Config */ #define CONFIG_SYS_SICRH (SICRH_TSOBI1 | SICRH_TSOBI2)/* RGMII */ -#define CONFIG_SYS_SICRL SICRL_USBDR_10/* Enable Internal USB Phy */ +#define CONFIG_SYS_SICRL (SICRL_USBDR_10 | SICRL_LBC)/* Enable Internal USB Phy and GPIO on LCD Connector */ #define CONFIG_SYS_HID0_INIT 0x000000000#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
Signature · 1 line
1.6.0.2
PATCH v4 2/3 mpc83xx: Add a GPIO driver for the MPC83XX family
In reply to Kim Phillips---
Changes for v2:
- Improved names of INIT constants (to include "CONFIG_")
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c to patch 2/2
Changes for v3:
- gpio_init_* is now mpc83xx_gpio_init_*
Changes for v4:
- no volatile
- no camelCase
- use i/o accessors
arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 37 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 199 ++++++++++++++++++++++++++ 3 files changed, 237 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC83XX_GPIO_H_ +#define _MPC83XX_GPIO_H_ + +/* +* The MCP83xx's 1-2 GPIO controllers each with 32 bits. +*/ +#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif + +#define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) + +void mpc83xx_gpio_init_f (void ); +void mpc83xx_gpio_init_r (void ); + +#endif /* MPC83XX_GPIO_H_ */
drivers/gpio/Makefile +1 -0
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P) += s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/mpc83xx_gpio.c new file +199 -0
199 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v4 3/3 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
In reply to Kim Phillips---
Changes for v2:
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c from patch 1/2
Changes for v3:
- Renamed gpio_init_* to mpc83xx_gpio_init_*
- Added board_early_init_r support to MPC8313ERDB targets
Changes for v4:
- Fixed build warning
board/freescale/mpc8313erdb/mpc8313erdb.c | 15 +++++++++++++++ include/configs/MPC8313ERDB.h | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
board/freescale/mpc8313erdb/mpc8313erdb.c +15 -0
@@ -31,6 +31,9 @@#include <vsc7385.h> #include <ns16550.h> #include <nand.h> +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +#include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -42,6 +45,18 @@ int board_early_init_f(void)if (im->pmc.pmccr1 &PMCCR1_POWER_OFF ) gd->flags |=GD_FLG_SILENT ;#endif +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_f (); +#endif + +return 0 ; +} + +int board_early_init_r (void ) +{ +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +mpc83xx_gpio_init_r (); +#endif return 0 ; }
include/configs/MPC8313ERDB.h +6 -2
@@ -82,7 +82,8 @@#define CONFIG_SYS_CLK_FREQ CONFIG_83XX_CLKIN -#define CONFIG_BOARD_EARLY_INIT_F /* call board_pre_init */ +#define CONFIG_BOARD_EARLY_INIT_F /* call board_early_init_f */ +#define CONFIG_BOARD_EARLY_INIT_R /* call board_early_init_r */ #define CONFIG_SYS_IMMR 0xE0000000
@@ -322,6 +323,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_MPC83XX_GPIO 1 +#define CONFIG_CMD_GPIO 1 +/* * Serial Port */
@@ -535,7 +539,7 @@/* System IO Config */ #define CONFIG_SYS_SICRH (SICRH_TSOBI1 | SICRH_TSOBI2)/* RGMII */ -#define CONFIG_SYS_SICRL SICRL_USBDR_10/* Enable Internal USB Phy */ +#define CONFIG_SYS_SICRL (SICRL_USBDR_10 | SICRL_LBC)/* Enable Internal USB Phy and GPIO on LCD Connector */ #define CONFIG_SYS_HID0_INIT 0x000000000#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
Signature · 1 line
1.6.0.2
PATCH v2 1/2 mpc83xx: Add a GPIO driver for the MPC83XX family
In reply to Joe Hershberger---
Changes for v2:
- Improved names of INIT constants (to include "CONFIG_")
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c to patch 2/2
arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 37 +++++ arch/powerpc/include/asm/gpio.h | 38 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/mpc83xx_gpio.c | 198 ++++++++++++++++++++++++++ 4 files changed, 274 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/arch-mpc83xx/gpio.h create mode 100644 arch/powerpc/include/asm/gpio.h create mode 100644 drivers/gpio/mpc83xx_gpio.c
arch/powerpc/include/asm/arch-mpc83xx/gpio.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC83XX_GPIO_H_ +#define _MPC83XX_GPIO_H_ + +/* +* The MCP83xx's 1-2 GPIO controllers each with 32 bits. +*/ +#if defined(CONFIG_MPC8313 ) || defined(CONFIG_MPC8308 ) || defined(CONFIG_MPC8315 ) +#define MPC83XX_GPIO_CTRLRS 1 +#elif defined(CONFIG_MPC834x) || defined(CONFIG_MPC837x) +#define MPC83XX_GPIO_CTRLRS 2 +#else +#define MPC83XX_GPIO_CTRLRS 0 +#endif + +#define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) + +void gpio_init_f (void ); +void gpio_init_r (void ); + +#endif /* MPC83XX_GPIO_H_ */
arch/powerpc/include/asm/gpio.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Copyright (c) 2011, NVIDIA Corp. All rights reserved. +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +#include <asm/arch/gpio.h> +/* +* Generic GPIO API +*/ + +int gpio_request (int gp,const char *label); +void gpio_free (int gp); +void gpio_toggle_value (int gp); +int gpio_direction_input (int gp); +int gpio_direction_output (int gp,int value); +int gpio_get_value (int gp); +void gpio_set_value (int gp,int value); + +#endif /* _GPIO_H_ */
drivers/gpio/Makefile +1 -0
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_PCA953X) += pca953x.o COBJS-$(CONFIG_S5P) += s5p_gpio.o COBJS-$(CONFIG_TEGRA2_GPIO) += tegra2_gpio.o COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o +COBJS-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/gpio/mpc83xx_gpio.c new file +198 -0
198 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH v2 2/2 mpc8313erdb: Enable GPIO support on the MPC8313E RDB
In reply to Joe Hershberger---
Changes for v2:
- Moved changes to board/freescale/mpc8313erdb/mpc8313erdb.c from patch 1/2
board/freescale/mpc8313erdb/mpc8313erdb.c | 9 +++++++++ include/configs/MPC8313ERDB.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletions(-)
board/freescale/mpc8313erdb/mpc8313erdb.c +9 -0
@@ -31,6 +31,9 @@#include <vsc7385.h> #include <ns16550.h> #include <nand.h> +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +#include <asm/gpio.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -42,6 +45,9 @@ int board_early_init_f(void)if (im->pmc.pmccr1 &PMCCR1_POWER_OFF ) gd->flags |=GD_FLG_SILENT ;#endif +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +gpio_init_f (); +#endif return 0 ; }
@@ -140,6 +146,9 @@ void board_init_f(ulong bootflag)void board_init_r (gd_t *gd,ulong dest_addr) { +#if defined(CONFIG_MPC83XX_GPIO ) && !defined(CONFIG_NAND_SPL ) +gpio_init_r (); +#endif nand_boot (); }
include/configs/MPC8313ERDB.h +4 -1
@@ -322,6 +322,9 @@#define CONFIG_OF_BOARD_SETUP 1#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define CONFIG_MPC83XX_GPIO 1 +#define CONFIG_CMD_GPIO 1 +/* * Serial Port */
@@ -535,7 +538,7 @@/* System IO Config */ #define CONFIG_SYS_SICRH (SICRH_TSOBI1 | SICRH_TSOBI2)/* RGMII */ -#define CONFIG_SYS_SICRL SICRL_USBDR_10/* Enable Internal USB Phy */ +#define CONFIG_SYS_SICRL (SICRL_USBDR_10 | SICRL_LBC)/* Enable Internal USB Phy and GPIO on LCD Connector */ #define CONFIG_SYS_HID0_INIT 0x000000000#define CONFIG_SYS_HID0_FINAL (HID0_ENABLE_MACHINE_CHECK | \
Signature · 1 line
1.6.0.2