RFC Need advice on reworking gpio-ep93xx.c to DT support

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

 



Dear all, after studying the question i've came up with the following suggestion:

- split ep93xx_gpio_resource into per port platform device:

So instead of:
```
static struct resource ep93xx_gpio_resource[] = {
DEFINE_RES_MEM(EP93XX_GPIO_PHYS_BASE, 0xcc),
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO_AB),
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO0MUX),
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO1MUX),
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO2MUX),
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO3MUX),
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO4MUX),
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO5MUX),
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO6MUX),
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO7MUX),
};

static struct platform_device ep93xx_gpio_device = {
.name = "gpio-ep93xx",
.id = -1,
.num_resources = ARRAY_SIZE(ep93xx_gpio_resource),
.resource = ep93xx_gpio_resource,
};
```

We will have something like this for each port:
```
static struct resource ep93xx_gpio_A_resource[] = {
DEFINE_RES_MEM(EP93XX_GPIO_PHYS_BASE + DATA, 0x04),
DEFINE_RES_MEM(EP93XX_GPIO_PHYS_BASE + DIRECTION, 0x04),
DEFINE_RES_MEM(EP93XX_GPIO_PHYS_BASE + INTERRUPT, 0x2c), /** only port A/B/F*/
DEFINE_RES_IRQ(IRQ_EP93XX_GPIO_AB), /** only port A/B*/
... /* IRQS only for port F*/
};

static struct platform_device ep93xx_gpio_A_device = {
.name = "gpio-ep93xx",
.id = -1,
.num_resources = ARRAY_SIZE(ep93xx_gpio_A_resource),
.resource = ep93xx_gpio_A_resource,
};
```

And they will registered separately.

I think this will allow more transparent transition to DT

- rework gpio-ep93xx.c to handle each platform device instance separately
- add processing for the following device tree (example):

Showing only ports A, F and no interrupt capable C:
```
gpio0: gpio@80840000 {
compatible = "cirrus,ep93xx-gpio-a", "cirrus,ep93xx-gpio";
label = "A";
reg = <0x80840000 0x04>,
<0x80840010 0x04>,
<0x80840090 0x1c>;
reg-names = "data", "dir", "int";
gpio-controller;
interrupt-controller;
interrupt-parent = <&vic1>;
interrupts = <27>;
};

gpio2: gpio@80840008 {
compatible = "cirrus,ep93xx-gpio";
label = "C";
reg = <0x80840008 0x04>,
<0x80840018 0x04>;
reg-names = "data", "dir";
gpio-controller;
};

gpio5: gpio@80840030 {
compatible = "cirrus,ep93xx-gpio-f", "cirrus,ep93xx-gpio";
label = "F";
reg = <0x80840030 0x04>,
<0x80840034 0x04>,
<0x8084004C 0x1c>;
reg-names = "data", "dir", "int";
gpio-controller;
interrupt-controller;
interrupts-extended= <&vic0 19 20 21 22>,
<&vic1 15 16 17 18>;
};
```

So the work will be split into 2 stages:
- breaking gpio platform data into pieces, adapting gpio-ep93xx.c
- adding DT support for gpio-ep93xx.c

Please advise me on this issue.



[Index of Archives]     [Linux SPI]     [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