Skip to content

Commit

Permalink
Merge branch 'kirkwood/dt' of git://git.infradead.org/users/jcooper/l…
Browse files Browse the repository at this point in the history
…inux into late/kirkwood

From Jason Cooper:

New bindings:
  - iconnect nand and keys
  - mv_cesa
  - gpio-fan

* 'kirkwood/dt' of git://git.infradead.org/users/jcooper/linux:
  ARM: kirkwood: Use devicetree to define DNS-32[05] fan
  hwmon: Add devicetree bindings to gpio-fan
  Crypto: CESA: Add support for DT based instantiation.
  ARM: Kirkwood: Describe iconnect nand in DT.
  ARM: Kirkwood: Describe iconnect keys in DT.
  • Loading branch information
Olof Johansson committed Sep 22, 2012
2 parents fb6f3d6 + 1b90e06 commit d6a93ce
Show file tree
Hide file tree
Showing 10 changed files with 251 additions and 79 deletions.
20 changes: 20 additions & 0 deletions Documentation/devicetree/bindings/crypto/mv_cesa.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Marvell Cryptographic Engines And Security Accelerator

Required properties:
- compatible : should be "marvell,orion-crypto"
- reg : base physical address of the engine and length of memory mapped
region, followed by base physical address of sram and its memory
length
- reg-names : "regs" , "sram";
- interrupts : interrupt number

Examples:

crypto@30000 {
compatible = "marvell,orion-crypto";
reg = <0x30000 0x10000>,
<0x4000000 0x800>;
reg-names = "regs" , "sram";
interrupts = <22>;
status = "okay";
};
25 changes: 25 additions & 0 deletions Documentation/devicetree/bindings/gpio/gpio-fan.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Bindings for fan connected to GPIO lines

Required properties:
- compatible : "gpio-fan"
- gpios: Specifies the pins that map to bits in the control value,
ordered MSB-->LSB.
- gpio-fan,speed-map: A mapping of possible fan RPM speeds and the
control value that should be set to achieve them. This array
must have the RPM values in ascending order.

Optional properties:
- alarm-gpios: This pin going active indicates something is wrong with
the fan, and a udev event will be fired.

Examples:

gpio_fan {
compatible = "gpio-fan";
gpios = <&gpio1 14 1
&gpio1 13 1>;
gpio-fan,speed-map = <0 0
3000 1
6000 2>;
alarm-gpios = <&gpio1 15 1>;
};
10 changes: 10 additions & 0 deletions arch/arm/boot/dts/kirkwood-dnskw.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
};
};

gpio_fan {
/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
compatible = "gpio-fan";
gpios = <&gpio1 14 1
&gpio1 13 1>;
gpio-fan,speed-map = <0 0
3000 1
6000 2>;
};

ocp@f1000000 {
sata@80000 {
status = "okay";
Expand Down
50 changes: 49 additions & 1 deletion arch/arm/boot/dts/kirkwood-iconnect.dts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
};

chosen {
bootargs = "console=ttyS0,115200n8 earlyprintk mtdparts=orion_nand:0xc0000@0x0(uboot),0x20000@0xa0000(env),0x300000@0x100000(zImage),0x300000@0x540000(initrd),0x1f400000@0x980000(boot)";
bootargs = "console=ttyS0,115200n8 earlyprintk";
linux,initrd-start = <0x4500040>;
linux,initrd-end = <0x4800000>;
};
Expand All @@ -30,7 +30,37 @@
clock-frequency = <200000000>;
status = "ok";
};

nand@3000000 {
status = "okay";

partition@0 {
label = "uboot";
reg = <0x0000000 0xc0000>;
};

partition@a0000 {
label = "env";
reg = <0xa0000 0x20000>;
};

partition@100000 {
label = "zImage";
reg = <0x100000 0x300000>;
};

partition@540000 {
label = "initrd";
reg = <0x540000 0x300000>;
};

partition@980000 {
label = "boot";
reg = <0x980000 0x1f400000>;
};
};
};

gpio-leds {
compatible = "gpio-leds";

Expand Down Expand Up @@ -69,4 +99,22 @@
gpios = <&gpio1 16 0>;
};
};

gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
button@1 {
label = "OTB Button";
linux,code = <133>;
gpios = <&gpio1 3 1>;
debounce-interval = <100>;
};
button@2 {
label = "Reset";
linux,code = <0x198>;
gpios = <&gpio0 12 1>;
debounce-interval = <100>;
};
};
};
12 changes: 11 additions & 1 deletion arch/arm/boot/dts/kirkwood.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

ocp@f1000000 {
compatible = "simple-bus";
ranges = <0 0xf1000000 0x4000000>;
ranges = <0x00000000 0xf1000000 0x4000000
0xf5000000 0xf5000000 0x0000400>;
#address-cells = <1>;
#size-cells = <1>;

Expand Down Expand Up @@ -105,5 +106,14 @@
clock-frequency = <100000>;
status = "disabled";
};

crypto@30000 {
compatible = "marvell,orion-crypto";
reg = <0x30000 0x10000>,
<0xf5000000 0x800>;
reg-names = "regs", "sram";
interrupts = <22>;
status = "okay";
};
};
};
26 changes: 0 additions & 26 deletions arch/arm/mach-kirkwood/board-dnskw.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <linux/of.h>
#include <linux/gpio.h>
#include <linux/input.h>
#include <linux/gpio-fan.h>
#include <linux/leds.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
Expand Down Expand Up @@ -67,29 +66,6 @@ static unsigned int dnskw_mpp_config[] __initdata = {
0
};

/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
static struct gpio_fan_speed dnskw_fan_speed[] = {
{ 0, 0 },
{ 3000, 1 },
{ 6000, 2 },
};
static unsigned dnskw_fan_pins[] = {46, 45};

static struct gpio_fan_platform_data dnskw_fan_data = {
.num_ctrl = ARRAY_SIZE(dnskw_fan_pins),
.ctrl = dnskw_fan_pins,
.num_speed = ARRAY_SIZE(dnskw_fan_speed),
.speed = dnskw_fan_speed,
};

static struct platform_device dnskw_fan_device = {
.name = "gpio-fan",
.id = -1,
.dev = {
.platform_data = &dnskw_fan_data,
},
};

static void dnskw_power_off(void)
{
gpio_set_value(36, 1);
Expand All @@ -114,8 +90,6 @@ void __init dnskw_init(void)
kirkwood_ehci_init();
kirkwood_ge00_init(&dnskw_ge00_data);

platform_device_register(&dnskw_fan_device);

/* Register power-off GPIO. */
if (gpio_request(36, "dnskw:power:off") == 0
&& gpio_direction_output(36, 0) == 0)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-kirkwood/board-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1030000, "mv_crypto", NULL),
{},
};

Expand Down Expand Up @@ -60,7 +61,6 @@ static void __init kirkwood_dt_init(void)
/* internal devices that every board has */
kirkwood_xor0_init();
kirkwood_xor1_init();
kirkwood_crypto_init();

#ifdef CONFIG_KEXEC
kexec_reinit = kirkwood_enable_pcie;
Expand Down
48 changes: 0 additions & 48 deletions arch/arm/mach-kirkwood/board-iconnect.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
#include <linux/of_fdt.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/mtd/partitions.h>
#include <linux/mv643xx_eth.h>
#include <linux/gpio.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
#include <asm/mach/arch.h>
#include <mach/kirkwood.h>
#include "common.h"
Expand All @@ -44,57 +41,12 @@ static unsigned int iconnect_mpp_config[] __initdata = {
0
};

static struct mtd_partition iconnect_nand_parts[] = {
{
.name = "flash",
.offset = 0,
.size = MTDPART_SIZ_FULL,
},
};

/* yikes... theses are the original input buttons */
/* but I'm not convinced by the sw event choices */
static struct gpio_keys_button iconnect_buttons[] = {
{
.type = EV_SW,
.code = SW_LID,
.gpio = 12,
.desc = "Reset Button",
.active_low = 1,
.debounce_interval = 100,
}, {
.type = EV_SW,
.code = SW_TABLET_MODE,
.gpio = 35,
.desc = "OTB Button",
.active_low = 1,
.debounce_interval = 100,
},
};

static struct gpio_keys_platform_data iconnect_button_data = {
.buttons = iconnect_buttons,
.nbuttons = ARRAY_SIZE(iconnect_buttons),
};

static struct platform_device iconnect_button_device = {
.name = "gpio-keys",
.id = -1,
.num_resources = 0,
.dev = {
.platform_data = &iconnect_button_data,
},
};

void __init iconnect_init(void)
{
kirkwood_mpp_conf(iconnect_mpp_config);
kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);

kirkwood_ehci_init();
kirkwood_ge00_init(&iconnect_ge00_data);

platform_device_register(&iconnect_button_device);
}

static int __init iconnect_pci_init(void)
Expand Down
17 changes: 15 additions & 2 deletions drivers/crypto/mv_cesa.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#include <linux/clk.h>
#include <crypto/internal/hash.h>
#include <crypto/sha.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/of_irq.h>

#include "mv_cesa.h"

Expand Down Expand Up @@ -1062,7 +1065,10 @@ static int mv_probe(struct platform_device *pdev)
goto err_unmap_reg;
}

irq = platform_get_irq(pdev, 0);
if (pdev->dev.of_node)
irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
else
irq = platform_get_irq(pdev, 0);
if (irq < 0 || irq == NO_IRQ) {
ret = irq;
goto err_unmap_sram;
Expand Down Expand Up @@ -1170,12 +1176,19 @@ static int mv_remove(struct platform_device *pdev)
return 0;
}

static const struct of_device_id mv_cesa_of_match_table[] = {
{ .compatible = "marvell,orion-crypto", },
{}
};
MODULE_DEVICE_TABLE(of, mv_cesa_of_match_table);

static struct platform_driver marvell_crypto = {
.probe = mv_probe,
.remove = mv_remove,
.remove = __devexit_p(mv_remove),
.driver = {
.owner = THIS_MODULE,
.name = "mv_crypto",
.of_match_table = of_match_ptr(mv_cesa_of_match_table),
},
};
MODULE_ALIAS("platform:mv_crypto");
Expand Down
Loading

0 comments on commit d6a93ce

Please sign in to comment.