AHCI Add the AHCI SATA feature on MX53 platforms
Subsystems (4)
PATCH v5 1/2 AHCI Add the AHCI SATA feature on MX53 platforms
Signed-off-by Richard Zhu <[email protected]>
--- arch/arm/mach-mx5/clock-mx51-mx53.c | 11 +++++ arch/arm/mach-mx5/devices-imx53.h | 4 ++ arch/arm/plat-mxc/Makefile | 1 + arch/arm/plat-mxc/ahci_sata.c | 43 ++++++++++++++++++ arch/arm/plat-mxc/devices/Kconfig | 4 ++ arch/arm/plat-mxc/devices/Makefile | 1 + arch/arm/plat-mxc/devices/platform-ahci-imx.c | 55 +++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/ahci_sata.h | 54 ++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/devices-common.h | 10 ++++ 9 files changed, 183 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-mxc/ahci_sata.c create mode 100644 arch/arm/plat-mxc/devices/platform-ahci-imx.c create mode 100644 arch/arm/plat-mxc/include/mach/ahci_sata.h
arch/arm/mach-mx5/clock-mx51-mx53.c +11 -0
@@ -1387,6 +1387,14 @@ static struct clk esdhc4_mx53_clk = { .secondary = &esdhc4_ipg_clk, }; +static struct clk sata_clk = { + .parent = &ipg_clk, + .enable = _clk_max_enable, + .enable_reg =MXC_CCM_CCGR4 , + .enable_shift = MXC_CCM_CCGRx_CG1_OFFSET, + .disable = _clk_max_disable, +}; +DEFINE_CLOCK (mipi_esc_clk,0 ,MXC_CCM_CCGR4 , MXC_CCM_CCGRx_CG5_OFFSET,NULL ,NULL ,NULL , &pll2_sw_clk);DEFINE_CLOCK (mipi_hsc2_clk,0 ,MXC_CCM_CCGR4 , MXC_CCM_CCGRx_CG4_OFFSET,NULL ,NULL , &mipi_esc_clk, &pll2_sw_clk);DEFINE_CLOCK (mipi_hsc1_clk,0 ,MXC_CCM_CCGR4 , MXC_CCM_CCGRx_CG3_OFFSET,NULL ,NULL , &mipi_hsc2_clk, &pll2_sw_clk);
@@ -1476,6 +1484,9 @@ static struct clk_lookup mx53_lookups[] = { _REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk) _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk) + _REGISTER_CLOCK("ahci.0", NULL, sata_clk) + _REGISTER_CLOCK(NULL, "usb_phy1", usb_phy1_clk) + _REGISTER_CLOCK(NULL, "ahb", ahb_clk) };static void clk_tree_init (void )
arch/arm/mach-mx5/devices-imx53.h +4 -0
@@ -32,3 +32,7 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[];extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[];#define imx53_add_imx2_wdt (id, pdata) \ imx_add_imx2_wdt(&imx53_imx2_wdt_data[id]) + +extern const struct imx_ahci_data imx53_ahci_data__initconst ; +#define imx53_add_ahci (id, pdata) \ + imx_add_ahci(&imx53_ahci_data, pdata)
arch/arm/plat-mxc/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o +obj-$(CONFIG_IMX_HAVE_PLATFORM_AHCI) += ahci_sata.o ifdef CONFIG_SND_IMX_SOC obj-y += ssi-fiq.o obj-y += ssi-fiq-ksym.o
arch/arm/plat-mxc/ahci_sata.c new file +43 -0
43 lines not on this page · raw message
arch/arm/plat-mxc/devices/Kconfig +4 -0
@@ -76,3 +76,7 @@ config IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX config IMX_HAVE_PLATFORM_SPI_IMX bool + +config IMX_HAVE_PLATFORM_AHCI + bool + default y if ARCH_MX53
arch/arm/plat-mxc/devices/Makefile +1 -0
@@ -24,3 +24,4 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o +obj-$(CONFIG_IMX_HAVE_PLATFORM_AHCI) += platform-ahci-imx.o
arch/arm/plat-mxc/devices/platform-ahci-imx.c new file +55 -0
55 lines not on this page · raw message
arch/arm/plat-mxc/include/mach/ahci_sata.h new file +54 -0
54 lines not on this page · raw message
arch/arm/plat-mxc/include/mach/devices-common.h +10 -0
@@ -291,3 +291,13 @@ struct imx_spi_imx_data {struct platform_device *__init imx_add_spi_imx (const struct imx_spi_imx_data *data,const struct spi_imx_master *pdata); + +#include <linux/ahci_platform.h> +struct imx_ahci_data { +int id; +resource_size_t iobase; +resource_size_t irq; +}; +struct platform_device *__init imx_add_ahci ( +const struct imx_ahci_data *data, +const struct ahci_platform_data *pdata);
Signature · 1 line
1.7.1
PATCH v5 2/2 MX53 Enable the AHCI SATA on MX53 LOCO
Signed-off-by Richard Zhu <[email protected]>
--- arch/arm/mach-mx5/board-mx53_loco.c | 75 +++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 0 deletions(-)
arch/arm/mach-mx5/board-mx53_loco.c +75 -0
@@ -26,6 +26,7 @@#include <mach/common.h> #include <mach/hardware.h> #include <mach/iomux-mx53.h> +#include <mach/ahci_sata.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -39,6 +40,8 @@#define MX53_LOCO_UI2 IMX_GPIO_NR(2, 15)#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6) +static struct clk *sata_clk, *sata_ref_clk; +static iomux_v3_cfg_t mx53_loco_pads[] = {/* FEC */ MX53_PAD_FEC_MDC__FEC_MDC ,
@@ -225,6 +228,77 @@ static const struct imxi2c_platform_data mx53_loco_i2c_data __initconst = { .bitrate = 100000, }; +/* HW Initialization, if return 0, initialization is successful. */ +static int mx53_loco_sata_init (struct device *dev,void __iomem *addr) +{ +u32 tmpdata; +int ret =0 ; +struct clk *clk; + + sata_clk =clk_get (dev,NULL ); +if (IS_ERR (sata_clk)) { +dev_err (dev,"no sata clock.\n" ); +return PTR_ERR (sata_clk); + } + ret =clk_enable (sata_clk); +if (ret) { +dev_err (dev,"can't enable sata clock.\n" ); + goto put_sata_clk; + } + +/* FSL IMX AHCI SATA uses the internal usb phy1 clk on loco */ + sata_ref_clk =clk_get (NULL ,"usb_phy1" ); +if (IS_ERR (sata_ref_clk)) { +dev_err (dev,"no sata ref clock.\n" ); + ret =PTR_ERR (sata_ref_clk); + goto release_sata_clk; + } + ret =clk_enable (sata_ref_clk); +if (ret) { +dev_err (dev,"can't enable sata ref clock.\n" ); + goto put_sata_ref_clk; + } + +/* Get the AHB clock rate, and configure the TIMER1MS reg later */ + clk =clk_get (NULL ,"ahb" ); +if (IS_ERR (clk)) { +dev_err (dev,"no ahb clock.\n" ); + ret =PTR_ERR (clk); + goto release_sata_ref_clk; + } + tmpdata =clk_get_rate (clk) /1000 ; +clk_put (clk); + +sata_init (addr, tmpdata); + +return ret; + +release_sata_ref_clk: +clk_disable (sata_ref_clk); +put_sata_ref_clk: +clk_put (sata_ref_clk); +release_sata_clk: +clk_disable (sata_clk); +put_sata_clk: +clk_put (sata_clk); + +return ret; +} + +static void mx53_loco_sata_exit (struct device *dev) +{ +clk_disable (sata_ref_clk); +clk_put (sata_ref_clk); + +clk_disable (sata_clk); +clk_put (sata_clk); +} + +static struct ahci_platform_data sata_data = { + .init = mx53_loco_sata_init, + .exit = mx53_loco_sata_exit, +}; +static void __init mx53_loco_board_init (void ) { mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
@@ -238,6 +312,7 @@ static void __init mx53_loco_board_init(void)imx53_add_sdhci_esdhc_imx (0 ,NULL );imx53_add_sdhci_esdhc_imx (2 ,NULL );imx_add_gpio_keys (&loco_button_data); +imx53_add_ahci (0 , &sata_data); }static void __init mx53_loco_timer_init (void )
Signature · 1 line
1.7.1