[PATCH 1/6 v10] ARM: Add basic architecture support for VIA/WonderMedia 85xx SoC's
Ryan Mallon
ryan at bluewatersys.com
Wed Dec 22 16:52:11 EST 2010
On 12/23/2010 10:18 AM, Alexey Charkov wrote:
> This adds support for the family of Systems-on-Chip produced initially
> by VIA and now its subsidiary WonderMedia that have recently become
> widespread in lower-end Chinese ARM-based tablets and netbooks.
>
> Support is included for both VT8500 and WM8505, selectable by a
> configuration switch at kernel build time.
>
> Included are basic machine initialization files, register and
> interrupt definitions, support for the on-chip interrupt controller,
> high-precision OS timer, GPIO lines, necessary macros for early debug,
> pulse-width-modulated outputs control, as well as platform device
> configurations for the specific drivers implemented elsewhere.
>
> Signed-off-by: Alexey Charkov <alchark at gmail.com>
> ---
>
> Welcome the jubilee tenth revision of this patch ;-)
>
> I've tried to incorporate the suggestions by Ryan and Arnd, hope that
> there is nothing left out. There was a massive reorganization of code
> to remove less-than-obvious magic with MMIO registers and irqs being
> held in huge structs, now they are again macro definitions. Those
> macros are, however, only included in single isolated files, and
> actual values to use are chosen at runtime by calling the respective
> routines at machine initialization. There are also stylistic changes
> all around, where Ryan suggested.
>
> As a result, i8042 should again be adjusted a bit to reflect the new
> place to find respective register/irq definitions, that one will be
> sent in the respective thread shortly.
>
> Best regards,
> Alexey
<snip>
> --- /dev/null
> +++ b/arch/arm/mach-vt8500/devices-vt8500.c
> @@ -0,0 +1,117 @@
> +/* linux/arch/arm/mach-vt8500/devices-vt8500.c
> + *
> + * Copyright (C) 2010 Alexey Charkov <alchark at gmail.com>
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#include <linux/platform_device.h>
> +
> +#include <mach/vt8500_regs.h>
> +#include <mach/vt8500_irqs.h>
> +#include <mach/i8042.h>
> +#include "devices.h"
> +
> +static inline struct resource WMT_MMIO_RES(u32 start, u32 size)
> +{
> + struct resource tmp = {
> + .flags = IORESOURCE_MEM,
> + .start = start,
> + .end = start + size - 1,
> + };
> +
> + return tmp;
> +}
These functions can be marked __init (though I guess they already are if
marked inline?). They should also have lower case names since they are
proper functions.
Do these functions generate warnings about returning temporary values
off the stack? If so, they could be rewritten as:
static __init void wmt_mmio_res(struct resource *res,
u32 start, u32 size)
{
res->flags = IORESOURCE_MEM;
res->start = start;
res->end = start + size - 1;
}
You could also make these functions static inline in devices.h to avoid
having to define them for each board.
> +
> +static inline struct resource WMT_IRQ_RES(int irq)
> +{
> + struct resource tmp = {
> + .flags = IORESOURCE_IRQ,
> + .start = irq,
> + .end = irq,
> + };
> +
> + return tmp;
> +}
> +
> +#define WMT_RES_ADD(__device, __resource, __num) \
> +if (platform_device_add_resources(__device, __resource, __num)) \
> + pr_err("Failed to assign resources to __device##\n");
This could be written as a proper function. The resource add is unlikely
to fail. Maybe keep the warning but don't worry about printing the
device name?
~Ryan
--
Bluewater Systems Ltd - ARM Technology Solution Centre
Ryan Mallon 5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934
More information about the linux-arm-kernel
mailing list