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]
Date:	Wed, 24 Oct 2012 11:05:10 +0200
From:	Andreas Larsson <andreas@...sler.com>
To:	Peter Korsgaard <jacmet@...site.dk>
CC:	linux-i2c@...r.kernel.org, Jean Delvare <khali@...ux-fr.org>,
	Ben Dooks <ben-linux@...ff.org>,
	Wolfram Sang <w.sang@...gutronix.de>,
	Grant Likely <grant.likely@...retlab.ca>,
	Rob Herring <rob.herring@...xeda.com>,
	linux-kernel@...r.kernel.org, devicetree-discuss@...ts.ozlabs.org,
	software@...sler.com
Subject: Re: [PATCH 2/2] i2c: i2c-ocores: Add support for the GRLIB port of
 the controller and custom getreg and setreg functions

On 10/23/2012 10:24 PM, Peter Korsgaard wrote:
>>>>>> "Andreas" == Andreas Larsson <andreas@...sler.com> writes:
>   [...]
>   Andreas> +/* Read and write functions for the GRLIB port of the controller. Registers are
>   Andreas> + * 32-bit big endian and the PRELOW and PREHIGH registers are merged into one
>   Andreas> + * register. The subsequent registers has their offset decreased accordingly. */
>   Andreas> +static u8 oc_getreg_grlib(struct ocores_i2c *i2c, int reg)
>   Andreas> +{
>   Andreas> +	u32 rd;
>   Andreas> +	int rreg = reg;
>   Andreas> +	if (reg != OCI2C_PRELOW)
>   Andreas> +		rreg--;
>   Andreas> +	rd = ioread32be(i2c->base + (rreg << i2c->reg_shift));
>   Andreas> +	if (reg == OCI2C_PREHIGH)
>   Andreas> +		return (u8)rd >> 8;
>   Andreas> +	else
>   Andreas> +		return (u8)rd;
>   Andreas> +}
>   Andreas> +
>   Andreas> +static void oc_setreg_grlib(struct ocores_i2c *i2c, int reg, u8 value)
>   Andreas> +{
>   Andreas> +	u32 curr, wr;
>   Andreas> +	int rreg = reg;
>   Andreas> +	if (reg != OCI2C_PRELOW)
>   Andreas> +		rreg--;
>   Andreas> +	if (reg == OCI2C_PRELOW || reg == OCI2C_PREHIGH) {
>   Andreas> +		curr = ioread32be(i2c->base + (rreg << i2c->reg_shift));
>   Andreas> +		if (reg == OCI2C_PRELOW)
>   Andreas> +			wr = (curr & 0xff00) | value;
>   Andreas> +		else
>   Andreas> +			wr = (((u32)value) << 8) | (curr & 0xff);
>   Andreas> +	} else {
>   Andreas> +		wr = value;
>   Andreas> +	}
>   Andreas> +	iowrite32be(wr, i2c->base + (rreg << i2c->reg_shift));
>
> Are all platforms using i2c-ocores guaranteed to provide ioread32be /
> iowrite32be or should we stick an #ifdef CONFIG_SPARC around it?

As far as I can see, after digging around, the only platforms that have 
ioread/write32, but not ioread/write32be are frv and mn10300. Do you 
know if those platforms are using i2c-ocores?

Cheers,
Andreas Larsson

--
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