Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sata, highbank: send extra clock cycles in SGPIO patterns

Some SGPIO PICs don't follow the standard very well and expect a certain
number of clock cycles or port frames in each SGPIO pattern. Add two
optional parameters in the DTB that can provide the number of extra
clock cycles to be sent before and after SGPIO pattern. Read those
parameters from the DTB and send the extra clock cycles.

Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Mark Langsdorf and committed by
Tejun Heo
2b79c56f b2e4c7b9

+19
+6
Documentation/devicetree/bindings/ata/sata_highbank.txt
··· 23 23 - calxeda,tx-atten : a u32 array that contains TX attenuation override 24 24 codes, one per port. The upper 3 bytes are always 25 25 0 and thus ignored. 26 + - calxeda,pre-clocks : a u32 that indicates the number of additional clock 27 + cycles to transmit before sending an SGPIO pattern 28 + - calxeda,post-clocks: a u32 that indicates the number of additional clock 29 + cycles to transmit after sending an SGPIO pattern 26 30 27 31 Example: 28 32 sata@ffe08000 { ··· 39 35 calxeda,sgpio-gpio =<&gpioh 5 1 &gpioh 6 1 &gpioh 7 1>; 40 36 calxeda,led-order = <4 0 1 2 3>; 41 37 calxeda,tx-atten = <0xff 22 0xff 0xff 23>; 38 + calxeda,pre-clocks = <10>; 39 + calxeda,post-clocks = <0>; 42 40 };
+13
drivers/ata/sata_highbank.c
··· 84 84 85 85 struct ecx_plat_data { 86 86 u32 n_ports; 87 + /* number of extra clocks that the SGPIO PIC controller expects */ 88 + u32 pre_clocks; 89 + u32 post_clocks; 87 90 unsigned sgpio_gpio[SGPIO_PINS]; 88 91 u32 sgpio_pattern; 89 92 u32 port_to_sgpio[SGPIO_PORTS]; ··· 163 160 spin_lock_irqsave(&sgpio_lock, flags); 164 161 ecx_parse_sgpio(pdata, ap->port_no, state); 165 162 sgpio_out = pdata->sgpio_pattern; 163 + for (i = 0; i < pdata->pre_clocks; i++) 164 + ecx_led_cycle_clock(pdata); 165 + 166 166 gpio_set_value(pdata->sgpio_gpio[SLOAD], 1); 167 167 ecx_led_cycle_clock(pdata); 168 168 gpio_set_value(pdata->sgpio_gpio[SLOAD], 0); ··· 178 172 sgpio_out >>= 1; 179 173 ecx_led_cycle_clock(pdata); 180 174 } 175 + for (i = 0; i < pdata->post_clocks; i++) 176 + ecx_led_cycle_clock(pdata); 181 177 182 178 /* save off new led state for port/slot */ 183 179 emp->led_state = state; ··· 214 206 of_property_read_u32_array(np, "calxeda,led-order", 215 207 pdata->port_to_sgpio, 216 208 pdata->n_ports); 209 + if (of_property_read_u32(np, "calxeda,pre-clocks", &pdata->pre_clocks)) 210 + pdata->pre_clocks = 0; 211 + if (of_property_read_u32(np, "calxeda,post-clocks", 212 + &pdata->post_clocks)) 213 + pdata->post_clocks = 0; 217 214 218 215 /* store em_loc */ 219 216 hpriv->em_loc = 0;