030-gpio_line_config.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. --- a/arch/arm/mach-ixp4xx/common.c
  2. +++ b/arch/arm/mach-ixp4xx/common.c
  3. @@ -93,22 +93,7 @@ void __init ixp4xx_map_io(void)
  4. /*
  5. * GPIO-functions
  6. */
  7. -/*
  8. - * The following converted to the real HW bits the gpio_line_config
  9. - */
  10. -/* GPIO pin types */
  11. -#define IXP4XX_GPIO_OUT 0x1
  12. -#define IXP4XX_GPIO_IN 0x2
  13. -
  14. -/* GPIO signal types */
  15. -#define IXP4XX_GPIO_LOW 0
  16. -#define IXP4XX_GPIO_HIGH 1
  17. -
  18. -/* GPIO Clocks */
  19. -#define IXP4XX_GPIO_CLK_0 14
  20. -#define IXP4XX_GPIO_CLK_1 15
  21. -
  22. -static void gpio_line_config(u8 line, u32 direction)
  23. +void gpio_line_config(u8 line, u32 direction)
  24. {
  25. if (direction == IXP4XX_GPIO_IN)
  26. *IXP4XX_GPIO_GPOER |= (1 << line);
  27. @@ -116,17 +101,17 @@ static void gpio_line_config(u8 line, u3
  28. *IXP4XX_GPIO_GPOER &= ~(1 << line);
  29. }
  30. -static void gpio_line_get(u8 line, int *value)
  31. +void gpio_line_get(u8 line, int *value)
  32. {
  33. *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
  34. }
  35. -static void gpio_line_set(u8 line, int value)
  36. +void gpio_line_set(u8 line, int value)
  37. {
  38. - if (value == IXP4XX_GPIO_HIGH)
  39. - *IXP4XX_GPIO_GPOUTR |= (1 << line);
  40. - else if (value == IXP4XX_GPIO_LOW)
  41. + if (value == IXP4XX_GPIO_LOW)
  42. *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
  43. + else
  44. + *IXP4XX_GPIO_GPOUTR |= (1 << line);
  45. }
  46. /*************************************************************************
  47. --- a/arch/arm/mach-ixp4xx/include/mach/platform.h
  48. +++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
  49. @@ -131,5 +131,21 @@ struct pci_sys_data;
  50. extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
  51. extern struct pci_ops ixp4xx_ops;
  52. +/* GPIO pin types */
  53. +#define IXP4XX_GPIO_OUT 0x1
  54. +#define IXP4XX_GPIO_IN 0x2
  55. +
  56. +/* GPIO signal types */
  57. +#define IXP4XX_GPIO_LOW 0
  58. +#define IXP4XX_GPIO_HIGH 1
  59. +
  60. +/* GPIO Clocks */
  61. +#define IXP4XX_GPIO_CLK_0 14
  62. +#define IXP4XX_GPIO_CLK_1 15
  63. +
  64. +void gpio_line_config(u8 line, u32 direction);
  65. +void gpio_line_get(u8 line, int *value);
  66. +void gpio_line_set(u8 line, int value);
  67. +
  68. #endif // __ASSEMBLY__