-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
175 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2015 wowotech | ||
* | ||
* wowo<wowo@wowotech.net> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
|
||
#include "s900.dtsi" | ||
|
||
/ { | ||
pinctrl@e01b0000 { | ||
/* actions,pins = <reg, offset, mask, valude>, ...*/ | ||
pinctrl_serial5: serial5 { | ||
actions,pins = <0x0044 23 0x3f 0xc>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
/* | ||
* Copyright (c) 2015 Actions Semi Co., Ltd. | ||
* Copyright (c) 2015 wowotech | ||
* | ||
* wowo<wowo@wowotech.net> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
/dts-v1/; | ||
|
||
#include "s900.dtsi" | ||
#include "s900-bubblegum-pinctrl.dtsi" | ||
|
||
/ { | ||
uart5: serial@e012a000 { | ||
compatible = "actions,s900-serial"; | ||
pinctrl@e01b0000 { | ||
u-boot,dm-pre-reloc; | ||
}; | ||
|
||
serial5: serial@e012a000 { | ||
u-boot,dm-pre-reloc; | ||
pinctrl-names = "default"; | ||
pinctrl-0 = <&pinctrl_serial5>; | ||
}; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2015 wowotech | ||
* | ||
* wowo<wowo@wowotech.net> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
|
||
/ { | ||
#address-cells = <2>; | ||
#size-cells = <2>; | ||
|
||
serial5: serial@e012a000 { | ||
compatible = "actions,s900-serial"; | ||
reg = <0 0xe012a000 0 0x1000>; | ||
}; | ||
|
||
pinctrl@e01b0000 { | ||
compatible = "actions,s900-pinctrl"; | ||
reg = <0 0xe01b0000 0 0x1000>; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright (c) 2015 wowotech | ||
* | ||
* wowo<wowo@wowotech.net> | ||
* | ||
* SPDX-License-Identifier: GPL-2.0+ | ||
*/ | ||
|
||
#define DEBUGX | ||
|
||
#include <common.h> | ||
#include <asm/io.h> | ||
#include <dm/device.h> | ||
#include <dm/pinctrl.h> | ||
|
||
DECLARE_GLOBAL_DATA_PTR; | ||
|
||
struct owl_pinctrl_priv { | ||
fdt_addr_t base; /* register address */ | ||
}; | ||
|
||
static int owl_pinctrl_set_state_simple(struct udevice *dev, | ||
struct udevice *periph) | ||
{ | ||
int entry, count, i; | ||
uint32_t cell[20]; | ||
struct owl_pinctrl_priv *priv = dev_get_priv(dev); | ||
|
||
entry = fdtdec_lookup_phandle(gd->fdt_blob, periph->of_offset, | ||
"pinctrl-0"); | ||
if (entry < 0) | ||
return -1; | ||
|
||
count = fdtdec_get_int_array_count(gd->fdt_blob, entry, "actions,pins", | ||
cell, ARRAY_SIZE(cell)); | ||
if (count < 4) | ||
return -1; | ||
|
||
for (i = 0; i < count / 4; i += 4) | ||
clrsetbits_le32(priv->base + cell[i], | ||
cell[i + 2] << cell[i + 1], | ||
cell[i + 3] << cell[i + 1]); | ||
|
||
return 0; | ||
} | ||
|
||
static const struct pinctrl_ops owl_pinctrl_ops = { | ||
.set_state_simple = owl_pinctrl_set_state_simple, | ||
}; | ||
|
||
static int owl_pinctrl_probe(struct udevice *dev) | ||
{ | ||
struct owl_pinctrl_priv *priv = dev_get_priv(dev); | ||
|
||
priv->base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg"); | ||
if (priv->base == FDT_ADDR_T_NONE) | ||
return -1; | ||
|
||
debug("%s: base is 0x%llx\n", __func__, priv->base); | ||
|
||
return 0; | ||
} | ||
|
||
|
||
static const struct udevice_id owl_pinctrl_match[] = { | ||
{ .compatible = "actions,s900-pinctrl" }, | ||
{ /* sentinel */ } | ||
}; | ||
|
||
U_BOOT_DRIVER(owl_pinctrl) = { | ||
.name = "owl_pinctrl", | ||
.id = UCLASS_PINCTRL, | ||
.of_match = owl_pinctrl_match, | ||
.probe = owl_pinctrl_probe, | ||
.ops = &owl_pinctrl_ops, | ||
.flags = DM_FLAG_PRE_RELOC, | ||
.priv_auto_alloc_size = sizeof(struct owl_pinctrl_priv), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters