* [PATCH 3/3] palm_bk3710: factor out cable detection
@ 2008-02-07 14:42 Bartlomiej Zolnierkiewicz
2008-02-07 14:41 ` Sergei Shtylyov
0 siblings, 1 reply; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-07 14:42 UTC (permalink / raw)
To: linux-ide; +Cc: linux-kernel, Anton Salnikov
Factor out cable detection to palm_bk3710_cable_detect().
Cc: Anton Salnikov <asalnikov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/arm/palm_bk3710.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Index: b/drivers/ide/arm/palm_bk3710.c
===================================================================
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -311,6 +311,12 @@ static void __devinit palm_bk3710_chipin
palm_bk3710_setpiomode(base, NULL, 0, 600, 0);
palm_bk3710_setpiomode(base, NULL, 1, 600, 0);
}
+
+static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif)
+{
+ return ATA_CBL_PATA80;
+}
+
static int __devinit palm_bk3710_probe(struct platform_device *pdev)
{
struct clk *clkp;
@@ -381,7 +387,7 @@ static int __devinit palm_bk3710_probe(s
hwif->set_dma_mode = &palm_bk3710_set_dma_mode;
hwif->mmio = 1;
default_hwif_mmiops(hwif);
- hwif->cbl = ATA_CBL_PATA80;
+ hwif->cbl = palm_bk3710_cable_detect(hwif);
hwif->ultra_mask = 0x1f; /* Ultra DMA Mode 4 Max
(input clk 99MHz) */
hwif->mwdma_mask = 0x7;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 3/3] palm_bk3710: factor out cable detection 2008-02-07 14:42 [PATCH 3/3] palm_bk3710: factor out cable detection Bartlomiej Zolnierkiewicz @ 2008-02-07 14:41 ` Sergei Shtylyov 2008-02-07 16:14 ` Bartlomiej Zolnierkiewicz 0 siblings, 1 reply; 5+ messages in thread From: Sergei Shtylyov @ 2008-02-07 14:41 UTC (permalink / raw) To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel, Anton Salnikov Bartlomiej Zolnierkiewicz wrote: > Factor out cable detection to palm_bk3710_cable_detect(). > Cc: Anton Salnikov <asalnikov@ru.mvista.com> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> > Index: b/drivers/ide/arm/palm_bk3710.c > =================================================================== > --- a/drivers/ide/arm/palm_bk3710.c > +++ b/drivers/ide/arm/palm_bk3710.c > @@ -311,6 +311,12 @@ static void __devinit palm_bk3710_chipin > palm_bk3710_setpiomode(base, NULL, 0, 600, 0); > palm_bk3710_setpiomode(base, NULL, 1, 600, 0); > } > + > +static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif) > +{ > + return ATA_CBL_PATA80; > +} > + > static int __devinit palm_bk3710_probe(struct platform_device *pdev) > { > struct clk *clkp; > @@ -381,7 +387,7 @@ static int __devinit palm_bk3710_probe(s > hwif->set_dma_mode = &palm_bk3710_set_dma_mode; > hwif->mmio = 1; > default_hwif_mmiops(hwif); > - hwif->cbl = ATA_CBL_PATA80; > + hwif->cbl = palm_bk3710_cable_detect(hwif); > hwif->ultra_mask = 0x1f; /* Ultra DMA Mode 4 Max > (input clk 99MHz) */ > hwif->mwdma_mask = 0x7; Hm, how does it help if you don't make it into driver's method? :-O MBR, Sergei ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] palm_bk3710: factor out cable detection 2008-02-07 14:41 ` Sergei Shtylyov @ 2008-02-07 16:14 ` Bartlomiej Zolnierkiewicz 2008-02-07 20:51 ` Bartlomiej Zolnierkiewicz 0 siblings, 1 reply; 5+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2008-02-07 16:14 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: linux-ide, linux-kernel, Anton Salnikov On Feb 7, 2008 3:41 PM, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote: > Bartlomiej Zolnierkiewicz wrote: > > > Factor out cable detection to palm_bk3710_cable_detect(). > > > Cc: Anton Salnikov <asalnikov@ru.mvista.com> > > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> > > > Index: b/drivers/ide/arm/palm_bk3710.c > > =================================================================== > > --- a/drivers/ide/arm/palm_bk3710.c > > +++ b/drivers/ide/arm/palm_bk3710.c > > @@ -311,6 +311,12 @@ static void __devinit palm_bk3710_chipin > > palm_bk3710_setpiomode(base, NULL, 0, 600, 0); > > palm_bk3710_setpiomode(base, NULL, 1, 600, 0); > > } > > + > > +static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif) > > +{ > > + return ATA_CBL_PATA80; > > +} > > + > > static int __devinit palm_bk3710_probe(struct platform_device *pdev) > > { > > struct clk *clkp; > > @@ -381,7 +387,7 @@ static int __devinit palm_bk3710_probe(s > > hwif->set_dma_mode = &palm_bk3710_set_dma_mode; > > hwif->mmio = 1; > > default_hwif_mmiops(hwif); > > - hwif->cbl = ATA_CBL_PATA80; > > + hwif->cbl = palm_bk3710_cable_detect(hwif); > > hwif->ultra_mask = 0x1f; /* Ultra DMA Mode 4 Max > > (input clk 99MHz) */ > > hwif->mwdma_mask = 0x7; > > Hm, how does it help if you don't make it into driver's method? :-O This was meant to be a preparation before converting palm_bk3710 to use struct ide_port_info. On the second thought this change may be as well integrated into the future patch (which I'll try to cook later today, unless somebody beats me to it ;-). Thanks, Bart ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] palm_bk3710: factor out cable detection 2008-02-07 16:14 ` Bartlomiej Zolnierkiewicz @ 2008-02-07 20:51 ` Bartlomiej Zolnierkiewicz 2008-02-08 17:34 ` Sergei Shtylyov 0 siblings, 1 reply; 5+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2008-02-07 20:51 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: linux-ide, linux-kernel, Anton Salnikov On Thursday 07 February 2008, Bartlomiej Zolnierkiewicz wrote: > On Feb 7, 2008 3:41 PM, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote: > > Bartlomiej Zolnierkiewicz wrote: > > > > > Factor out cable detection to palm_bk3710_cable_detect(). > > > > > Cc: Anton Salnikov <asalnikov@ru.mvista.com> > > > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> > > > > > Index: b/drivers/ide/arm/palm_bk3710.c > > > =================================================================== > > > --- a/drivers/ide/arm/palm_bk3710.c > > > +++ b/drivers/ide/arm/palm_bk3710.c > > > @@ -311,6 +311,12 @@ static void __devinit palm_bk3710_chipin > > > palm_bk3710_setpiomode(base, NULL, 0, 600, 0); > > > palm_bk3710_setpiomode(base, NULL, 1, 600, 0); > > > } > > > + > > > +static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif) > > > +{ > > > + return ATA_CBL_PATA80; > > > +} > > > + > > > static int __devinit palm_bk3710_probe(struct platform_device *pdev) > > > { > > > struct clk *clkp; > > > @@ -381,7 +387,7 @@ static int __devinit palm_bk3710_probe(s > > > hwif->set_dma_mode = &palm_bk3710_set_dma_mode; > > > hwif->mmio = 1; > > > default_hwif_mmiops(hwif); > > > - hwif->cbl = ATA_CBL_PATA80; > > > + hwif->cbl = palm_bk3710_cable_detect(hwif); > > > hwif->ultra_mask = 0x1f; /* Ultra DMA Mode 4 Max > > > (input clk 99MHz) */ > > > hwif->mwdma_mask = 0x7; > > > > Hm, how does it help if you don't make it into driver's method? :-O > > This was meant to be a preparation before converting palm_bk3710 to > use struct ide_port_info. On the second thought this change may be as > well integrated into the future patch (which I'll try to cook later > today, unless somebody beats me to it ;-). From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Subject: [PATCH] palm_bk3710: use struct ide_port_info * Factor out cable detection to palm_bk3710_cable_detect(). * Add palm_bk3710_init_hwif() (->init_hwif method implementation). * Remove needless ->quirkproc initialization. * Add missing ->pio_mask initialization. * Use ATA_* defines for setting ->{ultra,mwdma}_mask. * Add 'struct ide_port_info palm_bk3710_port_info' and pass it to ide_device_add(). Then remove open-coded 'hwif' initialization. Cc: Anton Salnikov <asalnikov@ru.mvista.com> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> --- drivers/ide/arm/palm_bk3710.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) Index: b/drivers/ide/arm/palm_bk3710.c =================================================================== --- a/drivers/ide/arm/palm_bk3710.c +++ b/drivers/ide/arm/palm_bk3710.c @@ -311,6 +311,28 @@ static void __devinit palm_bk3710_chipin palm_bk3710_setpiomode(base, NULL, 0, 600, 0); palm_bk3710_setpiomode(base, NULL, 1, 600, 0); } + +static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif) +{ + return ATA_CBL_PATA80; +} + +static void __devinit palm_bk3710_init_hwif(ide_hwif_t *hwif) +{ + hwif->set_pio_mode = palm_bk3710_set_pio_mode; + hwif->set_dma_mode = palm_bk3710_set_dma_mode; + + hwif->cable_detect = palm_bk3710_cable_detect; +} + +static const struct ide_port_info __devinitdata palm_bk3710_port_info = { + .init_hwif = palm_bk3710_init_hwif, + .host_flags = IDE_HFLAG_NO_DMA, /* hack (no PCI) */ + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA4, /* (input clk 99MHz) */ + .mwdma_mask = ATA_MWDMA2, +}; + static int __devinit palm_bk3710_probe(struct platform_device *pdev) { struct clk *clkp; @@ -368,24 +390,15 @@ static int __devinit palm_bk3710_probe(s ide_init_port_data(hwif, i); ide_init_port_hw(hwif, &hw); - hwif->quirkproc = NULL; - hwif->set_pio_mode = &palm_bk3710_set_pio_mode; - hwif->set_dma_mode = &palm_bk3710_set_dma_mode; hwif->mmio = 1; default_hwif_mmiops(hwif); - hwif->cbl = ATA_CBL_PATA80; - hwif->ultra_mask = 0x1f; /* Ultra DMA Mode 4 Max - (input clk 99MHz) */ - hwif->mwdma_mask = 0x7; - hwif->drives[0].autotune = 1; - hwif->drives[1].autotune = 1; ide_setup_dma(hwif, mem->start); idx[0] = i; - ide_device_add(idx, NULL); + ide_device_add(idx, &palm_bk3710_port_info); if (!hwif->present) goto out; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] palm_bk3710: factor out cable detection 2008-02-07 20:51 ` Bartlomiej Zolnierkiewicz @ 2008-02-08 17:34 ` Sergei Shtylyov 0 siblings, 0 replies; 5+ messages in thread From: Sergei Shtylyov @ 2008-02-08 17:34 UTC (permalink / raw) To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel, Anton Salnikov Bartlomiej Zolnierkiewicz wrote: > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> > Subject: [PATCH] palm_bk3710: use struct ide_port_info > * Factor out cable detection to palm_bk3710_cable_detect(). > * Add palm_bk3710_init_hwif() (->init_hwif method implementation). > * Remove needless ->quirkproc initialization. > * Add missing ->pio_mask initialization. > * Use ATA_* defines for setting ->{ultra,mwdma}_mask. > * Add 'struct ide_port_info palm_bk3710_port_info' and pass it to > ide_device_add(). Then remove open-coded 'hwif' initialization. > Cc: Anton Salnikov <asalnikov@ru.mvista.com> > Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> MBR, Sergei ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-08 17:33 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-02-07 14:42 [PATCH 3/3] palm_bk3710: factor out cable detection Bartlomiej Zolnierkiewicz 2008-02-07 14:41 ` Sergei Shtylyov 2008-02-07 16:14 ` Bartlomiej Zolnierkiewicz 2008-02-07 20:51 ` Bartlomiej Zolnierkiewicz 2008-02-08 17:34 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).