Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1264798 > unrolled thread
| Started by | "Matwey V. Kornilov" <matwey@sai.msu.ru> |
|---|---|
| First post | 2015-11-07 11:20 +0100 |
| Last post | 2015-11-07 15:30 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 2/3] tty: Implement default fallback serial8250_rs485_config "Matwey V. Kornilov" <matwey@sai.msu.ru> - 2015-11-07 11:20 +0100
Re: [PATCH v2 2/3] tty: Implement default fallback serial8250_rs485_config Peter Hurley <peter@hurleysoftware.com> - 2015-11-07 13:30 +0100
Re: [PATCH v2 2/3] tty: Implement default fallback serial8250_rs485_config "Matwey V. Kornilov" <matwey@sai.msu.ru> - 2015-11-07 15:00 +0100
Re: [PATCH v2 2/3] tty: Implement default fallback serial8250_rs485_config Peter Hurley <peter@hurleysoftware.com> - 2015-11-07 15:30 +0100
| From | "Matwey V. Kornilov" <matwey@sai.msu.ru> |
|---|---|
| Date | 2015-11-07 11:20 +0100 |
| Subject | [PATCH v2 2/3] tty: Implement default fallback serial8250_rs485_config |
| Message-ID | <qs8Lf-XB-3@gated-at.bofh.it> |
When 8250 driver doesn't have its own hardware RS485 support and doesn't
want to override rs485_config callback, then default
serial8250_rs485_config is used. It just stores supplied by user-space
config.
Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
---
drivers/tty/serial/8250/8250_core.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 3912646..8f292da 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -395,6 +395,12 @@ static void serial8250_release_rsa_resource(struct uart_8250_port *up)
}
}
#endif
+static int serial8250_rs485_config(struct uart_port *port,
+ struct serial_rs485 *rs485)
+{
+ port->rs485 = *rs485;
+ return 0;
+}
static const struct uart_ops *base_ops;
static struct uart_ops univ8250_port_ops;
@@ -990,6 +996,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
uart->port.rs485 = up->port.rs485;
uart->dma = up->dma;
+ /* Use software RS485 support when hardware one is not available */
+ if (!(uart->capabilities & UART_CAP_HW485) && !uart->port.rs485_config)
+ uart->port.rs485_config = serial8250_rs485_config;
+
/* Take tx_loadsz from fifosize if it wasn't set separately */
if (uart->port.fifosize && !uart->tx_loadsz)
uart->tx_loadsz = uart->port.fifosize;
--
2.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2015-11-07 13:30 +0100 |
| Subject | Re: [PATCH v2 2/3] tty: Implement default fallback serial8250_rs485_config |
| Message-ID | <qsaN4-2eE-13@gated-at.bofh.it> |
| In reply to | #1264798 |
Hi Matwey,
On 11/07/2015 05:09 AM, Matwey V. Kornilov wrote:
> When 8250 driver doesn't have its own hardware RS485 support and doesn't
> want to override rs485_config callback, then default
> serial8250_rs485_config is used. It just stores supplied by user-space
> config.
>
> Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
> ---
> drivers/tty/serial/8250/8250_core.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index 3912646..8f292da 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -395,6 +395,12 @@ static void serial8250_release_rsa_resource(struct uart_8250_port *up)
> }
> }
> #endif
> +static int serial8250_rs485_config(struct uart_port *port,
> + struct serial_rs485 *rs485)
> +{
> + port->rs485 = *rs485;
> + return 0;
> +}
>
> static const struct uart_ops *base_ops;
> static struct uart_ops univ8250_port_ops;
> @@ -990,6 +996,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
> uart->port.rs485 = up->port.rs485;
> uart->dma = up->dma;
>
> + /* Use software RS485 support when hardware one is not available */
> + if (!(uart->capabilities & UART_CAP_HW485) && !uart->port.rs485_config)
> + uart->port.rs485_config = serial8250_rs485_config;
To setup a default 8250 port function,
1. define the default 8250 port function in 8250/8250_port.c
2. add the port function to the dispatch table (serial8250_pops)
3. add a test for 8250 sub-driver override in serial8250_register_8250_port()
Eg.,
if (up->port.rs485_config)
uart->port.rs485_config = up->port.rs485_config;
Regards,
Peter Hurley
> /* Take tx_loadsz from fifosize if it wasn't set separately */
> if (uart->port.fifosize && !uart->tx_loadsz)
> uart->tx_loadsz = uart->port.fifosize;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Matwey V. Kornilov" <matwey@sai.msu.ru> |
|---|---|
| Date | 2015-11-07 15:00 +0100 |
| Message-ID | <qscc9-30C-5@gated-at.bofh.it> |
| In reply to | #1264830 |
2015-11-07 15:29 GMT+03:00 Peter Hurley <peter@hurleysoftware.com>:
> Hi Matwey,
>
> On 11/07/2015 05:09 AM, Matwey V. Kornilov wrote:
>> When 8250 driver doesn't have its own hardware RS485 support and doesn't
>> want to override rs485_config callback, then default
>> serial8250_rs485_config is used. It just stores supplied by user-space
>> config.
>>
>> Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
>> ---
>> drivers/tty/serial/8250/8250_core.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
>> index 3912646..8f292da 100644
>> --- a/drivers/tty/serial/8250/8250_core.c
>> +++ b/drivers/tty/serial/8250/8250_core.c
>> @@ -395,6 +395,12 @@ static void serial8250_release_rsa_resource(struct uart_8250_port *up)
>> }
>> }
>> #endif
>> +static int serial8250_rs485_config(struct uart_port *port,
>> + struct serial_rs485 *rs485)
>> +{
>> + port->rs485 = *rs485;
>> + return 0;
>> +}
>>
>> static const struct uart_ops *base_ops;
>> static struct uart_ops univ8250_port_ops;
>> @@ -990,6 +996,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
>> uart->port.rs485 = up->port.rs485;
>> uart->dma = up->dma;
>>
>> + /* Use software RS485 support when hardware one is not available */
>> + if (!(uart->capabilities & UART_CAP_HW485) && !uart->port.rs485_config)
>> + uart->port.rs485_config = serial8250_rs485_config;
>
> To setup a default 8250 port function,
> 1. define the default 8250 port function in 8250/8250_port.c
> 2. add the port function to the dispatch table (serial8250_pops)
rs485_config is not a member of struct uart_ops, should I add it there?
> 3. add a test for 8250 sub-driver override in serial8250_register_8250_port()
> Eg.,
>
> if (up->port.rs485_config)
> uart->port.rs485_config = up->port.rs485_config;
>
> Regards,
> Peter Hurley
>
>> /* Take tx_loadsz from fifosize if it wasn't set separately */
>> if (uart->port.fifosize && !uart->tx_loadsz)
>> uart->tx_loadsz = uart->port.fifosize;
>>
>
--
With best regards,
Matwey V. Kornilov.
Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia
119991, Moscow, Universitetsky pr-k 13, +7 (495) 9392382
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Hurley <peter@hurleysoftware.com> |
|---|---|
| Date | 2015-11-07 15:30 +0100 |
| Subject | Re: [PATCH v2 2/3] tty: Implement default fallback serial8250_rs485_config |
| Message-ID | <qscFb-3rk-1@gated-at.bofh.it> |
| In reply to | #1264839 |
On 11/07/2015 08:51 AM, Matwey V. Kornilov wrote:
> 2015-11-07 15:29 GMT+03:00 Peter Hurley <peter@hurleysoftware.com>:
>> Hi Matwey,
>>
>> On 11/07/2015 05:09 AM, Matwey V. Kornilov wrote:
>>> When 8250 driver doesn't have its own hardware RS485 support and doesn't
>>> want to override rs485_config callback, then default
>>> serial8250_rs485_config is used. It just stores supplied by user-space
>>> config.
>>>
>>> Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
>>> ---
>>> drivers/tty/serial/8250/8250_core.c | 10 ++++++++++
>>> 1 file changed, 10 insertions(+)
>>>
>>> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
>>> index 3912646..8f292da 100644
>>> --- a/drivers/tty/serial/8250/8250_core.c
>>> +++ b/drivers/tty/serial/8250/8250_core.c
>>> @@ -395,6 +395,12 @@ static void serial8250_release_rsa_resource(struct uart_8250_port *up)
>>> }
>>> }
>>> #endif
>>> +static int serial8250_rs485_config(struct uart_port *port,
>>> + struct serial_rs485 *rs485)
>>> +{
>>> + port->rs485 = *rs485;
>>> + return 0;
>>> +}
>>>
>>> static const struct uart_ops *base_ops;
>>> static struct uart_ops univ8250_port_ops;
>>> @@ -990,6 +996,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
>>> uart->port.rs485 = up->port.rs485;
>>> uart->dma = up->dma;
>>>
>>> + /* Use software RS485 support when hardware one is not available */
>>> + if (!(uart->capabilities & UART_CAP_HW485) && !uart->port.rs485_config)
>>> + uart->port.rs485_config = serial8250_rs485_config;
>>
>> To setup a default 8250 port function,
>> 1. define the default 8250 port function in 8250/8250_port.c
>> 2. add the port function to the dispatch table (serial8250_pops)
>
> rs485_config is not a member of struct uart_ops, should I add it there?
Whoops, sorry! :/
For now, assign the default 8250 port function in serial8250_set_defaults().
Regards,
Peter Hurley
>> 3. add a test for 8250 sub-driver override in serial8250_register_8250_port()
>> Eg.,
>>
>> if (up->port.rs485_config)
>> uart->port.rs485_config = up->port.rs485_config;
>>
>> Regards,
>> Peter Hurley
>>
>>> /* Take tx_loadsz from fifosize if it wasn't set separately */
>>> if (uart->port.fifosize && !uart->tx_loadsz)
>>> uart->tx_loadsz = uart->port.fifosize;
>>>
>>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web