mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-07-23 15:27:52 +00:00
Use common function to set GPIOs for MX3 and MX5
The patch adds support for setting gpios to the MX51 processor and change name to the corresponding functions for MX31. In this way, it is possible to get rid of nasty #ifdef switches related to the processor type. Signed-off-by: Stefano Babic <sbabic@denx.de>
This commit is contained in:
parent
2e6e1772c0
commit
c4ea142424
10 changed files with 127 additions and 67 deletions
|
@ -57,6 +57,14 @@ struct clock_control_regs {
|
|||
u32 pdr2;
|
||||
};
|
||||
|
||||
/* GPIO Registers */
|
||||
struct gpio_regs {
|
||||
u32 gpio_dr;
|
||||
u32 gpio_dir;
|
||||
u32 gpio_psr;
|
||||
};
|
||||
|
||||
|
||||
/* Bit definitions for RCSR register in CCM */
|
||||
#define CCM_RCSR_NF16B (1 << 31)
|
||||
#define CCM_RCSR_NFMS (1 << 30)
|
||||
|
@ -153,9 +161,9 @@ struct clock_control_regs {
|
|||
/*
|
||||
* GPIO
|
||||
*/
|
||||
#define GPIO1_BASE 0x53FCC000
|
||||
#define GPIO2_BASE 0x53FD0000
|
||||
#define GPIO3_BASE 0x53FA4000
|
||||
#define GPIO1_BASE_ADDR 0x53FCC000
|
||||
#define GPIO2_BASE_ADDR 0x53FD0000
|
||||
#define GPIO3_BASE_ADDR 0x53FA4000
|
||||
#define GPIO_DR 0x00000000 /* data register */
|
||||
#define GPIO_GDIR 0x00000004 /* direction register */
|
||||
#define GPIO_PSR 0x00000008 /* pad status register */
|
||||
|
|
|
@ -28,31 +28,6 @@ extern u32 mx31_get_ipg_clk(void);
|
|||
#define imx_get_uartclk mx31_get_ipg_clk
|
||||
extern void mx31_gpio_mux(unsigned long mode);
|
||||
|
||||
enum mx31_gpio_direction {
|
||||
MX31_GPIO_DIRECTION_IN,
|
||||
MX31_GPIO_DIRECTION_OUT,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MX31_GPIO
|
||||
extern int mx31_gpio_direction(unsigned int gpio,
|
||||
enum mx31_gpio_direction direction);
|
||||
extern void mx31_gpio_set(unsigned int gpio, unsigned int value);
|
||||
extern int mx31_gpio_get(unsigned int gpio);
|
||||
#else
|
||||
static inline int mx31_gpio_direction(unsigned int gpio,
|
||||
enum mx31_gpio_direction direction)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
static inline int mx31_gpio_get(unsigned int gpio)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
static inline void mx31_gpio_set(unsigned int gpio, unsigned int value)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void mx31_uart1_hw_init(void);
|
||||
void mx31_spi2_hw_init(void);
|
||||
|
||||
|
|
|
@ -256,6 +256,12 @@ struct weim {
|
|||
u32 cswcr2;
|
||||
};
|
||||
|
||||
/* GPIO Registers */
|
||||
struct gpio_regs {
|
||||
u32 gpio_dr;
|
||||
u32 gpio_dir;
|
||||
u32 gpio_psr;
|
||||
};
|
||||
#endif /* __ASSEMBLER__*/
|
||||
|
||||
#endif /* __ASM_ARCH_MXC_MX51_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue