[RFC PATCH] soc: bcm2835: auxiliar devices enable infrastructure

Stefan Wahren info at lategoodbye.de
Sun Aug 9 16:52:23 PDT 2015


Hi Martin,

Am 04.08.2015 um 10:41 schrieb kernel at martin.sperl.org:
> From: Martin Sperl <kernel at martin.sperl.org>
>
> [...]
> diff --git a/Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-aux.txt b/Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-aux.txt
> new file mode 100644
> index 0000000..894ff5c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/bcm/brcm,bcm2835-aux.txt
> @@ -0,0 +1,16 @@
> +Broadcom BCM2835 auxiliar device enable register
> +
> +the BCM2835 contains 3 auxiliar SPI devices

3 auxiliar devices (spi1, spi2 and uart1) ?

> +which need to get enabled via a shared register.
> +
> +Required properties:
> +- compatible: Should be "brcm,bcm2835-aux-spi".

brcm,bcm2835-aux ?

> +- reg: Should contain register location and length for the enabl

enable ?

> +       register
> +
> +Example:
> +
> +aux_enable: aux_enable at 0x7e215004 {
> +	compatible = "bcrm,bcm2835-aux-enable";
> +	reg = <0x7e215004 0x04>;
> +};
> [...]
> diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
> index 7dc7c0d..c5744e1 100644
> --- a/drivers/soc/Makefile
> +++ b/drivers/soc/Makefile
> @@ -2,6 +2,7 @@
>   # Makefile for the Linux Kernel SOC specific device drivers.
>   #
>
> +obj-$(CONFIG_ARCH_BCM)		+= bcm/
>   obj-$(CONFIG_ARCH_MEDIATEK)	+= mediatek/
>   obj-$(CONFIG_ARCH_QCOM)		+= qcom/
>   obj-$(CONFIG_ARCH_SUNXI)	+= sunxi/
> diff --git a/drivers/soc/bcm/Kconfig b/drivers/soc/bcm/Kconfig
> new file mode 100644
> index 0000000..b26060d
> --- /dev/null
> +++ b/drivers/soc/bcm/Kconfig
> @@ -0,0 +1,10 @@
> +#
> +# MediaTek SoC drivers

Broadcom ?

> +#
> +config SOC_BCM2835_AUX
> +	tristate "Broadcom BCM2835 aux"
> +	depends on OF
> +	depends on ARCH_BCM2835 || COMPILE_TEST
> +
> +	help
> +	  Support for the BCM2835 auxiliar devices

Specify the type of those devices (SPI/UART) would be very helpful.

> diff --git a/drivers/soc/bcm/Makefile b/drivers/soc/bcm/Makefile
> new file mode 100644
> index 0000000..370a872
> --- /dev/null
> +++ b/drivers/soc/bcm/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_SOC_BCM2835_AUX) += bcm2835-aux.o
> diff --git a/drivers/soc/bcm/bcm2835-aux.c b/drivers/soc/bcm/bcm2835-aux.c
> new file mode 100644
> index 0000000..19e50f8
> --- /dev/null
> +++ b/drivers/soc/bcm/bcm2835-aux.c
> @@ -0,0 +1,155 @@
> +/*
> + * bcm2835-aux
> + *
> + * Copyright (C) 2015 Martin Sperl
> + *
> + * Author: Martin Sperl <kernel at martin.sperl.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/device.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/list.h>

This header shouldn't be necessary.

> [...]
> diff --git a/include/linux/soc/bcm/bcm2835-aux.h b/include/linux/soc/bcm/bcm2835-aux.h
> new file mode 100644
> index 0000000..685232c
> --- /dev/null
> +++ b/include/linux/soc/bcm/bcm2835-aux.h
> @@ -0,0 +1,24 @@
> +/*
> + * Copyright (C) 2015 Martin Sperl
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * 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.
> + */
> +
> +#ifndef __BCM2835_AUX_H__
> +#define __BCM2835_AUX_H__
> +
> +#include <linux/device.h>
> +#include <linux/types.h>

I'm not sure but maybe a forward declaration of struct device would be a 
better solution instead of both includes.

> +
> +int bcm2835aux_enable(struct device *dev, const char *property);
> +int bcm2835aux_disable(struct device *dev, const char *property);
> +
> +#endif
>

Regards Stefan



More information about the linux-rpi-kernel mailing list