Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c Remove tps65950pm (hardware now supported by twl...



details:   https://anonhg.NetBSD.org/src/rev/71a4cf2636ae
branches:  trunk
changeset: 460718:71a4cf2636ae
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Nov 01 09:59:22 2019 +0000

description:
Remove tps65950pm (hardware now supported by twl4030.c)

diffstat:

 sys/dev/i2c/files.i2c  |    7 +-
 sys/dev/i2c/tps65950.c |  449 -------------------------------------------------
 2 files changed, 1 insertions(+), 455 deletions(-)

diffs (truncated from 474 to 300 lines):

diff -r 1d506c8d6682 -r 71a4cf2636ae sys/dev/i2c/files.i2c
--- a/sys/dev/i2c/files.i2c     Fri Nov 01 09:49:55 2019 +0000
+++ b/sys/dev/i2c/files.i2c     Fri Nov 01 09:59:22 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.i2c,v 1.102 2019/10/30 21:38:28 jmcneill Exp $
+#      $NetBSD: files.i2c,v 1.103 2019/11/01 09:59:22 jmcneill Exp $
 
 obsolete defflag       opt_i2cbus.h            I2C_SCAN
 define i2cbus { }
@@ -196,11 +196,6 @@
 attach ibmhawk at iic
 file   dev/i2c/ibmhawk.c               ibmhawk
 
-# TI TPS65950 OMAP Power Management and System Companion Device
-device tps65950pm: sysmon_wdog
-attach tps65950pm at iic
-file   dev/i2c/tps65950.c              tps65950pm
-
 # TI TPS65217
 device tps65217pmic { }: sysmon_envsys
 device tps65217reg: tps65217pmic
diff -r 1d506c8d6682 -r 71a4cf2636ae sys/dev/i2c/tps65950.c
--- a/sys/dev/i2c/tps65950.c    Fri Nov 01 09:49:55 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,449 +0,0 @@
-/* $NetBSD: tps65950.c,v 1.6 2018/06/16 21:22:13 thorpej Exp $ */
-
-/*-
- * Copyright (c) 2012 Jared D. McNeill <jmcneill%invisible.ca@localhost>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * TI TPS65950 OMAP Power Management and System Companion Device
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tps65950.c,v 1.6 2018/06/16 21:22:13 thorpej Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/bus.h>
-#include <sys/kmem.h>
-#include <sys/sysctl.h>
-#include <sys/wdog.h>
-
-#include <dev/i2c/i2cvar.h>
-
-#include <dev/clock_subr.h>
-#include <dev/sysmon/sysmonvar.h>
-
-/* Default watchdog period, in seconds */
-#ifndef TPS65950_WDOG_DEFAULT_PERIOD
-#define TPS65950_WDOG_DEFAULT_PERIOD   30
-#endif
-
-/* I2C Bus Addressing */
-#define        TPS65950_ADDR_ID1               0x48    /* GP */
-#define TPS65950_ADDR_ID2              0x49    /* GP */
-#define TPS65950_ADDR_ID3              0x4a    /* GP */
-#define TPS65950_ADDR_ID4              0x4b    /* GP */
-#define TPS65950_ADDR_ID5              0x12    /* SmartReflex */
-
-/* ID2 */
-#define TPS65950_ID2_IDCODE_7_0                0x85
-#define TPS65950_ID2_IDCODE_15_8       0x86
-#define TPS65950_ID2_IDCODE_23_16      0x87
-#define TPS65950_ID2_IDCODE_31_24      0x88
-#define TPS65950_ID2_UNLOCK_TEST_REG   0x97
-#define TPS65950_ID2_UNLOCK_TEST_REG_MAGIC 0x49
-
-/* ID3 */
-#define TPS65950_LED_BASE              0xee
-#define        TPS65950_ID3_REG_LED            (TPS65950_LED_BASE + 0)
-#define        TPS65950_ID3_REG_LED_LEDAON     __BIT(0)
-#define        TPS65950_ID3_REG_LED_LEDBON     __BIT(1)
-#define TPS65950_ID3_REG_LED_LEDAPWM   __BIT(4)
-#define TPS65950_ID3_REG_LED_LEDBPWM   __BIT(5)
-
-/* ID4 */
-#define TPS65950_PM_RECEIVER_BASE      0x5b
-#define TPS65950_ID4_REG_WATCHDOG_CFG  (TPS65950_PM_RECEIVER_BASE + 3)
-#define TPS65950_RTC_BASE              0x1c
-#define TPS65950_ID4_REG_SECONDS_REG   (TPS65950_RTC_BASE + 0)
-#define TPS65950_ID4_REG_MINUTES_REG   (TPS65950_RTC_BASE + 1)
-#define TPS65950_ID4_REG_HOURS_REG     (TPS65950_RTC_BASE + 2)
-#define TPS65950_ID4_REG_DAYS_REG      (TPS65950_RTC_BASE + 3)
-#define TPS65950_ID4_REG_MONTHS_REG    (TPS65950_RTC_BASE + 4)
-#define TPS65950_ID4_REG_YEARS_REG     (TPS65950_RTC_BASE + 5)
-#define TPS65950_ID4_REG_WEEKS_REG     (TPS65950_RTC_BASE + 6)
-#define TPS65950_ID4_REG_RTC_CTRL_REG  (TPS65950_RTC_BASE + 13)
-#define TPS65950_ID4_REG_RTC_CTRL_REG_GET_TIME __BIT(6)
-#define TPS65950_ID4_REG_RTC_CTRL_REG_STOP_RTC __BIT(1)
-
-struct tps65950_softc {
-       device_t        sc_dev;
-       i2c_tag_t       sc_i2c;
-       i2c_addr_t      sc_addr;
-
-       struct sysctllog *sc_sysctllog;
-       struct sysmon_wdog sc_smw;
-       struct todr_chip_handle sc_todr;
-};
-
-static int     tps65950_match(device_t, cfdata_t, void *);
-static void    tps65950_attach(device_t, device_t, void *);
-
-static int     tps65950_read_1(struct tps65950_softc *, uint8_t, uint8_t *);
-static int     tps65950_write_1(struct tps65950_softc *, uint8_t, uint8_t);
-
-static void    tps65950_sysctl_attach(struct tps65950_softc *);
-
-static void    tps65950_rtc_attach(struct tps65950_softc *);
-static int     tps65950_rtc_enable(struct tps65950_softc *, bool);
-static int     tps65950_rtc_gettime(todr_chip_handle_t, struct clock_ymdhms *);
-static int     tps65950_rtc_settime(todr_chip_handle_t, struct clock_ymdhms *);
-
-static void    tps65950_wdog_attach(struct tps65950_softc *);
-static int     tps65950_wdog_setmode(struct sysmon_wdog *);
-static int     tps65950_wdog_tickle(struct sysmon_wdog *);
-
-CFATTACH_DECL_NEW(tps65950pm, sizeof(struct tps65950_softc),
-    tps65950_match, tps65950_attach, NULL, NULL);
-
-static int
-tps65950_match(device_t parent, cfdata_t match, void *aux)
-{
-       struct i2c_attach_args *ia = aux;
-
-       switch (ia->ia_addr) {
-       case TPS65950_ADDR_ID1:
-       case TPS65950_ADDR_ID2:
-       case TPS65950_ADDR_ID3:
-       case TPS65950_ADDR_ID4:
-       case TPS65950_ADDR_ID5:
-               return I2C_MATCH_ADDRESS_ONLY;
-       default:
-               return 0;
-       }
-}
-
-static void
-tps65950_attach(device_t parent, device_t self, void *aux)
-{
-       struct tps65950_softc *sc = device_private(self);
-       struct i2c_attach_args *ia = aux;
-       uint8_t buf[4];
-       uint32_t idcode;
-
-       sc->sc_dev = self;
-       sc->sc_i2c = ia->ia_tag;
-       sc->sc_addr = ia->ia_addr;
-
-       aprint_naive("\n");
-
-       switch (sc->sc_addr) {
-       case TPS65950_ADDR_ID2:
-               memset(buf, 0, sizeof(buf));
-               iic_acquire_bus(sc->sc_i2c, 0);
-               tps65950_write_1(sc, TPS65950_ID2_UNLOCK_TEST_REG,
-                   TPS65950_ID2_UNLOCK_TEST_REG_MAGIC);
-               tps65950_read_1(sc, TPS65950_ID2_IDCODE_7_0, &buf[0]);
-               tps65950_read_1(sc, TPS65950_ID2_IDCODE_15_8, &buf[1]);
-               tps65950_read_1(sc, TPS65950_ID2_IDCODE_23_16, &buf[2]);
-               tps65950_read_1(sc, TPS65950_ID2_IDCODE_31_24, &buf[3]);
-               iic_release_bus(sc->sc_i2c, 0);
-               idcode = (buf[0] << 0) | (buf[1] << 8) |
-                        (buf[2] << 16) | (buf[3] << 24);
-               aprint_normal(": IDCODE %08X\n", idcode);
-               break;
-       case TPS65950_ADDR_ID3:
-               aprint_normal(": LED\n");
-               tps65950_sysctl_attach(sc);
-               break;
-       case TPS65950_ADDR_ID4:
-               aprint_normal(": RTC, WATCHDOG\n");
-               tps65950_rtc_attach(sc);
-               tps65950_wdog_attach(sc);
-               break;
-       default:
-               aprint_normal("\n");
-               break;
-       }
-}
-
-static int
-tps65950_read_1(struct tps65950_softc *sc, uint8_t reg, uint8_t *val)
-{
-       return iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP, sc->sc_addr,
-           &reg, sizeof(reg), val, sizeof(*val), 0);
-}
-
-static int
-tps65950_write_1(struct tps65950_softc *sc, uint8_t reg, uint8_t val)
-{
-       uint8_t data[2] = { reg, val };
-       return iic_exec(sc->sc_i2c, I2C_OP_WRITE_WITH_STOP, sc->sc_addr,
-           NULL, 0, data, sizeof(data), 0);
-}
-
-static int
-tps65950_sysctl_leda(SYSCTLFN_ARGS)
-{
-       struct tps65950_softc *sc;
-       struct sysctlnode node;
-       uint8_t val;
-       u_int leda;
-       int error;
-
-       node = *rnode;
-       sc = node.sysctl_data;
-       iic_acquire_bus(sc->sc_i2c, 0);
-       error = tps65950_read_1(sc, TPS65950_ID3_REG_LED, &val);
-       iic_release_bus(sc->sc_i2c, 0);
-       if (error)
-               return error;
-       leda = (val & TPS65950_ID3_REG_LED_LEDAON) ? 1 : 0;
-       node.sysctl_data = &leda;
-       error = sysctl_lookup(SYSCTLFN_CALL(&node));
-       if (error || newp == NULL)
-               return error;
-
-       if (leda)
-               val |= (TPS65950_ID3_REG_LED_LEDAON|TPS65950_ID3_REG_LED_LEDAPWM);
-       else
-               val &= ~(TPS65950_ID3_REG_LED_LEDAON|TPS65950_ID3_REG_LED_LEDAPWM);
-
-       
-       iic_acquire_bus(sc->sc_i2c, 0);
-       error = tps65950_write_1(sc, TPS65950_ID3_REG_LED, val);
-       iic_release_bus(sc->sc_i2c, 0);
-
-       return error;
-}
-
-static int
-tps65950_sysctl_ledb(SYSCTLFN_ARGS)
-{
-       struct tps65950_softc *sc;
-       struct sysctlnode node;
-       uint8_t val;
-       u_int ledb;
-       int error;
-
-       node = *rnode;
-       sc = node.sysctl_data;
-       iic_acquire_bus(sc->sc_i2c, 0);
-       error = tps65950_read_1(sc, TPS65950_ID3_REG_LED, &val);
-       iic_release_bus(sc->sc_i2c, 0);
-       if (error)
-               return error;
-       ledb = (val & TPS65950_ID3_REG_LED_LEDBON) ? 1 : 0;
-       node.sysctl_data = &ledb;
-       error = sysctl_lookup(SYSCTLFN_CALL(&node));
-       if (error || newp == NULL)
-               return error;
-
-       if (ledb)
-               val |= (TPS65950_ID3_REG_LED_LEDBON|TPS65950_ID3_REG_LED_LEDBPWM);
-       else
-               val &= ~(TPS65950_ID3_REG_LED_LEDBON|TPS65950_ID3_REG_LED_LEDBPWM);
-
-       iic_acquire_bus(sc->sc_i2c, 0);
-       error = tps65950_write_1(sc, TPS65950_ID3_REG_LED, val);
-       iic_release_bus(sc->sc_i2c, 0);
-
-       return error;
-}
-
-static void
-tps65950_sysctl_attach(struct tps65950_softc *sc)
-{
-       struct sysctllog **log = &sc->sc_sysctllog;
-       const struct sysctlnode *rnode, *cnode;
-       int error;
-
-       error = sysctl_createv(log, 0, NULL, &rnode, CTLFLAG_PERMANENT,



Home | Main Index | Thread Index | Old Index