[PATCH 1/2] spi: bcm2835: add spi-bcm2835aux driver for the auxiliar spi1 and spi2
Martin Sperl
kernel at martin.sperl.org
Thu Jul 30 00:10:55 PDT 2015
Hi Stefan!
> On 30.07.2015, at 08:45, Martin Sperl <kernel at martin.sperl.org> wrote:
>
> I am just trying to find a solution that will get accepted with the minimum
> number of reposts/rewrites to avoid frustration, but nobody has an answer
> which api we really should use.
>
> The problem is that we have DT and we have code and as we only want HW
> being represented in the device tree we need something “sensible”.
>
> What about adding “bcrm,bcm2835-aux-enable” to drivers/mfd/syscon.c
> compatibility?
>
> That way we:
> * have a clean dt that only represents hardware
> * reuse existing code with minimal modifications
> * minimal effort
>
> That would be a minimal patch to enable this, so we can ask if that is
> acceptable and if it is not then we can still think of something else,
> which would be mostly replicating the bit-management portion of syscon.
that minimal patch extending compatibility of syscon and also including
the config portion for the kernel as well as the device tree would look
something like this (note that it is not tested yet):
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index 301c73f..bde42ce 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -158,6 +158,11 @@
arm-pmu {
compatible = "arm,arm1176-pmu";
};
+
+ aux-enable: aux-enable at 0x7e215004 {
+ compatible = "bcrm,bcm2835-aux-enable";
+ reg = <0x7e215004 0x04>;
+ };
};
clocks {
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 0ac9e4b3..e32ceea 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -116,6 +116,7 @@ config ARCH_BCM2835
select CLKSRC_OF
select PINCTRL
select PINCTRL_BCM2835
+ select MFD_SYSCON
help
This enables support for the Broadcom BCM2835 SoC. This SoC is
used in the Raspberry Pi and Roku 2 devices.
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 176bf0f..49cdd37 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -211,6 +211,12 @@ static int syscon_probe(struct platform_device *pdev)
return 0;
}
+static const struct of_device_id syscon_match[] = {
+ { .compatible = "bcrm,bcm2835-aux-enable", },
+ {}
+};
+MODULE_DEVICE_TABLE(of, syscon_match);
+
static const struct platform_device_id syscon_ids[] = {
{ "syscon", },
{ }
@@ -219,6 +225,7 @@ static const struct platform_device_id syscon_ids[] = {
static struct platform_driver syscon_driver = {
.driver = {
.name = "syscon",
+ .of_match_table = syscon_match,
},
.probe = syscon_probe,
.id_table = syscon_ids,
(please ignore the tabs converted to spaces for now introduced by copy/paste)
Then what would be missing is the config of the spi/uart devices
that would require a property in the device-tree like:
bcrm,aux-enable = <&aux-enable 1 /* bitmask for device */>;
which then would be used by the respective drivers like this:
enable:
regmap_update_bits(bs->aux_enable, 0,
bs->aux_enable_mask, bs->aux_enable_mask);
disable:
regmap_update_bits(bs->aux_enable, 0,
bs->aux_enable_mask, 0);
Is this something that you would accept?
Thanks,
Martin
More information about the linux-rpi-kernel
mailing list