From: Andrew Lunn <andrew@lunn.ch> To: Tim Harvey <tharvey@gateworks.com> Cc: Lee Jones <lee.jones@linaro.org>, Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Mark Brown <broonie@kernel.org>, Dmitry Torokhov <dmitry.torokhov@gmail.com>, Wim Van Sebroeck <wim@iguana.be>, Guenter Roeck <linux@roeck-us.net>, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 2/4] mfd: add Gateworks System Controller core driver Date: Tue, 3 Apr 2018 18:47:15 +0200 [thread overview] Message-ID: <20180403164715.GA5676@lunn.ch> (raw) In-Reply-To: <CAJ+vNU3-gaTcMAzo5wB6oSfE-JQC3NBVRJS5zFMTE-nVpD4F5g@mail.gmail.com> On Tue, Apr 03, 2018 at 08:48:27AM -0700, Tim Harvey wrote: > On Wed, Mar 28, 2018 at 8:14 AM, Tim Harvey <tharvey@gateworks.com> wrote: > > The Gateworks System Controller (GSC) is an I2C slave controller > > implemented with an MSP430 micro-controller whose firmware embeds the > > following features: > > - I/O expander (16 GPIO's) using PCA955x protocol > > - Real Time Clock using DS1672 protocol > > - User EEPROM using AT24 protocol > > - HWMON using custom protocol > > - Interrupt controller with tamper detect, user pushbotton > > - Watchdog controller capable of full board power-cycle > > - Power Control capable of full board power-cycle > > > > see http://trac.gateworks.com/wiki/gsc for more details > > > <snip> > > + > > +/* > > + * gsc_powerdown - API to use GSC to power down board for a specific time > > + * > > + * secs - number of seconds to remain powered off > > + */ > > +static int gsc_powerdown(struct gsc_dev *gsc, unsigned long secs) > > +{ > > + int ret; > > + unsigned char regs[4]; > > + > > + dev_info(&gsc->i2c->dev, "GSC powerdown for %ld seconds\n", > > + secs); > > + regs[0] = secs & 0xff; > > + regs[1] = (secs >> 8) & 0xff; > > + regs[2] = (secs >> 16) & 0xff; > > + regs[3] = (secs >> 24) & 0xff; > > + ret = regmap_bulk_write(gsc->regmap, GSC_TIME_ADD, regs, 4); > > + > > + return ret; > > +} > > Any feedback on the 'powerdown' sysfs attribute that hooks to this > function? This allows the GSC to disable the board primary power > supply for 2^32 seconds and is often used to 'reset' the board > although it could also be used to put the board in a power down state > longer. I'm wondering if there is a more appropriate API for this in > the kernel that I don't know about. Hi Tim RTC can cause wakeup when an alarm is set. It looks like the DS1672 does not have this. But you are emulating the DS1672 right? You could add a second emulated RTC which does support an alarm? DS3232? > I would also like to register a restart handler using this but I > believe that ARM restart handlers currently can not use I2C - is that > correct? There are plenty which use GPIOs, or UARTs. Not seen any which use i2c. What do you think does not work at this point? Andrew
WARNING: multiple messages have this Message-ID (diff)
From: andrew@lunn.ch (Andrew Lunn) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/4] mfd: add Gateworks System Controller core driver Date: Tue, 3 Apr 2018 18:47:15 +0200 [thread overview] Message-ID: <20180403164715.GA5676@lunn.ch> (raw) In-Reply-To: <CAJ+vNU3-gaTcMAzo5wB6oSfE-JQC3NBVRJS5zFMTE-nVpD4F5g@mail.gmail.com> On Tue, Apr 03, 2018 at 08:48:27AM -0700, Tim Harvey wrote: > On Wed, Mar 28, 2018 at 8:14 AM, Tim Harvey <tharvey@gateworks.com> wrote: > > The Gateworks System Controller (GSC) is an I2C slave controller > > implemented with an MSP430 micro-controller whose firmware embeds the > > following features: > > - I/O expander (16 GPIO's) using PCA955x protocol > > - Real Time Clock using DS1672 protocol > > - User EEPROM using AT24 protocol > > - HWMON using custom protocol > > - Interrupt controller with tamper detect, user pushbotton > > - Watchdog controller capable of full board power-cycle > > - Power Control capable of full board power-cycle > > > > see http://trac.gateworks.com/wiki/gsc for more details > > > <snip> > > + > > +/* > > + * gsc_powerdown - API to use GSC to power down board for a specific time > > + * > > + * secs - number of seconds to remain powered off > > + */ > > +static int gsc_powerdown(struct gsc_dev *gsc, unsigned long secs) > > +{ > > + int ret; > > + unsigned char regs[4]; > > + > > + dev_info(&gsc->i2c->dev, "GSC powerdown for %ld seconds\n", > > + secs); > > + regs[0] = secs & 0xff; > > + regs[1] = (secs >> 8) & 0xff; > > + regs[2] = (secs >> 16) & 0xff; > > + regs[3] = (secs >> 24) & 0xff; > > + ret = regmap_bulk_write(gsc->regmap, GSC_TIME_ADD, regs, 4); > > + > > + return ret; > > +} > > Any feedback on the 'powerdown' sysfs attribute that hooks to this > function? This allows the GSC to disable the board primary power > supply for 2^32 seconds and is often used to 'reset' the board > although it could also be used to put the board in a power down state > longer. I'm wondering if there is a more appropriate API for this in > the kernel that I don't know about. Hi Tim RTC can cause wakeup when an alarm is set. It looks like the DS1672 does not have this. But you are emulating the DS1672 right? You could add a second emulated RTC which does support an alarm? DS3232? > I would also like to register a restart handler using this but I > believe that ARM restart handlers currently can not use I2C - is that > correct? There are plenty which use GPIOs, or UARTs. Not seen any which use i2c. What do you think does not work at this point? Andrew
next prev parent reply other threads:[~2018-04-03 16:47 UTC|newest] Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-28 15:13 [PATCH v3 0/4] Add support for the Gateworks System Controller Tim Harvey 2018-03-28 15:13 ` Tim Harvey 2018-03-28 15:14 ` [PATCH v3 1/4] dt-bindings: mfd: Add Gateworks System Controller bindings Tim Harvey 2018-03-28 15:14 ` Tim Harvey 2018-03-28 15:14 ` Tim Harvey 2018-03-28 16:24 ` Guenter Roeck 2018-03-28 16:24 ` Guenter Roeck 2018-03-28 19:17 ` Tim Harvey 2018-03-28 19:17 ` Tim Harvey 2018-03-28 20:23 ` Guenter Roeck 2018-03-28 20:23 ` Guenter Roeck 2018-03-28 20:53 ` Tim Harvey 2018-03-28 20:53 ` Tim Harvey 2018-04-09 19:24 ` Rob Herring 2018-04-09 19:24 ` Rob Herring 2018-03-28 15:14 ` [PATCH v3 2/4] mfd: add Gateworks System Controller core driver Tim Harvey 2018-03-28 15:14 ` Tim Harvey 2018-04-03 15:48 ` Tim Harvey 2018-04-03 15:48 ` Tim Harvey 2018-04-03 16:47 ` Andrew Lunn [this message] 2018-04-03 16:47 ` Andrew Lunn 2018-04-03 17:29 ` Tim Harvey 2018-04-03 17:29 ` Tim Harvey 2018-04-04 13:12 ` Andrew Lunn 2018-04-04 13:12 ` Andrew Lunn 2018-04-04 14:41 ` Mark Brown 2018-04-04 14:41 ` Mark Brown 2018-03-28 15:14 ` [PATCH v3 3/4] hwmon: add Gateworks System Controller support Tim Harvey 2018-03-28 15:14 ` Tim Harvey 2018-03-28 17:00 ` Guenter Roeck 2018-03-28 17:00 ` Guenter Roeck 2018-03-28 20:23 ` Tim Harvey 2018-03-28 20:23 ` Tim Harvey 2018-03-28 20:33 ` Guenter Roeck 2018-03-28 20:33 ` Guenter Roeck 2018-03-28 15:14 ` [PATCH v3 4/4] watchdog: " Tim Harvey 2018-03-28 15:14 ` Tim Harvey 2018-03-30 1:07 ` [v3,4/4] " Guenter Roeck 2018-03-30 1:07 ` Guenter Roeck 2018-03-30 17:48 ` Dmitry Torokhov 2018-03-30 17:48 ` Dmitry Torokhov 2018-03-30 17:49 ` Tim Harvey 2018-03-30 17:49 ` Tim Harvey 2018-03-30 18:19 ` Guenter Roeck 2018-03-30 18:19 ` Guenter Roeck 2018-04-02 16:07 ` Tim Harvey 2018-04-02 16:07 ` Tim Harvey 2018-04-02 16:32 ` Andrew Lunn 2018-04-02 16:32 ` Andrew Lunn 2018-04-04 16:57 ` Tim Harvey 2018-04-04 16:57 ` Tim Harvey
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=20180403164715.GA5676@lunn.ch \ --to=andrew@lunn.ch \ --cc=broonie@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=dmitry.torokhov@gmail.com \ --cc=lee.jones@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-hwmon@vger.kernel.org \ --cc=linux-input@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-watchdog@vger.kernel.org \ --cc=linux@roeck-us.net \ --cc=mark.rutland@arm.com \ --cc=rdunlap@infradead.org \ --cc=robh+dt@kernel.org \ --cc=tharvey@gateworks.com \ --cc=wim@iguana.be \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.