Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328610
b: refs/heads/master
c: 39a6ac1
h: refs/heads/master
v: v3
  • Loading branch information
Roland Stigge authored and Mark Brown committed Sep 25, 2012
1 parent 4790eed commit 2fa7d66
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5bee3b94d945851d6cb624a5e6808d9a815ebca0
refs/heads/master: 39a6ac11df6579df0361922f05c43f0fac8daa37
7 changes: 7 additions & 0 deletions trunk/Documentation/devicetree/bindings/spi/spi_pl022.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ Optional properties:
- cs-gpios : should specify GPIOs used for chipselects.
The gpios will be referred to as reg = <index> in the SPI child nodes.
If unspecified, a single SPI device without a chip select can be used.
- pl022,autosuspend-delay : delay in ms following transfer completion before
the runtime power management system suspends the
device. A setting of 0 indicates no delay and the
device will be suspended immediately
- pl022,rt : indicates the controller should run the message pump with realtime
priority to minimise the transfer latency on the bus (boolean)


SPI slave nodes must be children of the SPI master node and can
contain the following properties.
Expand Down
39 changes: 34 additions & 5 deletions trunk/drivers/spi/spi-pl022.c
Original file line number Diff line number Diff line change
Expand Up @@ -2029,6 +2029,34 @@ static void pl022_cleanup(struct spi_device *spi)
kfree(chip);
}

static struct pl022_ssp_controller *
pl022_platform_data_dt_get(struct device *dev)
{
struct device_node *np = dev->of_node;
struct pl022_ssp_controller *pd;
u32 tmp;

if (!np) {
dev_err(dev, "no dt node defined\n");
return NULL;
}

pd = devm_kzalloc(dev, sizeof(struct pl022_ssp_controller), GFP_KERNEL);
if (!pd) {
dev_err(dev, "cannot allocate platform data memory\n");
return NULL;
}

pd->bus_id = -1;
of_property_read_u32(np, "num-cs", &tmp);
pd->num_chipselect = tmp;
of_property_read_u32(np, "pl022,autosuspend-delay",
&pd->autosuspend_delay);
pd->rt = of_property_read_bool(np, "pl022,rt");

return pd;
}

static int __devinit
pl022_probe(struct amba_device *adev, const struct amba_id *id)
{
Expand All @@ -2041,18 +2069,19 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)

dev_info(&adev->dev,
"ARM PL022 driver, device ID: 0x%08x\n", adev->periphid);
if (platform_info == NULL) {
dev_err(&adev->dev, "probe - no platform data supplied\n");
if (!platform_info && IS_ENABLED(CONFIG_OF))
platform_info = pl022_platform_data_dt_get(dev);

if (!platform_info) {
dev_err(dev, "probe: no platform data defined\n");
status = -ENODEV;
goto err_no_pdata;
}

if (platform_info->num_chipselect) {
num_cs = platform_info->num_chipselect;
} else if (IS_ENABLED(CONFIG_OF)) {
of_property_read_u32(np, "num-cs", &num_cs);
} else {
dev_err(&adev->dev, "probe: no chip select defined\n");
dev_err(dev, "probe: no chip select defined\n");
status = -ENODEV;
goto err_no_pdata;
}
Expand Down

0 comments on commit 2fa7d66

Please sign in to comment.