From: Kevin Cernekee <cernekee@gmail.com>
To: sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org,
arnd@arndb.de, linux@prisktech.co.nz, stern@rowland.harvard.edu,
gregkh@linuxfoundation.org, f.fainelli@gmail.com
Cc: grant.likely@linaro.org, robh+dt@kernel.org,
computersforpeace@gmail.com, marc.ceeeee@gmail.com,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org,
linux-mips@linux-mips.org
Subject: [PATCH 2/9] power/reset: brcmstb: Use the DT "compatible" string to indicate bit positions
Date: Tue, 25 Nov 2014 16:49:47 -0800 [thread overview]
Message-ID: <1416962994-27095-3-git-send-email-cernekee@gmail.com> (raw)
In-Reply-To: <1416962994-27095-1-git-send-email-cernekee@gmail.com>
Some of the older chips used different bits to arm and trigger the reset.
Add the infrastructure needed to specify this through the "compatible"
string.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
drivers/power/reset/brcmstb-reboot.c | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/drivers/power/reset/brcmstb-reboot.c b/drivers/power/reset/brcmstb-reboot.c
index 3306241..4e61c3f 100644
--- a/drivers/power/reset/brcmstb-reboot.c
+++ b/drivers/power/reset/brcmstb-reboot.c
@@ -11,6 +11,7 @@
* GNU General Public License for more details.
*/
+#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/init.h>
@@ -34,13 +35,20 @@ static struct regmap *regmap;
static u32 rst_src_en;
static u32 sw_mstr_rst;
+struct reset_reg_mask {
+ u32 rst_src_en_mask;
+ u32 sw_mstr_rst_mask;
+};
+
+static const struct reset_reg_mask *reset_masks;
+
static int brcmstb_restart_handler(struct notifier_block *this,
unsigned long mode, void *cmd)
{
int rc;
u32 tmp;
- rc = regmap_write(regmap, rst_src_en, 1);
+ rc = regmap_write(regmap, rst_src_en, reset_masks->rst_src_en_mask);
if (rc) {
pr_err("failed to write rst_src_en (%d)\n", rc);
return NOTIFY_DONE;
@@ -52,7 +60,7 @@ static int brcmstb_restart_handler(struct notifier_block *this,
return NOTIFY_DONE;
}
- rc = regmap_write(regmap, sw_mstr_rst, 1);
+ rc = regmap_write(regmap, sw_mstr_rst, reset_masks->sw_mstr_rst_mask);
if (rc) {
pr_err("failed to write sw_mstr_rst (%d)\n", rc);
return NOTIFY_DONE;
@@ -75,10 +83,28 @@ static struct notifier_block brcmstb_restart_nb = {
.priority = 128,
};
+static const struct reset_reg_mask reset_bits_40nm = {
+ .rst_src_en_mask = BIT(0),
+ .sw_mstr_rst_mask = BIT(0),
+};
+
+static const struct of_device_id of_match[] = {
+ { .compatible = "brcm,brcmstb-reboot", .data = &reset_bits_40nm },
+ {},
+};
+
static int brcmstb_reboot_probe(struct platform_device *pdev)
{
int rc;
struct device_node *np = pdev->dev.of_node;
+ const struct of_device_id *of_id;
+
+ of_id = of_match_node(of_match, np);
+ if (!of_id) {
+ pr_err("failed to look up compatible string\n");
+ return -EINVAL;
+ }
+ reset_masks = of_id->data;
regmap = syscon_regmap_lookup_by_phandle(np, "syscon");
if (IS_ERR(regmap)) {
@@ -108,11 +134,6 @@ static int brcmstb_reboot_probe(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id of_match[] = {
- { .compatible = "brcm,brcmstb-reboot", },
- {},
-};
-
static struct platform_driver brcmstb_reboot_driver = {
.probe = brcmstb_reboot_probe,
.driver = {
--
2.1.0
next prev parent reply other threads:[~2014-11-26 0:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 0:49 [PATCH 0/9] Extend various drivers to run on bi-endian BMIPS hosts Kevin Cernekee
2014-11-26 0:49 ` [PATCH 1/9] power/reset: brcmstb: Make the driver buildable on MIPS Kevin Cernekee
[not found] ` <1416962994-27095-2-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-22 1:46 ` Sebastian Reichel
2014-11-26 0:49 ` Kevin Cernekee [this message]
2015-01-22 1:46 ` [PATCH 2/9] power/reset: brcmstb: Use the DT "compatible" string to indicate bit positions Sebastian Reichel
2014-11-26 0:49 ` [PATCH 7/9] bus: brcmstb_gisb: Add register offset tables for older chips Kevin Cernekee
[not found] ` <1416962994-27095-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-26 0:49 ` [PATCH 3/9] power/reset: brcmstb: Add support for old 65nm chips Kevin Cernekee
[not found] ` <1416962994-27095-4-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-22 1:47 ` Sebastian Reichel
2014-11-26 0:49 ` [PATCH 4/9] bus: brcmstb_gisb: Make the driver buildable on MIPS Kevin Cernekee
2014-11-26 0:49 ` [PATCH 5/9] bus: brcmstb_gisb: Introduce wrapper functions for MMIO accesses Kevin Cernekee
2014-11-26 0:49 ` [PATCH 6/9] bus: brcmstb_gisb: Look up register offsets in a table Kevin Cernekee
2014-11-26 0:49 ` [PATCH 8/9] bus: brcmstb_gisb: Honor the "big-endian" and "native-endian" DT properties Kevin Cernekee
2015-02-09 21:59 ` Florian Fainelli
[not found] ` <1416962994-27095-9-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-29 4:01 ` Florian Fainelli
2014-11-26 0:49 ` [PATCH 9/9] usb: {ohci,ehci}-platform: Use new OF big-endian helper function Kevin Cernekee
2014-11-26 4:15 ` Tony Prisk
2014-11-26 15:14 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1411261013340.1322-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-11-26 16:07 ` Kevin Cernekee
[not found] ` <CAJiQ=7CuLA2vDpnkDysBU100R0uuUidB_ua3sZdV74vNPjV76w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-26 16:24 ` Alan Stern
2014-11-26 5:33 ` [PATCH 0/9] Extend various drivers to run on bi-endian BMIPS hosts Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1416962994-27095-3-git-send-email-cernekee@gmail.com \
--to=cernekee@gmail.com \
--cc=arnd@arndb.de \
--cc=computersforpeace@gmail.com \
--cc=dbaryshkov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=f.fainelli@gmail.com \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@prisktech.co.nz \
--cc=marc.ceeeee@gmail.com \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).