/* each gpio can serve for 4 different purposes . These are called "functions" and passed in the parameter func. Functions 0-2 are always some special things, function 3 is GPIO. If func == 3 dir specifies input or output, and with inv you can enable an inverter (independent of func).  */
int __ns9360_gpio_configure(unsigned gpio, int dir, int inv, int func)
/* each gpio can serve for 4 different purposes . These are called "functions" and passed in the parameter func. Functions 0-2 are always some special things, function 3 is GPIO. If func == 3 dir specifies input or output, and with inv you can enable an inverter (independent of func).  */
int __ns9360_gpio_configure(unsigned gpio, int dir, int inv, int func)
{
	void __iomem *conf = ns9360_gpio_get_gconfaddr(gpio);
	u32 confval;
	confval = __raw_readl(conf);
	REGSETIM_IDX(confval, BBU_GCONFx, DIR, gpio & 7, dir);
	REGSETIM_IDX(confval, BBU_GCONFx, INV, gpio & 7, inv);
	REGSETIM_IDX(confval, BBU_GCONFx, FUNC, gpio & 7, func);
	__raw_writel(confval, conf);
	return 0;
}