// SPDX-License-Identifier: GPL-2.0-or-later /* * arch/powerpc/sysdev/qe_lib/qe_io.c * * QE Parallel I/O ports configuration routines * * Copyright 2006 Freescale Semiconductor, Inc. All rights reserved. * * Author: Li Yang <LeoLi@freescale.com> * Based on code from Shlomi Gridish <gridish@freescale.com>
*/
int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain, int assignment, int has_irq)
{ if (!par_io || port >= num_par_io_ports) return -EINVAL;
if (val == 0) /* clear */
iowrite32be(~pin_mask & tmp_val, &par_io[port].cpdata); else/* set */
iowrite32be(pin_mask | tmp_val, &par_io[port].cpdata);
return 0;
}
EXPORT_SYMBOL(par_io_data_set);
int par_io_of_config(struct device_node *np)
{ struct device_node *pio; int pio_map_len; const __be32 *pio_map;
if (par_io == NULL) {
printk(KERN_ERR "par_io not initialized\n"); return -1;
}
pio = of_parse_phandle(np, "pio-handle", 0); if (pio == NULL) {
printk(KERN_ERR "pio-handle not available\n"); return -1;
}
pio_map = of_get_property(pio, "pio-map", &pio_map_len); if (pio_map == NULL) {
printk(KERN_ERR "pio-map is not set!\n"); return -1;
}
pio_map_len /= sizeof(unsignedint); if ((pio_map_len % 6) != 0) {
printk(KERN_ERR "pio-map format wrong!\n"); return -1;
}
while (pio_map_len > 0) {
u8 port = be32_to_cpu(pio_map[0]);
u8 pin = be32_to_cpu(pio_map[1]); int dir = be32_to_cpu(pio_map[2]); int open_drain = be32_to_cpu(pio_map[3]); int assignment = be32_to_cpu(pio_map[4]); int has_irq = be32_to_cpu(pio_map[5]);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.