Re: [PATCH 1/2] spi: bcm2835: add spi-bcm2835aux driver for the auxiliar spi1 and spi2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28.07.2015 08:18, Martin Sperl wrote:
Hi Stephen!
But the bigger question you have not answered is: “where should such an
auxiliar driver go in the kernel tree?” i.e. which directory?
One thing: could the "module" be a regulator?

So drivers/regulators/bcm2835-aux-regulator.c

The devicetree would look something like this:

regulators {
    bcm2835aux_reg {
        compatible = "bcrm,bcrm-2835-aux-enable";
        reg = <0x7e215004 0x4>; /* the AUX enable register */

        bcm2835aux_uart1: {
            regulator-name = "bcm2835_aux_uart1";
            reg = <0>; /* bit 0 in enable register */
        };
        bcm2835aux_spi1: {
            regulator-name = "bcm2835_aux_spi1";
            reg = <1>; /* bit 1 in enable register */
        };
        bcm2835aux_spi2: {
            regulator-name = "bcm2835_aux_spi2";
            reg = <2>; /* bit 2 in enable register */
        };
    }
};

uart1: uart1@7e215040 {
compatible = "brcm,bcm2835-aux-uart";
    reg = <0x7e215040 0x40>;
    ...
    vcc = <&bcm2835aux_uart1>
};

spi1: spi1@7e215080 {
compatible = "brcm,bcm2835-aux-spi";
    reg = <0x7e215080 0x40>;
    ...
    vcc = <&bcm2835aux_spi1>
};

spi2: spi2@7e2150C0 {
compatible = "brcm,bcm2835-aux-spi";
    reg = <0x7e2150C0 0x40>;
    ...
    vcc = <&bcm2835aux_spi2>
};

And the necessary driver-side code for bcm2835aux_spi and
bcm2835aux_uart would be along those lines:

probe:
  /* get the "power-supply" */
  bs->power = devm_regulator_get(dev, "vcc");
  if ((PTR_ERR(priv->power) == -EPROBE_DEFER)
    return -EPROBE_DEFER
  /* enable the power-supply */
  regulator_enable(bs->power);

remove:
  regulator_disable(bs->power);

Would that look like an acceptable solution?

Thanks,
	Martin

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux