ahci: enable ahci sata support on imx6q
v4 cover ahci: enable ahci sata support on imx6q
V4: add imx6q specific ahci sata support
Thanks for the review comments provided by Sascha, and Alexander.
- Use the private data and keep a pointer to the PHY clock.
- Don't use the global platform device variable, because that it would make the driver broken for mutiple instances.
- Don't do the "writel" with assignment.
- Other minor changes, such as print the error code when printing error message, use a u32 type to store readl results, and so on.
v3: http://www.spinics.net/lists/linux-ide/msg45688.html
- Keep arch/arm and ahci_platform driver clean.
- Add the sata_imx standalone driver contained all the specific setup
- Add the release function, support the loadable module driver.
- Tested on imx6q sd board.
v2: http://www.spinics.net/lists/linux-ide/msg45666.html
- Setup standalone imx ahci sata driver, because of the misalignments of the bits definition of the HBA register.
- Replace the node by the label in the board dts.
-
v1: http://www.spinics.net/lists/linux-ide/msg45581.html
- add imx6q specific ahci sata support to arch/arm/mach-imx/mach-imx6q.c
These patches is based on imx/dt branch of "http://git.linaro.org/git-ro/people/shawnguo/linux-2.6.git"
[v4 1/3] ARM: dtsi: enable ahci sata on imx6q platforms [v4 2/3] ARM: imx6q: update the sata bits definitions of gpr13 [v4 3/3] sata: imx: add ahci sata support on imx platforms
arch/arm/boot/dts/imx6q-sabreauto.dts | 4 + arch/arm/boot/dts/imx6q-sabrelite.dts | 4 + arch/arm/boot/dts/imx6q-sabresd.dts | 4 + arch/arm/boot/dts/imx6q.dtsi | 9 + drivers/ata/Kconfig | 9 + drivers/ata/Makefile | 1 + drivers/ata/sata_imx.c | 237 +++++++++++++++++++++++++++ include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 121 ++++++++++---- 8 files changed, 352 insertions(+), 37 deletions(-)
PATCH v4 1/3 ARM: dtsi: enable ahci sata on imx6q platforms
From: Richard Zhu <[email protected]>
Only imx6q has the ahci sata controller, enable
it on imx6q platforms.
--- arch/arm/boot/dts/imx6q-sabreauto.dts | 4 ++++ arch/arm/boot/dts/imx6q-sabrelite.dts | 4 ++++ arch/arm/boot/dts/imx6q-sabresd.dts | 4 ++++ arch/arm/boot/dts/imx6q.dtsi | 9 +++++++++ 4 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/boot/dts/imx6q-sabreauto.dts +4 -0
@@ -20,6 +20,10 @@ compatible = "fsl,imx6q-sabreauto", "fsl,imx6q"; }; +&ahci { + status = "okay"; +}; + &iomuxc { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_hog>;
arch/arm/boot/dts/imx6q-sabrelite.dts +4 -0
@@ -65,6 +65,10 @@ }; }; +&ahci { + status = "okay"; +}; + &ecspi1 { fsl,spi-num-chipselects = <1>; cs-gpios = <&gpio3 19 0>;
arch/arm/boot/dts/imx6q-sabresd.dts +4 -0
@@ -20,6 +20,10 @@ compatible = "fsl,imx6q-sabresd", "fsl,imx6q"; }; +&ahci { + status = "okay"; +}; + &iomuxc { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_hog>;
arch/arm/boot/dts/imx6q.dtsi +9 -0
@@ -424,6 +424,15 @@ }; }; + ahci: ahci@02200000 { + compatible = "fsl,imx6q-ahci"; + reg = <0x02200000 0x4000>; + interrupts = <0 39 0x04>; + clocks = <&clks 154>, <&clks 187>; + clock-names = "sata", "sata_ref"; + status = "disabled"; + }; + ipu2: ipu@02800000 { #crtc-cells = <1>; compatible = "fsl,imx6q-ipu";
Signature · 1 line
1.7.5.4
PATCH v4 2/3 ARM: imx6q: update the sata bits definitions of gpr13
In reply to Richard ZhuFrom: Richard Zhu <[email protected]>
Replace the SATA_PHY_# by the more readable definitons.
--- include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 121 ++++++++++++++++++-------- 1 files changed, 84 insertions(+), 37 deletions(-)
include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +84 -37
@@ -279,41 +279,88 @@#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29)#define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28)#define IMX6Q_GPR13_ENET_STOP_REQ BIT(27) -#define IMX6Q_GPR13_SATA_PHY_8_MASK (0x7 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_0_5_DB (0x0 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_1_0_DB (0x1 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_1_5_DB (0x2 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_2_0_DB (0x3 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_2_5_DB (0x4 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_3_0_DB (0x5 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_3_5_DB (0x6 << 24) -#define IMX6Q_GPR13_SATA_PHY_8_4_0_DB (0x7 << 24) -#define IMX6Q_GPR13_SATA_PHY_7_MASK (0x1f << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA1I (0x10 << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA1M (0x10 << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA1X (0x1a << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA2I (0x12 << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA2M (0x12 << 19) -#define IMX6Q_GPR13_SATA_PHY_7_SATA2X (0x1a << 19) -#define IMX6Q_GPR13_SATA_PHY_6_MASK (0x7 << 16) -#define IMX6Q_GPR13_SATA_SPEED_MASK BIT(15) -#define IMX6Q_GPR13_SATA_SPEED_1P5G 0x0 -#define IMX6Q_GPR13_SATA_SPEED_3P0G BIT(15) -#define IMX6Q_GPR13_SATA_PHY_5 BIT(14) -#define IMX6Q_GPR13_SATA_PHY_4_MASK (0x7 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_16_16 (0x0 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_14_16 (0x1 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_12_16 (0x2 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_10_16 (0x3 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_9_16 (0x4 << 11) -#define IMX6Q_GPR13_SATA_PHY_4_8_16 (0x5 << 11) -#define IMX6Q_GPR13_SATA_PHY_3_MASK (0xf << 7) -#define IMX6Q_GPR13_SATA_PHY_3_OFF 0x7 -#define IMX6Q_GPR13_SATA_PHY_2_MASK (0x1f << 2) -#define IMX6Q_GPR13_SATA_PHY_2_OFF 0x2 -#define IMX6Q_GPR13_SATA_PHY_1_MASK (0x3 << 0) -#define IMX6Q_GPR13_SATA_PHY_1_FAST (0x0 << 0) -#define IMX6Q_GPR13_SATA_PHY_1_MED (0x1 << 0) -#define IMX6Q_GPR13_SATA_PHY_1_SLOW (0x2 << 0) - +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK (0x7 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_0_5_DB (0x0 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_0_DB (0x1 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_5_DB (0x2 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_0_DB (0x3 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_5_DB (0x4 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB (0x5 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_5_DB (0x6 << 24) +#define IMX6Q_GPR13_SATA_RX_EQ_VAL_4_0_DB (0x7 << 24) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK (0x1f << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1I (0x10 << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1M (0x10 << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1X (0x1a << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2I (0x12 << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M (0x12 << 19) +#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2X (0x1a << 19) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK (0x7 << 16) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_1F (0x0 << 16) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_2F (0x1 << 16) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_4F (0x2 << 16) +#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F (0x3 << 16) +#define IMX6Q_GPR13_SATA_SPD_MODE_MASK BIT(15) +#define IMX6Q_GPR13_SATA_SPD_MODE_1P5G 0x0 +#define IMX6Q_GPR13_SATA_SPD_MODE_3P0G BIT(15) +#define IMX6Q_GPR13_SATA_MPLL_SS_EN BIT(14) +#define IMX6Q_GPR13_SATA_TX_ATTEN_MASK (0x7 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_16_16 (0x0 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_14_16 (0x1 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_12_16 (0x2 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_10_16 (0x3 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_9_16 (0x4 << 11) +#define IMX6Q_GPR13_SATA_TX_ATTEN_8_16 (0x5 << 11) +#define IMX6Q_GPR13_SATA_TX_BOOST_MASK (0xf << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_0_00_DB (0x0 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_0_37_DB (0x1 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_0_74_DB (0x2 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_1_11_DB (0x3 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_1_48_DB (0x4 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_1_85_DB (0x5 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_2_22_DB (0x6 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_2_59_DB (0x7 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_2_96_DB (0x8 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB (0x9 << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_3_70_DB (0xa << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_4_07_DB (0xb << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_4_44_DB (0xc << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_4_81_DB (0xd << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_5_28_DB (0xe << 7) +#define IMX6Q_GPR13_SATA_TX_BOOST_5_75_DB (0xf << 7) +#define IMX6Q_GPR13_SATA_TX_LVL_MASK (0x1f << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_937_V (0x00 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_947_V (0x01 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_957_V (0x02 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_966_V (0x03 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_976_V (0x04 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_986_V (0x05 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_0_996_V (0x06 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_005_V (0x07 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_015_V (0x08 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_025_V (0x09 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_035_V (0x0a << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_045_V (0x0b << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_054_V (0x0c << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_064_V (0x0d << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_074_V (0x0e << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_084_V (0x0f << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_094_V (0x10 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_104_V (0x11 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_113_V (0x12 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_123_V (0x13 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_133_V (0x14 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_143_V (0x15 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_152_V (0x16 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_162_V (0x17 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_172_V (0x18 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_182_V (0x19 << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_191_V (0x1a << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_201_V (0x1b << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_211_V (0x1c << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_221_V (0x1d << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_230_V (0x1e << 2) +#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2) +#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1) +#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0)#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
Signature · 1 line
1.7.5.4
PATCH v4 3/3 sata: imx: add ahci sata support on imx platforms
In reply to Richard ZhuFrom: Richard Zhu <[email protected]>
imx6q contains one Synopsys AHCI SATA controller, But it can't shares ahci_platform driver with other controllers.
Because there are some misalignments of the generic AHCI controller.
The bits definitions of the HBA registers, the Vendor Specific registers, and the AHCI PHY clock.
- CAP_SSS(bit20) of the HOST_CAP is writable, default value is '0', should be configured to be '1'
- bit0 (only one AHCI SATA port on imx6q) of the HOST_PORTS_IMPL should be set to be '1'.(default 0)
- One Vendor Specific register HOST_TIMER1MS(offset:0xe0) should be configured regarding to the frequency of AHB bus clock.
- Configurations of the AHCI PHY clock, and the signal parameters of the GPR13
Setup its own ahci sata driver, contained the imx6q specific initialized codes, and re-use the generic ahci_platform drier,
--- drivers/ata/Kconfig | 9 ++ drivers/ata/Makefile | 1 + drivers/ata/sata_imx.c | 237 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 247 insertions(+), 0 deletions(-) create mode 100644 drivers/ata/sata_imx.c
drivers/ata/Kconfig +9 -0
@@ -97,6 +97,15 @@ config SATA_AHCI_PLATFORM If unsure, say N. +config SATA_IMX + tristate "Freescale i.MX AHCI SATA support" + depends on SATA_AHCI_PLATFORM + help + This option enables support for the Freescale i.MX SoC's + onboard AHCI SATA. + + If unsure, say N. + config SATA_FSL tristate "Freescale 3.0Gbps SATA support" depends on FSL_SOC
drivers/ata/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o obj-$(CONFIG_SATA_SIL24) += sata_sil24.o obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o obj-$(CONFIG_SATA_HIGHBANK) += sata_highbank.o libahci.o +obj-$(CONFIG_SATA_IMX) += sata_imx.o # SFF w/ custom DMA obj-$(CONFIG_PDC_ADMA) += pdc_adma.o
drivers/ata/sata_imx.c new file +237 -0
237 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Sascha Hauer
maintainerPATCH v4 3/3 sata: imx: add ahci sata support on imx platforms
Quoted 30 lines · Richard Zhu
From: Richard Zhu <[email protected]>
imx6q contains one Synopsys AHCI SATA controller, But it can't shares
ahci_platformdriver with other controllers.
Because there are some misalignments of the generic AHCI controller.
The bits definitions of the HBA registers, the Vendor Specific registers, and the AHCI PHY clock.
-CAP_SSS(bit20)of theHOST_CAPis writable, default value is '0', should be configured to be '1'
- bit0 (only one AHCI SATA port on imx6q) of theHOST_PORTS_IMPLshould be set to be '1'.(default 0)
- One Vendor Specific registerHOST_TIMER1MS(offset:0xe0)should be configured regarding to the frequency of AHB bus clock.
- Configurations of the AHCI PHY clock, and the signal parameters of the GPR13Setup its own ahci sata driver, contained the imx6q specific initialized codes, and re-use the generic
ahci_platformdrier,Signed-off-by Richard Zhu <[email protected]>--- drivers/ata/Kconfig | 9 ++ drivers/ata/Makefile | 1 + drivers/ata/sata_imx.c | 237 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 247 insertions(+), 0 deletions(-) create mode 100644 drivers/ata/sata_imx.c
[...]
drivers/ata/sata_imx.c line 47
Quoted 9 lines
drivers/ata/sata_imx.c new file +9
-0+ +/* imx6q ahci module initialization. */ +static int imx6q_sata_init (struct device *dev,void __iomem *mmio) +{ +int ret =0 ; +unsigned int rc; +struct regmap *gpr; +struct clk *ahb_clk; +struct imx_ahci_priv *imxpriv = (struct imx_ahci_priv *)dev->p;
Just because a pointer points to valid memory doesn't mean that it's free to use for your purposes. If you look closer maybe you realize that the imxpriv pointer you use here is another one than the one you allocate below in your probe function.
I give up here. Maybe I'll write a driver for this when I find time for it.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH v4 3/3 sata: imx: add ahci sata support on imx platforms
Hi Sascha:
Sorry to make a mess on the usage of the private data.
The private data of "imx_ahci_pdev" platform device would be used to store ata_host point. I shouldn't set imxpriv to the private data of "imx_ahci_pdev", so do the wrong assignment of The private pointer of device.
Best Regards
Richard Zhu
-----Original Message-----
From: Sascha Hauer [mailto:[email protected]]
Sent: Thursday, July 11, 2013 5:04 AM
To: Richard Zhu
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Zhu Richard-R65037
Subject: Re: [v4 3/3] sata: imx: add ahci sata support on imx platforms
Quoted 28 lines · Richard Zhu
From: Richard Zhu <[email protected]>
imx6q contains one Synopsys AHCI SATA controller, But it can't shares
ahci_platformdriver with other controllers.
Because there are some misalignments of the generic AHCI controller. The bits definitions of the HBA registers, the Vendor Specific registers, and the AHCI PHY clock.
-CAP_SSS(bit20)of theHOST_CAPis writable, default value is '0',
should be configured to be '1'
- bit0 (only one AHCI SATA port on imx6q) of theHOST_PORTS_IMPL
should be set to be '1'.(default 0)
- One Vendor Specific registerHOST_TIMER1MS(offset:0xe0)should be
configured regarding to the frequency of AHB bus clock.
- Configurations of the AHCI PHY clock, and the signal parameters of
the GPR13Setup its own ahci sata driver, contained the imx6q specific initialized codes, and re-use the generic
ahci_platformdrier,Signed-off-by Richard Zhu <[email protected]>--- drivers/ata/Kconfig | 9 ++ drivers/ata/Makefile | 1 + drivers/ata/sata_imx.c | 237 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 247 insertions(+), 0 deletions(-) create mode100644
drivers/ata/sata_imx.c
[...]
drivers/ata/sata_imx.c line 47
Quoted 8 lines
drivers/ata/sata_imx.c new file +8
-0+ +/* imx6q ahci module initialization. */ static int +imx6q_sata_init (struct device *dev,void __iomem *mmio) { +int ret =0 ; +unsigned int rc; +struct regmap *gpr; +struct clk *ahb_clk; +struct imx_ahci_priv *imxpriv = (struct imx_ahci_priv *)dev->p;
Just because a pointer points to valid memory doesn't mean that it's free to use for your purposes. If you look closer maybe you realize that the imxpriv pointer you use here is another one than the one you allocate below in your probe function.
I give up here. Maybe I'll write a driver for this when I find time for it.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Sascha Hauer
maintainerPATCH v4 3/3 sata: imx: add ahci sata support on imx platforms
Hi Richard,
Quoted 5 lines · On Thu, Jul 11, 2013 at 07:50:50AM +0000, Zhu Richard-R65037 wrote:
Hi Sascha:
Sorry to make a mess on the usage of the private data.
The private data of "imx_ahci_pdev" platform device would be used to storeata_hostpoint. I shouldn't set imxpriv to the private data of "imx_ahci_pdev", so do the wrong assignment of The private pointer of device.
Please allocate your private data along with the platform_device in the probe function, then in the init callback you can use container_of() to get a pointer to the data.
Also I would recommend you to request the necessary resources (clocks, regmap) in the probe function and not in the init callback.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH v4 3/3 sata: imx: add ahci sata support on imx platforms
Hi Sascha:
Thanks for your comments.
Yes, it is.
That's is what I done in the V5 patch-set. The patch-set is almost done, would send out a moment later.
Best Regards
Richard Zhu
-----Original Message-----
From: Sascha Hauer [mailto:[email protected]]
Sent: Thursday, July 11, 2013 3:56 PM
To: Zhu Richard-R65037
Cc: Richard Zhu; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [v4 3/3] sata: imx: add ahci sata support on imx platforms
Hi Richard,
Quoted 5 lines · On Thu, Jul 11, 2013 at 07:50:50AM +0000, Zhu Richard-R65037 wrote:
Hi Sascha:
Sorry to make a mess on the usage of the private data.
The private data of "imx_ahci_pdev" platform device would be used to storeata_hostpoint. I shouldn't set imxpriv to the private data of "imx_ahci_pdev", so do
the wrong assignment of The private pointer of device.
Please allocate your private data along with the platform_device in the probe function, then in the init callback you can use container_of() to get a pointer to the data. Also I would recommend you to request the necessary resources (clocks,
regmap) in the probe function and not in the init callback.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |