Re: [RFC, PATCH 2/4] SoC base drivers: ASIC3 SoC hardware definitions

Andrew Morton
2007-05-01T06:56:47Z

On Tue, 1 May 2007 08:08:39 +0300 Paul Sokolovsky <pmiscml@gmail.com> wrote:

> Hello linux-kernel,
>
> Intro: This is a header with hardware definitions for ASIC3 chip,
> contributed by HP/Compaq. It is provided as-is, as a vendor-originated
> header.
> ---------
>
> ipaq-asic3.h: Hardware definitions for ASIC3 chip, found in ~12
> handheld devices from HP/Compaq and HTC.
>
> Signed-off-by: Paul Sokolovsky <pmiscml@gmail.com>
>
>
> include/asm-arm/hardware/ipaq-asic3.h | 609 +++++++++++++++++++++++++++++++++
> 1 files changed, 609 insertions(+), 0 deletions(-)
>
> diff --git a/include/asm-arm/hardware/ipaq-asic3.h b/include/asm-arm/hardware/ipaq-asic3.h
> new file mode 100644
> index 0000000..789bb16
> --- /dev/null
> +++ b/include/asm-arm/hardware/ipaq-asic3.h
> @@ -0,0 +1,609 @@
> +/*
> + *
> + * Definitions for the HTC ASIC3 chip found in several handheld devices
> + *
> + * Copyright 2001 Compaq Computer Corporation.
> + *
> + * Use consistent with the GNU GPL is permitted,
> + * provided that this copyright notice is
> + * preserved in its entirety in all copies and derived works.
> + *
> + * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
> + * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
> + * FITNESS FOR ANY PARTICULAR PURPOSE.
> + *
> + * Author: Andrew Christian
> + *
> + */
> +
> +#ifndef IPAQ_ASIC3_H
> +#define IPAQ_ASIC3_H
> +
> +/****************************************************/
> +/* IPAQ, ASIC #3, replaces ASIC #1 */
> +
> +#define IPAQ_ASIC3(_b,s,x,y) \
> + (*((volatile s *) (_b + _IPAQ_ASIC3_ ## x ## _Base + (_IPAQ_ASIC3_ ## x ## _ ## y))))
> +#define IPAQ_ASIC3_N(_b,s,x,y,z) \
> + (*((volatile s *) (_b + _IPAQ_ASIC3_ ## x ## _ ## y ## _Base + (_IPAQ_ASIC3_ ## x ## _ ## z))))
> +
> +#define IPAQ_ASIC3_GPIO(_b,s,x,y) \
> + (*((volatile s *) (_b + _IPAQ_ASIC3_GPIO_ ## x ## _Base + (_IPAQ_ASIC3_GPIO_ ## y))))
> +
> +#define IPAQ_ASIC3_OFFSET(x,y) (_IPAQ_ASIC3_ ## x ## _Base + _IPAQ_ASIC3_ ## x ## _ ## y)
> +#define IPAQ_ASIC3_GPIO_OFFSET(x,y) (_IPAQ_ASIC3_GPIO_ ## x ## _Base + _IPAQ_ASIC3_GPIO_ ## y)

Oh my eyes. What are these doing?

The volatiles are a worry - volatile is said to be basically-always-wrong
in-kernel, although we've never managed to document why, and i386
cheerfully uses it in readb() and friends.

Perhaps if you can describe presisely what's going on here, alternatives
might be suggested.