lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF04B7321777@HQMAIL01.nvidia.com>
Date:	Tue, 20 Sep 2011 15:15:05 -0700
From:	Stephen Warren <swarren@...dia.com>
To:	Linus Walleij <linus.walleij@...ricsson.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Grant Likely <grant.likely@...retlab.ca>,
	Barry Song <21cnbao@...il.com>
CC:	Lee Jones <lee.jones@...aro.org>, Joe Perches <joe@...ches.com>,
	Russell King <linux@....linux.org.uk>,
	Linaro Dev <linaro-dev@...ts.linaro.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	David Brown <davidb@...eaurora.org>,
	Linus Walleij <linus.walleij@...aro.org>
Subject: RE: [PATCH 2/2 v7] pinmux: add a driver for the U300 pinmux

Linus Walleij wrote at Friday, September 16, 2011 6:14 AM:
> This adds a driver for the U300 pinmux portions of the system
> controller "SYSCON". It also serves as an example of how to use
> the pinmux subsystem. This driver also houses the platform data
> for the only supported platform.
...
> diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
...
> +/* Pinmux settings */
> +static struct pinmux_map u300_pinmux_map[] = {
> +	/* anonymous maps for chip power and EMIFs */
> +	PINMUX_MAP_PRIMARY_SYS_HOG("POWER", "power"),
> +	PINMUX_MAP_PRIMARY_SYS_HOG("EMIF0", "emif0"),
> +	PINMUX_MAP_PRIMARY_SYS_HOG("EMIF1", "emif1"),
> +	/* per-device maps for MMC/SD, SPI and UART */
> +	PINMUX_MAP_PRIMARY("MMCSD", "mmc0", "mmci"),
> +	PINMUX_MAP_PRIMARY("SPI", "spi0", "pl022"),
> +	PINMUX_MAP_PRIMARY("UART0", "uart0", "uart0"),
> +};
> +
> +struct u300_mux_hog {
> +	const char *name;
> +	struct device *dev;
> +	struct pinmux *pmx;
> +};
> +
> +static struct u300_mux_hog u300_mux_hogs[] = {
> +	{
> +		.name = "uart0",
> +		.dev = &uart0_device.dev,
> +	},
> +	{
> +		.name = "spi0",
> +		.dev = &pl022_device.dev,
> +	},
> +	{
> +		.name = "mmc0",
> +		.dev = &mmcsd_device.dev,
> +	},
> +};
> +
> +static int __init u300_pinmux_fetch(void)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) {
> +		struct pinmux *pmx;
> +		int ret;
> +
> +		pmx = pinmux_get(u300_mux_hogs[i].dev, NULL);
> +		if (IS_ERR(pmx)) {
> +			pr_err("u300: could not get pinmux hog %s\n",
> +			       u300_mux_hogs[i].name);
> +			continue;
> +		}
> +		ret = pinmux_enable(pmx);
> +		if (ret) {
> +			pr_err("u300: could enable pinmux hog %s\n",
> +			       u300_mux_hogs[i].name);
> +			continue;
> +		}
> +		u300_mux_hogs[i].pmx = pmx;
> +	}
> +	return 0;
> +}
> +subsys_initcall(u300_pinmux_fetch);

Why not just have the pinmux core support hogging on non-"system" mapping
entries; then everything I quoted above except u300_pinmux_map[] could
be deleted, and the "hog" flag set on the last 3 u300_pinmux_map[] entries.

-- 
nvpublic

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ