1 #include <linux/types.h>
4 #include <linux/kernel.h>
13 #define DBG(fmt...) printk(fmt)
33 static int macio_do_gpio_irq_disable(
struct pmf_function *func)
55 tmp = (
tmp & ~mask) | (value & mask);
56 DBG(
"Do write 0x%02x to GPIO %s (%p)\n",
57 tmp, func->
node->full_name, addr);
82 msleep((duration + 999) / 1000);
87 .irq_enable = macio_do_gpio_irq_enable,
88 .irq_disable = macio_do_gpio_irq_disable,
89 .write_gpio = macio_do_gpio_write,
90 .read_gpio = macio_do_gpio_read,
91 .delay = macio_do_delay,
94 static void macio_gpio_init_one(
struct macio_chip *macio)
109 DBG(
"Installing GPIO functions for macio %s\n",
110 macio->of_node->full_name);
127 offset += (
unsigned long)macio->base;
131 DBG(
"Calling initial GPIO functions for macio %s\n",
132 macio->of_node->full_name);
149 MACIO_OUT32(offset, (MACIO_IN32(offset) & ~mask) | (value & mask));
162 *
args->u[0].p = MACIO_IN32(offset);
172 MACIO_OUT8(offset, (MACIO_IN8(offset) & ~mask) | (value & mask));
185 *((
u8 *)(
args->u[0].p)) = MACIO_IN8(offset);
198 *
args->u[0].p = ((MACIO_IN32(offset) &
mask) >> shift) ^
xor;
211 *((
u8 *)(
args->u[0].p)) = ((MACIO_IN8(offset) &
mask) >> shift) ^
xor;
223 if (args ==
NULL ||
args->count == 0)
227 tmp = MACIO_IN32(offset);
228 val =
args->u[0].v << shift;
229 tmp = (tmp & ~mask) | (val & mask);
230 MACIO_OUT32(offset, tmp);
243 if (args ==
NULL ||
args->count == 0)
247 tmp = MACIO_IN8(offset);
248 val =
args->u[0].v << shift;
249 tmp = (tmp & ~mask) | (val & mask);
250 MACIO_OUT8(offset, tmp);
256 .write_reg32 = macio_do_write_reg32,
257 .read_reg32 = macio_do_read_reg32,
258 .write_reg8 = macio_do_write_reg8,
259 .read_reg8 = macio_do_read_reg8,
260 .read_reg32_msrx = macio_do_read_reg32_msrx,
261 .read_reg8_msrx = macio_do_read_reg8_msrx,
262 .write_reg32_slm = macio_do_write_reg32_slm,
263 .write_reg8_slm = macio_do_write_reg8_slm,
264 .delay = macio_do_delay,
267 static void macio_mmio_init_one(
struct macio_chip *macio)
269 DBG(
"Installing MMIO functions for macio %s\n",
270 macio->of_node->full_name);
285 UN_OUT(offset, (UN_IN(offset) & ~mask) | (value & mask));
292 .write_reg32 = unin_do_write_reg32,
293 .delay = macio_do_delay,
296 static void uninorth_install_pfunc(
void)
300 DBG(
"Installing functions for UniN %s\n",
319 DBG(
"Installing functions for UniN clock %s\n",
330 static int pfbase_inited;
337 if (!machine_is(powermac))
340 DBG(
"Installing base platform functions...\n");
345 for (i = 0 ; i < MAX_MACIO_CHIPS; i++) {
360 uninorth_install_pfunc();
362 DBG(
"All base functions installed\n");
379 for (i = 0 ; i < MAX_MACIO_CHIPS; i++) {
402 for (i = 0 ; i < MAX_MACIO_CHIPS; i++) {