|
|
Re: [PATCH 3/3] mtd: gpmi: change the code for clocks |
于 2012年06月29日 10:06, Shawn Guo 写道:
gpmi_regs + HW_GPMI_TIMING1);> > /* Get the timing information we need. */> - nfc->clock_frequency_in_hz = clk_get_rate(r->clock); > + nfc->clock_frequency_in_hz = clk_get_rate(r->clock[0]); > clock_period_in_ns = 1000000000 / nfc->clock_frequency_in_hz;> > gpmi_nfc_compute_hardware_timing(this,&hw);> @@ -784,8 +812,7 @@ err_out:> > void gpmi_end(struct gpmi_nand_data *this)> { > - struct resources *r =&this->resources; > - clk_disable_unprepare(r->clock); > + gpmi_disable_clk(this); > }> > /* Clears a BCH interrupt. */> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > index 941cfb7..edda3b1 100644 > --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > @@ -464,9 +464,59 @@ acquire_err: > return -EINVAL; > }> > +static void gpmi_put_clks(struct gpmi_nand_data *this)> +{ > + struct resources *r =&this->resources; > + struct clk *clk; > + int i; > + > + for (i = 0; i< GPMI_CLK_MAX; i++) { > + clk = r->clock[i]; > + if (clk) { > + clk_put(clk); > + r->clock[i] = NULL; > + } > + } > +} > + > +static char *extra_clks_for_mx6q[] = { > + "gpmi_apb", "gpmi_bch", "gpmi_bch_apb", "per1_bch", > +}; > + > +static int __devinit gpmi_get_clks(struct gpmi_nand_data *this) > +{ > + struct resources *r =&this->resources; > + char **extra_clks = NULL; > + struct clk *clk; > + int i; > + > + r->clock[0] = clk_get(&this->pdev->dev, NULL); > + if (IS_ERR(r->clock[0])) > + goto err_clock; > + > + /* Get extra clocks */ > + if (GPMI_IS_MX6Q(this)) > + extra_clks = extra_clks_for_mx6q;We probably do not need this tweaking. We can have the driver always take all those 5 clocks, and I think the current imx28 clock driver can just work with it, because the gpmi-nand clkdev lookup has NULL con_id and all those 5 clocks can match the same one on imx28.
I think your method makes the code hard to understand. My code is more clear in logic. thanks Huang Shijie _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[Linux ARM (vger)] [Linux ARM MSM] [Linux Omap] [Linux Arm] [Linux Tegra] [Fedora ARM] [eCos] [Linux Fastboot] [Gcc Help] [Git] [DCCP] [IETF Announce] [Security] [PDAs] [Linux] [Linux MIPS] [Yosemite Campsites] [Photos]
![]() |
![]() |