mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 10:26:10 +01:00 
			
		
		
		
	gpio: rgpio2p: Enhance reading of GPIO pin value
Add support for reading GPIO pin value when function is output. With this patch applied, gpio toggle command is working. Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Fabio Estevam <festevam@denx.de>
This commit is contained in:
		
				
					committed by
					
						 Stefano Babic
						Stefano Babic
					
				
			
			
				
	
			
			
			
						parent
						
							9d371e5fea
						
					
				
				
					commit
					0539d16d22
				
			| @@ -39,6 +39,14 @@ static int imx_rgpio2p_is_output(struct gpio_regs *regs, int offset) | ||||
| 	return val & (1 << offset) ? 1 : 0; | ||||
| } | ||||
|  | ||||
| static int imx_rgpio2p_bank_get_direction(struct gpio_regs *regs, int offset) | ||||
| { | ||||
| 	if ((readl(®s->gpio_pddr) >> offset) & 0x01) | ||||
| 		return IMX_RGPIO2P_DIRECTION_OUT; | ||||
|  | ||||
| 	return IMX_RGPIO2P_DIRECTION_IN; | ||||
| } | ||||
|  | ||||
| static void imx_rgpio2p_bank_direction(struct gpio_regs *regs, int offset, | ||||
| 				    enum imx_rgpio2p_direction direction) | ||||
| { | ||||
| @@ -67,7 +75,11 @@ static void imx_rgpio2p_bank_set_value(struct gpio_regs *regs, int offset, | ||||
|  | ||||
| static int imx_rgpio2p_bank_get_value(struct gpio_regs *regs, int offset) | ||||
| { | ||||
| 	return (readl(®s->gpio_pdir) >> offset) & 0x01; | ||||
| 	if (imx_rgpio2p_bank_get_direction(regs, offset) == | ||||
| 	    IMX_RGPIO2P_DIRECTION_IN) | ||||
| 		return (readl(®s->gpio_pdir) >> offset) & 0x01; | ||||
|  | ||||
| 	return (readl(®s->gpio_pdor) >> offset) & 0x01; | ||||
| } | ||||
|  | ||||
| static int  imx_rgpio2p_direction_input(struct udevice *dev, unsigned offset) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user