diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-04-02 16:18:46 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-04-02 16:18:46 +0000 |
commit | 23cac077bd18bf6f9c16566a152e18184084b831 (patch) | |
tree | fb170889b00eaecd73d16256eb465228ed2e0603 | |
parent | b954e740f60b47a08429b6a02d11d17f31ebd3cb (diff) |
Have imxahci(4) make use of the clock framework by implementing the sata
and sata ref clock in imxccm(4).
-rw-r--r-- | sys/arch/armv7/imx/imxahci.c | 6 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxccm.c | 13 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxccm_clocks.h | 4 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxccmvar.h | 3 |
4 files changed, 14 insertions, 12 deletions
diff --git a/sys/arch/armv7/imx/imxahci.c b/sys/arch/armv7/imx/imxahci.c index 460880c1b80..98cc2681838 100644 --- a/sys/arch/armv7/imx/imxahci.c +++ b/sys/arch/armv7/imx/imxahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxahci.c,v 1.9 2018/04/01 19:07:31 patrick Exp $ */ +/* $OpenBSD: imxahci.c,v 1.10 2018/04/02 16:18:45 patrick Exp $ */ /* * Copyright (c) 2013 Patrick Wildt <patrick@blueri.se> * @@ -29,7 +29,6 @@ #include <dev/ic/ahcireg.h> #include <dev/ic/ahcivar.h> -#include <armv7/imx/imxccmvar.h> #include <armv7/imx/imxiomuxcvar.h> #include <dev/ofw/openfirm.h> @@ -134,7 +133,8 @@ imxahci_attach(struct device *parent, struct device *self, void *aux) } /* power it up */ - imxccm_enable_sata(); + clock_enable(faa->fa_node, "sata_ref"); + clock_enable(faa->fa_node, "sata"); delay(100); /* power phy up */ diff --git a/sys/arch/armv7/imx/imxccm.c b/sys/arch/armv7/imx/imxccm.c index 973089b5259..edc3f02862b 100644 --- a/sys/arch/armv7/imx/imxccm.c +++ b/sys/arch/armv7/imx/imxccm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxccm.c,v 1.16 2018/04/02 16:03:50 patrick Exp $ */ +/* $OpenBSD: imxccm.c,v 1.17 2018/04/02 16:18:45 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> * @@ -243,7 +243,7 @@ void imxccm_enable_pll_usb1(struct imxccm_softc *); void imxccm_enable_pll_usb2(struct imxccm_softc *); void imxccm_enable_pll_enet(void); void imxccm_enable_enet(void); -void imxccm_enable_sata(void); +void imxccm_enable_sata(struct imxccm_softc *); int imxccm_match(struct device *parent, void *match, void *aux) @@ -491,6 +491,9 @@ imxccm_enable(void *cookie, uint32_t *cells, int on) case IMX6_CLK_USBPHY2: imxccm_enable_pll_usb2(sc); return; + case IMX6_CLK_SATA_REF_100: + imxccm_enable_sata(sc); + return; default: break; } @@ -593,14 +596,10 @@ imxccm_enable_enet(void) } void -imxccm_enable_sata(void) +imxccm_enable_sata(struct imxccm_softc *sc) { - struct imxccm_softc *sc = imxccm_sc; - imxccm_enable_pll_enet(); HWRITE4(sc, CCM_ANALOG_PLL_ENET_SET, CCM_ANALOG_PLL_ENET_100M_SATA); - - HSET4(sc, CCM_CCGR5, CCM_CCGR5_100M_SATA); } void diff --git a/sys/arch/armv7/imx/imxccm_clocks.h b/sys/arch/armv7/imx/imxccm_clocks.h index d4cd3ed6c06..aed158d1524 100644 --- a/sys/arch/armv7/imx/imxccm_clocks.h +++ b/sys/arch/armv7/imx/imxccm_clocks.h @@ -12,6 +12,7 @@ #define IMX6_CLK_I2C1 0x7d #define IMX6_CLK_I2C2 0x7e #define IMX6_CLK_I2C3 0x7f +#define IMX6_CLK_SATA 0x9a #define IMX6_CLK_UART_IPG 0xa0 #define IMX6_CLK_UART_SERIAL 0xa1 #define IMX6_CLK_USBOH3 0xa2 @@ -21,12 +22,15 @@ #define IMX6_CLK_USDHC4 0xa6 #define IMX6_CLK_USBPHY1 0xb6 #define IMX6_CLK_USBPHY2 0xb7 +#define IMX6_CLK_SATA_REF 0xba +#define IMX6_CLK_SATA_REF_100 0xbb struct imxccm_gate imx6_gates[] = { [IMX6_CLK_ENET] = { CCM_CCGR1, 5, IMX6_CLK_IPG }, [IMX6_CLK_I2C1] = { CCM_CCGR2, 3, IMX6_CLK_IPG_PER }, [IMX6_CLK_I2C2] = { CCM_CCGR2, 4, IMX6_CLK_IPG_PER }, [IMX6_CLK_I2C3] = { CCM_CCGR2, 5, IMX6_CLK_IPG_PER }, + [IMX6_CLK_SATA] = { CCM_CCGR5, 2 }, [IMX6_CLK_UART_IPG] = { CCM_CCGR5, 12, IMX6_CLK_IPG }, [IMX6_CLK_UART_SERIAL] = { CCM_CCGR5, 13 }, [IMX6_CLK_USBOH3] = { CCM_CCGR6, 0 }, diff --git a/sys/arch/armv7/imx/imxccmvar.h b/sys/arch/armv7/imx/imxccmvar.h index 2ae01097fc1..443ddd63818 100644 --- a/sys/arch/armv7/imx/imxccmvar.h +++ b/sys/arch/armv7/imx/imxccmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: imxccmvar.h,v 1.8 2018/04/02 16:03:50 patrick Exp $ */ +/* $OpenBSD: imxccmvar.h,v 1.9 2018/04/02 16:18:45 patrick Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se> * @@ -19,6 +19,5 @@ #define IMXCCMVAR_H void imxccm_enable_enet(void); -void imxccm_enable_sata(void); #endif /* IMXCCMVAR_H */ |